Chapter 1 · Getting Started 1.2
LLM Learning Roadmap: A Map of the Wiki and Four Study Paths
See how the wiki's four parts and twelve chapters fit together, then pick a path by goal: a 10-hour weekend crash course, an 8-week application path, a 14-week engineering path or a 16-week research path, each with weekly reading, exercises and deliverables.
After this page you will be able to
- Name the question each of the wiki's four parts and twelve chapters answers, and find the chapter where you should start.
- Pick one of the four routes (weekend crash course, AI application developer, LLM engineer, LLM researcher) that fits your goal.
- Use the basics self-check to see which prerequisites you still lack.
- Run four beginner exercises and choose an appropriate next chapter.
- Know what to read, practice and produce in each week of a route, and adjust the order yourself using each page's prerequisites and objectives.
On this page
- A map of the wiki: four parts, twelve chapters
- How to choose a path
- Getting the most out of the wiki
- Pair your route with an open course
- Four exercises to start from zero
- Before you start: a self-check
- Quick self-check
- Route 0: Weekend crash course (about 10 hours)
- Route 1: AI application developer (8 weeks)
- Route 2: LLM engineer (14 weeks)
- Route 3: LLM researcher (16 weeks)
- Phase 1: build a paper map (weeks 1–3)
- Phase 2: scaling, architecture and systems (weeks 4–7)
- Phase 3: long context, post-training and reasoning (weeks 8–12)
- Phase 4: evaluation, risks, reproduction and writing (weeks 13–16)
- FAQ
Pick a study route
Route 0
Weekend crash course
Build an overall picture of LLMs in one weekend, know what each stage does, and then decide which route to take
7 pages
Start hereWhat Is a Large Language Model? From Next-Word Prediction to General AssistantsRoute finished
Route 1
AI application developer
Connect prompting, structured output, retrieval-augmented generation, tool calling, evaluation and security into one deliverable application loop
23 pages
Start hereWhat Is a Large Language Model? From Next-Word Prediction to General AssistantsRoute finished
Route 2
LLM engineer
Understand the full chain from data and pre-training through fine-tuning to serving, estimate the compute and memory of a training run, complete a small fine-tuning run, and deploy an inference endpoint you can load-test
39 pages
Start herePython and tensor shapesRoute finished
Route 3
LLM researcher
Build a map of the literature, learn to pose verifiable questions and design minimal experiments, and write the results up as conclusions others can repeat
21 pages
Start hereFrom RNNs to AttentionRoute finished
A map of the wiki: four parts, twelve chapters
The wiki splits LLMs into four parts and twelve chapters that follow one thread: first understand the model itself, then see how it is trained, then how it is put to use, and finally how to measure it, secure it and judge where it is heading. Chapter numbers match the sidebar, and the pages inside a chapter are ordered by their prerequisites.
| Part | The question it answers | Chapters |
|---|---|---|
| Part 1: Understand LLMs | What is an LLM, what is it made of, and why is each part designed the way it is? | 1 Getting Started, 2 Foundations, 3 Model Architecture |
| Part 2: Train LLMs | How do you train a model on a finite budget of compute and data, then teach it to follow instructions and reason? | 4 Compute and Systems, 5 Pre-training, 6 Post-training and Alignment |
| Part 3: Deploy and apply | How do you run a model fast and cheaply, and turn it into a reliable application? | 7 Inference and Serving, 8 Applications, 9 Multimodal |
| Part 4: Evaluate, secure, look ahead | How do you know whether a model is good and safe, and where is the technology heading? | 10 Evaluation, 11 Safety and Alignment Risks, 12 Frontier |
The figure below lays the twelve chapters side by side and marks with letters which chapters each of the four routes passes through. They share one map; what differs is which chapters they visit and how deeply.
How to choose a path
Start with one question: what do you want to be able to build a few months from now?
| If you want to… | Pick this path | Duration | Time per week | You should already be able to |
|---|---|---|---|---|
| See the whole picture first, then decide where to go | Weekend crash course | About 10 hours | One weekend | Read code |
| Ship an AI application that can be demoed, evaluated and kept within safe limits | Application path | 8 weeks | 6–8 hours | Write business code |
| Understand the full chain of training, fine-tuning and serving | Engineering path | 14 weeks | 8–10 hours | Python and basic deep learning |
| Read and reproduce papers and form research judgments | Research path | 16 weeks | 10+ hours | Transformers and the training pipeline |
All four paths share the same starting point: read What Is a Large Language Model? first. The routes are suggested orders, not gates: each page’s Prerequisites list says what to know before it, and its “After this page you will be able to” box is the acceptance test for finishing it, so you can skip ahead or fill gaps accordingly.
Getting the most out of the wiki
- Top of each page: “After this page you will be able to” is a checklist to test yourself against, and Prerequisites lists the pages to know first.
- Chapter pages: “Chapter roadmap” orders the pages by prerequisites and gives an estimated reading time for each; “Read first” and “Continue with” connect chapters to one another.
- Bottom of each page: the quick self-check and exercises with worked answers test whether you really understood; “Continue with” points to the next step; “Terms on this page” links to definitions in the glossary.
- Mark as read: progress is stored only in your own browser, and the sidebar, chapter pages and the home page outline show check marks and counts.
- Companion code: most pages come with an experiment that runs on a laptop CPU; see Companion code.
- Outside resources: to pair the wiki with a course, a book or a from-scratch codebase, see Learning Resources Map.
- Search: the search box in the header finds pages by concept name.
Pair your route with an open course
- Weekend crash course. Pick one CS25 lecture and use the wiki to explain how the inputs become the outputs.
- AI application developer. Use Berkeley’s advanced agents course for memory and planning, then use CMU’s production ML book to add final-state grading, monitoring, and rollback to the same application.
- LLM engineer. Build the basics with CS336 assignments and profile a system with CMU ML Systems or Berkeley Scalable AI. Report compute budget, quality, and throughput together.
- LLM researcher. Take a question from a CS25 seminar and adapt the CS324 evaluation project to build a baseline, inspect slices, and analyze errors.
The course and assignment guide links to the courses and lists what to produce at each stage.
Four exercises to start from zero
Start here if tensor shapes, GPUs, or HTTP interfaces are new to you. Do one exercise at a time. Reproduce the result, then change one input. Each exercise runs on a CPU. The third uses only a local port.
| Exercise | Read | What you can check afterwards |
|---|---|---|
| 1 | Python and tensor shapes | Run Python, read one value by index, and calculate a linear-layer entry |
| 2 | LLM hardware basics | Tell disk, RAM, and device memory apart and count the bytes of a matrix |
| 3 | Your first inference service | Observe a successful HTTP response and an invalid request on your machine |
| 4 | Your first agent | Trace the task, tool result, and stopping condition in a bounded tool loop |
Then choose a direction. For models, read neural network basics and attention. For machine performance, read the GPU roofline and GPU kernels. For applications, follow structured output with agent tool calling and agent evaluation. For infrastructure, measure latency in inference serving and then study continuous batching.
Before you start: a self-check
If you answer “not sure” to any of the following, fill the gap before starting a path:
- I can read a piece of PyTorch or NumPy code and follow how tensor shapes change.
- I know what a matrix multiplication and a dot product do.
- I know softmax turns a set of scores into probabilities, and cross-entropy measures the gap between a prediction and the true label.
- I know how gradient descent updates parameters.
Try six short questions. Where you get one wrong, fill in the matching concept before starting a path.
Quick self-check
1. Matrix A has shape (4, 8) and matrix B has shape (8, 3). What shape does A times B have?
- (8, 8)
- (4, 8)
- (4, 3)
- The shapes do not match, so they cannot be multiplied
The number of columns of the first matrix must equal the number of rows of the second (both 8); the result takes the rows of the first and the columns of the second, which is (4, 3).
2. What is the dot product of the vectors [1, 2, 3] and [4, 5, 6]?
- 15
- 21
- 32
- 36
Multiply matching positions and add up: 1×4+2×5+3×6=4+10+18=32. The score between a query and a key in attention is exactly such a dot product.
3. What is the result of softmax on the scores [0, 0, 0, 0]?
- [0, 0, 0, 0]
- [0.25, 0.25, 0.25, 0.25]
- [1, 0, 0, 0]
- [1, 1, 1, 1]
Softmax exponentiates and divides by the sum; when all scores are equal every entry is 1/4. It turns any set of scores into probabilities that sum to 1.
4. The model gives the true label probability 0.5. About what is the cross-entropy loss of this step (natural logarithm)?
- 0.50
- 0.69
- 1.00
- 2.00
Cross-entropy is the negative logarithm of the probability of the true label: −ln 0.5=ln 2≈0.69. At probability 1 the loss is 0, and the lower the probability the larger the loss.
5. How does gradient descent update the parameters?
- A small step along the gradient, which makes the loss larger
- A small step against the gradient, with the step size controlled by the learning rate
- It resets all parameters to random values
- It updates only the parameters whose gradient is 0
The update rule is new parameter = old parameter − learning rate × gradient. The gradient points in the direction in which the loss rises fastest, so you step the other way.
6. A tensor has shape (2, 5, 16), read as batch 2, 5 tokens per sequence and 16 dimensions per token. What happens if you apply softmax over the last dimension?
- The shape becomes (2, 5)
- The shape is unchanged, and every row along the last dimension sums to 1
- The shape is unchanged, and all elements of the whole tensor sum to 1
- The shape becomes (2, 16)
Softmax does not change the shape; it normalizes each group of scores along the chosen dimension. The attention weights are softmax applied over the dimension that holds the keys.
Exercise: Verify each of the answers above with PyTorch, then change the inputs and see how the results change.
Reference answer
import math
import torch
a = torch.tensor([1.0, 2.0, 3.0])
b = torch.tensor([4.0, 5.0, 6.0])
x = torch.randn(2, 5, 16)
sums = torch.softmax(x, dim=-1).sum(dim=-1)
print((torch.randn(4, 8) @ torch.randn(8, 3)).shape) # torch.Size([4, 3])
print(torch.dot(a, b).item()) # 32.0
print(torch.softmax(torch.zeros(4), dim=0)) # four times 0.2500
print(round(-math.log(0.5), 4)) # 0.6931
print(torch.allclose(sums, torch.ones(2, 5))) # True
w = torch.tensor(3.0, requires_grad=True)
loss = (w - 1) ** 2
loss.backward()
print(w.grad.item()) # 4.0: positive, so w should shrink
print(round((w - 0.1 * w.grad).item(), 3)) # 2.6: one step, learning rate 0.1
The last part demonstrates gradient descent: the gradient of the loss at is , and one step with learning rate updates to , one step closer to the minimum at .
Keep three fixed actions every week: read (this week’s pages and papers), do (work through the math by hand or run the code), and write (a page of notes in your own words). If you only read and never do, you will remember nothing a few weeks later.
Route 0: Weekend crash course (about 10 hours)
Goal: build an overall picture of LLMs in one weekend, know what each stage does, and then decide which route to take. Budget one to one and a half hours per page, self-check included, so seven pages come to about 10 hours.
| Step | Read | After it you can… |
|---|---|---|
| 1 | What Is a Large Language Model? | Explain how an answer is generated, and tell pre-training, post-training and decoding apart |
| 2 | From Language Modeling to Next-Token Prediction | Write down cross-entropy loss and perplexity, and state the power and the limits of predicting the next token |
| 3 | Attention Basics | Say what Q, K and V each represent, and explain why the scores are divided by √d_k |
| 4 | The Transformer Block | Name what each module in a block does, and compute its parameter count |
| 5 | The LLM Training Pipeline | Name the six stages from data to launch, with an order-of-magnitude feel for the data at each stage |
| 6 | KV Cache and Inference Performance | Explain why autoregressive generation is slow, and why a cache cuts latency yet takes a lot of memory |
| 7 | LLM Evaluation Methodology | Know what to ask when you see a leaderboard score: what it measures, how it is verified, whether it is contaminated |
When you finish, go back to “How to choose a path” above and pick a route to continue.
Route 1: AI application developer (8 weeks)
Goal: connect prompting, structured output, retrieval-augmented generation, tool calling, evaluation and security into one deliverable application loop. You do not train models, but you need to build the habit of “measurable, iterable and safe within limits” as early as possible.
| Week | What to study | Deliverable |
|---|---|---|
| 1 | What Is a Large Language Model?; From Language Modeling to Next-Token Prediction; Decoding and Sampling | A record table of 20 samples of one question at each of three temperatures |
| 2 | Prompt Engineering: A Systematic Guide; Structured Outputs and Function Calling | A prompt specification, 20 test questions and a JSON output with schema validation |
| 3 | LLM Evaluation Methodology; The Statistics of Evaluation | A table of failure types and one prompt A/B comparison with confidence intervals |
| 4 | Your first inference service; RAG in Practice; the RAG survey explainer; Lost in the Middle | A minimal RAG prototype, document chunking rules and a log of failing samples |
| 5 | Your first agent; Agents and Tool Calling in Practice; Agent Evaluation: Grading the System, Not the Model; MCP and the Tool Ecosystem; the ReAct explainer; Agent context and memory | A minimal agent with two or three tools, a measurement of how many tokens all the tool definitions take, and a pass^4 record on one task |
| 6 | Prompt Injection and Jailbreaks; Hallucination and Calibration; Memorization and Privacy | A one-page threat model, 20 injection tests, a “refuse or cite” rule and a rule for which data must never enter a fine-tuning set |
| 7 | LLM Inference Serving; KV Cache and Inference Performance; Model Quantization | A callable HTTP API with latency, cost and error-rate records |
| 8 | Building Evaluation Sets; LLM-as-a-Judge; Production evaluation; narrow down the product scenario | A regression set of frequent tasks, a one-page product definition and a demoable prototype |
Week 8 forces you to narrow the scenario. Many demos can answer a little of everything and yet not one scenario is reliable. Decide on the target user, state what you will not do, define the success metrics, and freeze the 20 most important high-frequency tasks.
A note on gaps: the RAG in week 4 uses the idea of embeddings (Tokenizers and Embeddings), and the jailbreaks in week 6 relate to how models learn to refuse (Preference Optimization: From RLHF to DPO); if your footing is shaky, read those two pages first. When you need the model to pick up a specific style or domain knowledge, read LoRA Fine-Tuning in Practice.
Route 2: LLM engineer (14 weeks)
Goal: understand the full chain from data and pre-training through fine-tuning to serving, estimate the compute and memory of a training run, complete a small fine-tuning run, and deploy an inference endpoint you can load-test.
| Week | What to study | Deliverable |
|---|---|---|
| 1 | Python and tensor shapes; Neural Network Basics; From Language Modeling to Next-Token Prediction; Information Theory Refresher | A hand-written forward and backward pass for a two-layer network, checked against numerical gradients |
| 2 | Tokenizers and Embeddings; From RNNs to Attention; Attention Basics | A hand-written minimal BPE and single-head attention worked out by hand |
| 3 | Positional Encoding; The Transformer Block | A minimal block in PyTorch and its parameter count |
| 4 | Modern LLM Architecture; Efficient Attention; the LLaMA explainer | A table comparing the structure of GPT-2 and Llama, and the KV cache that GQA saves |
| 5 | The LLM Training Pipeline; Optimizers and Training Stability; Pretraining Data Engineering | A training recipe for an imaginary project and deduplication statistics for a small corpus |
| 6 | Scaling Laws; The Compute and Memory Ledger of Training | A training budget table: FLOPs, MFU and memory |
| 7 | LLM hardware basics; GPUs and the Roofline Model; Numerical Precision; GPU kernels | A call on whether a few operators are compute-bound or bandwidth-bound, and a checklist of mixed-precision failures |
| 8 | Distributed Training; Collective Communication; the ZeRO explainer | An estimate of the memory, parallelism plan and communication time for training a 7B model |
| 9 | SFT Data: Construction and Quality Control; LoRA Fine-Tuning in Practice; Memorization and Privacy | 50 high-quality instruction examples, an annotation guideline, one LoRA run, and a batch of canaries planted in the fine-tuning set to measure how much the model memorized |
| 10 | Reward Models; Reinforcement Learning Basics: Policy Gradients, Advantages and PPO; Preference Optimization: From RLHF to DPO | A one-page comparison of the data, pipeline and risks of RLHF and DPO, plus a numerical check of the policy gradient formula |
| 11 | KV Cache and Inference Performance; Model Quantization; the FlashAttention explainer | Measurements of prefill, decode and time to first token, and quality versus speed before and after quantization |
| 12 | LLM Inference Serving; Continuous Batching and PagedAttention; Speculative Decoding; Prefix Caching and PD Disaggregation; the vLLM explainer | A reachable inference API and a load-test report |
| 13 | LLM Evaluation Methodology; The Statistics of Evaluation; Building Evaluation Sets | A before-and-after evaluation report for the fine-tuned model: evaluation set spec, confidence intervals and failure cases |
| 14 | Wrap up the project and review; electives: Multimodal LLMs, Test-Time Compute | A demoable project, a README and a retrospective |
The goal of this path is not to “know everything” after 14 weeks. It is to build an extensible engineering skeleton: when a new model, framework or optimization appears, you know which step of the pipeline it belongs to.
Route 3: LLM researcher (16 weeks)
Goal: build a map of the literature, learn to pose verifiable questions and design minimal experiments, and write the results up as conclusions others can repeat. For each topic, read the wiki overview first and then the matching paper explainers; most explainers carry numbers we checked ourselves or runnable verification code, so change something and run it.
Phase 1: build a paper map (weeks 1–3)
| Week | What to study | Deliverable |
|---|---|---|
| 1 | Set up a uniform paper-card template: problem, method, experiments, limits, follow-up questions; From RNNs to Attention; Attention Is All You Need | A paper-card template and a timeline of sequence models |
| 2 | BERT; the GPT series; T5 | Comparison cards for the encoder, decoder and encoder-decoder lines |
| 3 | LLaMA; the Llama 3 report; Modern LLM Architecture | A timeline of architecture evolution, and the data and training compute of the two Llama generations side by side |
Phase 2: scaling, architecture and systems (weeks 4–7)
| Week | What to study | Deliverable |
|---|---|---|
| 4 | Scaling Laws; the scaling laws paper; Chinchilla | An explanation in your own words of how a budget is split between model and data, and where the two papers differ |
| 5 | Mixture of Experts (MoE); Switch Transformers; Mixtral; DeepSeek-V3 | A table of dense versus sparse trade-offs |
| 6 | Efficient Attention; Mamba (state space models); StreamingLLM | The boundaries of where attention and state space models each fit |
| 7 | GPUs and the Roofline Model; FlashAttention; vLLM | Notes analysing bottlenecks in inference systems |
Phase 3: long context, post-training and reasoning (weeks 8–12)
| Week | What to study | Deliverable |
|---|---|---|
| 8 | Long Context; Lost in the Middle; YaRN | Design a minimal “information position” experiment |
| 9 | Reward Models; InstructGPT; Constitutional AI | An alignment pipeline diagram marking the source of each signal |
| 10 | Reinforcement Learning Basics: Policy Gradients, Advantages and PPO; Preference Optimization: From RLHF to DPO; DPO; PPO | Derive the DPO loss and write down its relation to RLHF; write down the four cases of PPO’s clipped objective |
| 11 | Reinforcement Learning for Reasoning; DeepSeekMath (GRPO); DeepSeek-R1; Rollout and learner scheduling | The GRPO advantage of one group of answers worked out by hand, and how it differs from PPO |
| 12 | Test-Time Compute; Scaling LLM Test-Time Compute Optimally; Chain-of-Thought; World models and planning | A small experiment comparing runs with and without intermediate steps and with different sample counts |
Phase 4: evaluation, risks, reproduction and writing (weeks 13–16)
| Week | What to study | Deliverable |
|---|---|---|
| 13 | LLM Evaluation Methodology; The Statistics of Evaluation; Building Evaluation Sets; Benchmark Contamination | An evaluation checklist and a contamination-risk checklist that says which signals detect contamination and where they are blind |
| 14 | Hallucination and Calibration; Prompt Injection and Jailbreaks; Memorization and Privacy | One conclusion you want to test: its hypothesis, controlled variables, metrics and failure criteria |
| 15 | Design and run a minimal reproduction | An experiment record with run IDs, configurations, example inputs, results, anomalies, and the next hypothesis |
| 16 | Trace how a method evolves across several papers | A focused survey or a reproduction report |
The “capability claims” in papers often have to be verified piece by piece. Window length, retrieval ability and robustness to position are not the same thing, and one clear question moves research further than reading a few more papers.
FAQ
- What should I learn before starting these paths if I am a complete beginner?
- Start with the four exercises on this page. Run Python, read tensor shapes, learn how hardware moves data, send a local HTTP request, and trace an agent loop. Reproduce the outputs before changing inputs. Use the self-check to fill gaps in dot products, softmax, cross-entropy, and gradient descent before studying architecture or training.
- Do I need my own GPU for this material?
- The four starter exercises and companion labs run on a CPU. Application work can later use an existing inference service. Measuring device kernels or training a larger model calls for hardware suited to the workload.
- Can I switch between the paths?
- Yes. The four paths share their first half: understand language modeling, tokens and attention first. The application path gets to prompting, retrieval and evaluation earlier, the engineering path goes deeper into training and serving systems, and the research path puts more weight on reading papers and running comparison experiments. If you are unsure, take the weekend crash course first and choose after its seven pages.
- I only have a weekend. Which pages should I read first?
- Take Route 0, the weekend crash course: What Is a Large Language Model?, language modeling, attention basics, the Transformer block, the training pipeline, the KV cache and evaluation methodology. That is seven pages, about 10 hours at one to one and a half hours per page. The goal is to see the whole picture first and then decide whether to go toward applications, engineering or research.
- There are many pages. Do I have to read them in order?
- No. Pages inside a chapter are ordered by prerequisites, but every page also lists what you should know first and an After this page you will be able to checklist. Skip what you already know and check yourself against the objectives. When a concept is unfamiliar, look it up in the glossary or go back to the prerequisite page. The route tables are a suggested order, not a gate.