Skip to content

AI Engineering, a course that runs offline with no dependencies

AI Engineering

Build It Yourself · Measure Everything · Then Ship It

License: MIT Course Technology Author

You write every line, measure every claim, and install nothing. No account, no API key, no GPU, no paid service, and no network at any point.


❖ Author  ·  ⓘ Overview  ·  ◎ Motivation  ·  ▶ Start Here  ·  ☰ The Course  ·  ⊞ Curriculum  ·  ★ What You Will Build  ·  ⚑ Guarantees  ·  ◬ Completion  ·  ☷ Usage Guidelines  ·  © License  ·  ⌬ About  ·  ✦ Acknowledgments


Author

Amey Thakur
Amey Thakur

ORCID
LinkedIn

Overview

You clone this repository, open a terminal, and run a file. That is the whole setup. There is nothing to provision, nothing to sign up for, and nothing that can be withdrawn from under you later.

From there you build one system across ten phases. It starts as a classifier that tells a question from a statement and ends as something with tools, a retrieval index, a cost meter, an access boundary and a release sheet. Every piece of it is yours, in plain Python, on data small enough to read in full.

The part that makes this different from other courses is the second half. Anybody can show you a model that works. Phases 7 and 8 hand you the instruments to find out whether it does, and the first thing you point them at is the course's own earlier lessons. Several of them do not survive.

Purpose: To take a reader with nothing installed through to building, measuring and shipping a working AI system, using only the Python standard library, so that the material still runs in ten years and every number in it can be checked by the reader.

Target Audience: Anyone who can read a for loop. Beginners who want to start at a terminal, self-taught engineers who can already use the libraries and want to know what is under them, and working engineers who need the measurement half nobody taught them.


Motivation

I kept opening well-regarded courses and finding the same things.

Code that no longer ran, because a package had moved. A dataset that had been withdrawn. A statistics page reporting a figure that was simply wrong. A cloud account demanded before lesson two. None of that is carelessness. It is what happens when material is written faster than it can be checked, and when it is built on services that belong to somebody else.

There was a second problem, quieter and worse. The courses taught how to make a number go up and never how to tell whether it had. I learned to call model.fit() years before I learned that a score on twenty examples means almost nothing, and the gap between those two moments holds a great deal of work I would now call wasted.

This course is built the other way round. Nothing is installed, so nothing can be taken away. Every number printed in a lesson is generated by the code beside it and compared against the real output, so no figure in it can be typed by hand. And when a measurement contradicts an earlier lesson, the measurement stays and the earlier lesson gets a link to it.

Note

That last rule is not a pose. Phase 7 finds that phase 3's classifier cannot be told apart from a coin, and that the entire retrieval half of the finished system cannot be told apart from deleting it. Both findings sit in the material, next to the lessons they undermine.


Start Here

Three commands. The third one is the course.

git clone https://github.com/Amey-Thakur/AI-ENGINEERING
cd AI-ENGINEERING
python tools/run_lessons.py phases/00-your-machine/01-the-terminal

If that last line fails because you do not have Python, or because you have never opened a terminal, that is expected, and it is exactly what lesson 1 is for.

Or borrow a machine that already has one. Open it in a codespace and the first lesson runs in a browser tab, on anything, in about a minute. The container supplies the interpreter and nothing else: every lesson still imports only the standard library, and check_imports.py proves it on every change.

Tip

The whole course is also readable in a browser at amey-thakur.github.io/AI-ENGINEERING, with a sidebar in course order, search across every lesson, and a next link at the foot of each page. Same material, same numbers, built from these files on every push.

Then work forwards. Every lesson is a directory holding the same three files:

File What it is
README.md The lesson. Read this first.
solve.py The worked solution, written to be read rather than hidden.
check.py Looks at what you produced and says what is wrong in one line.
python tools/run_lessons.py                    every lesson
python tools/run_lessons.py phases/03          one phase, or one lesson
python tools/progress.py                       how far you have got

Tip

Reading solve.py when you are stuck is not cheating. It is a considerably better use of an evening than an hour of guessing, and the lesson's README explains what the solution does and why it does it that way.

