Assignment 2 Companion · Pre-Training a Base Model Under a Fixed Budget

Scalable AI: Bridging Theory, Understanding, and Practice · 配套练习 A2。个人学习讲义与配套实验,按主题整理并持续修订。

课程源码 ZIP ↓

个人整理的学习笔记,非官方讲义;课程来源与整理说明见课程介绍。配套示例未逐一运行验证。

本篇目录

Maps to: UC Berkeley EE 290/194 Scalable AI, Fall 2026 Assignment 2, Pre-training a Base Model from Scratch (due 21 October 2026; about three weeks). Part A (40%): the NeMo Curator lab notebook. Part B (60%): pre-train a Nemotron-Nano-V3-based hybrid Mamba–Transformer MoE from scratch on the group’s one 8×H100 node, graded on base-model quality from NeMo Evaluator results, considered alongside the difficulty of the evaluations. Spring 2026 Assignment 2 was the same assignment over two weeks.

Sources: the two public handouts (assignment_2.zip on the Fall and Spring course pages), paraphrased here; Lectures 1, 4, 9–15 and 17 of these notes. The Curator lab notebook and its answers are not reproduced.

What this companion is. It covers the decisions the assignment asks you to make, the arithmetic and checks behind them, and how base models are evaluated. It deliberately does not make the decisions for you:

  • the worked budget is 4 H100s for 10 days, not the course node;
  • no architecture configuration is recommended;
  • the evaluated models are this course’s Atlas World models.

Code: code/assignmentA2/ contains:

  • budget.py: a budget ledger and plan calculator;
  • base_eval.py: base-model multiple-choice scoring with every common convention, on benchmarks built from Atlas World, whose exact probabilities provide a reference;
  • preflight.py: a pre-flight checker for training configurations;
  • three demos.

Reading time: ~70 minutes; ~15 seconds to run all demos.


0. How to read this companion

0.1 Learning goals

After this companion you should be able to:

  1. Turn an allocation into a plan: follow GPU-days through reserves, MFU and goodput to the main run’s FLOPs, and reason about model size, tokens and data repetition at that budget.
  2. Explain why systems work comes first in a fixed-compute pre-training assignment, in numbers.
  3. Check a configuration before launch: divisibility, batch arithmetic, schedule, memory, run length, data epochs, checkpoint interval, evaluation hygiene.
  4. Evaluate a base model honestly: cloze vs multiple-choice format, length normalization, few-shot examples, chance level, confidence intervals, paired comparisons.
  5. Write the report the handout asks for, with each decision justified by an estimate or a measurement.

0.2 Prerequisites and scope

  • Prerequisites:
    • Lecture 1 (scaling laws);
    • Lecture 4 (MoE, hybrids);
    • Lecture 9 (the training step, telemetry, number formats, stability, ladders);
    • Lectures 10–11 (data, synthetic data);
    • Lecture 12 (optimizers and schedules);
    • Lecture 14 (failures and goodput);
    • Lecture 15 (Nemotron 3 Nano: the architecture family and how NVIDIA planned its run);
    • Assignment 1 (MFU).
  • In scope: the planning arithmetic, the configuration checks, the evaluation method.
  • Not in scope: a recommended model size or configuration for the course node, the Curator lab’s answers, and data sources (choose and document your own legally usable data).

0.3 Section → code map

SectionIdeaCode in code/assignmentA2/
§1what the assignment asks and grades–
§2the budget, what MFU buys, size vs tokens, repetition, ablationsbudget.py, 01_budget_and_plan.py
§3the architecture family: which knobs exist– (Lectures 4, 15)
§4tokenizer, data, and the pre-flight checkpreflight.py, 03_preflight.py
§5the training run– (Lectures 9, 12, 14)
§6evaluating a base modelbase_eval.py, 02_base_model_evaluation.py
§7the report–

1. What the assignment asks, and what the grading rewards

1.1 The two parts

Part A (40%) is the NeMo Curator lab: run the notebook end to end, answer its questions, and save the requested outputs. Curator is NVIDIA’s data-curation library:

  • download and extraction;
  • language identification;
  • heuristic and model-based quality filters;
  • exact, fuzzy and semantic deduplication;
  • PII handling;
  • decontamination.

The lab need not feed into Part B, but its skills do. Lecture 10 covers the ideas behind each stage.

