How the AI Engineering Curriculum Is Organized Across 20 Phases: From Core Math to Production Systems

The AI engineering curriculum in rohitg00/ai-engineering-from-scratch follows a strict progressive structure of 20 numbered phases (0–19), moving from development environment setup and mathematical foundations through deep learning, transformers, and large language models, culminating in multi-agent systems, production infrastructure, and safety-aligned deployment.

The repository provides a comprehensive, self-contained learning path designed to take practitioners from first principles to production-grade AI systems. At the heart of this educational framework lies the ROADMAP.md file, which orchestrates approximately 503 lessons across 20 distinct phases, representing over 1,050 hours of structured content. Each phase builds strictly upon the previous, ensuring learners develop both theoretical depth and practical implementation skills required for modern AI engineering.

The 20-Phase Learning Path

The curriculum is divided into 20 sequential phases, each containing a coherent set of lessons with estimated completion times. The progression follows a deterministic path: you must complete earlier phases before advancing, as later lessons assume knowledge of specific implementations from previous stages.

Phase 0: Setup & Tooling (~14 hours)

The curriculum begins with development environment configuration, GPU and cloud setup, version control workflows, Docker containerization for AI, and data handling fundamentals. This phase ensures learners can execute subsequent lessons without environment-related friction. Key lessons include Dev Environment and Docker for AI, located in phases/00-setup/.

Phase 1: Math Foundations (~23 hours)

This phase establishes the mathematical machinery required for machine learning: linear algebra, calculus, probability theory, optimization techniques, and information theory. Learners study Linear Algebra Intuition and Chain Rule & Automatic Differentiation before writing neural network code, ensuring they understand gradient descent and loss landscapes at a mathematical level.

Phase 2: ML Fundamentals (~21 hours)

Classical machine learning algorithms form the backbone of this phase: regression models, decision trees, SVMs, k-NN, ensemble methods, and evaluation pipelines. Lessons such as Logistic Regression and Ensemble Methods in phases/02-ml-fundamentals/ emphasize the scikit-learn style APIs that underpin later deep learning frameworks.

Phase 3: Deep Learning Core (~15 hours)

Progressing from perceptrons to backpropagation, this phase covers optimizers, regularization techniques, and culminates in building a mini-framework from scratch. The Backpropagation from Scratch and Build Your Own Mini Framework lessons provide the foundational understanding later used when studying PyTorch and JAX internals.

Phase 4: Computer Vision (~27 hours)

Computer vision coverage spans from raw pixels through convolutional neural networks (CNNs) to modern architectures including Vision Transformers (ViT), diffusion models, and segmentation pipelines. Key lessons include Image Generation – Diffusion Models and Vision Transformers, located in phases/04-computer-vision/.

Phase 5: NLP – Foundations to Advanced (~30 hours)

Natural language processing begins with tokenization and embeddings (Word2Vec), progressing through classic models to modern transformer architectures, retrieval mechanisms, and LLM evaluation methodologies. The Word2Vec from Scratch and Attention Mechanism lessons bridge classical NLP and modern transformer-based approaches.

Phase 6: Speech & Audio (~18 hours)

Audio processing covers waveforms, spectrograms, automatic speech recognition (ASR), OpenAI Whisper fine-tuning, voice cloning, and audio-language models. Lessons in phases/06-speech-and-audio/ include Whisper — Architecture & Fine-Tuning and Audio-Language Models.

Phase 7: Transformers Deep Dive (~14 hours)

This phase provides an intimate understanding of self-attention, multi-head attention, positional encodings, and the architectural differences between BERT and GPT. Advanced topics include KV-cache optimization and speculative decoding, with lessons like Self-Attention from Scratch and Speculative Decoding.

Phase 8: Generative AI (~14 hours)

Generative modeling covers autoencoders, GANs, diffusion models, ControlNet, and inpainting techniques. The Stable Diffusion – Architecture and Flow Matching lessons in phases/08-generative-ai/ include evaluation metrics specific to generative outputs.

Phase 9: Reinforcement Learning (~13 hours)

