Skip to content

A.1 Capstone: TinyStories, owned end to end

Every part of the system has passed its own tests by now. None of them has had to work with all the others for hours, on data you did not choose, with numbers nobody gave you in advance. That is where the remaining bugs live: a tokenizer whose vocabulary disagrees with the model config, a checkpoint whose data cursor resumes one window late, an eval that reads the wrong split, a release spec the gateway cannot route. This capstone runs the whole system on one goal, a model that writes small stories, and defends each choice with a measurement. There is no oracle for the result. The report is the evidence, and a correct capstone is one whose evidence agrees with itself and with the runs that produced it.

Concepts from other sections (28)

This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.

Concretely, the system does one real job end to end. Clean data flows through the CorpusBuild workflow, a tokenizer is trained and ablated, a Llama-family model trains as a durable TrainRun with mixed precision and bitwise resume, the result is evaluated against the model zoo, released through the gated ModelRelease workflow with a model card and data ledger, and served by your engine behind your gateway. Nothing new is added to the library here: the system runs, and the write-up records what it measured. Reading the section takes about three hours; reproducing it takes 4 to 12 hours of laptop training for the full configuration, under an hour for the short configuration, and minutes for the smoke tier.

The capstone draws on everything before it. It ships through the model release workflow from Systems Engineering, whose preflight it must pass; its full and short training specs use the bf16 emulation, gradient accumulation, and activation recompute of mixed precision, accumulation, and checkpointing; and its release report carries the safety suite from bias and safety evals in AI Engineering. The sections it leans on most are named where they matter below, above all tokenize and pack and the licensing ledger and datasheet from Data Engineering.

Learning objectives

  • Size a training run from a compute budget with C≈6NDC \approx 6ND and count a Llama config’s parameters and KV bytes by hand.
  • Design an ablation that changes one thing at an equal budget, pair it by document, and read its verdict from a bootstrap confidence interval.
  • Reproduce a log-log least-squares scaling fit and a zoo table from the report’s own numbers.
  • Explain how ADRs, the model card, the ledger, and the release gates turn measurements into a shippable decision.
  • Check a capstone report for internal consistency without rerunning the training.

The capstone uses only verbs the system already has. In the listing below, <system> is the deployed workflow CLI and {tinyllm} the Python CLI:

Terminal window
<system> data build --dataset tinystories --version v1 # CorpusBuild (data.09)
{tinyllm} tok train --algo bpe --vocab 4096 --sample 16MB # and --algo unigram, for the ablation
<system> train --spec specs/c1/tinystories-short.json # TrainRun (dur.11); the full spec when there is a night to spare
<system> train --spec specs/c1/abl-mla.json # one short run per ablation arm, same seed
<system> eval --suite zoo # EvalSuite (dur.11) over every family trained
# write docs/capstone/c1/report.json from the runs' outputs, then the two ADRs
<system> release --spec specs/c1/release.json # ModelRelease (dur.12); then send it the `approve` signal
# through the durable server's SignalWorkflow RPC from a gRPC client (dur.08)

The data step is the CorpusBuild durable workflow; training and evaluation are the TrainRun and EvalSuite workflows; the final approval is a signal of the kind described in signals, cancellation, and sagas.

The inputs are staged by {tinyllm} capstone prepare, implemented in cli_c1_data.py:

Terminal window
# Full and short tiers: use the inputs produced by the corpus pipeline.
{tinyllm} capstone prepare --spec specs/c1/tinystories-short.json --inputs artifacts --out runs/c1-inputs --seed 0
# Smoke tier: the course's synthetic stories file.
{tinyllm} capstone prepare --spec specs/c1/smoke.json --fixture <small reference corpus>/sources/stories.jsonl --holdout 32 --license CC0-1.0 --out runs/c1-smoke-inputs --seed 0

The two tiers prepare differently. The smoke preparation fits BPE on the first 130 documents only, scrubs the fixture’s seeded redaction examples, and keeps the last 32 documents for evaluation; token manifests and separate corpus ledgers record the files, hashes, counts, and license. The full preparation instead checks and copies the completed CorpusBuild and tokenizer outputs under artifacts/ into the run directory, without fitting another tokenizer or changing the split, and a missing input is an error. Both write a run-local train-spec.json with the run’s seed, so a five-seed calibration really trains five independent initializations. The smoke tier then trains the smoke config (about 0.8M parameters, 200 steps), measures held-out bpb, and scores 20 seeded samples. The durable training, release, trace, and serving steps need the full system and its cluster.

