How the Build It / Use It Methodology Works in AI Engineering From Scratch
The Build It / Use It methodology is a six-beat learning loop that forces learners to implement AI algorithms from scratch using raw mathematics before re-implementing them with production-grade libraries.
The rohitg00/ai-engineering-from-scratch repository structures every lesson around this pedagogical spine, ensuring students understand underlying mechanics before abstracting them away. According to the repository's README.md, this split forms the core of the curriculum, creating a repeatable pattern that transforms theoretical knowledge into concrete engineering artifacts.
The Six-Beat Learning Loop
The curriculum organizes content into a continuous cycle defined in lines 99‑101 of the README. This loop consists of three distinct phases:
- Build It – Students write algorithms using only fundamental mathematics and minimal language features, eliminating black-box abstractions.
- Use It – The same algorithm is reconstructed using optimized libraries like PyTorch or scikit-learn, revealing the relationship between theory and implementation.
- Ship It – The lesson culminates in a reusable artifact (prompts, skills, agents, or MCP servers) suitable for production pipelines.
The flow is visualized in a mermaid diagram at lines 100‑110 of the README. Every lesson follows this pattern, with explicit ## Build It and ## Use It section headings in the documentation, as seen in the End-to-End Safety Gate lesson at phases/19-capstone-projects/87-end-to-end-safety-gate/docs/en.md.
Build It: Implementing From First Principles
In the Build It phase, learners implement algorithms using pure NumPy, plain Python loops, or handcrafted tensor operations. This approach forces deep understanding by requiring the explicit coding of every mathematical component.
Consider the Linear Model lesson from phase 10. The build_it/ subfolder contains a manual least-squares regression implementation that follows the exact mathematical formula for the ordinary least-squares estimator:
import numpy as np
# raw data
X = np.random.randn(100, 3)
y = X @ np.array([1.5, -2.0, 0.7]) + 0.1 * np.random.randn(100)
# closed-form solution (XᵀX)⁻¹Xᵀy
w_hat = np.linalg.inv(X.T @ X) @ X.T @ y
This code contains no hidden optimizations. The learner must understand matrix transposition, inversion, and the normal equation to make it work. The file resides at phases/10-llms-from-scratch/01-linear-model/code/build_it/ (referenced in the lesson's main.py).
Use It: Production-Grade Libraries
The Use It phase re-implements the identical algorithm using production-grade libraries. By swapping the handcrafted version for optimized counterparts, learners can compare numerical stability, performance characteristics, and API design while verifying that the library matches their manual implementation.
Using the same linear regression example, the use_it/ subfolder contains the PyTorch implementation:
import torch
import torch.nn as nn
import torch.optim as optim
model = nn.Linear(3, 1, bias=False) # library implementation
criterion = nn.MSELoss()
optimizer = optim.SGD(model.parameters(), lr=0.01)
X_t = torch.from_numpy(X).float()
y_t = torch.from_numpy(y).float().unsqueeze(1)
for _ in range(500):
optimizer.zero_grad()
preds = model(X_t)
loss = criterion(preds, y_t)
loss.backward()
optimizer.step()
The library handles weight initialization, automatic differentiation, and iterative optimization. Learners can inspect model.weight and compare it directly to w_hat from the Build It phase, validating that both approaches converge to similar solutions.
Ship It: Creating Reusable Artifacts
The final phase produces tangible outputs stored in outputs/ directories. These artifacts—ranging from saved model weights to configuration files—demonstrate how to transition from educational code to production-ready components.
torch.save(model.state_dict(), "linear_model.pt") # artifact for downstream pipelines
This file can be loaded by other lessons or external projects, completing the transition from theoretical understanding to practical utility.
File Structure and Lesson Organization
The repository enforces this methodology through strict directory conventions. Each lesson contains:
build_it/– Raw mathematical implementations (e.g.,phases/10-llms-from-scratch/01-linear-model/code/build_it/)use_it/– Library-based versions using PyTorch, TensorFlow, or scikit-learn (e.g.,phases/10-llms-from-scratch/01-linear-model/code/use_it/)outputs/– Ship It artifacts likelinear_model.ptready for downstream consumption
The AGENTS.md file reiterates these conventions for contributors, ensuring AI agents and human authors maintain consistency across the curriculum.
Summary
- The Build It / Use It methodology forms the pedagogical spine of the
ai-engineering-from-scratchrepository, defined in the README's six-beat learning loop. - Build It requires implementation from first principles using NumPy or pure Python, eliminating abstraction layers.
- Use It reconstructs the solution with production libraries like PyTorch, enabling direct comparison between manual and optimized implementations.
- Ship It produces reusable artifacts in
outputs/directories, bridging the gap between learning and production engineering. - Every lesson follows explicit directory structures (
build_it/,use_it/,outputs/) and documentation headings (## Build It,## Use It).
Frequently Asked Questions
What is the Build It / Use It methodology?
The Build It / Use It methodology is a two-stage learning pattern where students first implement AI algorithms from scratch using raw mathematics (Build It), then re-implement them using production-grade libraries (Use It). This approach ensures deep understanding of underlying mechanics before abstraction. According to the repository's README.md, this split forms the "spine" of every lesson.
How does the Ship It phase work?
Ship It is the final phase where lessons produce reusable artifacts such as saved model weights, prompts, skills, agents, or MCP servers. These outputs are stored in outputs/ directories (e.g., linear_model.pt) and can be imported into downstream projects or subsequent lessons, demonstrating the transition from educational code to production engineering.
Where can I find examples of this methodology in the repository?
Concrete examples appear in multiple locations: the Linear Model lesson at phases/10-llms-from-scratch/01-linear-model/code/main.py contains both implementations, while the End-to-End Safety Gate capstone at phases/19-capstone-projects/87-end-to-end-safety-gate/docs/en.md shows the explicit ## Build It and ## Use It documentation sections.
What libraries are typically used in the Use It phase?
The Use It phase primarily employs PyTorch, TensorFlow, and scikit-learn for machine learning algorithms, though specific lessons may use additional domain-specific libraries. The methodology focuses on comparing these optimized implementations against the raw NumPy or pure Python versions created in the Build It phase to highlight performance differences and API design patterns.
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 →