RL fundamentals include Markov Decision Processes (MDPs), dynamic programming, Q-learning, and policy gradients. Advanced coverage includes Proximal Policy Optimization (PPO) and RLHF (Reinforcement Learning from Human Feedback), the latter being critical for modern LLM alignment.

Phase 10: LLMs from Scratch (~26 hours)

This substantial phase covers end-to-end large language model construction: tokenizers, data pipelines, mini-GPT pre-training, scaling laws, instruction tuning, and quantization techniques. Key implementations include Building a Tokenizer from Scratch and Speculative Decoding – EAGLE-3, providing reusable training infrastructure.

Phase 11: LLM Engineering (~17 hours)

Focusing on application rather than architecture, this phase covers prompt engineering, few-shot learning, structured outputs, RAG (Retrieval-Augmented Generation), LoRA fine-tuning, and function calling. The Prompt Engineering – Techniques & Patterns and Function Calling & Tool Use lessons demonstrate production-ready integration patterns.

Phase 12: Multimodal AI (~65 hours)

The most time-intensive phase covers vision-language models (CLIP, FLamingo), LLaVA, video understanding, and omni-models. The CLIP and Contrastive Pretraining and Omni Models – Thinker-Talker lessons explore how modern AI systems process multiple modalities simultaneously.

Phase 13: Tools & Protocols (~24.5 hours)

This phase introduces the Model Context Protocol (MCP), covering server/client implementations, transports, security, and sampling strategies. The MCP Fundamentals and MCP Security II – OAuth 2.1 lessons provide standardized tool-use interfaces used in subsequent agent phases.

Phase 14: Agent Engineering (~42 hours)

Agentic systems are explored through the agent loop, ReWOO, Tree-of-Thoughts reasoning, memory systems, and skill libraries. Benchmarking methodologies including SWE-bench are covered to evaluate agent performance on real-world coding tasks.

Phase 15: Autonomous Systems (~20 hours)

Long-horizon planning, self-improvement mechanisms, AI-Scientist workflows, and safety gating are the focus here. The From Chatbots to Long-Horizon Agents and Recursive Self-Improvement lessons address advanced autonomous capabilities.

Phase 16: Multi-Agent & Swarms (~28 hours)

Drawing on FIPA-ACL heritage, this phase covers A2A protocol (Agent-to-Agent), orchestration patterns, consensus mechanisms, and multi-agent reinforcement learning (MARL). The Why Multi-Agent and MARL – MADDPG lessons explore agent economies and coordination.

Phase 17: Infrastructure & Production (~32 hours)

Production ML engineering covers managed LLM platforms, autoscaling Kubernetes, vLLM serving, speculative decoding at scale, quantization deployment, observability, and FinOps. Lessons include Managed LLM Platforms and Prompt Caching & Semantic Caching.

Phase 18: Ethics, Safety & Alignment (~31 hours)

Critical safety topics include instruction-following as alignment signal, reward hacking detection, Constitutional AI, watermarking (SynthID), and regulatory frameworks. The Instruction-Following as Alignment Signal and Watermarking – SynthID lessons ensure responsible deployment practices.

Phase 19: Capstone Projects (~620 hours)

The final phase consolidates learning through end-to-end research pipelines: building tokenizers, distributed training, multimodal agents, safety-gate servers, and evaluation harnesses. Major projects include the Terminal-Native Coding Agent and Speculative-Decoding Inference Server, located in phases/19-capstone-projects/.

Repository Structure and Lesson Organization

Each phase follows a strict directory convention enforced by the build system. Within phases/<phase-slug>/<lesson-slug>/, you will find:

  • docs/en.md – Human-readable lesson explainer with front-matter (title, objectives, prerequisites)
  • code/ – Reference implementation (Python, TypeScript, Rust, or Julia)
  • code/tests/ – Unit tests (minimum 5 per lesson) executed by CI
  • quiz.json – Structured knowledge check with 6 items

This uniform layout is maintained by helper scripts in scripts/, including lesson_run.py for execution and build_catalog.py for curriculum validation. The site/build.js script automatically generates the public website from ROADMAP.md and lesson metadata, ensuring consistency between documentation and delivered content.

Programmatically Navigating the Curriculum

