# What Is the Build It / Use It Methodology in AI Engineering from Scratch?

> Understand the Build It Use It methodology in AI Engineering. Learn to implement AI algorithms from scratch and then with production frameworks to grasp core mechanics and abstractions.

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

---

**The Build It / Use It methodology is a dual-phase learning approach where you first implement AI algorithms from raw mathematical foundations using only standard libraries, then rebuild the same solution using production frameworks like PyTorch or scikit-learn to understand both the underlying mechanics and the production abstractions.**

The **Build It / Use It methodology** forms the pedagogical core of the `rohitg00/ai-engineering-from-scratch` curriculum, a structured program designed to transform mathematical concepts into deployable AI systems. This approach splits every lesson into two distinct implementation phases, ensuring you understand exactly what happens inside the "black box" before adopting high-level library conveniences.

## The Six-Beat Learning Workflow

The curriculum organizes each lesson into six sequential "beats" that guide you from abstract idea to concrete artifact. According to the repository's [`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) (lines 24-27), the flow follows this progression:

- **MOTTO** – A one-line core idea that captures the lesson's essence
- **PROBLEM** – A concrete pain point or use case
- **CONCEPT** – Diagrams and intuition-building explanations
- **BUILD IT** – Raw mathematical implementation without frameworks
- **USE IT** – The same logic expressed through PyTorch or scikit-learn
- **SHIP IT** – A reusable artifact (prompt, skill, agent, or MCP server)

The mermaid diagram embedded in the README (lines 33-35) visualizes this pipeline, showing how raw mathematics feeds into production libraries and finally into shippable products.

## Phase 1: Build It (Raw Mathematics)

In the **Build It** phase, you write core logic using only the language's standard library and elementary numeric tools. This forces you to manually implement underlying equations, data-flow mechanisms, and gradient computations without the convenience of automatic differentiation or optimized kernels.

For example, in [`phases/03-deep-learning-core/11-intro-to-pytorch/code/main.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/03-deep-learning-core/11-intro-to-pytorch/code/main.py), you would construct a linear regression model by explicitly coding matrix-vector products and mean-squared error calculations. This phase eliminates abstraction leaks, requiring you to handle every weight initialization, forward pass, and backward gradient computation by hand.

## Phase 2: Use It (Production Frameworks)

The **Use It** phase replaces your hand-crafted components with equivalent production-grade implementations from modern AI libraries. Because you already own a faithful reference implementation from the Build phase, you can immediately map library abstractions back to the raw mathematics you coded earlier.

As documented in [`phases/03-deep-learning-core/11-intro-to-pytorch/docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/03-deep-learning-core/11-intro-to-pytorch/docs/en.md), this phase typically involves refactoring your pure-Python implementation into PyTorch `nn.Module` classes or scikit-learn estimators. This comparison makes the library's "magic" transparent—you can see exactly how `torch.nn.Linear` encapsulates the same weight matrices and bias vectors you manually defined, and why `loss.backward()` performs the identical gradient calculations you wrote explicitly.

### Practical Example: Linear Regression Implementation

