How the 20 Phases of the AI Engineering from Scratch Curriculum Are Organized

The AI Engineering from Scratch curriculum divides its learning path into 20 sequential phases stored under the phases/ directory, with each folder containing 10–30 lessons organized into code/, docs/, and outputs/ subdirectories, progressing from foundational tooling to production AI systems.

The rohitg00/ai-engineering-from-scratch repository structures its comprehensive learning path into 20 phases of the AI Engineering from Scratch curriculum, each housed in a numbered directory that builds cumulatively upon its predecessors. Starting with environment configuration in phases/00-setup-and-tooling/ and culminating in integrated capstone projects at phases/19-capstone-projects/, this architecture ensures learners master mathematical foundations and classical algorithms before advancing to transformers, autonomous agents, and production infrastructure.

Sequential Phase Structure from Foundations to Production

The curriculum implements a strict dependency chain across twenty zero-padded directories (00–19), where content in later phases assumes mastery of earlier material.

Foundational Phases (0–3) establish the computational and mathematical bedrock. phases/00-setup-and-tooling/ delivers 12 lessons covering git, Docker, API fundamentals, and debugging workflows. phases/01-math-foundations/ contains 22 lessons on linear algebra, calculus, probability, and optimization. phases/02-ml-fundamentals/ (18 lessons) introduces classical algorithms including regression, decision trees, SVMs, and clustering. phases/03-deep-learning-core/ (13 lessons) transitions from perceptron implementations to constructing mini-frameworks using PyTorch and JAX.

Domain-Specific Phases (4–9) cover major AI disciplines. phases/04-computer-vision/ spans 28 lessons on CNNs, object detection, segmentation, diffusion models, and vision transformers. phases/05-nlp-foundations-to-advanced/ provides 29 lessons progressing from tokenization to embeddings, seq2seq architectures, attention mechanisms, and LLM evaluation. phases/06-speech-and-audio/ (17 lessons) addresses audio fundamentals, ASR, TTS, and voice cloning. phases/07-transformers-deep-dive/ dedicates 16 lessons to self-attention, BERT/GPT architectures, Mixture-of-Experts, and speculative decoding. phases/08-generative-ai/ (15 lessons) explores autoencoders, GANs, VAEs, and video/audio/3D generation. phases/09-reinforcement-learning/ (12 lessons) covers MDPs, Q-learning, policy gradients, PPO, and RLHF.

LLM and Agent Phases (10–16) focus on modern AI systems. phases/10-llms-from-scratch/ contains 24 lessons on tokenizer construction, mini-GPT pre-training, distributed training, quantization, and RLHF implementation. phases/11-llm-engineering/ addresses prompt engineering, safety evaluations, and deployment patterns. phases/12-multimodal/ explores vision-language models and cross-modal retrieval. phases/13-tools-and-protocols/ implements the Model-Context-Protocol (MCP) and agent-skill SDKs. phases/14-agent-engineering/ covers agent loops, tool calling, and ReAct patterns. phases/15-autonomous-systems/ and phases/16-multi-agent-swarms/ progress through swarm coordination, multi-agent orchestration, and emergent dynamics.

Production and Ethics Phases (17–19) complete the engineering cycle. phases/17-infrastructure-and-production/ covers deployment pipelines, monitoring, and CI/CD for AI systems. phases/18-ethics-and-alignment/ focuses on responsible AI, bias mitigation, and safety checks. phases/19-capstone-projects/ synthesizes all prior knowledge into end-to-end implementations that combine lessons from multiple phases.

Uniform Directory Layout and Lesson Structure

Every phase follows a consistent filesystem schema enabling programmatic discovery. Each phase resides at phases/<NN>-<descriptive-name>/, containing sequential lesson directories named <NN>-<lesson-name>/.

Every lesson folder enforces three mandatory subdirectories:

  • code/ – Runnable implementations featuring both from-scratch versions (pure Python/Julia/Rust) and production-library integrations (PyTorch, JAX)
  • docs/ – Explanatory markdown files including en.md with the lesson title and narrative content
  • outputs/ – Generated artifacts including prompts, skill definitions, and MCP servers installable via the repository's skill system

This triad structure appears identically across all 20 phases, from phases/00-setup-and-tooling/ through phases/19-capstone-projects/.

Four Core Organizational Principles

The curriculum architecture adheres to four design principles governing content sequencing and packaging.

Stacked Dependency – Content in later phases assumes artifacts built in earlier directories. Phase 7's transformer implementations require the linear algebra foundations from Phase 1 and the deep learning primitives from Phase 3. Phase 14's agent engineering depends on the LLM construction techniques taught in Phase 10.

Uniform Lesson Layout – Every lesson across all phases maintains the code/, docs/, outputs/ structure, creating a predictable interface for both learners and automation tools.

Build-It / Use-It Split – Each lesson first requires implementing an algorithm from fundamental mathematical principles, then demonstrates the identical functionality using industry-standard libraries. This methodology appears in lessons ranging from phases/03-deep-learning-core/01-the-perceptron/ to advanced transformer architectures.

Reusable Artifacts – Every lesson ships a concrete artifact (prompt file, skill definition, or agent configuration) stored in its outputs/ directory. These integrate with scripts/install_skills.py to allow learners to import capabilities into external environments.

Programmatic Curriculum Navigation

The consistent structure enables automated exploration and execution without manual directory traversal.

To enumerate lessons within a phase, such as Phase 3 (Deep Learning Core), extract titles from the documentation files:

import pathlib

phase_root = pathlib.Path("phases/03-deep-learning-core")
lesson_dirs = sorted([p for p in phase_root.iterdir() if p.is_dir()])

print("Lessons in Phase 3:")
for ld in lesson_dirs:
    title_path = ld / "docs" / "en.md"
    if title_path.exists():
        title = title_path.read_text().splitlines()[0].replace("# ", "")

        print(f"- {ld.name}: {title}")

To execute a specific lesson's implementation from the command line:

git clone https://github.com/rohitg00/ai-engineering-from-scratch.git
cd ai-engineering-from-scratch
python3 phases/03-deep-learning-core/01-the-perceptron/code/main.py

To load a lesson's reusable skill artifact into a host environment:

import pathlib

skill_path = pathlib.Path(
    "phases/14-agent-engineering/01-the-agent-loop/outputs/skill-agent-loop.md"
)
skill_content = skill_path.read_text()

# Parse frontmatter metadata (key: value pairs)

metadata_lines = [line for line in skill_content.splitlines() if ": " in line]
metadata = dict(line.split(": ", 1) for line in metadata_lines)
print("Loaded skill metadata:", metadata)

Repository Metadata and Build Automation

Several root-level files govern curriculum presentation and maintenance:

  • README.md – Contains the canonical phase table (source lines 24–102) mapping phase numbers to folder paths, lesson counts, and quick-start commands
  • ROADMAP.md – Tracks development status and contributor assignments for incomplete phases
  • AGENTS.md – Serves as the repository-wide operating manual defining contribution policies and automation protocols
  • phases/ – The core content directory containing all 20 phase folders
  • scripts/install_skills.py – Utility for installing lesson artifacts into external environments
  • site/build.js – Generates the static website's data layer by parsing README and ROADMAP metadata
  • certifications/claude/ – Houses certification tracks and diagnostic assessments aligned with specific phase completions

Summary

  • The 20 phases of the AI Engineering from Scratch curriculum are stored sequentially in phases/00-setup-and-tooling/ through phases/19-capstone-projects/
  • Each phase contains 10–30 lessons following a uniform structure with code/, docs/, and outputs/ subdirectories
  • Stacked dependency ensures mathematical and conceptual prerequisites are mastered before advancing to transformers, LLMs, and autonomous systems
  • The Build-It / Use-It methodology requires implementing algorithms from scratch before utilizing production frameworks
  • Reusable artifacts in every lesson's outputs/ folder integrate with scripts/install_skills.py for external deployment

Frequently Asked Questions

What prerequisites are required before starting Phase 0 of the AI Engineering from Scratch curriculum?

Phase 0 assumes only basic command-line familiarity. The 12 lessons in phases/00-setup-and-tooling/ explicitly cover git workflows, Docker containerization, API interactions, and debugging techniques, establishing the computational environment needed for subsequent mathematical and AI content.

How does the curriculum handle dependencies between the 20 phases?

The repository implements a stacked dependency architecture where each phase folder assumes knowledge from all previous numbered directories. For instance, Phase 7's transformer implementations in phases/07-transformers-deep-dive/ rely on linear algebra foundations from Phase 1, while Phase 14's agent engineering requires the LLM construction techniques taught in Phase 10 (phases/10-llms-from-scratch/).

Can I skip directly to the LLM or Agent Engineering phases without completing earlier sections?

While direct file access is technically possible, the pedagogical design assumes cumulative knowledge. Lessons in phases/10-llms-from-scratch/ and phases/14-agent-engineering/ reference implementations and mathematical foundations established in Phases 0–9, making sequential progression essential for proper comprehension.

What distinguishes the "outputs" folder from "code" in each lesson directory?

The outputs/ directory contains reusable artifacts—exportable prompts, skill definitions, and MCP servers that can be installed into external environments using scripts/install_skills.py. In contrast, code/ contains the lesson's executable educational implementations used for learning and experimentation rather than production deployment.

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 →