Before following the pipeline, fix the notation. Every claim in the report is phrased in terms of these quantities.

SymbolMeaningType
NNtrainable parameters of the modelint
DDtraining tokensint
C≈6NDC \approx 6NDtraining compute in FLOP (2 for the forward pass, 4 for the backward)float
bpb\mathrm{bpb}held-out bits per byte: total NLL in bits over the held-out bytesfloat
u=1,…,nu = 1, \dots, na paired unit: one held-out document
δu=bpbb(u)−bpba(u)\delta_u = \mathrm{bpb}_b(u) - \mathrm{bpb}_a(u)the ablation’s paired difference on document uufloat
δˉ\bar\delta, [ℓ,h][\ell, h]the mean difference and its 95% bootstrap CIfloat
aa, α\alphathe scaling fit bpb=aN−α\mathrm{bpb} = a N^{-\alpha}float

The capstone is a pipeline through parts of the system you built in many different chapters. The table maps each stage to what runs and where you built it.

StageWhat runsWhere it was built
DataCorpusBuild: fetch, filter (with the KN perplexity filter), dedup, decontamination, PII, shards; the tokenizer trained on a fixed 16 MB sample; encode to uint16 .binthe corpus pipeline in Data Engineering, byte-level BPE, the Unigram LM tokenizer, Rust fast BPE, Kneser-Ney n-grams
ModelLlamaConfig(vocab=4096, d=320, layers=8, heads=8, kv_heads=4, d_ff=864, ctx=512, tied)the modern decoder block, from pre-LN and RMSNorm to the Llama-family model; counting params, FLOPs, and KV bytes
TrainAdamW, WSD, clipping, bf16 emulation, accumulation, recompute; TrainRun segments with resumeAdam and AdamW, schedules and clipping, mixed precision, checkpoints and token streams, subprocess activities, TrainRun
Ablationstokenizer, attention, MLP, one short run per armUnigram LM, multi-head latent attention, mixture of experts, hypothesis tests
Evaluateheld-out bpb with a CI, seeded samples, the scaling fit, the zoo tablethe evaluation harness and model zoo, least squares, bits per byte, model evals as tests
Releaseexport, eval gates, model card, ledger, canaryModelRelease, ledger and datasheet
Servethe Rust engine behind the gatewayserving in this book, the gateway in AI Engineering

One config family comes in three sizes, so the same pipeline can be exercised at three costs. Only the first two produce a model result.

TierModelTokensLaptop time (estimate)What it shows
fullabout 10.4M parametersabout 10810^84 to 12 hthe capstone result: beats every zoo baseline
shortabout 2.4Mabout 2×1072 \times 10^7under 1 hthe capstone result at a looser bar
smokeabout 0.8M, 200 stepsabout 4×1054 \times 10^5minutesthat the pipeline runs end to end; not a model result

The rule C=6NDC = 6ND sizes the run before it starts. The full tier is 6×1.04×107×108≈6.2×10156 \times 1.04 \times 10^7 \times 10^8 \approx 6.2 \times 10^{15} FLOP. At an effective 0.2 to 0.4 TFLOP/s for numpy with Accelerate on an M-series laptop, that is 4 to 9 hours. The throughput figure is uncertain, so measure your machine on a short run first.

An ablation changes one thing and holds the budget equal; otherwise the comparison measures the budget rather than the idea. The capstone runs three:

  • Tokenizer: BPE against Unigram at the same vocabulary size on the same sample. Compare in bits per byte, never per token: a tokenizer that splits text into more, easier tokens has a lower per-token loss and is no better a model.
  • Attention: GQA against MLA at equal KV bytes per token. GQA caches L⋅2⋅nkv⋅dhL \cdot 2 \cdot n_{kv} \cdot d_h values per token; MLA caches the latent rr plus the shared rope key drd_r, so L⋅(r+dr)L \cdot (r + d_r). In bf16 each value is 2 bytes.
  • MLP: dense SwiGLU against a mixture of experts at equal active parameters per token (the router plus kk experts, not all EE).

Both arms are measured on the same held-out documents and paired by document, so the per-document difference δu\delta_u removes how hard each document is. The verdict follows the 95% bootstrap CI of δˉ\bar\delta: b wins when h<0h < 0, a wins when ℓ>0\ell > 0, and otherwise it is a tie. A tie is a result, not a failure.