Skip phase 0 if you already have a terminal, Python and Git. Everybody else should start there, because the rest of the course assumes you can run a file and nothing more than that.


Should you do this?

Most people who use these systems cannot say what any part of them does. That is not their fault. Every tutorial hands you a library, the library does the interesting part, and you are left fluent in the names and empty on the mechanisms. When the library moves, and it will, you begin again.

Here you write the interesting part and you measure it. What you keep is not a framework to relearn next year. It is an understanding of what the pieces do, and that does not expire.

I built this for myself, because I looked for it and it was not there. I write and publish research in this field, and I wanted material I could hand to somebody without a caveat attached. Nothing in it is for sale, there is no account, and no lesson touches the network.

You do not have to take any of that on trust. The guarantees are programs, not promises: every number on every page is regenerated from the code beside it and checked on Linux, macOS and Windows on each change. Where the course's own results fail to hold up, it says so and leaves them in. Phase 7 turns its tests on the earlier phases and finds some of their results indistinguishable from a coin toss.

What stops people What is actually true
I am not good at maths. Phase 2 derives backpropagation with arithmetic you already have, then checks it by nudging a weight to see whether the answer moves. No calculus you have not met, and nothing taken on faith.
My laptop is old and slow. Every lesson runs in plain Python on data small enough to read in full. Most finish in seconds, and the two that do not say what they cost before you start them.
I cannot pay for a course. There is nothing to pay for, no account to open and no key to buy.
My internet is unreliable. Clone it once. Lessons run with the network closed, and a program enforces that rather than a promise.
I will start and not finish. Fifty lessons of about forty minutes. The curriculum ticks them off and remembers where you stopped.
I have never used a terminal. Phase 0 lesson 1 opens one and explains why it is still here. That is the assumed starting point.

The Course

Ten phases of five lessons each, fifty lessons, one system built the whole way through from a rule you write by hand to a transformer block you prove correct by hand.

# Phase What you will have built by the end of it
0 Your machine A terminal you are not afraid of, Python running, an isolated environment, and your first commit
1 Teach it to tell two things apart A classifier that sorts questions from statements, first by a rule you wrote, then by weights it learned
2 A network you wrote yourself A network with a hidden layer, trained by a backpropagation you wrote and checked against nudging the weights
3 Words that know what they mean Word vectors built from co-occurrence counts, compressed by power iteration, then measured against the actual task
4 A language model you wrote yourself A model that generates text, scored by perplexity, and a measurement of what it cannot recall
5 Finding the right thing to say A retrieval system that beats the model 15 to 0, and the measurement showing the generator makes it worse
6 Tools and agents An agent: tools it can call, a rule that picks one, a loop that can stop, and a scorecard with six columns
7 Measuring whether any of it works Confidence intervals, a paired significance test, baselines and a regression test, turned on your own earlier work
8 Shipping: cost, latency, failure, safety An index, a cost meter, an outage drill, an access boundary, and the release sheet you hand somebody
9 Attention, and the block One attention head and its backward pass, a transformer block assembled and proved correct by hand, and the measurements showing neither of them explains itself the way you would expect

About thirty-seven hours in total, by the estimate printed at the top of each phase. Phase 0 is the shortest at two hours and phase 4 the longest at five. Nothing is installed at any point.

Every lesson on one page →  ·  all fifty, in order, with what you do in each. On the website the boxes tick off and remember where you stopped.

Tip

If you only have one evening, read phase 7 lesson 1. It puts a confidence interval on every score this course reports and finds that most of them establish very little. It needs nothing from the phases before it, and it will change how you read every benchmark you meet after it.


What You Will Build

Not a toy that works because the data was chosen to make it work. These are results you measure yourself, with your own code, and all of them are in the material:

