ai/from-scratch

A learning path for developers

Learn AI from scratch by building every piece yourself.

Start with the math you need, then a straight line and gradient descent. End with an agent that searches your own notes, cites its sources, and passes an eval suite you wrote. No magic in between: you build the neural network, the autograd, the tiny transformer, the retrieval layer, and the tools.

Your pace, your order

48 lessons, about 35 hours, one sitting each. Follow the path, or skip ahead and come back.

Mechanism first

Every coached step shows what happens under the hood before you apply it.

You build Pocket

One running project: a small assistant over your own notes, grown stage by stage.

The path

12 stages, from basics to shipping. Each lesson: what you need from before, the idea, a worked example, coached practice, a lab you run on your machine, then a short quiz. Follow the path in order, or skip what you already know: skipped lessons stay open, and every lesson re-teaches what it builds on.

  1. 0The math toolkitFloats, derivatives, logs and probability: exactly the math the path uses, in numpy.
  2. 1How machines learnParameters, vectors, loss and gradient descent, one worked number at a time.
  3. 2Neural networks from scratchBuild a neuron, an autograd and a training loop, then port it to PyTorch.
  4. 3Language models from scratchTokens, a bigram baseline, attention by hand, and a tiny GPT trained on your own notes.
  5. 4Building with LLM APIsCall a real model, write prompts as specs, trust the output, and harden every call.
  6. 5Retrieval and RAGFind the right note, then answer from it with citations.
  7. 6Tools and agentsLet the model ask for tools, run them in a bounded loop, guard them, and share them over MCP.
  8. 7Evaluate and shipMeasure Pocket, watch it run, and ship it with evidence.
  9. 8RAG in productionIndex at scale, keep it fresh, sharpen the query, and measure every stage.
  10. 9Agentic AI patternsRoute, chain, plan, reflect, remember, and delegate, each with a budget and a gate.
  11. 10Agent development: tests and reliabilityTest the loop exactly, measure the model honestly, and make every tool call safe to retry and resume.
  12. 11Deploying agentsServe Pocket's agent, box it in, watch it run, and roll it out safely.

Want to build with LLM APIs first and come back for the internals? Start at stage 4: Building with LLM APIs. The path still recommends the order above.