Consider the implementation of a simple linear layer across both phases. The **Build It** approach found in [`phases/03-deep-learning-core/11-intro-to-pytorch/code/main.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/03-deep-learning-core/11-intro-to-pytorch/code/main.py) implements the forward pass manually:

```python

# Build It: raw-math implementation using only standard Python

class Linear:
    def __init__(self, in_dim, out_dim):
        self.w = [[0.0 for _ in range(in_dim)] for _ in range(out_dim)]
        self.b = [0.0 for _ in range(out_dim)]

    def forward(self, x):
        # Manual matrix-vector product: y = Wx + b

        return [sum(self.w[i][j] * x[j] for j in range(len(x))) + self.b[i]
                for i in range(len(self.w))]

    def loss(self, y_hat, y):
        # Mean-squared error calculation

        return sum((y_hat[i] - y[i]) ** 2 for i in range(len(y))) / len(y)

```

After mastering these mechanics, the **Use It** phase demonstrates the PyTorch equivalent:

```python

# Use It: production-grade implementation with PyTorch

import torch
import torch.nn as nn

model = nn.Linear(in_features=3, out_features=1)  # Automatic w & b initialization

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

# Training loop with automatic differentiation

x = torch.randn(10, 3)
y = torch.randn(10, 1)

optimizer.zero_grad()
y_hat = model(x)
loss = criterion(y_hat, y)
loss.backward()
optimizer.step()

```

## Pedagogical Benefits of the Dual-Phase Approach

This methodology delivers two distinct competitive advantages to AI engineers:

**Deep Comprehension** – By implementing the algorithm twice—first naïvely, then optimally—you experience identical steps through different lenses. When you encounter discrepancies between your manual gradients and PyTorch's `autograd` results, you debug the mathematics directly rather than treating the library as an opaque oracle.

**Practical Readiness** – Each lesson concludes with the **SHIP IT** phase, generating artifacts like the skill documentation found in [`phases/03-deep-learning-core/11-intro-to-pytorch/outputs/skill-pytorch-patterns.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/03-deep-learning-core/11-intro-to-pytorch/outputs/skill-pytorch-patterns.md). These reusable components can be immediately dropped into production projects as prompts, API skills, autonomous agents, or Model Context Protocol (MCP) servers.

## From Learning to Shipping

The final beat transforms educational code into capital assets. After completing the Build It / Use It cycle for a specific algorithm, you package the knowledge into domain-specific artifacts. The curriculum emphasizes creating **prompts**, **skills**, **agents**, and **MCP servers** that encapsulate the learned patterns, ensuring that theoretical knowledge immediately translates to practical application.

## Summary

- The **Build It / Use It methodology** splits every lesson into raw-math implementation followed by framework-based reconstruction.
- The curriculum follows a six-beat structure defined in [`README.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/README.md) (lines 24-27): Motto → Problem → Concept → Build It → Use It → Ship It.
- **Build It** phases use only standard libraries to force understanding of gradients, matrix operations, and data flow.
- **Use It** phases leverage PyTorch and scikit-learn to demonstrate production abstractions and optimizations.
- Each module produces ship-ready artifacts stored in `outputs/` directories, such as [`skill-pytorch-patterns.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/skill-pytorch-patterns.md).
- This dual-phase approach eliminates "magic" from AI libraries by mapping every high-level function call back to first principles.

## Frequently Asked Questions

### What is the primary goal of the Build It / Use It methodology?

The primary goal is **transparent understanding** of AI algorithms. By forcing you to implement mathematical operations manually before using optimized libraries, the methodology ensures you can debug, modify, and optimize models based on first principles rather than treating frameworks as black boxes. This approach targets the gap between academic knowledge and production competency.

### Which files in the repository demonstrate the Build It / Use It workflow?

The most complete example appears in `phases/03-deep-learning-core/11-intro-to-pytorch/`, where [`code/main.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/code/main.py) contains both the raw-math "Build" implementation and the PyTorch "Use" implementation. The accompanying [`docs/en.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/docs/en.md) explains the conceptual bridge between phases, while [`outputs/skill-pytorch-patterns.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/outputs/skill-pytorch-patterns.md) represents the final "Ship It" artifact generated after mastering both implementations.

### Why does the curriculum forbid external libraries during the Build phase?

Restricting the **Build It** phase to standard libraries ensures you encounter the "pain" of manual gradient computation, weight initialization, and tensor operations. This constraint prevents abstraction leaks—when you later use PyTorch's `nn.Linear` or `autograd`, you understand exactly which mathematical operations are being executed and why specific hyperparameters affect convergence behavior.

### How does the SHIP IT phase relate to Build It / Use It?

The **SHIP IT** phase serves as the capstone that validates your dual-phase learning. After building an algorithm from scratch and validating it against a production framework, you extract the reusable patterns into deployable artifacts (prompts, agents, or MCP servers) stored in `outputs/` directories. This ensures that the theoretical knowledge gained through the Build It / Use It cycle immediately becomes a practical tool for real-world AI engineering tasks.