What you measure The result
A hand-written rule against a perceptron against a network The rule wins, and for three phases nothing learned beats it
Whether a language model can recall a fact it was trained on 0 of 20, and its interval is the narrowest in the course
Counting shared words against BM25 on your corpus Counting wins, because BM25's reputation was earned on somebody else's data
Retrieval, and then generation on top of it The generator destroys 15 of 15 correct retrievals
A retry loop on a search that refused Provably incapable of working, 2.15 times the cost, not one answer changed
A confidence threshold, measured twice A 3-for-1 loss on answerable questions, a 3-for-8 gain once unanswerable ones exist
Deleting the entire retrieval half of your agent Costs seven questions of forty-eight, and chance produces that gap 83% of the time
Losing the whole corpus in production Accuracy falls 15%, false statements fall to zero, and no ordinary alarm fires
Putting a secret in the corpus A question about next quarter's budget returns an API key
An attention head against an even share that cannot look at anything The even share reaches 15 of 20 where the head reaches 16, and the signal turns out to be a single vector

Important

Read that table again and notice how many of the results are negative. That is the point. Showing that something does not work is cheap, showing that one thing beats another is expensive, and knowing which of the two you are looking at is most of the skill.


Guarantees

You do not have to take any of these on trust. Each one is a program in tools/, and they all run on every change and again nightly.

Guarantee How it is kept
Every lesson runs. Every solution and every check is executed on Linux, macOS and Windows on each change, and again every night.
Every number shown is generated. Output printed in a lesson, and any of it quoted on this page, is compared against what the code actually prints. A figure is never typed by hand.
Nothing can be taken away. Only the Python standard library is used, anywhere in the course. This is checked, not promised.
Nothing is fetched. Lessons run with the network closed. A lesson that reaches for it fails on the push that introduced it.
The same answer every time. Each solution runs under three different string hash seeds and must print the same thing. A number that moves between runs is caught here.
Every link still points at something. Each path and heading linked anywhere in the course is resolved against the repository, so renaming a lesson or retitling a section cannot leave a dead link behind.
python tools/run_lessons.py        every lesson still works
python tools/check_output.py       shown output matches real output
python tools/check_imports.py      nothing outside the standard library
python tools/check_determinism.py  the same output on every run
python tools/check_glossary.py     the glossary still points at the course
python tools/check_links.py        every link resolves to a real path or heading
python tools/build_curriculum.py --check   the curriculum still lists every lesson

One Result in Full

The table above is a summary. This is one of its rows as the program prints it, from lesson 3 of phase 9. Attention is the mechanism inside every large language model. For each word it scores every other word, turns the scores into weights, and reads back a blend of what it found. Those weights get published as heatmaps and read as an account of what the model looked at.

40 sentences to train on, 20 held back. Chance is 10 of 20.

  what                                 trained on   held back
  the attention head                   38 of 40    16 of 20
  an even share, trained that way      34 of 40    15 of 20
  the head, weights evened at test     33 of 40    15 of 20

Does it need the weights? An even share, with no query and no key anywhere in it,
reaches 15 of 20 where the head reaches 16. The learned weights are worth 1.

Does the trained head use them? Evening its own weights at test time costs it
1 of 20. It had barely been relying on them.

So where is the signal? Silence one position's value at a time:

  silenced                             trained on   held back
  position 0                             38 of 40    15 of 20
  position 1                             20 of 40    10 of 20  <- the subject
  position 2                             38 of 40    16 of 20
  position 3                             38 of 40    15 of 20
  position 4                             36 of 40    15 of 20
  position 5                             36 of 40    16 of 20

Silencing the subject's value takes it to 10 of 20, which is chance.
Silencing any other position leaves it at 15 or better.

Nothing there is a claim about attention in general. It is one small head on one small task, and the intervals in the lesson are wide enough that 16 and 15 are not a difference. What carries over is not the numbers but the method: the only way anyone found out where the signal was came from removing one part at a time and reading what happened.

Attention weights tell you how a blend was mixed. They do not tell you which ingredient mattered, because a loud ingredient matters at any ratio above zero. If you want to know what a component contributes, take it out, leave everything else alone, and read the number.

That block is not typed by hand. check_output.py runs the lesson and fails the build if what is shown here stops being a verbatim slice of what the code prints.


Record of Completion

Record of completion: all fifty lessons passed, with the commit, the date and a credential number


When you finish there is a record, and it is deliberately not a certificate of competence.

python tools/certificate.py --name "Your Name"

