Map
Arrows point from a prerequisite to the module that builds on it. Numbers give the recommended order; dashed boxes are the hands-on tutorials. Click a box to open its guide.
Recommended order: Transformer primer → full Transformer guide → labs 01–03 → T1 Build an LLM → modules 2–8, each followed by its lab (04–10) → 9 Robot FM → T2 Build an agent (optional; it needs only T1, so any time after it works too). Keep the efficiency cookbook (E) open throughout as a reference. Mamba and MoE need only the Transformer, so you can take them earlier; the numbered order interleaves vision and language so each module reuses something recent.
Main track
Each module has an interactive *_guide.html (open it in a browser), a runnable reference implementation with shape and FLOP printouts, and a README with the key bottlenecks.
-
1
Transformer
Attention from first principles, with the FLOP and memory accounting every later module reuses.
-
2
Vision Transformer
Images as sequences of patches, encoded with bidirectional attention.
-
3
Vision-Language Models
A vision encoder and a projector feed image tokens into an LLM.
-
4
Diffusion (DiT)
Generation by iterative denoising, with a transformer as the denoiser.
-
5
Mamba (SSM)
A selective linear recurrence: parallel scan for training, constant-size state for decoding.
-
6
Mixture-of-Experts LLMsnew
Sparse expert FFNs chosen by a router, plus multi-head latent attention: the shape of most large open LLMs.
-
7
BEV Perception
Many cameras fused into one bird's-eye-view grid of tokens.
-
8
Vision-Language-Action
A VLM backbone plus an action expert that generates robot action chunks.
-
9
Robot Foundation Models
A slow reasoning system and a fast action system, across robot bodies.
Hands-on track
Build the models yourself. Do the matching lab right after each module (labs 01–03 after the full Transformer guide), take the LLM tutorial right after labs 01–03, keep the efficiency cookbook open whenever a guide talks about memory or speed, and finish with the optional agent tutorial.
-
L
Build-it-yourself labs10 labs
Fill-in-the-blank files that build the core of every module from scratch: attention, a transformer block, GPT generation with a KV cache, ViT, VLM fusion, diffusion, the Mamba scan, MoE routing, BEV projection and flow matching. A checker reports PASS / TODO / FAIL with hints; solutions are included.
Lab list →python labs/check.py 1 -
E
Memory & inference efficiency cookbookcookbook
Where memory goes (weights, KV cache, activations), a "will it fit?" calculator for Jetson and GPUs, the roofline, and one card per technique: quantization, GQA/MLA, FlashAttention, paged KV, prefix caching, speculative decoding, fusion, sparsity, LoRA and checkpointing, plus the Jetson deployment workflow.
-
T1
Build an LLM from scratchtutorial
Byte-level BPE, a GPT decoder (RMSNorm, RoPE, SwiGLU, tied embeddings), pretraining, sampling, a tested KV cache and SFT. Trains in about a minute on 4 CPU threads, no downloads.
-
T2
Build a personal agenttutorial
A tool-use loop on the Claude Messages API with notes search, memory, guardrails and evals. A scripted mock model runs everything offline.
How to study this repo
The same five steps for every module. The guides end with the material for steps 3 and 4.
- Read the guideFollow the tensor shapes through each diagram; use the calculators with your own model sizes.
- Run the .py
python <module>.pyprints shapes, parameter counts and FLOPs. Change a dimension and predict the output first. - Do the exercisesEach has a self-verification step, usually an assertion you can run.
- Take the self-checkAnswer before opening the hidden answers; redo the numeric ones on paper.
- Revisit after a few daysRetake the self-check cold. Whatever you missed, reread that section only.
Suggested study cadence
About two modules a week, at 4–6 hours per module including its lab, running the code and some exercises. Plan more time if you do every exercise, less if you only read.
| Week | Study | Review (self-check, cold) |
|---|---|---|
| 1 | 1 Transformer (primer, full guide, labs 01–03) · T1 Build an LLM | – |
| 2 | 2 ViT · 3 VLM | Transformer |
| 3 | 4 Diffusion | Build an LLM, ViT |
| 4 | 5 Mamba · 6 MoE | VLM, Diffusion |
| 5 | 7 BEV · 8 VLA | Mamba, MoE |
| 6 | 9 Robot FM · E cookbook (review) · T2 Build an agent (optional) | BEV, VLA, and the Transformer again |
About this project
These guides are written with AI and reviewed by me, Hokwang Choi, as I study the models myself. Worked numbers come from the scripts in each module, and every guide links the papers it follows. They can still be wrong.