From learning signals to inference at scale
Follow one model from a learning objective to a measured service. This route connects the science of learning with the engineering that makes a trained artifact useful. Each stage ends with evidence you can inspect; a successful command is only one part of that evidence.
Choose a depth
Section titled “Choose a depth”For the high-level explanation, read how models learn, architecture and performance, and runtime controls. For hands-on work, continue through the stages below, using CPU examples first and supported GPU runtimes when available. The model-building route in the worked LLM system supplies implementation depth.
The route and the evidence
Section titled “The route and the evidence”| Stage | Read and work | Evidence to produce |
|---|---|---|
| Understand learning | Signals and the update loop, learning foundations | Explain the target, loss, trainable parameters, and held-out task metric |
| Choose/build the architecture | Foundation-model families, decoder block | Tiny forward-pass checks; parameter, compute, and state counts |
| Train locally | Frameworks, training-step comparison, TinyStories | Correct target shift/masks; parameter changes; train and validation curves |
| Fit and scale training | Precision/accumulation, parallel layouts, recovery | Matched global-batch checks, peak memory, useful tokens/sec, interrupted-run recovery |
| Adapt with the available signal | SFT, DPO, SFT recipes, preference variants, method scoping | Frozen comparison with the base model and task-specific regressions |
| Learn from actions when justified | Policy/data distinctions, PPO and GAE, reward design, GRPO | Behavior probabilities, valid advantages, independent success, reference and old/current KL |
| Scale rollout learning | Actor/learner systems and GRPO variants | Revision/lag accounting, reward audit, accepted fresh tokens and improvement per GPU-hour |
| Compress if needed | KL distillation, distillation data/deployment, quantization | Student/base/teacher task comparison; export and precision regression checks |
| Serve and validate locally | Local vLLM, SGLang, llama.cpp, and in-process lab, model loading | Artifact identity, template/token equivalence, API/stream tests, held-out service quality |
| Optimize execution | Architecture constraints, control mechanisms and flags, batch invariance | Fixed-workload ablations, numerical/replay criteria, measured memory and latency |
| Deploy at scale | Serving layouts, capacity and load, GPU deployment | Open-loop goodput curve, startup and failure capacity, bounded admission, recovery behavior |
| Operate and revisit | Performance gates, evaluation, observability | Versioned reports, workload drift checks, regressions, and cost per successful task |
This is a branching route. SFT, preference learning, reward optimization, and distillation can solve different problems; running them all in sequence is not a requirement. Architecture, data rights, privacy, and evaluation constraints apply throughout. Data Engineering covers corpus construction and provenance; the responsible-deployment chapters in this book cover release obligations.
A reusable experiment record
Section titled “A reusable experiment record”Question and expected mechanism:Baseline and candidate revisions:Data/workload and split hashes:Learning objective or serving control changed:Hardware, runtime versions, resolved configuration:Correctness, numerical, quality, latency, and cost criteria:Observed results, failures, uncertainty, and raw records:Conclusion under these assumptions; untested conditions:How the material is verified
Section titled “How the material is verified”The source register records checked primary papers and runtime documentation. Executable learning checks recompute the worked arithmetic, while the local and distributed labs specify experiments to run on the actual stack. Source verification, arithmetic verification, a trained model’s behavior, and a GPU benchmark are distinct forms of evidence; each supports only its own claims.