Part B (60%) is an end-to-end pre-training run, data → tokenizer → model → training → evaluation, with these rules:

  • Architecture: Nemotron-Nano-V3-based, a hybrid Mamba–Transformer MoE. You choose and report the depth and width and keep the overall model family consistent.
  • From scratch: random initialization, no continued pre-training.
  • Tokenizer: you select or train one, and report the vocabulary size, its training data and the key settings.
  • Data: any legally usable sources, documented with filtering, deduplication and quality controls. No benchmark data: keep the test sets of the benchmarks you report out of training.
  • Training stack: any, as long as it runs on the course node.
  • Evaluation: every reported benchmark number comes from NeMo Evaluator, with the exact command or config included. At minimum, report:
    • an intrinsic metric: validation loss or perplexity on a held-out split of your mixture;
    • an extrinsic base-model benchmark suite.
  • Checkpoint retention: keep the final checkpoint and tokenizer, available on request so staff can rerun the evaluations.

The submission contains:

  • report.pdf (2–6 pages);
  • training logs and configs;
  • tokenizer files;
  • raw NeMo Evaluator outputs;
  • a one-command repro/;
  • checkpoint_availability.txt.

The report’s sections: architecture and scaling justification (full config, parameter estimate, why this size, the size–tokens trade-off); tokenizer; data (sources, preprocessing, filtering, dedup, final token counts); the training run (hardware, wall clock, stability issues, tokens consumed); evaluation; reproducibility.

1.2 What the grading rewards

Part B is graded on base-model quality, measured by the evaluations you submit, considered alongside their difficulty. The handout adds two things in paraphrase:

  • higher quality often comes from consuming more high-quality tokens;
  • throughput and MFU earn no points directly, but better systems performance lets you train on more tokens with the same compute. Spend as much time as you can on it before launching.

Three consequences shape everything below:

  1. Systems performance is a quality lever. Every percent of MFU becomes tokens (§2.2). Assignment 1’s investigation is the first week of Assignment 2.
  2. Evaluation choices are graded. A suite of easy benchmarks scored generously is worth less than hard, standard benchmarks with standard settings. Choose benchmarks where a model of your size is measurably above chance, and report them honestly (§6).
  3. The budget is fixed and shared by everything. Ablations, evaluations, failed starts and the main run all draw on the same node-hours. Plan the reserves before the main run (§2.1).

2. The budget and the plan (demo 01)

2.1 The ledger

A fixed allocation is GPUs × days. Demo 01 follows a worked allocation of 4 H100s for 10 days through the ledger (plug in your own with budget.NodeBudget):

itemGPU-daysFLOPs
allocation at peak (989.4 TFLOP/s per GPU, dense BF16)40.03.42 ZFLOP
reserved: ablations 20%, evaluations 3%, contingency 7%12.0–
main run at peak28.02.39 ZFLOP
× MFU 30%718 EFLOP
× goodput 90% = main-run model FLOPs646 EFLOP (18.9%)

Read the ledger from the bottom up: of every peak FLOP the allocation offers, under a fifth becomes training. The terms:

  • Reserves are deliberate. Small-scale ablations (§2.5) decide the data mixture, learning rate and size. Evaluations of intermediate checkpoints catch problems early. Contingency pays for one restart from scratch if a bug appears late (a tokenizer error, a data leak, a divergence).
  • MFU is the largest single factor, and the one Assignment 1 taught you to raise.
  • Goodput (有效产出率) is what failures, restarts, checkpoint stalls and lost steps leave (Lecture 14). On one node it is mostly about software crashes and checkpoint intervals (§4.3).

2.2 What MFU buys

Holding the allocation and reserves fixed, and using the Chinchilla fit (Hoffmann et al. 2022, dense Transformers) for the shape of the trade-off:

MFUmain-run FLOPscompute-optimal Ntokens Dpredicted loss
15%323 EFLOP1.10B48.8B2.4499
25%539 EFLOP1.39B64.6B2.3926
35%754 EFLOP1.61B78.3B2.3572
45%969 EFLOP1.80B89.7B2.3319

In the ledger, MFU multiplies FLOPs exactly as the number of GPUs does: 45% MFU on 4 GPUs buys what 12 GPUs would at 15%. The predicted gain from 15% → 45% (0.118 nats) is far larger than anything a choice of model size can give at fixed FLOPs (§2.3). This is the quantitative reason the handout tells you to optimize systems performance before launching.

