░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
84% of students already use AI tools. Only 18% feel prepared to use them professionally. This curriculum closes that gap.
503 lessons. 20 phases. ~320 hours. Python, TypeScript, Rust, Julia. Every lesson ships a reusable artifact: a prompt, a skill, an agent, an MCP server. Free, open source, MIT.
You don't just learn AI. You build it. End-to-end. By hand.
150,639 readers · 241,669 page views in the last 30 days · as of 2026-06-07
Most AI material teaches in scattered pieces. A paper here, a fine-tuning post there, a flashy agent demo somewhere else. The pieces rarely line up. You ship a chatbot but can't explain its loss curve. You hook a function to an agent but can't say what attention does inside the model that's calling it.
This curriculum is the spine. 20 phases, 503 lessons, four languages: Python, TypeScript, Rust, Julia. Linear algebra at one end, autonomous swarms at the other. Every algorithm gets built from raw math first. Backprop. Tokenizer. Attention. Agent loop. By the time PyTorch shows up, you already know what it's doing under the hood.
Each lesson runs the same loop: read the problem, derive the math, write the code, run the test, keep the artifact. No five-minute videos, no copy-paste deploys, no hand-holding. Free, open source, and built to run on your own laptop.
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
Twenty phases stack on top of each other. Math is the floor. Agents and production are the roof. Skip ahead if you already know the lower layers, but don't skip and then wonder why something at the top is breaking.
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#fafaf5','primaryTextColor':'#1a1a1a','primaryBorderColor':'#3553ff','lineColor':'#3553ff','fontFamily':'JetBrains Mono','fontSize':'12px'}}}%%
flowchart TB
P0["Phase 0 — Setup & Tooling"] --> P1["Phase 1 — Math Foundations"]
P1 --> P2["Phase 2 — ML Fundamentals"]
P2 --> P3["Phase 3 — Deep Learning Core"]
P3 --> P4["Phase 4 — Vision"]
P3 --> P5["Phase 5 — NLP"]
P3 --> P6["Phase 6 — Speech & Audio"]
P3 --> P9["Phase 9 — RL"]
P5 --> P7["Phase 7 — Transformers"]
P7 --> P8["Phase 8 — GenAI"]
P7 --> P10["Phase 10 — LLMs from Scratch"]
P10 --> P11["Phase 11 — LLM Engineering"]
P10 --> P12["Phase 12 — Multimodal"]
P11 --> P13["Phase 13 — Tools & Protocols"]
P13 --> P14["Phase 14 — Agent Engineering"]
P14 --> P15["Phase 15 — Autonomous Systems"]
P15 --> P16["Phase 16 — Multi-Agent & Swarms"]
P14 --> P17["Phase 17 — Infrastructure & Production"]
P15 --> P18["Phase 18 — Ethics & Alignment"]
P16 --> P19["Phase 19 — Capstone Projects"]
P17 --> P19
P18 --> P19
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
Each lesson lives in its own folder, with the same structure across the entire curriculum:
phases/<NN>-<phase-name>/<NN>-<lesson-name>/
├── code/ runnable implementations (Python, TypeScript, Rust, Julia)
├── docs/
│ └── en.md lesson narrative
└── outputs/ prompts, skills, agents, or MCP servers this lesson produces
Every lesson follows six beats. The Build It / Use It split is the spine — you implement the algorithm from scratch first, then run the same thing through the production library. You understand what the framework is doing because you wrote the smaller version yourself.
%%{init: {'theme':'base','themeVariables':{'primaryColor':'#fafaf5','primaryTextColor':'#1a1a1a','primaryBorderColor':'#3553ff','lineColor':'#3553ff','fontFamily':'JetBrains Mono','fontSize':'13px'}}}%%
flowchart LR
M["MOTTO
<sub>one-line core idea</sub>"] --> Pr["PROBLEM
<sub>concrete pain</sub>"]
Pr --> C["CONCEPT
<sub>diagrams & intuition</sub>"]
C --> B["BUILD IT
<sub>raw math, no frameworks</sub>"]
B --> U["USE IT
<sub>same thing in PyTorch / sklearn</sub>"]
U --> S["SHIP IT
<sub>prompt · skill · agent · MCP</sub>"]
Three ways in. Pick one.
Option A — read. Open any completed lesson on aiengineeringfromscratch.com or expand a phase under Contents. No setup, no cloning.
Option B — clone and run.
git clone https://github.com/rohitg00/ai-engineering-from-scratch.git
cd ai-engineering-from-scratch
python phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py
Option C — find your level (recommended). Skip ahead intelligently. Inside Claude, Cursor, Codex, OpenClaw, Hermes, or any agent with the curriculum skills installed:
/find-your-level
Ten questions. Maps your knowledge to a starting phase, builds a personalized path with hour estimates. After each phase:
/check-understanding 3 # quiz yourself on phase 3
ls phases/03-deep-learning-core/05-loss-functions/outputs/
# ├── prompt-loss-function-selector.md
# └── prompt-loss-debugger.md
| Skill | What it does |
|---|---|
/find-your-level |
Ten-question placement quiz. Maps your knowledge to a starting phase and produces a personalized path with hour estimates. |
/check-understanding <phase> |
Per-phase quiz, eight questions, with feedback and specific lessons to review. |
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
Other curricula end with "congratulations, you learned X." Each lesson here ends with a reusable tool you can install or paste into your daily workflow.
| Paste into any AI assistant for expert-level help on a narrow task. | Drop into Claude, Cursor, Codex, OpenClaw, Hermes, or any agent that reads SKILL.md. |
Deploy as autonomous workers — you wrote the loop yourself in Phase 14. | Plug into any MCP-compatible client. Built end-to-end in Phase 13. |
Install the lot with
python3 scripts/install_skills.py. Real tools, not homework. By the end of the curriculum, you have a portfolio of 503 artifacts you actually understand because you built them.
Phase 14, lesson 1: the agent loop. ~120 lines of pure Python, no dependencies.
**`code/agent_loop.py`** build it
|
**`outputs/skill-agent-loop.md`** ship it
**`outputs/prompt-debug-agent.md`**
|
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒
Twenty phases. Click any phase to expand its lesson list.
12 lessonsGet your environment ready for everything that follows.
| # | Lesson | Type | Lang |
|---|---|---|---|
| 01 | Dev Environment | Build | Python |
| 02 | Git & Collaboration | Learn | — |
| 03 | GPU Setup & Cloud | Build | Python |
| 04 | APIs & Keys | Build | Python |
| 05 | Jupyter Notebooks | Build | Python |
| 06 | Python Environments | Build | Shell |
| 07 | Docker for AI | Build | Docker |
| 08 | Editor Setup | Build | — |
| 09 | Data Management | Build | Python |
| 10 | Terminal & Shell | Learn | — |
| 11 | Linux for AI | Learn | — |
| 12 | Debugging & Profiling | Build | Python |
Phase 1 — Math Foundations 22 lessons The intuition behind every AI algorithm, through code.
| # | Lesson | Type | Lang |
|---|---|---|---|
| 01 | Linear Algebra Intuition | Learn | Python, Julia |
| 02 | Vectors, Matrices & Operations | Build | Python, Julia |
| 03 | Matrix Transformations & Eigenvalues | Build | Python, Julia |
| 04 | Calculus for ML: Derivatives & Gradients | Learn | Python |
| 05 | Chain Rule & Automatic Differentiation | Build | Python |
| 06 | Probability & Distributions | Learn | Python |
| 07 | Bayes' Theorem & Statistical Thinking | Build | Python |
| 08 | Optimization: Gradient Descent Family | Build | Python |
| 09 | Information Theory: Entropy, KL Divergence | Learn | Python |
| 10 | Dimensionality Reduction: PCA, t-SNE, UMAP | Build | Python |
| 11 | Singular Value Decomposition | Build | Python, Julia |
| 12 | Tensor Operations | Build | Python |
| 13 | Numerical Stability | Build | Python |
| 14 | Norms & Distances | Build | Python |
| 15 | Statistics for ML | Build | Python |
| 16 | Sampling Methods | Build | Python |
| 17 | Linear Systems | Build | Python |
| 18 | Convex Optimization | Build | Python |
| 19 | Complex Numbers for AI | Learn | Python |
| 20 | The Fourier Transform | Build | Python |
| 21 | [Graph Th |
$ claude mcp add ai-engineering-from-scratch \
-- python -m otcore.mcp_server <graph>