claudeers.

🔓 unclaimed — this page was auto-generated from GitHub. Are you the creator?

Claim this page →
// Education & Learning

ai-engineering-from-scratch

Learn it. Build it. Ship it for others.

Actively maintained
97/100
last commit 13 days ago
last release none
releases 0
open issues 32
// install
git clone https://github.com/rohitg00/ai-engineering-from-scratch

AI Engineering from Scratch — reference manual banner

From the creator of Agent Memory - #1 Persistent memory ⭐ which naturally works with any agents or chat assistants.

░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒

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

How this works

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.

░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒

The shape of the curriculum

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
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒

The shape of a lesson

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<br/><sub>one-line core idea</sub>"] --> Pr["PROBLEM<br/><sub>concrete pain</sub>"]
  Pr --> C["CONCEPT<br/><sub>diagrams &amp; intuition</sub>"]
  C --> B["BUILD IT<br/><sub>raw math, no frameworks</sub>"]
  B --> U["USE IT<br/><sub>same thing in PyTorch / sklearn</sub>"]
  U --> S["SHIP IT<br/><sub>prompt · skill · agent · MCP</sub>"]

Getting started

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

Prerequisites

  • You can write code (any language; Python helps).
  • You want to understand how AI actually works, not just call APIs.

Built-in agent skills (Claude, Cursor, Codex, OpenClaw, Hermes)

SkillWhat it does
/find-your-levelTen-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.
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒

Every lesson ships something

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.

FIG_001.A prompts
FIG_001 · A
PROMPTS
FIG_001.B skills
FIG_001 · B
SKILLS
FIG_001.C agents
FIG_001 · C
AGENTS
FIG_001.D MCP servers
FIG_001 · D
MCP SERVERS
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.

FIG_002 · A worked sample

Phase 14, lesson 1: the agent loop. ~120 lines of pure Python, no dependencies.

code/agent_loop.py   build it