Three sizes of the short family give three points (Ni,bpbi)(N_i, \mathrm{bpb}_i). In log space the power law is a line, log⁡bpb=log⁡a−αlog⁡N\log \mathrm{bpb} = \log a - \alpha \log N, fitted by least squares with the lstsq from SVD, low rank, and least squares. Three points do not prove a law; they say whether the next size is worth training.

The model-zoo suite from the evaluation harness and model zoo, run by EvalSuite, scores every family the system trained on the same held-out text: KN-4, NPLM, LSTM, GPT, and the capstone Llama in bits per byte, plus the seq2seq (EM), classification (accuracy), and word-similarity (Spearman) rows. At the full and short tiers the capstone must beat every baseline.

With the definitions in place, you can size the full config without running anything. Its shape is V=4096V = 4096, d=320d = 320, 8 layers, 8 heads of dh=40d_h = 40, 4 KV heads, SwiGLU width f=864f = 864, and tied embeddings. The parameter count adds up as follows.

PartCount
embedding VdV d (shared with the output)4096⋅320=1,310,7204096 \cdot 320 = 1{,}310{,}720
per layer: WqW_q, WoW_o (d⋅8⋅40d \cdot 8 \cdot 40 each)2⋅102,400=204,8002 \cdot 102{,}400 = 204{,}800
per layer: WkW_k, WvW_v (d⋅4⋅40d \cdot 4 \cdot 40 each)2⋅51,200=102,4002 \cdot 51{,}200 = 102{,}400
per layer: gate, up, down (3df3 d f)3⋅320⋅864=829,4403 \cdot 320 \cdot 864 = 829{,}440
per layer: two RMSNorm gains640640
8 layers8⋅1,137,280=9,098,2408 \cdot 1{,}137{,}280 = 9{,}098{,}240
final norm320320
total10,409,280

The KV cache costs, in bf16, 8⋅2⋅4⋅40⋅2=5,1208 \cdot 2 \cdot 4 \cdot 40 \cdot 2 = 5{,}120 bytes per token. An MLA arm at equal KV bytes therefore needs r+dr=5120/(8⋅2)=320r + d_r = 5120 / (8 \cdot 2) = 320, for example r=288r = 288 and dr=32d_r = 32. The compute is 6⋅10,409,280⋅108≈6.2×10156 \cdot 10{,}409{,}280 \cdot 10^8 \approx 6.2 \times 10^{15} FLOP.

Reading an ablation verdict is just as mechanical. In the reference smoke report (report.json), Unigram minus BPE is δˉ=+0.032\bar\delta = +0.032 bits per byte over 32 documents, with CI (0.014,0.059)(0.014, 0.059). The CI excludes zero and δ=b−a>0\delta = b - a > 0, so a (BPE) wins. MLA minus GQA is −0.011-0.011 with CI (−0.042,0.008)(-0.042, 0.008): the interval includes zero, so it is a tie. The walkthrough below recomputes the same quantities for the reference smoke-tier model and checks them against its report.

A capstone is judged by its artifacts. The reference artifacts are smoke-tier: the specs in specs/c1/ (full, short, smoke, and release), the report and its companions in docs/capstone/c1/, and two ADRs, 0002-c1-vocabulary-size.md and 0003-c1-architecture.md. The CLI glue lives in cli_c1.py, cli_c1_data.py, and cli_c1_eval.py. The formats they follow are the contracts formats/train-spec.schema.json, formats/eval-results.schema.json (the zoo table), and formats/ledger.schema.json, the templates templates/ADR.md and templates/MODEL_CARD.md, and the report format tl.capstone-report.v1, whose fields the walkthrough below covers.

ArtifactContent
specs/c1/tinystories-10m.json, specs/c1/tinystories-short.jsontrain specs (formats/train-spec.schema.json) of the two tiers; the reference also has specs/c1/smoke.json
specs/c1/release.jsonthe ModelRelease spec of the capstone model (see the release-spec design in the model release workflow): suites, a quality and a safety gate, the route, the canary, the burn query of <model_id>-<version>
docs/capstone/c1/report.jsonthe report (tl.capstone-report.v1): tier, spec, tokenizer, model config and parameters, the training run, held-out bpb with its CI, the three ablations, the scaling points and fit, and the paths below
docs/capstone/c1/zoo.jsonthe zoo suite’s report (formats/eval-results.schema.json)
docs/capstone/c1/samples.jsonl20 samples, seeds 0 to 19: {"seed", "prompt", "text", ...}
the model card and ledger the release spec namesMODEL_CARD.md from the template (see datasheet and model card), the release’s LEDGER.jsonl
two ADRs in docs/adr/the vocabulary (citing the tokenizer ablation) and the architecture (citing the attention and MLP ablations)

The report is written by tooling from the runs’ outputs, a few lines of Python over the progress files and eval reports, never by hand.

Every check below can be recomputed from the artifacts alone, which is what makes the report evidence rather than a claim.

CaseChecks
parameter countthe hand count above, and the report’s parameter count recomputed from its own config
capstone train specsboth specs validate, are Llamas of the tier’s size, and train on enough tokens
a complete reportthe report’s fields; a full or short tier (a smoke report is only a pipeline check); its spec, zoo, samples, and release exist; bpb inside its CI
fair, paired ablationsthree ablations; equal vocabulary, KV bytes, active parameters (recomputed); mean inside its CI; the verdict follows the CI
a reproducible scaling fitthree or more sizes; the log-log least-squares fit of the points is the reported fit
the zoo tablethe zoo report validates; KN-4, NPLM, LSTM, GPT, Llama on one text; the other tasks scored or skipped with a reason; the Llama row is the report’s bpb; the capstone wins at full and short
sample quality20 seeds; at least 20 words; repeated 8-grams at most 0.25 per sample and 0.10 on average; at least 30% distinct words
ADRs cite the ablationsthe two ADRs, their sections, and the cited mean differences
the release passes the system’s own preflightthe Go ReleaseSpec decodes the release spec strictly, Validate and Preflight pass on its card and ledger; quality and safety gates; the burn query selects the served model

Before reading each step of the walkthrough, try to predict what the report must contain. The reasoning chain comes first, because each design choice in the reference run follows from it.

  1. Size the run before training it. The goal fixes a compute budget (a laptop night), and C≈6NDC \approx 6ND turns that budget into a model size and a token count. The full config’s 10.4M parameters and 10810^8 tokens are what fits in 4 to 12 hours at 0.2 to 0.4 TFLOP/s; the smoke config is the same architecture shrunk until it trains in seconds.
  2. Make every reported number derivable. The parameter count must follow from the config, bpb must lie inside its own CI, and the zoo’s Llama row must equal the report’s bpb. If any one of these disagrees, the report describes a different model from the one that was trained.
  3. An ablation changes one thing at an equal budget. Otherwise the comparison measures the budget. So each arm’s budget quantity (vocabulary size, KV bytes per token, active parameters) is computed and recorded next to the result.
  4. Pair by document and bootstrap the mean difference. Documents vary in difficulty far more than the arms differ, so the per-document difference δu\delta_u removes that variance, and resampling documents gives a CI for δˉ\bar\delta. The verdict is mechanical: a winner only when the CI excludes zero.
  5. Decisions follow from the verdicts. A measured winner is adopted; a tie keeps the option that costs less in engine work and memory. The ADR records the numbers so the decision can be revisited when the full tier reruns the ablation.
  6. The scaling fit is a least-squares line in log space, so it can be reproduced from the points; three points are a planning signal, not a law.
  7. Ship only through the release workflow. The model’s release spec must pass the same strict decoding, validation, and gates as any other release, and the canary’s burn query must select this model, or a bad release would be judged by another model’s error rate.

The smoke spec (smoke.json) trains the smoke config with the same optimizer and schedule family as the full tier:

{
"name": "c1-smoke",
"tokenizer": {"id": "c1-bpe-512", "path": "tokenizers/c1-bpe-512/tokenizer.json"},
"optimizer": {"name": "adamw", "lr": 0.003, "betas": [0.9, 0.95], "weight_decay": 0.1},
"schedule": {"name": "wsd", "warmup_steps": 20, "decay_frac": 0.2, "min_lr_ratio": 0.1},
"precision": {"dtype": "fp32"},
"batch": {"micro_batch": 16, "accum": 1, "seq_len": 128},
"steps": 200, "ckpt_every": 100, "seed": 0
}

That is 200×16×128=409,600200 \times 16 \times 128 = 409{,}600 tokens and 6×791,680×409,600≈1.9×10126 \times 791{,}680 \times 409{,}600 \approx 1.9 \times 10^{12} FLOP. The report’s wall_s is 7.4 s, an effective 0.26 TFLOP/s, inside the tier estimate above, so the same machine would need roughly 6.2×1015/0.26×1012≈6.66.2 \times 10^{15} / 0.26 \times 10^{12} \approx 6.6 hours for the full tier. The short spec (tinystories-short.json) adds "precision": {"dtype": "bf16", "recompute": true} and "accum": 2, the features of mixed precision, accumulation, and checkpointing.

Before any run, check_spec in cli_c1.py rejects what the trainer cannot honour:

def check_spec(spec: dict) -> list[str]:
errors = []
model = spec["model"]
if model.get("tl_tokenizer") not in ("bytes", "file"):
errors.append("llama requires tl_tokenizer bytes or file")
if model.get("tl_tokenizer") == "file" and not spec.get("tokenizer", {}).get("path"):
errors.append("file tokenization requires tokenizer.path") # vocabulary must match a file
if spec.get("precision", {}).get("dtype", "fp32") not in ("fp32", "bf16"):
errors.append("capstone precision must be fp32 or bf16")
schedule = spec["schedule"]
# ... schedule name in constant, cosine, wsd
warmup = schedule.get("warmup_steps", 0)
if not isinstance(warmup, int) or not 0 <= warmup < spec["steps"]:
errors.append("warmup_steps must be an integer in [0, steps)") # else lr never peaks
# ... decay_frac in (0, 1], min_lr_ratio in [0, 1], keep_ckpts and ckpt_every positive
return errors

Returning a list of every problem, rather than raising on the first, means one failed submission reports everything wrong with the spec.

The reference smoke model is V=512V = 512, d=128d = 128, 4 layers, 4 heads of dh=32d_h = 32, 2 KV heads, f=344f = 344, tied. Following the same table as the full config: the embedding is 512⋅128=65,536512 \cdot 128 = 65{,}536; each layer is 2⋅128⋅128+2⋅128⋅64+3⋅128⋅344+256=181,5042 \cdot 128 \cdot 128 + 2 \cdot 128 \cdot 64 + 3 \cdot 128 \cdot 344 + 256 = 181{,}504; four layers make 726,016; the final norm adds 128. The total is 791,680, which is the report’s "params".

From report.json:

"eval": {"val_bpb": 0.500221, "ci95": [0.448999, 0.597273], "n": 32, "val_loss": 0.993277}

The CI is a bootstrap over the 32 held-out documents, not over tokens: tokens within a document are correlated, and resampling them would give a CI that is too narrow. bpb lies inside its CI, as it must.

Each ablation records both arms, their configs, the paired mean difference, its CI, the verdict, and the equal-budget quantity:

{
"id": "attention",
"question": "GQA or MLA at equal KV bytes per token",
"metric": "bpb", "unit": "held-out document", "n": 32, "seed": 0,
"a": {"name": "gqa", "config": {"...": "the smoke config"}, "value": 0.500221},
"b": {"name": "mla", "config": {"...": "plus", "tl_attention": "mla", "tl_mla_rank": 112,
"qk_rope_head_dim": 16, "qk_nope_head_dim": 32, "v_head_dim": 32}, "value": 0.499284},
"mean_diff": -0.011246,
"ci95": [-0.042154, 0.00765],
"winner": "tie",
"kv_bytes_per_token": {"a": 1024, "b": 1024}
}

Recompute the budgets. GQA caches L⋅2⋅nkv⋅dh=4⋅2⋅2⋅32=512L \cdot 2 \cdot n_{kv} \cdot d_h = 4 \cdot 2 \cdot 2 \cdot 32 = 512 values per token, 1,024 bytes in bf16. MLA caches L⋅(r+dr)=4⋅(112+16)=512L \cdot (r + d_r) = 4 \cdot (112 + 16) = 512 values, also 1,024 bytes: the rank 112 was chosen to make them equal. The MoE arm (4 experts, top-1, expert width 344) has 793,728 active parameters against 791,680; the 2,048 difference is the router, 4 layers×128×44 \text{ layers} \times 128 \times 4 experts. The tokenizer arms share vocabulary 512 and the same 65,840-byte sample.

Notice that mean_diff is the mean of the per-document differences, not bpbb−bpba\mathrm{bpb}_b - \mathrm{bpb}_a of the pooled values (0.499284−0.500221=−0.0009370.499284 - 0.500221 = -0.000937). Pooled bpb weights documents by their byte count; the paired mean weights each document equally, which is what the bootstrap over documents resamples.

The CI comes from the course’s percentile bootstrap, bootstrap_ci in prob/stats.py, applied to the 32 differences with stat = mean:

def bootstrap_ci(x, stat, n_boot, alpha, rng):
a = _sample(x, 1)
# ... alpha in (0, 1), n_boot a positive integer
n = a.size
thetas = np.empty(int(n_boot), dtype=np.float64)
for b in range(int(n_boot)):
idx = np.empty(n, dtype=np.int64)
for i in range(n):
# One uniform per index, in order: the same seed resamples the same
# rows in Python and in Go (ag.12).
idx[i] = min(int(rng.uniform() * n), n - 1)
thetas[b] = float(stat(a[idx])) # the statistic of one resample
return (
float(stat(a)), # the point estimate on the real data
quantile(thetas, alpha / 2.0), # 2.5th percentile
quantile(thetas, 1.0 - alpha / 2.0), # 97.5th percentile
)

The one-uniform-per-index rule is what lets the Go implementation in paired A/B experiments reproduce the same resamples. The verdict rule is then mechanical: "b" if the upper bound is below 0, "a" if the lower bound is above 0, else "tie". Applied to the reference, the tokenizer interval (0.014,0.059)(0.014, 0.059) excludes zero with δ>0\delta > 0, so BPE (a) wins; the attention interval (−0.042,0.008)(-0.042, 0.008) and the MLP interval (−0.0002,0.033)(-0.0002, 0.033) include zero, so both are ties. The MLP interval is a useful lesson: its lower bound is almost exactly zero, and the rule still calls it a tie.

The ADRs turn the verdicts into choices. ADR-0002 adopts byte-level BPE because it won:

On the paired held-out documents, Unigram’s bits per byte minus BPE’s is 0.032 on average, 95% CI (0.014, 0.059): BPE is better and the interval excludes zero.

ADR-0003 keeps GQA and a dense MLP although neither alternative lost, because a tie is decided by cost:

Both intervals include zero: neither alternative is measurably better at this tier, and both cost engine work.

It lists the cost precisely: MLA needs the latent cache of the KV cache and generate and weight absorption in the engine, and the MoE holds four times the MLP weights for the same active compute. Both ADRs record the evidence’s limits (one seed, smoke tier) as a consequence, so the full tier knows to rerun them.

The report’s three points are (123,712, 0.50393)(123{,}712,\ 0.50393), (353,952, 0.504022)(353{,}952,\ 0.504022), and (791,680, 0.500221)(791{,}680,\ 0.500221), and the fit is a=0.527387a = 0.527387, α=0.003773\alpha = 0.003773. You can reproduce it: regress log⁡bpb\log \mathrm{bpb} on [1,log⁡N][1, \log N] by least squares; the intercept is log⁡a\log a and the slope is −α-\alpha. That gives exactly the reported values. An exponent of α≈0.004\alpha \approx 0.004 is almost flat: at 200 steps every size is data-limited, so a bigger smoke model buys nothing. The model card says so, and that is the right reading. The smoke tier proves the pipeline, not the model.

zoo.json scores every family on the same ts-val text:

ModelParametersbpb (95% CI)
KN-4(counts)0.646 (0.599, 0.725)
NPLM230,2080.602 (0.544, 0.707)
LSTM592,3840.496 (0.453, 0.578)
GPT875,2640.943 (0.877, 1.065)
c1-llama791,6800.500 (0.449, 0.597)

The Llama row is the report’s val_bpb. At the smoke tier the LSTM edges it out, inside overlapping CIs, which is allowed: only the full and short tiers must beat every baseline. The seq2seq, classification, and word-similarity rows are "skipped" with a reason, which is how a report says “not measured here” without leaving a hole.

The 20 samples in samples.jsonl (prompt “Once upon a time”, temperature 0.8, 64 tokens, seeds 0 to 19) are scored with the word-level scorers of model evals as tests by quality in cli_c1_eval.py. The reference samples have at least 34 words each, no repeated 8-gram in any sample, and at least 60% distinct words (70% on average), well inside the thresholds listed earlier.

The last artifact is release.json:

{
"model_id": "c1-smoke", "version": "v1", "from": "runs/c1-smoke/ckpt",
"dtype": "f32", "quant": "none",
"model_card": "docs/capstone/c1/MODEL_CARD.md",
"ledger": "docs/capstone/c1/LEDGER.jsonl",
"suites": ["quality", "safety"], "eval_seed": 0,
"gates": [
{"suite": "quality", "task": "ts-val", "metric": "bpb", "op": "<=", "value": 0.6},
{"suite": "safety", "task": "refusal", "metric": "score", "op": ">=", "value": 0.9}
],
"route": "tinystories", "canary_weight": 0.1, "canary_wait_s": 600, "approve_timeout_s": 86400,
"burn": {
"query": "sum(rate(http_server_request_duration_seconds_count{model=\"c1-smoke-v1\",http_response_status_code=~\"5..\"}[5m])) / sum(rate(http_server_request_duration_seconds_count{model=\"c1-smoke-v1\"}[5m])) / (1 - 0.99)",
"max": 14.4
}
}

Each field earns its place. The quality gate (bpb at most 0.6) is set above the measured 0.500 and its upper CI bound 0.597, so the release passes on this evidence and a regressed retrain would not. The burn query selects model="c1-smoke-v1", the <model_id>-<version> of this release, so the canary is judged on its own errors: the ratio is the 5xx rate over the error budget of a 99% SLO, and 14.4 is the standard fast-burn threshold, the rate that would spend a 30-day budget in about two days. The model card (MODEL_CARD.md) carries the evaluation table with CIs and states the out-of-scope uses; the ledger records the one data source with its license, hash, and allowed uses (train, eval), which Preflight checks against the release.

The reference run makes a handful of choices that deserve defending.

Cost comes first. The full tier is one laptop night, plus one short run (under an hour) per ablation arm and per extra size of the scaling fit. The smoke tier reproduces the whole report in minutes, which is what makes it a usable regression check for the pipeline.

A paired bootstrap beats a t-test on pooled numbers. Two arms’ pooled bpb differ by less than the spread between documents, so an unpaired comparison would call almost everything a tie; pairing removes the document effect. The bootstrap also makes no normality assumption about per-document differences, which are skewed because a few hard documents dominate.

Equal budgets beat “the default config of each”. An MLA arm that caches more, or an MoE that computes more per token, would win for a reason that has nothing to do with the architecture. Holding the budget equal and recording it makes the comparison mean what the question asks.

A tie is decided by cost. When the evidence cannot separate two options, the cheaper one to build and run is the right default, and the ADR keeps the door open by naming what would change the decision.

Finally, some tradeoffs are accepted openly: one seed per arm (so seed variance is not in the CI), 32 evaluation documents at the smoke tier, and a three-point scaling fit. Each is stated in the ADRs or the model card rather than hidden.

Most capstone failures are not crashes. They are reports that look fine and mean something other than what they say. The table lists the ones the reference run is built to avoid.

PitfallSymptomHow the solution avoids it
an ablation at unequal budgetMLA “wins” because it caches more; the MoE “wins” because it computes moreeach ablation records its budget (kv_bytes_per_token, active_params, equal vocabulary), and the arms are sized to match
a winner declared inside the noisean ADR built on a CI that includes zerothe verdict follows the CI; the attention and MLP ablations are recorded as ties
comparing tokenizers per tokenthe tokenizer with more, easier tokens looks betterevery ablation’s metric is bpb
a report that describes another modelparameters, config, and zoo row disagreethe parameter count follows from the config, and the zoo’s Llama row is val_bpb
a scaling fit drawn by eye or in linear spaceaa and α\alpha that no least-squares fit givesthe fit is least squares on log⁡bpb\log \mathrm{bpb} against log⁡N\log N, reproducible from the points
baselines scored on different texta zoo table whose rows cannot be comparedevery zoo row is scored on ts-val
a looping or degenerate samplerthe same 8-gram again and again; a handful of wordssamples are scored for repeated 8-grams and distinct words; the reference has no repeats
decisions without evidenceADRs that state a choice and cite nothingADR-0002 and ADR-0003 quote each mean difference and CI
a release the system’s own workflow refusesa template placeholder in the card, a non-train source, a burn query of another modelthe card is filled from the report, the ledger allows train and eval, and the burn query names c1-smoke-v1
a smoke run presented as the capstone200 steps of a 0.8M model reported as “the model”the report says "tier": "smoke", and the model card scopes it to a pipeline test

Warning: The smoke tier is a pipeline test. Its numbers prove that every stage connects and that the report is internally consistent; they say nothing about how good a TinyStories model the system can train. Only a full or short report is a capstone result.

Looking back, the capstone is the end-to-end result of everything up to the capstone training stage of the course path: it ships through ModelRelease, trains with the features of mixed precision, accumulation, and checkpointing, and reports the safety rows of bias and safety evals. Nothing in the system calls it. Looking forward, two things build on its release. The optional second capstone post-trains the released model into an instruction follower, and the data incident drill in Systems Engineering revokes a source of this model’s data and drives the retrain decision through ModelRelease.

Each piece also has a production counterpart worth studying. Karpathy’s nanoGPT and llm.c (see llm.c/train_gpt2.c) run the same loop on GPUs with careful throughput accounting. The DeepSeek-V2 and Mixtral reports run MLA and MoE ablations at scale with compute-matched baselines. Chinchilla’s three approaches fit scaling laws over hundreds of runs with isoFLOP profiles (Hoffmann et al., section 3). HELM (crfm-helm) and the Open LLM Leaderboard extend the zoo table to many tasks with standardized prompts and seeds.

  • Compute budget: the training FLOP available, C≈6NDC \approx 6ND, which fixes the trade between parameters NN and tokens DD.
  • Bits per byte (bpb): total held-out negative log-likelihood in bits divided by the number of held-out bytes, comparable across tokenizers.
  • Ablation: a paired experiment that changes one component while holding its budget (vocabulary, KV bytes per token, or active parameters) equal.
  • Paired difference: the per-document difference δu\delta_u between two arms, which cancels how hard each document is.
  • Percentile bootstrap CI: an interval from the 2.5th and 97.5th percentiles of a statistic recomputed on resampled documents.
  • Scaling fit: the least-squares line log⁡bpb=log⁡a−αlog⁡N\log \mathrm{bpb} = \log a - \alpha \log N through measured sizes.
  • Model zoo: the table that scores every model family the system trained on the same held-out text.
  • Burn rate: the error rate divided by the SLO’s error budget; a value of 14.4 spends a 30-day budget in about two days.
  • The capstone runs the whole system on one goal and treats the report as evidence that must agree with itself and with the runs.
  • C≈6NDC \approx 6ND sizes the run: the full tier is 10,409,280 parameters, 10810^8 tokens, and about 6.2×10156.2 \times 10^{15} FLOP.
  • Ablations change one thing at an equal budget, pair by held-out document, and name a winner only when the 95% bootstrap CI excludes zero; a tie is decided by cost.
  • Every reported number is derivable: parameters from the config, the scaling fit from its points, the zoo’s Llama row from val_bpb.
  • ADRs record decisions with their evidence, and the model ships only through the system’s own gated release workflow, judged by a burn query on its own traffic.
  1. Why compare tokenizers in bits per byte rather than per-token loss?

    Answer

    Per-token loss depends on how text is cut. A tokenizer that produces more, smaller tokens has easier predictions per token and a lower per-token loss without modelling the text any better. Bits per byte divides the total information by the number of bytes, which is the same for both tokenizers on the same text.

  2. The reference MLA arm uses rank 112 and a rope dimension of 16. Where do those numbers come from?

    Answer

    From equal KV bytes per token. GQA in the smoke config caches 4⋅2⋅2⋅32=5124 \cdot 2 \cdot 2 \cdot 32 = 512 values per token. MLA caches L(r+dr)L(r + d_r), so 4(r+dr)=5124(r + d_r) = 512 gives r+dr=128r + d_r = 128; with dr=16d_r = 16, r=112r = 112.

  3. The MLP ablation’s CI is (−0.0002,0.033)(-0.0002, 0.033). Why is the verdict a tie and not “dense wins”?

    Answer

    The rule names a winner only when the 95% CI of the paired difference excludes zero. −0.0002<0<0.033-0.0002 < 0 < 0.033, so it does not, however close the bound is. Declaring a winner on a CI that includes zero would build an ADR on noise.

  4. Why is the release’s quality gate 0.6 and not, say, 0.55?

    Answer

    The gate must pass the model that is being released, on the evidence the release evaluation produces, and fail a regression. The measured bpb is 0.500 with a CI up to 0.597; a gate of 0.55 sits inside the CI, so the same model could fail it on a different evaluation seed. 0.6 is just above the upper bound.

  5. Why must the burn query name c1-smoke-v1 exactly?

    Answer

    The canary is promoted or rolled back on the burn rate of its own traffic. A query that matched another model (or every model) would let a broken release ride on a healthy model’s error rate, or roll back a good one because of someone else’s errors.

  6. The attention ablation’s mean_diff is −0.011246-0.011246, but the two arms’ pooled values differ by only −0.000937-0.000937. Which one does the verdict use, and why?

    Answer

    The verdict uses mean_diff, the mean of the 32 per-document differences. Pooled bpb weights documents by their byte count, while the paired mean weights each document equally, which is exactly what the bootstrap over documents resamples. Mixing the two would pair a CI from one statistic with a point estimate from another.

  7. Why is the bootstrap done over documents rather than over tokens?

    Answer

    Tokens within a document are correlated, so they are not independent samples. Resampling tokens would treat them as if they were and produce a confidence interval that is too narrow; resampling whole documents respects the unit at which the data are independent.