Caution, which applies to every loss in this section: the fit was made on dense Transformers trained on one data mixture. Your hybrid MoE on your data has its own constants. Use the fit for the shape of trade-offs, and fit your own small ladder before trusting any absolute number (Lecture 9 demo 08 did exactly that, with a pre-registered prediction).

2.3 Size vs tokens: the optimum is flat

At the worked budget, with MFU 30%, the Hoffmann optimum is 1.52B parameters on 71.1B tokens (47 tokens per parameter):

size vs optimumNDtokens/paramΔ loss (Hoffmann)Δ loss (Besiroglu refit)
0.25×379M284B751+0.064+0.107
0.5×758M142B188+0.015+0.039
1×1.52B71.1B470+0.005
2×3.03B35.5B12+0.016+0.003
4×6.06B17.8B3+0.063+0.034

Every row costs the same FLOPs; only the split changes. Two lessons:

  • Within a factor of two of the optimum, the predicted loss changes by about 0.015, an order of magnitude less than the MFU lever.
  • Two published fits of the same data disagree about where the optimum lies. Besiroglu et al. (2024) refit Chinchilla’s data and prefer larger models. A size decision copied from someone else’s fit is not a justification. The report asks you to justify your size, so use your own ladder and say how flat it was.

For an MoE, “size” has two meanings:

  • active parameters decide FLOPs per token, and so tokens per budget;
  • total parameters decide memory and how much the model can store.

At equal active compute, an MoE usually reaches a lower loss than a dense model (Lecture 4 §2 and Lecture 15 demo 03 measured it). Its optimum in active parameters therefore differs from a dense fit. Treat the table as the dense baseline you argue from.

2.4 When high-quality data runs out

The handout says quality often comes from more high-quality tokens. If your filtered pool is small, the plan must repeat data. Muennighoff et al. (2023) fitted how much repeated tokens are worth. Up to about 4 epochs, repetition is nearly as good as fresh data; beyond that, the value of each extra pass decays with a fitted constant of about 15 repetitions, and the effective token count saturates.

unique tokens Ubest Ntokens Depochseffective Dpredicted loss
unlimited1.52B71.1B–71.1B2.3732
100B1.52B71.1B0.771.1B2.3732
30B1.61B67.1B2.265.7B2.3757
10B1.91B56.4B5.650.1B2.3887

With only 10B unique tokens:

  • the unlimited-data plan would need 7.1 epochs, and its predicted loss rises from 2.3732 to 2.3907;
  • moving to a larger model recovers only 0.002 of that.

More unique high-quality data is worth more than any choice of size. This is why the Curator lab is part of this assignment: filtering trades quantity for quality, and the right threshold depends on how many tokens you can afford to consume (Lecture 10).

2.5 What the ablation reserve can buy

The 20% reserve of the worked allocation is 192 GPU-hours:

  • 2 runs at 1/10 of the main run’s cost;
  • 8 runs at 1/30;
  • 28 runs at 1/100.

That is enough for a small ladder (3–4 sizes) and a few data-mixture or learning-rate comparisons, not for a grid search. Lecture 15 §5 compared two ways to spend such a budget: from-scratch ablations vs continued-training branches off a shared base.

The catch is resolution. Two models’ accuracies on a benchmark of n questions differ by noise of order √(2p(1−p)/n). At p = 0.5:

benchmark questionssmallest detectable difference (95%)
10013.9 points
1,0004.4 points
5,0002.0 points
14,0001.2 points

Small ablation models differ by less than a few points on most benchmarks. Decide ablations on intrinsic metrics (validation loss or bits per byte on held-out data, which resolve tiny differences) or on very large evaluation sets, not on a 500-question benchmark.

2.6 A plan, in order

A sequence that follows from §2.1–2.5. It is a way to order the work, not a schedule to copy:

  1. Systems first: get the training stack running on the node for a small Nano-V3-family model, then measure and raise MFU (Assignment 1’s method). Every percent counts across the whole run.
  2. Data pipeline and tokenizer in parallel: sources, filters, dedup, decontamination, token counts, a held-out validation split.
  3. A small ladder: 3–4 sizes on the real data, short runs, intrinsic metric. Fit the loss curve and pre-register a prediction for the main run (Lecture 9 demo 08).
  4. Pre-flight the main configuration (§4.3) and launch with checkpoints, telemetry and periodic evaluation.
  5. Evaluate with NeMo Evaluator on intermediate checkpoints (to catch problems) and on the final one (to report).

