1 Getting Started 2 / 4
  1. In this chapter
  2. What Is a Large Language Model? From Next-Word Prediction to General Assistants
  3. LLM Learning Roadmap
  4. Learning Resources Map
  5. LLM Cheat Sheet
All chapters →

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.

Beginner 20 min read Updated Companion code ↓

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
  1. A map of the wiki: four parts, twelve chapters
  2. How to choose a path
  3. Getting the most out of the wiki
  4. Pair your route with an open course
  5. Four exercises to start from zero
  6. Before you start: a self-check
  7. Quick self-check
  8. Route 0: Weekend crash course (about 10 hours)
  9. Route 1: AI application developer (8 weeks)
  10. Route 2: LLM engineer (14 weeks)
  11. Route 3: LLM researcher (16 weeks)
  12. Phase 1: build a paper map (weeks 1–3)
  13. Phase 2: scaling, architecture and systems (weeks 4–7)
  14. Phase 3: long context, post-training and reasoning (weeks 8–12)
  15. Phase 4: evaluation, risks, reproduction and writing (weeks 13–16)
  16. FAQ

Pick a study route

  1. Route 0about 10 hours

    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 Assistants

    Weekly plan
  2. Route 18 weeks

    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 Assistants

    Weekly plan
  3. Route 214 weeks

    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 shapes

    Weekly plan
  4. Route 316 weeks

    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 Attention

    Weekly plan

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.

PartThe question it answersChapters
Part 1: Understand LLMsWhat 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 LLMsHow 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 applyHow 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 aheadHow 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.

Wiki map: four parts, twelve chapters and four study routes Four columns for the four parts, three chapters each. Every chapter card lists its topics and uses letters to show whether the weekend, application, engineering and research routes read something in it. Part 1 Understand LLMs What it is, what it is made of Part 2 Train LLMs How it gets trained Part 3 Deploy and apply Run it fast, build with it Part 4 Evaluate, secure, look ahead How to judge and protect it 1 Getting Started What an LLM is, and how to learn it W A E R 2 Foundations Language modeling, networks, tokenizers, optimizers W A E 3 Model Architecture Attention, positions, MoE, long context W E R 4 Compute and Systems GPUs, numerics, collective communication E R 5 Pre-training Pipeline, data, scaling laws, parallelism W E R 6 Post-training and Alignment SFT, LoRA, reward models, RL basics, DPO, reasoning RL E R 7 Inference and Serving Decoding, KV cache, quantization, serving W A E 8 Applications Prompts, structured output, RAG, agents A 9 Multimodal How images become tokens, vision-language models E 10 Evaluation Benchmarks, statistics, judges, eval-set design W A E R 11 Safety and Alignment Risks Injection, jailbreaks, hallucination, calibration A R 12 Frontier Test-time compute E R W Weekend A Application E Engineering R Research
The four parts and twelve chapters, and which chapters each of the four routes visits. A letter means the route reads something in that chapter; the weekly tables below say which pages.

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 pathDurationTime per weekYou should already be able to
See the whole picture first, then decide where to goWeekend crash courseAbout 10 hoursOne weekendRead code
Ship an AI application that can be demoed, evaluated and kept within safe limitsApplication path8 weeks6–8 hoursWrite business code
Understand the full chain of training, fine-tuning and servingEngineering path14 weeks8–10 hoursPython and basic deep learning
Read and reproduce papers and form research judgmentsResearch path16 weeks10+ hoursTransformers 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.

ExerciseReadWhat you can check afterwards
1Python and tensor shapesRun Python, read one value by index, and calculate a linear-layer entry
2LLM hardware basicsTell disk, RAM, and device memory apart and count the bytes of a matrix
3Your first inference serviceObserve a successful HTTP response and an invalid request on your machine
4Your first agentTrace 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 (w−1)2(w-1)^2 at w=3w=3 is 2(w−1)=42(w-1)=4, and one step with learning rate 0.10.1 updates ww to 3−0.1×4=2.63 - 0.1 \times 4 = 2.6, one step closer to the minimum at w=1w=1.

How to study

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.

StepReadAfter it you can…
1What Is a Large Language Model?Explain how an answer is generated, and tell pre-training, post-training and decoding apart
2From Language Modeling to Next-Token PredictionWrite down cross-entropy loss and perplexity, and state the power and the limits of predicting the next token
3Attention BasicsSay what Q, K and V each represent, and explain why the scores are divided by √d_k
4The Transformer BlockName what each module in a block does, and compute its parameter count
5The LLM Training PipelineName the six stages from data to launch, with an order-of-magnitude feel for the data at each stage
6KV Cache and Inference PerformanceExplain why autoregressive generation is slow, and why a cache cuts latency yet takes a lot of memory
7LLM Evaluation MethodologyKnow 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.

WeekWhat to studyDeliverable
1What Is a Large Language Model?; From Language Modeling to Next-Token Prediction; Decoding and SamplingA record table of 20 samples of one question at each of three temperatures
2Prompt Engineering: A Systematic Guide; Structured Outputs and Function CallingA prompt specification, 20 test questions and a JSON output with schema validation
3LLM Evaluation Methodology; The Statistics of EvaluationA table of failure types and one prompt A/B comparison with confidence intervals
4Your first inference service; RAG in Practice; the RAG survey explainer; Lost in the MiddleA minimal RAG prototype, document chunking rules and a log of failing samples
5Your 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 memoryA 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
6Prompt Injection and Jailbreaks; Hallucination and Calibration; Memorization and PrivacyA 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
7LLM Inference Serving; KV Cache and Inference Performance; Model QuantizationA callable HTTP API with latency, cost and error-rate records
8Building Evaluation Sets; LLM-as-a-Judge; Production evaluation; narrow down the product scenarioA 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.

WeekWhat to studyDeliverable
1Python and tensor shapes; Neural Network Basics; From Language Modeling to Next-Token Prediction; Information Theory RefresherA hand-written forward and backward pass for a two-layer network, checked against numerical gradients
2Tokenizers and Embeddings; From RNNs to Attention; Attention BasicsA hand-written minimal BPE and single-head attention worked out by hand
3Positional Encoding; The Transformer BlockA minimal block in PyTorch and its parameter count
4Modern LLM Architecture; Efficient Attention; the LLaMA explainerA table comparing the structure of GPT-2 and Llama, and the KV cache that GQA saves
5The LLM Training Pipeline; Optimizers and Training Stability; Pretraining Data EngineeringA training recipe for an imaginary project and deduplication statistics for a small corpus
6Scaling Laws; The Compute and Memory Ledger of TrainingA training budget table: FLOPs, MFU and memory
7LLM hardware basics; GPUs and the Roofline Model; Numerical Precision; GPU kernelsA call on whether a few operators are compute-bound or bandwidth-bound, and a checklist of mixed-precision failures
8Distributed Training; Collective Communication; the ZeRO explainerAn estimate of the memory, parallelism plan and communication time for training a 7B model
9SFT Data: Construction and Quality Control; LoRA Fine-Tuning in Practice; Memorization and Privacy50 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
10Reward Models; Reinforcement Learning Basics: Policy Gradients, Advantages and PPO; Preference Optimization: From RLHF to DPOA one-page comparison of the data, pipeline and risks of RLHF and DPO, plus a numerical check of the policy gradient formula
11KV Cache and Inference Performance; Model Quantization; the FlashAttention explainerMeasurements of prefill, decode and time to first token, and quality versus speed before and after quantization
12LLM Inference Serving; Continuous Batching and PagedAttention; Speculative Decoding; Prefix Caching and PD Disaggregation; the vLLM explainerA reachable inference API and a load-test report
13LLM Evaluation Methodology; The Statistics of Evaluation; Building Evaluation SetsA before-and-after evaluation report for the fine-tuned model: evaluation set spec, confidence intervals and failure cases
14Wrap up the project and review; electives: Multimodal LLMs, Test-Time ComputeA 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)

WeekWhat to studyDeliverable
1Set up a uniform paper-card template: problem, method, experiments, limits, follow-up questions; From RNNs to Attention; Attention Is All You NeedA paper-card template and a timeline of sequence models
2BERT; the GPT series; T5Comparison cards for the encoder, decoder and encoder-decoder lines
3LLaMA; the Llama 3 report; Modern LLM ArchitectureA 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)

WeekWhat to studyDeliverable
4Scaling Laws; the scaling laws paper; ChinchillaAn explanation in your own words of how a budget is split between model and data, and where the two papers differ
5Mixture of Experts (MoE); Switch Transformers; Mixtral; DeepSeek-V3A table of dense versus sparse trade-offs
6Efficient Attention; Mamba (state space models); StreamingLLMThe boundaries of where attention and state space models each fit
7GPUs and the Roofline Model; FlashAttention; vLLMNotes analysing bottlenecks in inference systems

Phase 3: long context, post-training and reasoning (weeks 8–12)

WeekWhat to studyDeliverable
8Long Context; Lost in the Middle; YaRNDesign a minimal “information position” experiment
9Reward Models; InstructGPT; Constitutional AIAn alignment pipeline diagram marking the source of each signal
10Reinforcement Learning Basics: Policy Gradients, Advantages and PPO; Preference Optimization: From RLHF to DPO; DPO; PPODerive the DPO loss and write down its relation to RLHF; write down the four cases of PPO’s clipped objective
11Reinforcement Learning for Reasoning; DeepSeekMath (GRPO); DeepSeek-R1; Rollout and learner schedulingThe GRPO advantage of one group of answers worked out by hand, and how it differs from PPO
12Test-Time Compute; Scaling LLM Test-Time Compute Optimally; Chain-of-Thought; World models and planningA small experiment comparing runs with and without intermediate steps and with different sample counts

Phase 4: evaluation, risks, reproduction and writing (weeks 13–16)

WeekWhat to studyDeliverable
13LLM Evaluation Methodology; The Statistics of Evaluation; Building Evaluation Sets; Benchmark ContaminationAn evaluation checklist and a contamination-risk checklist that says which signals detect contamination and where they are blind
14Hallucination and Calibration; Prompt Injection and Jailbreaks; Memorization and PrivacyOne conclusion you want to test: its hypothesis, controlled variables, metrics and failure criteria
15Design and run a minimal reproductionAn experiment record with run IDs, configurations, example inputs, results, anomalies, and the next hypothesis
16Trace how a method evolves across several papersA focused survey or a reproduction report
The core habit of the research path

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.