It runs every lesson first and refuses to draw anything if one fails. There is no flag to skip that. What it produces attests to something narrow and checkable, and it prints the command to re-verify itself on its own face.

What it says What it does not say
Every lesson passed, and how many there were That you are good at this
The commit they passed at That anybody assessed you
The date, and a credential number derived from those Anything a reader has to take on trust

Anybody handed one can check it: python tools/verify_certificate.py record.png, or drop the file on the verifier, which recomputes the credential in the browser. What that does and does not prove is written out in full.

You can also run it from your own fork's Actions tab with certificate.yml, which runs the course on a clean machine and attaches the result. That version is worth more than the local one, because the log is public, timestamped, and not editable by the person it is about.


Alongside the Lessons

Curriculum All fifty lessons in order, with what you do in each. On the website the boxes tick off and remember where you stopped.
Verify a record How to check a record of completion, and what each check establishes. Three ways, all offline, and a plain statement of what the credential cannot prove.
Glossary The course teaches ideas before their names, and in places never uses the standard name at all. This maps what a lesson calls something onto what the field calls it, with a link to the lesson where you built it.
Questions Why there is no PyTorch, where transformers are, whether this is enough to get a job, and why the course keeps reporting that its own lessons were wrong.
Contributing The contract a lesson has to meet.
Security What the attack surface of a hundred offline files actually is.
Code of conduct Short. The part that matters is that a reader who is lost has found a defect.

Usage Guidelines

For Beginners
Start at phase 0 and do not skip it. It assumes you have never opened a terminal and it ends with you having made a commit. Nothing later in the course assumes more than that.

For Self-taught Engineers
You can already call the libraries. Phases 1 to 4 are what is inside them, and they are worth the weekend for the moment in phase 2 lesson 4 where you check your own gradients against nudging the weights and autodiff stops being magic.

For Working Engineers
Read phase 7 and phase 8 first, then come back for the rest. Confidence intervals, McNemar's test, ablations, a regression test for a system that is allowed to be wrong, cost distributions, outage drills and retrieval access control are the parts that decide whether what you build survives contact with users.

For Educators
MIT licensed, and there is nothing to install or provision, which is usually what kills a workshop. Thirty people on thirty laptops with no network all get identical output, and tools/check_determinism.py exists to keep that true.

For Researchers
The negative results are the honest contribution. Where a method failed, the material records what it was measured against and how many examples that measurement had, so it can be repeated rather than taken on trust.


License

This course is made available under the MIT License. See the LICENSE file for complete terms.

Note

Summary: Use it, fork it, teach from it, translate it, run a paid workshop on it. Attribution is appreciated and not required.

Copyright © Amey Thakur


About This Repository

Created & Maintained by: Amey Thakur

This is the course I wanted when I started and could not find: one that installs nothing, states plainly what it cannot do, and is honest about which of its own results hold up. It builds one system across ten phases rather than a drawer of disconnected exercises, and every claim in it was produced by running the code rather than by remembering roughly what the answer ought to be.

Connect: GitHub  ·  LinkedIn  ·  ORCID

Acknowledgments

Started: 2026
Built with: The Python standard library, and nothing else

Grateful acknowledgment to the Python core developers, whose standard library is the reason this course can promise that nothing in it will be withdrawn. A batteries-included library maintained for decades is a public good, and material built only on it inherits that durability for nothing.

Grateful acknowledgment to the authors whose results this course re-measures, named in the lessons that use them: Clopper and Pearson in 1934, McNemar in 1947, Firth in 1957, Rosenblatt on the perceptron, and Robertson and Zaragoza on BM25. Their methods are old, short, readable, and still the right tools.

Grateful acknowledgment to everyone who reports that a lesson lost them. A lesson that runs perfectly and teaches nothing has failed, no program can detect that, and a reader saying so is the only way it is ever found.



◈ The phases: Your machine  ·  Tell two things apart  ·  A network  ·  Word vectors  ·  A language model  ·  Retrieval  ·  Tools and agents  ·  Measurement  ·  Shipping  ·  Attention


AI Engineering mark

AI Engineering

Learn to build AI systems by building them

From nothing installed to shipping, with every number in them generated by the code beside it.