3. The architecture family: which knobs exist

The handout requires a Nano-V3-based architecture whose depth and width you choose and report. Lecture 15 dissected the released model, which repeats Mamba-2 mixers, MoE feed-forward layers and a few attention layers in a fixed pattern. The knobs, and what each one trades:

knobwhat it changeslecture
width d_modelFLOPs and parameters per layer (∝ d²); GEMM sizes (MFU)L1, L2
depth (layers)FLOPs and parameters linearly; pipeline stagesL1, L6
pattern ratio (Mamba : attention : MoE)long-context cost (attention FLOPs and KV memory grow with context; Mamba state does not); recall abilityL4 §5, L15 §3.2
attention layers’ heads / KV headsKV cache size; TP divisibilityL4 §3
experts, top-k, expert width, shared expertactive vs total parameters; all-to-all volume; GEMM shapes per expertL4 §2, L5 §6, L7 §6
Mamba heads, head dim, state size, groupsthe SSM’s capacity and kernel costL15 §3.2
vocabulary sizeembedding and LM-head parameters (a large share at small sizes); bytes per tokenL9 §2.3
MTP (multi-token prediction) headan auxiliary objective; optionalL15 §3.4

Three facts to keep in mind when choosing:

  • At small sizes, the embedding and LM head are a big share of parameters. In Assignment 1 demo 04’s invented hybrid, they were 30% of the active parameters. A huge vocabulary spends your FLOPs on the head.
  • MFU depends on shapes. Widths and expert sizes that are multiples of 128 (64 at least), and head counts divisible by your TP degree, keep GEMMs efficient. A model that is 10% “better” on paper but runs at 20% lower MFU sees fewer tokens.
  • Report the full config and its parameter count, total and active. preflight.param_count shows the per-layer formulas; Lecture 4’s accounting checks them against real checkpoints.

4. Tokenizer, data and the pre-flight check

4.1 Tokenizer

The report asks for the vocabulary size, the tokenizer’s training data and the key settings. The trade-offs (Lecture 9 §2.3):

  • A bigger vocabulary compresses text into fewer tokens (more bytes per token), so the same FLOPs see more text. But it costs embedding and head parameters and FLOPs, which matters at small model sizes.
  • Train the tokenizer on data that looks like your mixture, including code and numbers if you train on them. A tokenizer trained on one language wastes its vocabulary on another.
  • Choosing an existing tokenizer (for example, the released Nemotron one) is allowed. Report it and justify it with the same trade-offs.
  • Pad the vocabulary to a multiple of 128 for efficient embedding and head GEMMs (the pre-flight check warns otherwise).
  • Report bits per byte, not perplexity per token, for intrinsic comparisons across tokenizers: per-token loss is not comparable between vocabularies (Lecture 9 demo 01).

4.2 Data

Report sources, preprocessing, filtering, deduplication and final token counts. The ideas are in Lecture 10:

  • extraction quality;
  • heuristic and classifier quality filters;
  • exact, fuzzy (MinHash) and semantic dedup;
  • mixture weights.

Lecture 11 covers synthetic pre-training data (rephrasing, which multiplies scarce high-quality tokens). Two rules from the handout deserve their own step in the pipeline:

  • Legally usable sources, documented.
  • No benchmark test sets in training. Decontaminate: remove training documents that share long n-grams (8- to 13-grams after normalization) with the test sets you will report. Lecture 17 demo 05 measured both the score inflation from leaked items and how well three detectors find exact copies and paraphrases. Keep a list of what was removed: it is part of the data section.

4.3 The pre-flight check (demo 03)

The most expensive bug in a fixed-budget run is the one found on day 9 of 10. Most are visible in the configuration. preflight.check(cfg) turns lecture rules into checks with a severity:

  • ERROR: the run will crash, not fit, or be wrong;
  • WARN: likely waste;
  • OK.

Demo 03 runs it on a first-draft configuration of an invented 23-layer hybrid MoE (2.5B total, 0.63B active parameters) on 8 GPUs. Six errors and five warnings appear before a single GPU-hour is spent:

severityareafinding
ERRORparallel60 experts not divisible by EP 8
ERRORbatchsteps × global batch = 52.4B tokens, but the plan says 300B: the schedule ends in the wrong place
ERRORscheduleno warm-up
ERRORmemory~90 GB per GPU: activations of 16 × 4,096-token sequences without recomputation are 79 GB of it
ERRORtime13.9 days at the measured throughput; 10 available
ERRORevaluation120 validation documents also appear in training
WARNshapesvocabulary 50,257 not a multiple of 128
WARNoptimizerweight decay on norms and embeddings
WARNdata6 epochs over 50B unique tokens
WARNfailurescheckpoint once a day; Young/Daly optimum 161 minutes (expected loss 16.9% vs 3.7%)
WARNevaluationtraining data not checked against the benchmarks to be reported

The corrected configuration passes every check: 64 experts, a padded vocabulary, warm-up, decay only on matrices, a consistent step count, fewer planned tokens over more unique data, two-hourly checkpoints, a clean validation split.

One detail matters: the memory fix uses micro-batch 2 with 16 accumulation steps, keeping the global batch. A first version of this demo fixed memory by quartering the global batch, a recipe change disguised as a systems fix.

Memory. The checker’s model counts BF16 weights and gradients (2 + 2 bytes per parameter) plus FP32 master weights and Adam moments (4 + 8). TP and PP split all of these, EP splits the routed experts, and ZeRO stages 1/2/3 shard states, then gradients, then weights over the data-parallel group. Activations are about 34·s·b·d bytes per layer without recomputation (Korthikanti et al. 2022, with FlashAttention), and about 2·s·b·d with full recomputation. For the draft:

ZeROrecomputestates (master + moments)activationstotal
0none8.2 GB78.7 GB~90 GB
1none1.0 GB78.7 GB~83 GB
1full1.0 GB4.6 GB~8 GB

It is a rough model: good for catching “does not fit by 2×”, not for tuning a few GB. Measure the real peak with your framework’s memory profiler.

Checkpoints. The interval that minimizes expected lost time is the Young/Daly interval √(2 × save time × MTBF). With a 3-minute blocking save:

MTBFoptimumlost at the optimumlost with a daily checkpoint
24 h93 min6.5%50.2%
72 h (assumed)161 min3.7%16.9%
336 h348 min1.7%3.8%

On one node, failures are mostly software: crashes, NCCL hangs, out-of-memory after a data change, a full disk. Count them in your MTBF. Asynchronous checkpointing shrinks the save cost and with it the optimal interval.


5. The training run

The report asks for the hardware, wall-clock time, stability issues and total tokens consumed. The lectures that matter while the run is live:

  • Telemetry (Lecture 9 §5.1, demo 02): the actual LR, raw and smoothed loss, gradient norm before clipping, the clipping rate, tokens per second, data-loader wait, and validation loss per domain. A dashboard you look at daily turns a silent failure into a visible one.

  • Stability (Lecture 9 §5.3–5.4, demo 06):

    • loss spikes from bad batches (a repetition filter in the data pipeline);
    • attention-logit growth (QK-norm, z-loss);
    • learning rates that are too high (a short sweep at small scale, with µP or careful transfer, Lecture 9 demo 07).

    Know before launch what you will do after a spike: skip the batch, roll back to a checkpoint, lower the LR.

  • Schedules (Lecture 12 §3): a warm-up–stable–decay (WSD) schedule lets you decide the run’s length late, because the cool-down can start from any checkpoint of the stable phase. That is useful when the budget is fixed and the throughput is uncertain.

  • Mixed precision (Lecture 9 §3.5): BF16 compute with FP32 master weights; FP8 only with per-tensor scaling and a check that the loss curve is unaffected.

  • Checkpoints and restarts (§4.3, Lecture 14): test a restart early, on purpose. Resume should reproduce the loss curve, which means saving data-loader position and RNG state too, not just weights and optimizer.


6. Evaluating a base model (demo 02)

6.1 How base models are scored

A base model does not answer questions; it assigns probabilities to text. Standard base-model benchmarks are scored by comparing the model’s log-probability of each candidate answer, in one of two formats (Gu et al. 2024, OLMES):

  • Cloze (完形填空): score each candidate as a continuation of the question. “The capital of X is” → ” Y .” for each candidate Y.
  • Multiple-choice letters: list the options with labels, then score the label tokens. ”… a: Y₁ b: Y₂ c: Y₃ d: Y₄ answer:” → ” a”, ” b”, …

Within cloze, candidates of different lengths need a normalization:

  • the raw sum of log-probabilities, which penalizes long answers;
  • per token;
  • per character;
  • PMI, which subtracts each candidate’s log-probability after a neutral prompt.

Harnesses (including the tasks NeMo Evaluator runs) choose one per task, usually following the benchmark’s standard setting.

6.2 The same models, many “accuracies”

Demo 02 builds three 4-option benchmarks of 400 questions each from Atlas World (chance = 25%):

  • facts (knowledge);
  • sums (arithmetic);
  • story continuation (HellaSwag-like: two sentences of a story, then its true third sentence or third sentences from stories on other topics).

It scores Lecture 21’s two base models on them: the “draft” (2 layers, d 64) and the “parent” (6 layers, d 128). Because Atlas World’s probabilities are exact, an exact model gives a reference.

benchmarkmodelcloze rawper tokenper charPMIletters
factsdraft77.5%72.8%75.8%38.0%25.2%
parent97.8%97.8%97.8%68.2%24.5%
exact model100%
sumsdraft18.5%18.5%18.5%21.0%28.5%
parent42.2%42.2%42.2%38.5%25.2%
exact model100%
story continuationdraft46.8%60.5%77.2%89.0%25.5%
parent51.7%68.8%81.0%89.0%22.8%
exact model (raw)78.8%

Five lessons, each a choice your report must state:

  1. Format. In letter format both models are at chance on every benchmark, while the same questions as cloze reach 97.8% (facts) for the parent. Small base models cannot yet map a label back to an option, so the letter format measures that skill, not the knowledge. They also show label bias: the draft answered “a” on 93–100% of letter questions. Standard suites use cloze for small models for this reason (OLMES).
  2. Normalization matters when candidates differ in length. On story continuation the parent scores 51.7% with the raw sum and 89.0% with PMI.
  3. Even the exact model is not a ceiling under raw scoring. It scores 78.8% here, because the right decision rule depends on how the distractors were made. They come from other topics, so the evidence for “this is the true continuation” is the ratio p(candidate | prompt) / p(candidate). That is what PMI estimates.
  4. PMI is not a universal fix. On facts it costs the parent 30 points, because it penalizes answers that are common everywhere.
  5. Few-shot examples help where they restore the training context. On sums, the parent’s cloze accuracy goes 42.2% → 61.8% → 65.5% with 0 / 1 / 3 solved examples, since several equations look like the math documents it was trained on. The letter format stays at chance with or without examples. Three letter-format examples no longer fit a 128-token context: real benchmarks have context limits too.

6.3 Is a difference real?

A benchmark score is an estimate, and comparisons need intervals:

questionsparent [95% CI]draft [95% CI]parent − draft, paired [95% CI]
10099.0% [97.0, 100.0]74.0% [65.0, 82.0]+25.0 [+17.0, +34.0]
40097.8% [96.2, 99.0]72.8% [68.2, 77.2]+25.0 [+20.8, +29.2]
  • Interval width scales with √(p(1−p)/n): about 17 points at 100 questions for an accuracy near 73%, 9 at 400. Near the ceiling it is narrower.
  • Compare models on the same items with a paired interval (resample questions, keep the pairing). Item difficulty then cancels.
  • The verdict can depend on the scoring. On story continuation the parent is significantly better than the draft under raw, per-token and per-character scoring, but tied under PMI.

6.4 Choosing the suite

The grading considers the difficulty of your evaluations alongside the scores. Practical rules that follow from §6.2–6.3:

  • Use standard base-model benchmarks with their standard settings (format, normalization, number of shots), so your numbers can be compared with published ones. State every setting with every number.
  • Prefer benchmarks where your model is measurably above chance. A benchmark at chance for every model of your size says nothing about quality, and a hard benchmark at chance is not “difficulty credit”.
  • Mix knowledge, reasoning, commonsense and (if you trained on it) code, and report intervals.
  • Keep the intrinsic metric: validation loss or bits per byte on a held-out split of your mixture. It moves when benchmarks cannot (§2.5), and the handout requires it.
  • Keep the exact NeMo Evaluator command or config and its raw outputs. Staff may rerun your evaluations on your checkpoint.

7. The report

Map each required section to its evidence:

  1. Architecture and scaling justification: the full config, total and active parameters (with the formula), and why this size under your budget. Use your own ladder’s fit or at least the flatness of the optimum (§2.3), and the size–tokens trade-off you chose.
  2. Tokenizer: vocabulary size, training data, settings, and bytes per token on your mixture.
  3. Data: sources, filters, dedup, decontamination against the benchmarks you report, final token counts and epochs.
  4. Training run: hardware, wall clock, MFU and goodput (your ledger, §2.1), stability incidents and what you did, total tokens.
  5. Evaluation: the intrinsic metric on the held-out split; the extrinsic suite with settings, intervals and the exact NeMo Evaluator commands.
  6. Reproducibility: one command for training and evaluation, configs, where the checkpoint lives.

8. Summary

  • The ledger: of a fixed allocation’s peak FLOPs, under a fifth becomes main-run training at typical reserves, MFU and goodput. MFU is the largest factor, and it multiplies FLOPs exactly like extra GPUs.
  • Size vs tokens is a flat optimum. Within 2× of it the predicted loss moves by ~0.015, and two fits of the same data disagree about where it is. Fit your own ladder; spend effort on MFU and data.
  • Repetition costs little up to ~4 epochs and a lot beyond. More unique high-quality data is worth more than any size choice.
  • Ablations need resolution. Use intrinsic metrics or large evaluation sets; a 1,000-question benchmark cannot see differences below ~4 points.
  • Pre-flight the configuration. Divisibility, batch arithmetic, warm-up, decay groups, memory, run length, epochs, checkpoint interval and validation overlap are all visible before launch.
  • Base-model evaluation is a set of choices: format, normalization, shots, number of questions. Each changes the number, sometimes the ranking. State them, keep them fixed, report paired intervals, and choose benchmarks above chance for your size.

9. Common pitfalls

  1. Launching before measuring MFU, then discovering that half the budget bought a third of the tokens.
  2. Copying a published compute-optimal ratio as if it were a law for your architecture and data.
  3. Too many epochs over a small “high-quality” set when a slightly looser filter would give fresh tokens.
  4. A schedule whose length disagrees with the token plan: steps × global batch ≠ planned tokens, so the cool-down happens at the wrong time.
  5. Changing the global batch to fix memory without noticing it changed the recipe.
  6. No restart test: the first real failure reveals that the data-loader state was not saved.
  7. Validation documents in the training set, or benchmark test sets in the crawl.
  8. Letter-format benchmarks for a small base model: chance-level scores that measure format-following, not knowledge.
  9. Changing format, normalization or shots between models you compare, or between your number and the published one.
  10. Deciding ablations on small benchmarks whose noise is larger than the differences.

10. Exercises

  1. Your node: 8 H100s for 18 days. Reserves 25% in total, MFU 35%, goodput 92%. How many main-run model FLOPs is that? At 6 FLOPs per active parameter per token, how many tokens does a model with 1B active parameters see?
AnswerGPU-days: 8 × 18 = 144; main run 0.75 × 144 = 108 GPU-days = 108 × 86,400 s × 989.4 × 10¹² FLOP/s ≈ 9.23 × 10²¹ FLOPs at peak; × 0.35 × 0.92 ≈ 2.97 × 10²¹ model FLOPs. Tokens: 2.97 × 10²¹ / (6 × 10⁹) ≈ 4.95 × 10¹¹ ≈ 495B tokens (ignoring attention and scan FLOPs, which add a few percent for a hybrid at moderate context).
  1. Raising MFU from 30% to 40% takes your team three days of systems work out of an 18-day window. Is it worth it, if the main run would otherwise use all 18 days?
AnswerWithout the work: 18 days at 30% → 5.4 "MFU-days". With it: 15 days at 40% → 6.0. That is 11% more FLOPs, and the improvement also speeds every ablation and evaluation done afterwards. It is worth it if the gain is real, which you would check with Assignment 1's method before relying on it. The break-even is when (days left) × new MFU equals 18 × 30%.
  1. A teammate proposes 9 epochs over a 20B-token filtered set instead of 3 epochs over a 60B-token set filtered less strictly. What does the repetition model say, and what would you measure?
