# How the Build It / Use It Methodology Structures the AI Engineering from Scratch Curriculum

> Discover how the Build It / Use It methodology structures AI Engineering from Scratch. Implement algorithms from scratch then use production frameworks to master AI engineering.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: architecture
- Published: 2026-08-31

---

**The AI Engineering from Scratch curriculum uses a "Build It / Use It" split where learners first implement algorithms from raw mathematics without libraries, then rerun the same logic through production frameworks like PyTorch to understand exactly what the libraries abstract away.**

The **AI Engineering from Scratch curriculum**, maintained in the `rohitg00/ai-engineering-from-scratch` repository, centers every lesson around a fundamental pedagogical principle: you cannot effectively use a tool until you understand how it works. This principle manifests as the **Build It / Use It methodology**, a six-beat lesson flow that alternates between raw mathematical implementation and production library usage.

## The Six-Beat Lesson Flow

Every lesson follows a consistent rhythm represented by the Mermaid diagram `M → Pr → C → B → U → S` found in [`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) lines 31-35. In this sequence:

- **M** = Motivation
- **Pr** = Prerequisites
- **C** = Concept
- **B** = **BUILD IT** (raw math, no frameworks)
- **U** = **USE IT** (same algorithm in PyTorch/sklearn)
- **S** = Summary

According to the repository's documentation at [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) line 11, the **Build It / Use It** split forms the central spine of this entire structure.

## Build It: Raw Mathematics First

The **Build It** phase requires learners to implement algorithms from scratch using only basic numerical libraries like NumPy. This means writing gradient descent loops, back-propagation chains, and attention mechanisms using pure mathematical operations before touching high-level APIs.

As documented in [`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) lines 24-26, this approach forces "deep understanding of the underlying concepts" by removing abstraction layers. When learning linear regression, the **Build It** implementation manually calculates gradients and parameter updates:

```python
import numpy as np

# raw math: y = wx + b

def predict(w, b, x):
    return w * x + b

def loss(w, b, X, y):
    preds = predict(w, b, X)
    return np.mean((preds - y) ** 2)

# gradient descent on the raw equations

def train(X, y, lr=0.01, epochs=100):
    w, b = 0.0, 0.0
    for _ in range(epochs):
        grad_w = np.mean(2 * (predict(w, b, X) - y) * X)
        grad_b = np.mean(2 * (predict(w, b, X) - y))
        w -= lr * grad_w
        b -= lr * grad_b
    return w, b

```

This implementation lives in lesson directories like `phases/*/code/main.py`, serving as the minimal reference implementation for that concept.

## Use It: Production Library Integration

Immediately following the raw implementation, the **Use It** phase reimplements the identical logic using the production library—typically PyTorch or scikit-learn. Because the learner has already written the algorithm once, they can map each line of framework code to the underlying mathematics they previously coded.

The curriculum explicitly states that this turns "a 'black-box' library into an intelligible tool" ([`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) lines 24-26). The same linear regression example using PyTorch demonstrates this mapping:

```python
import torch
import torch.nn as nn

model = nn.Linear(1, 1)               # framework implementation

criterion = nn.MSELoss()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

X = torch.unsqueeze(torch.tensor([1., 2., 3.]), 1)
y = torch.unsqueeze(torch.tensor([2., 4., 6.]), 1)

for _ in range(100):
    optimizer.zero_grad()
    preds = model(X)
    loss = criterion(preds, y)
    loss.backward()
    optimizer.step()

```

Both snippets solve the identical optimization problem, but the **Use It** version leverages optimized kernels while the learner understands exactly what `loss.backward()` and `optimizer.step()` execute under the hood.

## Why This Methodology Works

Alternating between **Build It** and **Use It** achieves two specific pedagogical goals:

- **Conceptual mastery**: Learners own the mathematical foundations before relying on high-level abstractions, preventing the "API confusion" common in modern AI development.
- **Practical fluency**: They immediately see how theoretical logic maps to real-world libraries, enabling rapid prototyping and informed debugging when models fail in production.

This methodology permeates all twenty phases of the **AI Engineering from Scratch curriculum**, from the mathematical foundations in Phase 0 through the capstone projects in Phase 19, with each lesson's [`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md) reinforcing the "Build It / Use It" mantra through concrete scaffolds.

## Key Files Supporting the Methodology

The repository structure reflects this dual-phase approach through specific file patterns:

- **[`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md)** — Defines the Build It / Use It split as the curriculum's central spine at line 11.
- **[`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md)** — Explains the six-beat lesson structure and contains the Mermaid flow diagram (lines 24-26 and 31-35).
- **`phases/*/code/main.py`** — Contains the runnable **Build It** code, which represents minimal reference implementations using raw math.
- **`phases/*/code/main.py`** (library versions) — Contains the corresponding **Use It** implementation using production frameworks like PyTorch.
- **`phases/*/docs/en.md`** — Documents the concrete scaffolds showing both phases for specific lessons, such as in [`phases/12-multimodal-ai/25-multimodal-agents-computer-use/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/12-multimodal-ai/25-multimodal-agents-computer-use/docs/en.md).

## Summary

- The **AI Engineering from Scratch curriculum** organizes lessons around a "Build It / Use It" split defined in [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) line 11.
- Learners first implement algorithms from raw mathematics without external libraries (the **Build It** phase).
- They then rerun identical logic through production libraries like PyTorch (the **Use It** phase).
- This six-beat flow (M → Pr → C → B → U → S) spans all twenty phases of the curriculum.
- The methodology transforms black-box frameworks into intelligible tools by mapping high-level APIs to previously implemented mathematical foundations.

## Frequently Asked Questions

### What is the Build It / Use It methodology in AI Engineering from Scratch?

The **Build It / Use It** methodology is a pedagogical approach where learners first implement AI algorithms from pure mathematics without libraries, then immediately reimplement the same logic using production frameworks like PyTorch. This split, defined at [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) line 11, ensures learners understand underlying mechanics before using high-level abstractions.

### Why does the curriculum require implementing algorithms from scratch first?

Implementing from scratch during the **Build It** phase forces deep understanding of concepts like back-propagation and attention mechanisms before frameworks obscure the details. As noted in [`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) lines 24-26, this prevents treating libraries as black boxes and builds the mathematical intuition necessary for debugging complex models.

### How does the six-beat lesson flow work?

Each lesson follows the sequence **M → Pr → C → B → U → S** (Motivation, Prerequisites, Concept, Build It, Use It, Summary) documented in [`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) lines 31-35. The **Build It** (B) and **Use It** (U) phases form the central spine, with B using raw NumPy implementations and U using production libraries.

### Where can I find the Build It and Use It code implementations?

Each lesson contains both implementations in its directory structure. The **Build It** code typically resides in `phases/<phase-number>-<topic>/<lesson-number>-<name>/code/main.py` as minimal reference implementations, while the **Use It** version appears in the same location or adjacent files using PyTorch or scikit-learn. Documentation explaining both phases appears in `phases/*/docs/en.md` files.