The Complete AI Engineering from Scratch Curriculum: All 20 Phases Explained
The AI Engineering from Scratch curriculum organizes learning into 20 sequential phases, numbered 0 through 19, that progress from environment setup and mathematical foundations to production deployment and ethical AI alignment.
The rohitg00/ai-engineering-from-scratch repository provides a comprehensive roadmap for becoming an AI engineer through hands-on implementation. Each phase resides in a dedicated folder under phases/ and contains multiple lessons following a standardized structure with code, documentation, and assessments. According to the repository's main README, the curriculum is visualized as a Mermaid diagram spanning lines 57–80, detailing the progressive learning path from basic tooling to advanced autonomous systems.
Curriculum Architecture and Phase Organization
The curriculum employs a zero-indexed numbering system (Phases 0–19) where each phase builds upon the previous. Every phase folder follows the naming convention phases/<NN>-<descriptive-name>/, such as phases/00-setup-and-tooling or phases/19-capstone-projects.
Within each phase, lessons maintain a uniform structure:
code/– Implementation files and executable scriptsdocs/en.md– Markdown documentation with front-matter metadataoutputs/– Expected results, model artifacts, and logsquiz.json– Knowledge assessment questions
This standardized layout is enforced by the LESSON_TEMPLATE.md file in the repository root, ensuring consistency across the hundreds of lessons in the curriculum.
The 20 Phases: From Fundamentals to Production
Foundation Blocks (Phases 0–3)
The curriculum begins with essential prerequisites before touching machine learning code.
-
Phase 0: Setup & Tooling (
phases/00-setup-and-tooling) – Environment configuration, Git workflows, Docker containerization, Jupyter notebooks, and profiling tools. -
Phase 1: Math Foundations (
phases/01-math-foundations) – Linear algebra, calculus, probability theory, optimization techniques, and graph theory fundamentals required for AI modeling. -
Phase 2: ML Fundamentals (
phases/02-ml-fundamentals) – Classical algorithms including linear/logistic regression, decision trees, SVMs, clustering methods, and scikit-learn pipelines. -
Phase 3: Deep Learning Core (
phases/03-deep-learning-core) – Perceptron architecture, multi-layer networks, backpropagation mechanics, optimizer implementations, and construction of a mini-framework from scratch.
Domain Specializations (Phases 4–9)
These phases cover specific AI modalities and architectural patterns.
-
Phase 4: Vision (
phases/04-computer-vision) – Convolution operations, CNN architectures, object detection, image segmentation, diffusion models, Vision Transformers (ViT), and 3D vision fundamentals. -
Phase 5: NLP: Foundations to Advanced (
phases/05-nlp-foundations-to-advanced) – Text tokenization, word embeddings, sequence-to-sequence models, attention mechanisms, LLM-style text generation, and Retrieval-Augmented Generation (RAG) systems. -
Phase 6: Speech & Audio (
phases/06-speech-and-audio) – Digital waveforms, spectrogram generation, Automatic Speech Recognition (ASR), OpenAI Whisper integration, Text-to-Speech (TTS) synthesis, and voice cloning evaluation metrics. -
Phase 7: Transformers Deep Dive (
phases/07-transformers-deep-dive) – Self-attention mechanisms, multi-head attention implementations, positional encodings, BERT and GPT architectures, Mixture of Experts (MoE), and KV-cache optimization. -
Phase 8: Generative AI (
phases/08-generative-ai) – Variational Autoencoders (VAEs), Generative Adversarial Networks (GANs), diffusion models, latent diffusion, ControlNet conditioning, and video/audio generation techniques. -
Phase 9: Reinforcement Learning (
phases/09-reinforcement-learning) – Markov Decision Processes (MDPs), dynamic programming, Q-learning, Deep Q-Networks (DQN), policy gradient methods, Proximal Policy Optimization (PPO), RLHF (Reinforcement Learning from Human Feedback), and multi-agent systems.
Large Language Model Mastery (Phases 10–11)
These phases focus specifically on LLM construction and operationalization.
-
Phase 10: LLMs from Scratch (
phases/10-llms-from-scratch) – Byte Pair Encoding (BPE) tokenizers, mini-GPT pre-training implementations, distributed training strategies, RLHF fine-tuning, and quantization techniques. -
Phase 11: LLM Engineering (
phases/11-llm-engineering) – Advanced prompt engineering, RAG pipeline construction, parameter-efficient fine-tuning (LoRA), function calling implementations, and safety guardrails.
Advanced AI Systems (Phases 12–16)
Progressing to multimodal and agent-based architectures.
-
Phase 12: Multimodal AI (
phases/12-multimodal-ai) – Vision-language models (CLIP, BLIP-2), audio-language integration (Whisper), video understanding, and omni-modal architectures. -
Phase 13: Tools & Protocols (
phases/13-tools-and-protocols) – Tool interface design, Model Context Protocol (MCP) fundamentals, server/client implementations, security considerations, and routing mechanisms. -
Phase 14: Agent Engineering (
phases/14-agent-engineering) – Agent loop construction, planning algorithms, memory system design, LangGraph workflows, AutoGen multi-agent frameworks, and benchmarking methodologies. -
Phase 15: Autonomous Systems (
phases/15-autonomous-systems) – Self-contained agent architectures extending Phase 14 concepts, with emphasis on autonomy and decision-making independence. -
Phase 16: Multi-Agent & Swarms (
phases/16-multi-agent-and-swarms) – Coordination protocols, hierarchical orchestration patterns, and emergent swarm dynamics.
Production and Ethics (Phases 17–19)
The final phases cover deployment, safety, and practical application.
-
Phase 17: Infrastructure & Production (
phases/17-infrastructure-and-production) – Model deployment strategies, observability tooling, structured logging, horizontal scaling, and CI/CD pipelines for AI services. -
Phase 18: Ethics & Alignment (
phases/18-ethics-and-alignment) – AI safety frameworks, bias detection and mitigation, interpretability techniques, and Constitutional AI approaches. -
Phase 19: Capstone Projects (
phases/19-capstone-projects) – End-to-end real-world projects integrating the full technology stack from data ingestion to production deployment.
Navigating the Curriculum Programmatically
You can interact with the phase structure using automated scripts to audit progress or extract metadata.
List all lessons within a specific phase using Python:
import os, json, pathlib
def list_lessons(phase_folder: str):
base = pathlib.Path('phases') / phase_folder
lessons = sorted(p.name for p in base.iterdir() if p.is_dir())
return lessons
print(list_lessons('01-math-foundations')) # → ['01-linear-algebra-intuition', ...]
Extract documentation metadata from lesson files using Bash:
# Show the front-matter header of lesson 01 in Phase 1
sed -n '1,15p' phases/01-math-foundations/01-linear-algebra-intuition/docs/en.md
Execute individual lesson implementations directly:
# Run the perceptron implementation from Phase 3
python phases/03-deep-learning-core/01-the-perceptron/code/perceptron.py
Catalogue all available phases using Node.js:
const fs = require('fs');
const path = require('path');
const phases = fs.readdirSync('phases')
.filter(name => fs.lstatSync(path.join('phases', name)).isDirectory());
console.log('All phases:', phases);
Essential Repository Files
Several critical files govern the curriculum structure and progression tracking:
README.md– Contains the authoritative phase enumeration and Mermaid diagram showing the 20-phase learning trajectory.ROADMAP.md– Tracks completion status, work-in-progress items, and upcoming lessons for each phase.LESSON_TEMPLATE.md– Defines the required structure for all lessons, ensuringcode/,docs/en.md,outputs/, andquiz.jsonconsistency.scripts/audit_lessons.py– Automates validation of lesson completeness and synchronizes README phase counts.site/build.js– Generates the public-facing websiteaiengineeringfromscratch.comfrom the markdown curriculum.
Summary
- The AI Engineering from Scratch curriculum comprises 20 sequential phases (0–19) housed in the
phases/directory of therohitg00/ai-engineering-from-scratchrepository. - Phase numbering follows a zero-indexed convention, starting with
00-setup-and-toolingand culminating in19-capstone-projects. - Each phase contains multiple lessons structured with
code/,docs/en.md,outputs/, andquiz.jsoncomponents. - The progression moves from mathematical foundations and classical ML through deep learning, transformers, and LLMs, concluding with agent systems, production infrastructure, and ethical alignment.
- Repository metadata is centralized in
README.md(curriculum outline) andROADMAP.md(progress tracking).
Frequently Asked Questions
How long does it take to complete all 20 phases of the AI Engineering from Scratch curriculum?
The curriculum is self-paced, but the comprehensive scope—from phases/00-setup-and-tooling through phases/19-capstone-projects—typically requires 12–18 months of dedicated study. Each phase contains dozens of lessons with substantial coding exercises, and the repository's ROADMAP.md provides estimated completion times per phase based on complexity.
What is the difference between Phase 10 (LLMs from Scratch) and Phase 11 (LLM Engineering)?
Phase 10 (phases/10-llms-from-scratch) focuses on building transformer architectures and training pipelines from first principles, including tokenizer construction and distributed training. Phase 11 (phases/11-llm-engineering) shifts to operationalizing existing models through prompt engineering, RAG fine-tuning, LoRA adaptation, and production guardrails.
Are there prerequisites for starting Phase 0 of the curriculum?
Phase 0 (phases/00-setup-and-tooling) assumes only basic programming familiarity and guides learners through environment setup including Git, Docker, and Python configuration. No prior AI or machine learning knowledge is required, as mathematical foundations are covered sequentially in Phase 1 (phases/01-math-foundations).
How can I verify my progress through the 20 phases?
You can run the scripts/audit_lessons.py utility to check lesson completion status across all phases. Additionally, each lesson contains a quiz.json file for self-assessment, and the repository's ROADMAP.md maintains a public checklist of completed and pending content for each phase folder.
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 →