AnswerWith 180B planned tokens, 9 epochs over 20B unique gives an effective D of about 20 + 20 × 15.4 × (1 − e^(−8/15.4)) ≈ 20 + 20 × 15.4 × 0.405 ≈ 145B. Three epochs over 60B gives ≈ 60 + 60 × 15.4 × (1 − e^(−2/15.4)) ≈ 60 + 60 × 15.4 × 0.122 ≈ 173B. The looser filter wins on quantity; whether it wins on quality depends on how much worse the extra 40B tokens are. Measure it with a small-scale ablation on the intrinsic metric (both mixtures, same compute).
  1. Your 1B base model scores 26% on a 4-option letter-format benchmark and 41% on the same questions in cloze format. Which do you report, and how?
AnswerReport the benchmark's standard setting, and if that is the letter format, also report the cloze variant, labelled as such. 26% with 4 options is chance level, so it says the model cannot follow the format yet, not that it lacks the knowledge. Report intervals for both and state the format, normalization and shots.
  1. Two checkpoints differ by 1.8 points on a 1,200-question benchmark (accuracy ≈ 55%). Is the difference real?
AnswerThe unpaired minimal detectable difference at n = 1,200, p ≈ 0.55 is 1.96 × √(2 × 0.55 × 0.45 / 1,200) ≈ 4.0 points, so not from separate intervals. A paired comparison on the same questions is tighter (it depends on how many questions the two checkpoints answer differently), so compute the paired interval. If it still includes 0, say "no detectable difference".

11. Enhancing the assignment

Ideas for the 10% “enhancing an assignment” component, none of which is part of the graded solution:

  • A ledger template in the assignment repo: allocation → reserves → MFU → goodput → tokens, so every report states its budget the same way.
  • A pre-flight script for the course’s training stack, with checks drawn from §4.3 on the framework’s real config format.
  • An evaluation-settings table for the recommended base-model benchmarks (format, normalization, shots, chance level), so groups’ numbers are comparable.
  • A contamination report: the n-gram overlap of common pre-training sources with the benchmark test sets used in the course.

12. Further reading

  • Hoffmann et al. (2022), Training Compute-Optimal Large Language Models; Besiroglu et al. (2024), Chinchilla Scaling: A Replication Attempt.
  • Muennighoff et al. (2023), Scaling Data-Constrained Language Models.
  • Gu et al. (2024), OLMES: A Standard for Language Model Evaluations: cloze vs multiple-choice formats and normalizations.
  • Korthikanti et al. (2022), Reducing Activation Recomputation in Large Transformer Models: the activation memory formula.
  • NVIDIA Nemotron 3 Nano technical report (Lecture 15) and the NeMo Curator and NeMo Evaluator documentation.
  • Lectures 9, 10, 12, 14 and 15 of these notes.

术语表 (Glossary, English → 中文)

English中文
allocation / ledger / reserve算力配额 / 账本 / 预留
goodput有效产出率
compute-optimal / tokens per parameter算力最优 / 每参数词元数
scaling-law fit / ladder缩放律拟合 / 小规模阶梯实验
active vs total parameters激活参数 vs 总参数
data-constrained / epochs / effective tokens数据受限 / 轮次 / 等效词元数
ablation / resolution (minimal detectable difference)消融实验 / 分辨率(最小可检测差异)
intrinsic vs extrinsic evaluation内在评测 vs 外在评测
bits per byte每字节比特数
decontamination / n-gram overlap去污染 / n 元组重叠
pre-flight check / divisibility起飞前检查 / 整除性
global batch / gradient accumulation全局批量 / 梯度累积
warm-up / WSD schedule / cool-down预热 / 预热-稳定-衰减调度 / 冷却阶段
ZeRO / activation recomputation零冗余优化器 / 激活重计算
MTBF / Young–Daly interval平均故障间隔 / 最优检查点间隔
base model / cloze / multiple-choice letters基座模型 / 完形填空格式 / 字母选择题格式
length normalization / PMI长度归一化 / 点互信息
label bias / chance level标签偏好 / 随机水平
few-shot少样本
bootstrap / paired interval自助法 / 配对区间
← 返回课程目录