Phase II Capstone · Days 29–30 · ~8 hours Prerequisites: Study Note 05-gpt-scaling, Exercise 04-nanogpt-ablations
Train a mini language model on Shakespeare using nanoGPT, run systematic ablation experiments varying architectural choices, and produce a scaling curve with power-law fit. Synthesize findings in a written ablation report.
This project validates that you can: 1. Train a Transformer LM from scratch 2. Design and execute controlled experiments 3. Fit and interpret scaling laws 4. Communicate empirical results clearly
shakespeare_char with the baseline config (6 layers, 384 dim, 6 heads)Run at least 3 experiments per category:
| Category | Variables | Min Runs |
|---|---|---|
| Depth | n_layer ∈ {2, 4, 6, 8, 12} | 5 |
| Width | n_embd ∈ {64, 128, 256, 384, 512} | 5 |
| Heads | n_head ∈ {1, 2, 4, 6, 8} | 5 |
| Activation | {ReLU, GELU, SwiGLU} | 3 |
| Normalization | {Pre-LN, Post-LN, RMSNorm} | 3 |
Control: change exactly one variable per experiment. Everything else (seed, data, steps, LR) must match baseline.
Written report (Jupyter notebook or Markdown) containing: - Methodology: baseline config, what was varied, training setup - Results table: all experiments with params, train loss, val loss - Plots: scaling curve, ablation bar charts, training curves - Analysis: which choices matter most, diminishing returns, surprises - Comparison with published scaling laws - Discussion: implications for larger models
projects/02-mini-lm-ablations/
├── README.md ← this file
├── configs/
│ ├── baseline.py ← baseline config
│ └── ablations/ ← one config per experiment
├── results/
│ ├── ablation_table.csv ← all results in CSV
│ └── checkpoints/ ← saved model checkpoints
├── plots/
│ ├── scaling_curve.png ← loss vs params (log-log)
│ ├── ablation_bars.png ← grouped bar chart
│ └── training_curves.png ← loss vs iteration overlay
├── ablation_report.ipynb ← full report notebook
└── scripts/
├── run_all_ablations.sh ← automated experiment runner
└── plot_results.py ← plotting script
| Criterion | Points | Requirements |
|---|---|---|
| Trained model | 15 | Baseline achieves val loss ≤ 1.50 |
| Ablation completeness | 25 | ≥15 runs across all 5 categories, controlled methodology |
| Scaling curve | 20 | Log-log plot with power-law fit, $R^2$ reported, comparison with Kaplan |
| Ablation plots | 15 | Clear, labeled bar charts and training curves |
| Written analysis | 20 | Methodology, findings, interpretation, implications |
| Code quality | 5 | Reproducible scripts, clean configs, documented |
| Total | 100 |
Pass threshold: ≥ 70 points
# 1. Clone nanoGPT (if not already)
git clone https://github.com/karpathy/nanoGPT.git
cd nanoGPT
# 2. Prepare data
python data/shakespeare_char/prepare.py
# 3. Copy baseline config
cp config/train_shakespeare_char.py configs/baseline.py
# Edit to match the ablation baseline from Exercise 04
# 4. Run baseline
python train.py configs/baseline.py --out_dir=results/checkpoints/baseline
# 5. Start ablations (see Exercise 04 for full commands)
# ...
# 6. Collect results and plot
python scripts/plot_results.py
--seed=42 for all runs to reduce variancePart of the LLM-to-VLA Curriculum · Phase II: Language Models