How the AI Engineering from Scratch Curriculum Progresses Through 20 Phases: From Math Foundations to Capstones
The AI Engineering from Scratch curriculum structures 20 phases as a directed dependency graph, beginning with Python setup and math foundations in Phase 0‑1, progressing through classical ML and deep learning (Phases 2‑3), branching into computer vision, NLP, and transformers (Phases 4‑7), converging on LLMs and multimodal AI (Phases 10‑12), then advancing through agent engineering and production infrastructure (Phases 13‑18), and culminating in end‑to‑end capstone projects in Phase 19.
The rohitg00/ai-engineering-from-scratch repository delivers a comprehensive, self‑contained learning path that teaches learners to build AI systems from first principles. Unlike fragmented tutorials, this AI Engineering from Scratch curriculum organizes content into 20 sequential phases with explicit dependencies defined in the repository’s Mermaid diagram at README.md (lines 185‑203). This architectural design ensures every lesson—from linear algebra to autonomous agent deployment—builds upon validated, executable knowledge.
The Five-Layer Architecture Driving the Curriculum
The progression follows a layered architecture documented across phase‑specific README files, where each layer abstracts the complexity of the previous one.
Foundational Layer (Phases 0–3)
The journey begins in phases/00-setup-and-tooling/README.md by establishing Git workflows and Python 3.11+ environments required for all downstream work. phases/01-math-foundations/README.md introduces linear algebra, calculus, and probability—the mathematical language manipulated by every subsequent model. Phase 2 applies this math through classical ML algorithms (regression, trees, clustering), while Phase 3 replaces hand‑crafted models with neural network fundamentals and back‑propagation.
Domain-Specific Layer (Phases 4–9)
This layer extends core deep learning into specialized modalities. Phase 4 covers convolutions and vision transformers for computer vision, Phase 5 handles tokenizers and attention mechanisms for NLP, and Phase 6 addresses spectrograms and audio encoders. Phase 7 provides a deep dive into transformer architecture and scaling laws, which serves as a branching point: Phase 8 leverages these principles for diffusion models and generative AI, while Phase 9 applies them to reinforcement learning and RLHF foundations.
Model-Scale Layer (Phases 10–12)
phases/10-llms-from-scratch/README.md guides learners through constructing a complete decoder‑only large language model using the transformer stack from Phase 7. Phase 11 covers prompt engineering, retrieval‑augmented generation (RAG), and production LLM pipelines. Phase 12 then integrates vision, audio, and text into unified multimodal architectures that reason across modalities.
Interaction and Engineering Layer (Phases 13–18)
phases/13-tools-and-protocols/README.md establishes the Model Context Protocol (MCP) and agent‑skill SDKs that downstream components invoke. Phase 14 implements the agent loop in pure Python without external dependencies, creating reusable workbench packs. Phases 15‑16 extend to autonomous systems with long‑horizon planning and multi‑agent swarms. Phase 17 supplies the production‑grade ops layer with CI/CD for AI, model serving, and observability, while Phase 18 addresses alignment techniques, bias mitigation, and safety taxonomy.
Application Layer (Phase 19)
phases/19-capstone-projects/README.md consolidates all prior knowledge into end‑to‑end builds such as autonomous coding agents and RAG chatbots. These projects require integrating math foundations, model training, tool protocols from Phase 13, and deployment infrastructure from Phase 17.
Dependency Graph and Execution Flow
The curriculum’s progression is explicitly visualized as a directed graph in the Mermaid diagram at lines 185‑203 of README.md. The site/build.js script parses these files to generate the website’s visual curriculum map, though the source of truth remains the repository’s core documentation.
The primary dependency chain follows P0 → P1 → P2 → … → P10 → P13 → P14 → P15 → P16 → P17 → P18 → P19, ensuring that learners cannot attempt agent engineering without first mastering the tool protocols and LLM construction that precede it. Strategic branching occurs at Phase 7 (Transformers Deep Dive), which feeds both Phase 8 (Generative AI) and Phase 10 (LLMs from Scratch), allowing parallel specialization before converging at Phase 12 (Multimodal AI).
Running Lessons and Exploring Phase Artifacts
Each phase contains executable lessons under phases/<phase>/code/. The repository provides scripts/lesson_run.py as a CLI helper to discover and execute specific lessons programmatically.
import subprocess
import pathlib
def run_lesson(phase_slug: str, lesson_slug: str):
"""Execute the lesson's main script via the provided helper."""
repo_root = pathlib.Path(__file__).resolve().parent.parent
cmd = [
"python3",
"scripts/lesson_run.py",
f"--phase={phase_slug}",
f"--lesson={lesson_slug}"
]
subprocess.run(cmd, cwd=repo_root, check=True)
# Run the "Linear Algebra Intuition" lesson from Phase 1
run_lesson("01-math-foundations", "01-linear-algebra-intuition")
Phase 14 (Agent Engineering) produces reusable artifacts called Agent Workbench packs. According to phases/14-agent-engineering/README.md, these packs include AGENTS.md, schemas, execution scripts, and a README, and can be imported as libraries in downstream applications.
import { AgentWorkBench } from "./outputs/agents/agent-workbench-pack";
async function demo() {
const workbench = new AgentWorkBench();
await workbench.initialize();
const result = await workbench.run("code", {
prompt: "Write a Python function to compute factorial."
});
console.log(result);
}
demo();
Summary
- The AI Engineering from Scratch curriculum structures 20 phases into five architectural layers, from foundational math to production deployment and safety alignment.
- Dependencies are explicitly mapped in
README.md(lines 185‑203) as a directed graph with branching at Phase 7 for parallel specializations in generative AI and LLM development. - Phases 0‑3 establish Python environments, linear algebra, and classical ML; Phases 4‑9 extend into vision, NLP, audio, and transformers; Phases 10‑12 focus on LLM and multimodal construction.
- Phases 13‑18 cover the Model Context Protocol, pure‑Python agent loops, autonomous systems, CI/CD infrastructure, and alignment before Phase 19 requires integrating all components into capstone projects.
- Learners execute lessons via
scripts/lesson_run.pyand reuse Phase 14 outputs as importable Agent Workbench libraries.
Frequently Asked Questions
What prerequisites are required before starting Phase 0?
Phase 0 (phases/00-setup-and-tooling/README.md) assumes only basic familiarity with command‑line interfaces. It installs Python 3.11+, Git, and environment management tools, making the curriculum accessible to beginners while rigorous enough for experienced engineers reviewing fundamentals.
How does Phase 7 connect to both Generative AI and LLM development?
Phase 7 (Transformers Deep Dive) provides the self‑attention mechanisms and scaling law foundations required for both paths. The curriculum branches here: Phase 8 applies these principles to diffusion models for generative AI, while Phase 10 uses them to construct decoder‑only language models from scratch. Both paths reconverge at Phase 12 (Multimodal AI).
What production skills are validated in the capstone projects?
Phase 19 (phases/19-capstone-projects/README.md) requires integrating all prior layers: deploying models built in Phases 10‑12, invoking tools defined in Phase 13 (MCP), managing agent loops from Phase 14, implementing safety checks from Phase 18, and utilizing CI/CD pipelines from Phase 17. Capstones include building autonomous coding agents and RAG chatbots with full observability stacks.
Can learners skip phases if they already know the material?
The directed graph in README.md marks explicit dependencies (e.g., Phase 14 requires Phase 13 for tool protocols). While advanced practitioners may accelerate through early phases, the lesson_run.py validation and workbench pack dependencies in later phases assume mastery of specific file structures and conventions established in prerequisite lessons.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →