Skip to content
ImagineWorld

LLM Systems Engineering

node_idnode-book_llm-systems-engineering
node_typenode-book
schema_profileworld.node_book.v1
statusactive
orthogonal_scopemanifold, entropy, authority, state
manifoldworld
entropymedium
authorityinforms
stateexternal
domainimagineworld.net
node_interiorrosetta_contract
unisonone evidence claim read five ways: seated in the systems field, the work treats LLM systems engineering — the infrastructure, serving, and lifecycle of model systems — its framework, regime, and stance agreeing on what it is
governed_byWORLD-MANIFOLD
constitutional_citationCONSTITUTION
evidence_bundleworld-bundle-publication
compared_byworld-comparison-pillar-f-compiler-trinity-and-training-infrastructure
grounded_by
anchors_into
peer_node_books
pillar_membershipF — training_infrastructure
book_titleLLM Systems Engineering
book_subtitleTraining and Building Large Language Models
book_authorRob McKinsey
book_publisherAshford Partners
book_year2026
book_editionFirst Edition
total_chapters42
total_source_pages315
total_nodes43
source_pdfllm-systems-engineering_author_rob-mckinsey.pdf
source_pdf_sha2566c10e8a7057f607bf2748ca719dd8f8baa0b2b07985332964b5e9755e41ac544
source_text_output_slugllm-systems-engineering
ocr_sourceQwen3-VL-8B-Instruct via llama-server (scaffold-ocr-batch-v2; pdftoppm 150dpi grayscale)
ocr_quality_classcleaned
verification_statusverified_1to1
verification_progress{"all_nodes":"stitched from OCR output; frontier verification status per node"}
stitched_bykimi-k3-frontier-transposition-pass
generated_at2026-09-20
pillar_normalizedF-training_infrastructure
updated_at2026-10-14T05:45:17Z
verification_note2026-10-07 cleanup (agent-01, S51): all 313 scanned PDF pages read 1:1 against the scans (PDF 299-300 are the spec skips); 2 comment loops removed and the text they erased restored from the scans (PDF 157, 312); dropped page top restored (PDF 034) and dropped Contents lines restored (PDF 005-007); module code listings rebuilt from the scans (Modules 29, 35, 38); headings set from the Contents (## sections, ### sub-heads); 65 printed figures (1-1 to 8-4) carried: 59 converted to Mermaid, text diagram or table, 6 as tight PNG crops with written justifications; 3-11 lies in the 140-141 scan gap; scan gaps recorded: Preface (printed 1-7), printed 140-141, 302-303, Epilogue body and References. Page delimiters retained pending RL. Details and flags in CLEANUP_NOTES.md.; page markers removed 2026-10-07 at RL request (MISSING-SOURCE notes kept)
cleanup_notesCLEANUP_NOTES.md
asset_count6
local graph

Training and Building Large Language Models — Ashford Partners, 2026 (First Edition).

The book is organized as 42 modules under 8 parts (Chapter I–VIII dividers folded into the first module of each part), preceded by a Preface and closing with an Epilogue; there is no index. Known scan gaps, documented in the stitch spec: printed 302–303 (Module 41 opening) are missing from the scan, so module-41 begins mid-module; the Epilogue is a one-page stub and the References section is absent.

node-book_llm-systems-engineering_module-01-what-is-a-large-language-model — Module 1 — What Is a Large Language Model?

node-book_llm-systems-engineering_module-02-how-words-become-numbers — Module 2 — How Words Become Numbers

node-book_llm-systems-engineering_module-03-embeddings-and-vector-spaces — Module 3 — Embeddings and Vector Spaces

node-book_llm-systems-engineering_module-04-the-transformer-architecture — Module 4 — The Transformer Architecture

node-book_llm-systems-engineering_module-05-how-models-learn-patterns-in-language — Module 5 — How Models Learn Patterns in Language

node-book_llm-systems-engineering_module-06-inference — Module 6 — Inference

node-book_llm-systems-engineering_module-07-why-build-an-llm — Module 7 — Why Build an LLM?

node-book_llm-systems-engineering_module-08-domains-of-application — Module 8 — Domains of Application

node-book_llm-systems-engineering_module-09-when-to-use-an-existing-model — Module 9 — When to Use an Existing Model

node-book_llm-systems-engineering_module-10-the-three-paths-overview — Module 10 — The Three Paths Overview

node-book_llm-systems-engineering_module-11-cost-time-and-risk — Module 11 — Cost, Time, and Risk

node-book_llm-systems-engineering_module-12-hardware-and-infrastructure — Module 12 — Hardware and Infrastructure

node-book_llm-systems-engineering_module-13-the-role-of-data-in-llm-performance — Module 13 — The Role of Data in LLM Performance

node-book_llm-systems-engineering_module-14-choosing-training-data — Module 14 — Choosing Training Data

node-book_llm-systems-engineering_module-15-where-training-data-comes-from — Module 15 — Where Training Data Comes From

node-book_llm-systems-engineering_module-16-what-high-quality-training-data-looks-like — Module 16 — What High-Quality Training Data Looks Like

node-book_llm-systems-engineering_module-17-data-cleaning-filtering-and-deduplication — Module 17 — Data Cleaning, Filtering, and Deduplication

node-book_llm-systems-engineering_module-18-how-much-data-do-you-need — Module 18 — How Much Data Do You Need?

node-book_llm-systems-engineering_module-19-special-tokens-and-sequence-formatting — Module 19 — Special Tokens and Sequence Formatting

node-book_llm-systems-engineering_module-20-designing-the-model — Module 20 — Designing the Model

node-book_llm-systems-engineering_module-21-how-weight-matrices-are-learned-during-training — Module 21 — How Weight Matrices Are Learned During Training

node-book_llm-systems-engineering_module-22-batch-size-and-core-training-hyperparameters — Module 22 — Batch Size and Core Training Hyperparameters

node-book_llm-systems-engineering_module-23-training-stability — Module 23 — Training Stability

node-book_llm-systems-engineering_module-24-how-long-to-train — Module 24 — How Long to Train

node-book_llm-systems-engineering_module-25-training-checkpoints — Module 25 — Training Checkpoints

node-book_llm-systems-engineering_module-26-fine-tuning-in-depth — Module 26 — Fine-Tuning in Depth

node-book_llm-systems-engineering_module-27-preparing-fine-tuning-datasets — Module 27 — Preparing Fine-Tuning Datasets

node-book_llm-systems-engineering_module-28-supervised-fine-tuning-and-parameter-efficient-methods — Module 28 — Supervised Fine-Tuning and Parameter-Efficient Methods

node-book_llm-systems-engineering_module-29-hands-on-fine-tuning-with-python-and-unsloth — Module 29 — Hands-On Fine-Tuning with Python and Unsloth

node-book_llm-systems-engineering_module-30-alignment-and-behavior-shaping-after-fine-tuning — Module 30 — Alignment and Behavior Shaping After Fine-Tuning

node-book_llm-systems-engineering_module-31-continued-pretraining-in-depth — Module 31 — Continued Pretraining in Depth

node-book_llm-systems-engineering_module-32-selecting-domain-corpora-for-continued-pretraining — Module 32 — Selecting Domain Corpora for Continued Pretraining

node-book_llm-systems-engineering_module-33-updating-model-knowledge-without-starting-over — Module 33 — Updating Model Knowledge Without Starting Over

node-book_llm-systems-engineering_module-34-risks-of-domain-drift-and-over-specialization — Module 34 — Risks of Domain Drift and Over-Specialization

node-book_llm-systems-engineering_module-35-running-continued-pretraining-with-python-and-unsloth — Module 35 — Running Continued Pretraining with Python and Unsloth

node-book_llm-systems-engineering_module-36-training-from-scratch-in-depth — Module 36 — Training from Scratch in Depth

node-book_llm-systems-engineering_module-37-building-the-full-pipeline-with-engineering-tools — Module 37 — Building the Full Pipeline with Engineering Tools

node-book_llm-systems-engineering_module-38-end-to-end-workflow-from-scratch — Module 38 — End-to-End Workflow from Scratch

node-book_llm-systems-engineering_module-39-translating-scaling-laws-and-training-economics — Module 39 — Translating Scaling Laws and Training Economics

node-book_llm-systems-engineering_module-40-common-failure-points-when-building-a-model-from-scratch — Module 40 — Common Failure Points When Building a Model from Scratch

node-book_llm-systems-engineering_module-41-evaluating-llms — Module 41 — Evaluating LLMs

node-book_llm-systems-engineering_module-42-monitoring-and-maintenance — Module 42 — Monitoring and Maintenance

node-book_llm-systems-engineering_back-epilogue — Epilogue

Training and Building Large Language Models

LLM Systems Engineering

Rob McKinsey · Ashford Partners

LLM System Engineering
Written by Rob McKinsey

Copyright © 2026 Ashford Partners. All rights reserved.

Published by Ashford Partners

First Edition
ISBN 978-3-9526632-4-0
Copyeditor: Jeremy Springs

No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law.

This publication is intended for educational and informational purposes. Although every effort has been made to ensure the accuracy of the information contained herein, the publisher and author assume no responsibility for errors, omissions, or any consequences arising from the use of the material.

For more information, contact our customer service department:
[email protected]

PREFACE — 1

  • About the Book — 2
    • Author Perspective — 2
    • Guiding Principles — 3
    • Coding LLMs — 4
    • How to Read This Book — 4

INTRODUCTION TO LARGE LANGUAGE MODELS — 9

  • Module 01: What Is a Large Language Model? — 10
    • Defining the Term — 10
    • What LLMs Do — 12
    • What LLMs Are Not — 13
    • The Components That Make Up an LLM System — 14
  • Module 02: How Words Become Numbers — 16
    • Why Models Cannot Work with Raw Text — 16
    • What a Token Is — 17
    • Tokenizer Vocabularies and Token IDs — 19
    • How Tokenization Affects Model Behavior — 20
  • Module 03: Embeddings and Vector Spaces — 22
    • The Embedding Lookup — 22
    • What Vector Spaces Represent and Why They Work — 24
    • Dimensions of an Embedding Space — 25
    • Why Context Changes Meaning — 26
  • Module 04: The Transformer Architecture — 29
    • The Attention Mechanism — 29
    • Multi-Head Attention — 31
    • Feed-Forward Layers and Layer Normalization — 32
    • How Information Flows Through the Full Stack — 33
  • Module 05: How Models Learn Patterns in Language — 37
    • Next-Token Prediction — 37

    • Loss Functions — 39

    • How the Objective Shapes What the Model Learns — 41

    • Variations on the Pretraining Objective — 42

  • Module 06: Inference — 45
    • The Forward Pass — 45
    • Decoding Strategies — 46
    • Temperature and Controlling Output Behavior — 48
    • The Autoregressive Loop — 50

STRATEGIC AND TECHNICAL PLANNING — 53

  • Module 07: Why Build an LLM? — 54
    • Business Motivations — 54
    • Technical Motivations — 56
    • Research Motivations — 58
    • Stress-Testing the Rationale — 59
  • Module 08: Domains of Application — 61
    • Domains Where LLMs Create Reliable Value — 61
    • Domains Where LLMs Underperform or Introduce Risk — 63
    • Evaluating Domain Fit — 63
  • Module 09: When to Use an Existing Model — 66
    • What Existing Models Can Do — 66
    • Adaptation Without Building — 68
    • Decision Criteria — 70
  • Module 10: The Three Paths Overview — 73
    • Fine-Tuning — 73
    • Continued Pretraining — 75
    • Training from Scratch — 76
    • Choosing a Path — 77
  • Module 11: Cost, Time, and Risk — 80
    • How Costs Differ Across the Three Pathways — 80
    • Time Horizons — 82
    • Categories of Risk Across the Three Pathways — 83
    • Building a Realistic Resource Plan — 84
  • Module 12: Hardware and Infrastructure — 87
    • GPUs and Accelerators — 87

    • Memory Constraints — 89

    • Storage and the Infrastructure Stack — 92

    • Matching Infrastructure to Pathway — 93

DATA ENGINEERING — 97

  • Module 13: The Role of Data in LLM Performance — 98

    • Why Data Shapes Model Capability More Than Architecture Does — 98
    • How Training Data Determines What a Model Knows and How It Behaves — 100
    • Bias and Unintended Behavior — 102
    • The Compounding Effect of Data Decisions — 103
  • Module 14: Choosing Training Data — 105

    • Books and Long-Form Text — 105
    • Web Data — 107
    • Code — 108
    • Domain Corpora — 109
  • Module 15: Where Training Data Comes From — 112

    • Public Datasets — 112
    • Licensed and Commercial Data — 114
    • Synthetic Data — 115
    • Proprietary Data — 116
  • Module 16: What High-Quality Training Data Looks Like — 119

    • The Dimensions of Data Quality — 119
    • Diversity and Coverage — 121
    • Signal Density — 123
  • Module 17: Data Cleaning, Filtering, and Deduplication — 125

    • Text Normalization and Document-Level Cleaning — 125
    • Heuristic and Classifier-Based Filtering — 127
    • Deduplication — 130
    • The Cleaning Pipeline Design — 131
  • Module 18: How Much Data Do You Need? — 133

    • Why There Is No Universal Answer — 133
    • Scaling Laws — 135
    • Token Coverage — 136
    • Data Requirements Across the Three Pathways — 137
  • Module 19: Special Tokens and Sequence Formatting — 139

    • What Special Tokens Are — 139
    • Formatting for Instruction and Conversational Data — 141
    • Sequence Packing and Padding Strategies — 143
    • Consistency Between Training and Inference Formatting — 144

TRAINING SYSTEMS AND MODEL DEVELOPMENT — 149

  • Module 20: Designing the Model — 150
    • Depth vs. Width — 150
    • Context Length — 152
    • Architecture Variants and Design Decisions — 153
  • Module 21: How Weight Matrices Are Learned During Training — 156
    • How Prediction Error Drives Weight Updates — 156
    • Gradient Descent and the Optimizer’s Role — 157
    • What Happens Inside the Weight Matrices as Training Progresses — 159
    • Numerical Precision and Gradient Stability — 160
  • Module 22: Batch Size and Core Training Hyperparameters — 162
    • Learning Rate — 162
    • Batch Size — 164
    • Weight Initialization — 165
    • Hyperparameter Interaction — 167
  • Module 23: Training Stability — 169
    • Loss Spikes, Divergence, and Collapse — 169
    • Gradient-Level Instability — 171
    • Data-Driven Instability — 172
    • Monitoring and Recovery Strategies — 173
  • Module 24: How Long to Train — 175
    • Undertraining — 175
    • Overtraining and Memorization — 176
    • Compute-Optimal Training — 177
    • Evaluation-Driven Stopping — 177
  • Module 25: Training Checkpoints — 180
    • What a Checkpoint Contains — 180

    • Checkpoint Frequency — 182

    • Using Intermediate Checkpoints — 183

    • Checkpoint Storage and Lifecycle Management at Scale — 184

FINE-TUNING — 187

  • Module 26: Fine-Tuning in Depth — 188
    • What Fine-Tuning Actually Does to a Pretrained Model — 188
    • The Relationship Between Pretraining and Fine-Tuning — 189
    • What Fine-Tuning Changes and What It Does Not — 190
  • Module 27: Preparing Fine-Tuning Datasets — 193
    • How Fine-Tuning Data Differs From Pretraining Data — 193
    • Instruction Data — 194
    • Sourcing and Constructing Fine-Tuning Examples — 196
    • Dataset Size and Coverage — 197
  • Module 28: Supervised Fine-Tuning and Parameter-Efficient Methods — 199
    • The Supervised Fine-Tuning Training Loop — 199
    • Full Fine-Tuning and Selective Layer Updates — 201
    • LoRA and Parameter-Efficient Adaptation — 202
    • Adapter Layers and Prefix Tuning — 203
  • Module 29: Hands-On Fine-Tuning with Python and Unsloth — 205
    • Setting Up the Environment — 205
    • Attaching LoRA Adapters and Configuring Rank — 207
    • Formatting the Dataset and Configuring the Trainer — 208
    • Saving, Merging, and Validating the Fine-Tuned Model — 212
  • Module 30: Alignment and Behavior Shaping After Fine-Tuning — 215
    • What Alignment Means in Practice — 215
    • Reinforcement Learning from Human Feedback — 217
    • Direct Preference Optimization and Alternatives to RLHF — 219
    • Failure Modes in Alignment — 221

CONTINUED PRETRAINING — 225

  • Module 31: Continued Pretraining in Depth — 226

    • What Continued Pretraining Does to a Pretrained Model — 226
    • How Continued Pretraining Differs From Fine-Tuning — 228
    • What Continued Pretraining Is and Is Not Good For — 229
    • Choosing a Base Model for Continued Pretraining — 231
  • Module 32: Selecting Domain Corpora for Continued Pretraining — 234

    • What Makes a Corpus Suitable for Continued Pretraining — 234
    • Matching Corpus Composition to the Target Capability Gap — 236
    • Balancing Domain Data Against General Data — 237
  • Module 33: Updating Model Knowledge Without Starting Over — 240

    • How New Knowledge Enters a Model Through Continued Pretraining — 240
    • Learning Rate Strategy for Knowledge Updates — 241
    • Curriculum and Data Ordering Effects on Knowledge Integration — 242
    • Measuring Whether Knowledge Has Been Updated — 244
  • Module 34: Risks of Domain Drift and Over-Specialization — 246

    • Domain Drift — 246
    • Over-Specialization — 247
    • Detection and Evaluation — 248
  • Module 35: Running Continued Pretraining with Python and Unsloth — 250

    • Setting Up the Environment — 250
    • Preparing and Tokenizing a Domain Corpus for Training — 252
    • Configuring and Launching the Training Run — 253
    • Saving, Merging, and Validating the Updated Model — 256

TRAINING FROM SCRATCH — 261

  • Module 36: Training from Scratch in Depth — 262

    • What Training from Scratch Means — 262
    • What Training from Scratch Can Achieve — 264
    • The True Prerequisites — 266
    • Common Justifications That Do Not Hold Up — 268
  • Module 37: Building the Full Pipeline with Engineering Tools — 270

    • The Components of a Full Training Pipeline — 270
    • Distributed Training Frameworks and Parallelism Strategies — 271
    • Experiment Tracking and Observability Infrastructure — 273
    • Tooling Choices — 275
  • Module 38: End-to-End Workflow from Scratch — 277

    • Building and Validating the Tokenizer — 277
    • Model Initialization and Pre-Training Checks — 279
    • Staged Scaling — 282
    • Transitioning From Base Model to Usable System — 284
  • Module 39: Translating Scaling Laws and Training Economics — 287

    • Translating Scaling Laws Into a Compute Budget — 287
    • The Economics of a From-Scratch Run — 289
  • Module 40: Common Failure Points When Building a Model from Scratch — 291

    • Data Pipeline Failures — 291
    • Architecture and Configuration Mistakes — 293
    • Infrastructure and Distributed Training Failures — 294
    • Organizational and Planning Failures — 296

EVALUATION AND MAINTENANCE — 301

  • Module 41: Evaluating LLMs — 302
    • Why Training Metrics Are Insufficient as Evaluation — 302
    • What a Comprehensive Evaluation Must Cover — 304
    • Designing Evaluation Sets That Reflect Real Use — 306
    • Human Evaluation — 307
  • Module 42: Monitoring and Maintenance — 310
    • Monitoring Deployed LLM Systems — 310
    • Model Maintenance — 312
    • The Operational Discipline of Long-Running LLM Systems — 314

EPILOGUE — 317

  • Looking Forward — 318

REFERENCES — 321