Because the curriculum is defined in structured markdown and follows consistent directory conventions, you can programmatically discover and interact with course content.

Extracting Phase Metadata from ROADMAP.md

import pathlib, re

roadmap_path = pathlib.Path("ROADMAP.md")

phases = {}
current = None

for line in roadmap_path.read_text().splitlines():
    if line.startswith("## Phase"):

        current = re.search(r"Phase\s+(\d+):\s+([^—]+)", line).group(2).strip()
        phases[current] = []
    elif line.startswith("|") and current:
        parts = [p.strip() for p in line.split("|")[2:4]]
        if parts[0] and parts[1] != "Lesson":
            phases[current].append(parts[0])

for ph, lessons in phases.items():
    print(f"{ph}: {len(lessons)} lessons")

This script extracts the lessons per phase, confirming the curriculum size of approximately 503 lessons totaling over 1,050 hours.

Importing Reusable Artifacts

Later phases ship production-ready code that can be imported into external projects. For example, the MCP client from Phase 13 can be reused in any TypeScript application:

import { MCPClient } from "./phases/13-tools-and-protocols/08-building-an-mcp-client/code/main.ts";

async function demo() {
  const client = new MCPClient("http://localhost:8000");
  const response = await client.callTool({
    name: "search",
    args: { query: "transformer attention" },
  });
  console.log(response);
}

demo();

Executing Capstone Training Pipelines

Phase 19 provides near-production training infrastructure that can be executed directly:

from phases[19].train_loop import train, evaluate
from phases[19].data import get_dataloader

model = ...      # instantiate mini-GPT from Phase 10

optimizer = ...  # AdamW with LR scheduler from Phase 3

for epoch in range(5):
    train(model, optimizer, get_dataloader())
    metrics = evaluate(model, get_dataloader(split="val"))
    print(f"Epoch {epoch}: {metrics}")

All necessary modules (train_loop.py, data.py, etc.) reside within the capstone-projects folder, demonstrating how the curriculum bridges educational content and production systems.

Summary

  • Strict progression: The 20 phases (0–19) form a dependency chain where each phase assumes knowledge from all previous phases, ensuring comprehensive skill development.
  • Standardized structure: Every lesson in phases/<phase-slug>/<lesson-slug>/ contains docs/en.md, code/, code/tests/, and quiz.json, enabling automated validation and execution.
  • Production-ready artifacts: Phases 10 through 19 ship reusable libraries (tokenizers, MCP clients, evaluation harnesses) that can be imported into real-world projects.
  • Automation support: Scripts like scripts/lesson_run.py and site/build.js enforce curriculum invariants and generate the public website directly from ROADMAP.md.
  • Comprehensive scope: Approximately 503 lessons spanning 1,050 hours cover everything from linear algebra to autonomous multi-agent systems with safety alignment.

Frequently Asked Questions

How long does it take to complete the entire AI engineering curriculum?

The full curriculum requires approximately 1,050 hours of study, with Phase 19 (Capstone Projects) alone accounting for 620 hours of hands-on implementation. Early phases are shorter (Setup ~14h, Math ~23h), while advanced multimodal and capstone work demands significantly more time for deep mastery.

Can I skip phases if I already know the mathematics or classical ML?

The curriculum enforces a strict progression where each phase assumes implementation knowledge from previous stages. While you may breeze through familiar concepts, the build system and lesson dependencies in ROADMAP.md expect you to complete prerequisites, as later lessons reference specific code implementations (e.g., the mini-framework from Phase 3 is used in Phase 10).

What programming languages are used throughout the curriculum?

The primary languages are Python (for machine learning, deep learning, and data processing) and TypeScript (for agent systems, MCP protocols, and web interfaces). Some lessons in later phases include Rust and Julia for performance-critical components. Each lesson's code/ directory specifies the language in its implementation files.

How are the lessons tested and validated?

Every lesson includes a code/tests/ directory containing unit tests (minimum 5 per lesson) that are executed by continuous integration. The scripts/ directory contains utilities like audit_lessons.py and check_readme_counts.py that enforce these invariants, ensuring that all code examples remain functional as the curriculum evolves.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →