Skip to content

A straightforward method for training your LLM, from downloading data to generating text.

docs: add the laptop track, the Modern LLM section and the new pages to the site navigation and home page

FareedKhan-dev7b7f6d4fce4e
diff --git a/docs/README.md b/docs/README.md
index 24b43b6..e6b190b 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -7,11 +7,20 @@ through the whole journey I built on top of the base model, every stage written
in plain PyTorch (no `trl`, no `peft`, no `transformers`), trained on real public datasets, and
runnable on a single GPU or scaled across multiple GPUs with DDP.
-If you are new to LLM training internals, start with the new
+If you are new to LLM training internals, start with the
**[LLM Foundations](foundations/README.md)** section before reading the stage pages. It explains the
token shapes, decoder-only Transformer, attention masks, objectives, optimization loop, and generation
mechanics that every later page relies on.
+Two newer sections sit next to the pipeline:
+
+- **[Laptop Track](student/README.md)**: no GPU needed. Prepare TinyStories, train your own BPE
+ tokenizer and a small model on a CPU in minutes, and generate stories with it.
+- **[Modern LLM](modern/README.md)**: what changed between the 2017 Transformer and today's open
+ models (RoPE, RMSNorm, SwiGLU, grouped-query and latent attention, Mixture of Experts, the KV
+ cache), plus Muon, LoRA, the newer preference losses, the GRPO follow-ups and fast inference.
+ Every stage of the pipeline can train either model.
+
## Recommended reading order
1. **Foundations first**:
@@ -32,6 +41,9 @@ mechanics that every later page relies on.
3. **Finally run and inspect**:
[Evaluation](08_evaluation.md), [Inference / Chat](09_inference.md), and the
[command cheatsheet](howto/commands.md).
+4. **Then go modern**: [the modern model](modern/README.md), [optimizers](modern/optimizers.md),
+ [preference losses](modern/preference.md), [RL for reasoning](modern/rl_reasoning.md),
+ [LoRA](modern/lora.md) and [fast inference](modern/inference.md).
The pipeline mirrors how modern aligned/reasoning models are actually built:
diff --git a/docs/foundations/README.md b/docs/foundations/README.md
index e82d288..b096758 100644
--- a/docs/foundations/README.md
+++ b/docs/foundations/README.md
@@ -63,11 +63,13 @@ syntax, facts, formats, style, and reasoning traces into its weights.
Read in this order:
1. [Tokenization & Data Shapes](tokenization.md) - how text becomes batches.
-2. [Decoder-Only Transformer](transformer.md) - the model skeleton.
-3. [Attention, Masks & Heads](attention.md) - the core operation.
-4. [Objectives, Losses & Perplexity](objectives.md) - what the model is optimized to do.
-5. [Optimization & Training Systems](optimization.md) - how the loop stays stable.
-6. [Generation & Sampling](generation.md) - how logits become text.
+2. [BPE From Scratch](bpe.md) - how a tokenizer is trained.
+3. [Decoder-Only Transformer](transformer.md) - the model skeleton.
+4. [Attention, Masks & Heads](attention.md) - the core operation.
+5. [Objectives, Losses & Perplexity](objectives.md) - what the model is optimized to do.
+6. [Optimization & Training Systems](optimization.md) - how the loop stays stable.
+7. [Generation & Sampling](generation.md) - how logits become text.
+8. [Scaling, FLOPs & Memory](scaling.md) - how big, how long, and will it fit.
Then continue to the pipeline pages:
diff --git a/mkdocs.yml b/mkdocs.yml
index c11f5f2..8fc6b9a 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -1,5 +1,5 @@
site_name: Train LLM From Scratch
-site_description: From pretraining to RLHF/GRPO — every algorithm hand-written in pure PyTorch.
+site_description: From pretraining to RLHF and GRPO, every algorithm hand-written in pure PyTorch, on a GPU or a laptop CPU.
site_url: https://FareedKhan-dev.github.io/train-llm-from-scratch/
repo_url: https://github.com/FareedKhan-dev/train-llm-from-scratch
repo_name: FareedKhan-dev/train-llm-from-scratch
@@ -7,9 +7,10 @@ docs_dir: docs
# Files present under docs/ but intentionally not page nodes in the nav.
not_in_nav: |
/diagrams/README.md
-# Keep the raw mermaid sources out of the built site.
+# Keep the raw mermaid sources and the plotting script out of the built site.
exclude_docs: |
/diagrams/src/
+ /diagrams/*.py
theme:
name: material
@@ -69,14 +70,17 @@ extra_javascript:
nav:
- Home: README.md
+ - Laptop Track: student/README.md
- Foundations:
- Overview: foundations/README.md
- Tokenization & Data Shapes: foundations/tokenization.md
+ - BPE From Scratch: foundations/bpe.md
- Decoder-Only Transformer: foundations/transformer.md
- Attention, Masks & Heads: foundations/attention.md
- Objectives, Losses & Perplexity: foundations/objectives.md
- Optimization & Training Systems: foundations/optimization.md
- Generation & Sampling: foundations/generation.md
+ - Scaling, FLOPs & Memory: foundations/scaling.md
- Theory & Pipeline:
- Data handling: 01_data_pipeline.md
- Pretraining: 02_pretraining.md
@@ -85,9 +89,22 @@ nav:
- DPO / ORPO / KTO: 05_dpo.md
- PPO: 06_ppo.md
- GRPO / RLVR: 07_grpo.md
+ - Modern LLM:
+ - Overview: modern/README.md
+ - RMSNorm, SwiGLU & Init: modern/blocks.md
+ - Rotary Embeddings: modern/rope.md
+ - GQA, MLA & the KV Cache: modern/attention.md
+ - Mixture of Experts: modern/moe.md
+ - AdamW, Muon & Schedules: modern/optimizers.md
+ - DPO, IPO, SimPO, ORPO, KTO: modern/preference.md
+ - GRPO, Dr. GRPO, DAPO, GSPO: modern/rl_reasoning.md
+ - LoRA: modern/lora.md
+ - Fast Inference: modern/inference.md
- How-to:
- Configure (JSON): howto/configs.md
- Train (UI & CLI): howto/train.md
+ - Hardware (CPU, GPU, Mac, TPU): howto/hardware.md
+ - Type Safety: howto/type_safety.md
- The control-panel UI: howto/ui.md
- Evaluate: 08_evaluation.md
- Inference / Chat: 09_inference.md