def run(query, tools):
    history = [user(query)]
    for step in range(MAX_STEPS):
        msg = llm(history)
        if msg.tool_calls:
            for call in msg.tool_calls:
                result = tools[call.name](https://github.com/rohitg00/ai-engineering-from-scratch/blob/HEAD/**call.args)
                history.append(tool_result(call.id, result))
            continue
        return msg.content
    raise StepLimitExceeded

outputs/skill-agent-loop.md   ship it

---
name: agent-loop
description: ReAct-style loop for any tool list
phase: 14
lesson: 01
---

Implement a minimal agent loop that...

outputs/prompt-debug-agent.md

You are an agent debugger. Given the trace
of an agent run, identify the step where
the agent went wrong and explain why...
░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒░░░▒▒▒

Contents

Twenty phases. Click any phase to expand its lesson list.

Phase 0: Setup & Tooling 12 lessons

Get your environment ready for everything that follows.

#LessonTypeLang
01Dev EnvironmentBuildPython
02Git & CollaborationLearn
03GPU Setup & CloudBuildPython
04APIs & KeysBuildPython
05Jupyter NotebooksBuildPython
06Python EnvironmentsBuildShell
07Docker for AIBuildDocker
08Editor SetupBuild
09Data ManagementBuildPython
10Terminal & ShellLearn
11Linux for AILearn
12Debugging & ProfilingBuildPython
Phase 1 — Math Foundations  22 lessons  The intuition behind every AI algorithm, through code.
#LessonTypeLang
01Linear Algebra IntuitionLearnPython, Julia
02Vectors, Matrices & OperationsBuildPython, Julia
03Matrix Transformations & EigenvaluesBuildPython, Julia
04Calculus for ML: Derivatives & GradientsLearnPython
05Chain Rule & Automatic DifferentiationBuildPython
06Probability & DistributionsLearnPython
07Bayes' Theorem & Statistical ThinkingBuildPython
08Optimization: Gradient Descent FamilyBuildPython
09Information Theory: Entropy, KL DivergenceLearnPython
10Dimensionality Reduction: PCA, t-SNE, UMAPBuildPython
11Singular Value DecompositionBuildPython, Julia
12Tensor OperationsBuildPython
13Numerical StabilityBuildPython
14Norms & DistancesBuildPython
15Statistics for MLBuildPython
16Sampling MethodsBuildPython
17Linear SystemsBuildPython
18Convex OptimizationBuildPython
19Complex Numbers for AILearnPython
20The Fourier TransformBuildPython
21Graph Theory for MLBuildPython
22Stochastic ProcessesLearnPython
Phase 2 — ML Fundamentals  18 lessons  Classical ML — still the backbone of most production AI.
#LessonTypeLang
01What Is Machine LearningLearnPython
02Linear Regression from ScratchBuildPython
03Logistic Regression & ClassificationBuildPython
04Decision Trees & Random ForestsBuildPython
05Support Vector MachinesBuildPython
06KNN & Distance MetricsBuildPython
07Unsupervised Learning: K-Means, DBSCANBuildPython
08Feature Engineering & SelectionBuildPython
09Model Evaluation: Metrics, Cross-ValidationBuildPython
10Bias, Variance & the Learning CurveLearnPython
11Ensemble Methods: Boosting, Bagging, StackingBuildPython
12Hyperparameter TuningBuildPython
13ML Pipelines & Experiment TrackingBuildPython
14Naive BayesBuildPython
15Time Series FundamentalsBuildPython
16Anomaly DetectionBuildPython
17Handling Imbalanced DataBuildPython
18Feature SelectionBuildPython
Phase 3 — Deep Learning Core  13 lessons  Neural networks from first principles. No frameworks until you build one.
#LessonTypeLang
01The Perceptron: Where It All StartedBuildPython
02Multi-Layer Networks & Forward PassBuildPython
03Backpropagation from ScratchBuildPython
04Activation Functions: ReLU, Sigmoid, GELU & WhyBuildPython
05Loss Functions: MSE, Cross-Entropy, ContrastiveBuildPython
06Optimizers: SGD, Momentum, Adam, AdamWBuildPython
07Regularization: Dropout, Weight Decay, BatchNormBuildPython
08Weight Initialization & Training StabilityBuildPython
09Learning Rate Schedules & WarmupBuildPython
10Build Your Own Mini FrameworkBuildPython
11Introduction to PyTorchBuildPython
12Introduction to JAXBuildPython
13Debugging Neural NetworksBuildPython
Phase 4 — Computer Vision  28 lessons  From pixels to understanding — image, video, 3D, VLMs, and world models.
#LessonTypeLang
01Image Fundamentals: Pixels, Channels, Color SpacesLearnPython
02Convolutions from ScratchBuildPython
03CNNs: LeNet to ResNetBuildPython
04Image ClassificationBuildPython
05Transfer Learning & Fine-TuningBuildPython
06Object Detection — YOLO from ScratchBuildPython
07Semantic Segmentation — U-NetBuildPython
08Instance Segmentation — Mask R-CNNBuildPython
09Image Generation — GANsBuildPython
10Image Generation — Diffusion ModelsBuildPython
11Stable Diffusion — Architecture & Fine-TuningBuildPython
12Video Understanding — Temporal ModelingBuildPython
133D Vision: Point Clouds, NeRFsBuildPython
14Vision Transformers (ViT)BuildPython
15Real-Time Vision: Edge DeploymentBuildPython
16Build a Complete Vision PipelineBuildPython
17Self-Supervised Vision — SimCLR, DINO, MAEBuildPython
18Open-Vocabulary Vision — CLIPBuildPython
19OCR & Document UnderstandingBuildPython
20Image Retrieval & Metric LearningBuildPython
21Keypoint Detection & Pose EstimationBuildPython
223D Gaussian Splatting from ScratchBuildPython
23Diffusion Transformers & Rectified FlowBuildPython
24SAM 3 & Open-Vocabulary SegmentationBuildPython
25Vision-Language Models (ViT-MLP-LLM)BuildPython
26Monocular Depth & Geometry EstimationBuildPython
27Multi-Object Tracking & Video MemoryBuildPython
28World Models & Video DiffusionBuildPython
Phase 5 — NLP: Foundations to Advanced  29 lessons  Language is the interface to intelligence.
#LessonTypeLang
01Text Processing: Tokenization, Stemming, LemmatizationBuildPython
02Bag of Words, TF-IDF & Text RepresentationBuildPython
03Word Embeddings: Word2Vec from ScratchBuildPython
04GloVe, FastText & Subword EmbeddingsBuildPython
05Sentiment AnalysisBuildPython
06Named Entity Recognition (NER)BuildPython
07POS Tagging & Syntactic ParsingBuildPython
08Text Classification — CNNs & RNNs for TextBuildPython
09Sequence-to-Sequence ModelsBuildPython
10Attention Mechanism — The BreakthroughBuildPython
11Machine TranslationBuildPython
12Text SummarizationBuildPython
13Question Answering SystemsBuildPython
14Information Retrieval & SearchBuildPython
15Topic Modeling: LDA, BERTopicBuildPython
16Text GenerationBuildPython
17Chatbots: Rule-Based to NeuralBuildPython
18Multilingual NLPBuildPython
19Subword Tokenization: BPE, WordPiece, Unigram, SentencePieceLearnPython
20Structured Outputs & Constrained DecodingBuildPython
21NLI & Textual EntailmentLearnPython
22Embedding Models Deep DiveLearnPython
23Chunking Strategies for RAGBuildPython
24Coreference ResolutionLearnPython
25Entity Linking & DisambiguationBuildPython
26Relation Extraction & Knowledge Graph ConstructionBuildPython
27LLM Evaluation: RAGAS, DeepEval, G-EvalBuildPython
28Long-Context Evaluation: NIAH, RULER, LongBench, MRCRLearnPython
29Dialogue State TrackingBuildPython
Phase 6 — Speech & Audio  17 lessons  Hear, understand, speak.
#LessonTypeLang
01Audio Fundamentals: Waveforms, Sampling, FFTLearnPython
02Spectrograms, Mel Scale & Audio FeaturesBuildPython
03Audio ClassificationBuildPython
04Speech Recognition (ASR)BuildPython
05Whisper: Architecture & Fine-TuningBuildPython
06Speaker Recognition & VerificationBuildPython
07Text-to-Speech (TTS)BuildPython
08Voice Cloning & Voice ConversionBuildPython
09Music GenerationBuildPython
10Audio-Language ModelsBuildPython
11Real-Time Audio ProcessingBuildPython
12Build a Voice Assistant PipelineBuildPython
13Neural Audio Codecs — EnCodec, SNAC, Mimi, DACLearnPython
14Voice Activity Detection & Turn-TakingBuildPython
15Streaming Speech-to-Speech — Moshi, HibikiLearnPython
16Voice Anti-Spoofing & Audio WatermarkingBuildPython
17Audio Evaluation — WER, MOS, MMAU, LeaderboardsLearnPython
Phase 7 — Transformers Deep Dive  14 lessons  The architecture that changed everything.
#LessonTypeLang
01Why Transformers: The Problems with RNNsLearnPython
02Self-Attention from ScratchBuildPython
03Multi-Head AttentionBuildPython
04Positional Encoding: Sinusoidal, RoPE, ALiBiBuildPython
05The Full Transformer: Encoder + DecoderBuildPython
06BERT — Masked Language ModelingBuildPython
07GPT — Causal Language ModelingBuildPython
08T5, BART — Encoder-Decoder ModelsLearnPython
09Vision Transformers (ViT)BuildPython
10Audio Transformers — Whisper ArchitectureLearnPython
11Mixture of Experts (MoE)BuildPython
12KV Cache, Flash Attention & Inference OptimizationBuildPython
13Scaling LawsLearnPython
14Build a Transformer from ScratchBuildPython
15Attention Variants — Sliding Window, Sparse, DifferentialBuildPython
16Speculative Decoding — Draft, Verify, RepeatBuildPython
Phase 8 — Generative AI  14 lessons  Create images, video, audio, 3D, and more.
#LessonTypeLang
01Generative Models: Taxonomy & HistoryLearnPython
02Autoencoders & VAEBuildPython
03GANs: Generator vs DiscriminatorBuildPython
04Conditional GANs & Pix2PixBuildPython
05StyleGANBuildPython
06Diffusion Models — DDPM from ScratchBuildPython
07Latent Diffusion & Stable DiffusionBuildPython
08ControlNet, LoRA & ConditioningBuildPython
09Inpainting, Outpainting & EditingBuildPython
10Video GenerationBuildPython
11Audio GenerationBuildPython
123D GenerationBuildPython
13Flow Matching & Rectified FlowsBuildPython
14Evaluation: FID, CLIP ScoreBuildPython
19Visual Autoregressive Modeling (VAR): Next-Scale PredictionBuildPython
Phase 9 — Reinforcement Learning  12 lessons  The foundation of RLHF and game-playing AI.
#LessonTypeLang
01MDPs, States, Actions & RewardsLearnPython
02Dynamic ProgrammingBuildPython
03Monte Carlo MethodsBuildPython
04Q-Learning, SARSABuildPython
05Deep Q-Networks (DQN)BuildPython
06Policy Gradients — REINFORCEBuildPython
07Actor-Critic — A2C, A3CBuildPython
08PPOBuildPython
09Reward Modeling & RLHFBuildPython
10Multi-Agent RLBuildPython
11Sim-to-Real TransferBuildPython
12RL for GamesBuildPython
Phase 10 — LLMs from Scratch  22 lessons  Build, train, and understand large language models.
#LessonTypeLang
01Tokenizers: BPE, WordPiece, SentencePieceBuildPython, Rust
02Building a Tokenizer from ScratchBuildPython
03Data Pipelines for Pre-TrainingBuildPython
04Pre-Training a Mini GPT (124M)BuildPython
05Distributed Training, FSDP, DeepSpeedBuildPython
06Instruction Tuning — SFTBuildPython
07RLHF — Reward Model + PPOBuildPython
08DPO — Direct Preference OptimizationBuildPython
09Constitutional AI & Self-ImprovementBuildPython
10Evaluation — Benchmarks, EvalsBuildPython
11Quantization: INT8, GPTQ, AWQ, GGUFBuildPython
12Inference OptimizationBuildPython
13Building a Complete LLM PipelineBuildPython
14Open Models: Architecture WalkthroughsLearnPython
15Speculative Decoding and EAGLE-3BuildPython
16Differential Attention (V2)BuildPython
17Native Sparse Attention (DeepSeek NSA)BuildPython
18Multi-Token Prediction (MTP)BuildPython
19DualPipe ParallelismLearnPython
20DeepSeek-V3 Architecture WalkthroughLearnPython
21Jamba — Hybrid SSM-TransformerLearnPython
22Async and Hogwild! InferenceBuildPython

view the full README on GitHub.

// compatibility

Platformscli, api, web
Operating systems
AI compatibilityclaude
LicenseMIT
Pricingopen-source
LanguagePython

// faq

What is ai-engineering-from-scratch?

Learn it. Build it. Ship it for others.. It is open-source on GitHub.

Is ai-engineering-from-scratch free to use?

ai-engineering-from-scratch is open-source under the MIT license, so it is free to use.

What category does ai-engineering-from-scratch belong to?

ai-engineering-from-scratch is listed under mcp-servers in the Claudeers registry of Claude-compatible tools.

0 views
37,594 stars
unclaimed
updated 15 days ago

// embed badge

ai-engineering-from-scratch on Claudeers
[![Claudeers](https://claudeers.com/api/badge/ai-engineering-from-scratch.svg)](https://claudeers.com/ai-engineering-from-scratch)

// retro hit counter

ai-engineering-from-scratch hit counter
[![Hits](https://claudeers.com/api/counter/ai-engineering-from-scratch.svg)](https://claudeers.com/ai-engineering-from-scratch)

// reviews

// guestbook

0/500

// related in Education & Learning

🔓

Skills for Real Engineers. Straight from my .claude directory.

// educationmattpocock/Shell155,576MIT[ claude ]
🔓

Course to get into Large Language Models (LLMs) with roadmaps and Colab notebooks.

// educationmlabonne/80,658Apache-2.0[ claude ]
🔓

A collection of learning resources for curious software engineers

// educationcharlax/Python51,218MIT[ claude ]
🔓

Powerful AI Client

// educationchatboxai/TypeScript40,855GPL-3.0[ claude ]

// built by

Connectorlinks several projects together across the ecosystem · 10 connections
→ see how ai-engineering-from-scratch connects across the ecosystem