Skip to content
ImagineWorld

Appendix C: Hyperparameter Cheat-Sheet

node_idnode-book_building-frontier-llm-from-scratch_appendix-c-hyperparameter-cheat-sheet
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_titleAppendix C: Hyperparameter Cheat-Sheet
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Appendix C — Hyperparameter Cheat-Sheet

Reasonable starting values for the main training stages. These are defaults to adapt, not laws; the right value depends on model size, data, and budget. Where ranges are given, start in the middle and tune against a validation metric.

HyperparameterTypical value
OptimizerAdamW, betas (0.9, 0.95)
Peak learning rate~3e-4 (smaller for larger models)
LR schedulelinear warmup + cosine or WSD decay to ~10%
Warmup~0.5–2% of total steps
Weight decay0.1
Gradient clip (norm)1.0
Batch size (tokens)large — millions/step via accumulation + DP
Token budget≥ 20 tokens/param; often far more (overtrained)
PrecisionBF16, or FP8 with fine-grained scaling

Table C.1 — Pretraining

HyperparameterTypical value
Learning rate~1e-5 to 2e-5 (full); ~1e-4 to 3e-4 (LoRA)
Epochs1–3 (more overfits)
Losscross-entropy on the response only (prompt masked)
Datatens of thousands of high-quality examples

Table C.2 — Supervised fine-tuning (SFT)

HyperparameterTypical value
Rank r8–64
Alpha~2× rank
Target modulesattention (q, k, v, o) and/or FFN projections
Base precisionfull (LoRA) or 4-bit NF4 (QLoRA)
HyperparameterTypical value
Epochs1-3
Batch size32-512 sequences
Warmup0-3% of steps
Max length (packed)4K-32K
Lossmasked to assistant tokens (22.5)
Table C.2 — Supervised fine-tuning (SFT)
HyperparameterTypical value
DPO β0.1 (range 0.01-0.5)
DPO learning rate5e-7 to 5e-6
GRPO group size8-64 samples
GRPO clip ε0.2
KL coefficient β0.001-0.1
Epochs1-2
Table C.3 — Preference optimization (DPO and GRPO)
SettingCreativeReasoning / code
Temperature0.7-1.00.0-0.3
Top-p0.9-0.950.95 or off
Top-k40-50 or offoff
Repetition penalty1.0-1.11.0
Table C.4 — Inference and sampling defaults

Use these as priors, not prescriptions Every value here is a reasonable place to start and a poor place to stop. Sweep the learning rate first — it is the single most impactful knob — and let your own loss curves and evaluations move you off these defaults.

Reference: Representative Model Configurations

A rough sense of how the configuration numbers (Section 16.6) scale with model size. These are representative shapes, not any specific model’s exact values, meant to calibrate intuition for what a configuration of a given scale looks like.

ScaleHiddenLayersHeads
Small dense (~1-3 B)~2048~24~16
Mid dense (~7-8 B)~4096~32~32
Large dense (~70 B)~8192~80~64
Frontier MoE~6000-7000~60-80~48-128

Table C.5 — Approximate configuration shapes by scale

Two patterns are worth internalizing. Within dense models, hidden size, depth, and head count all grow together as scale rises — the balanced aspect ratio of Section 8.7 — rather than any one ballooning alone. And the frontier MoE row breaks the pattern: its dense dimensions are comparable to a large dense model, but its capacity comes from hundreds of experts (Chapter 11) of which only a handful are active per token, which is why such a model can have ten times the parameters of the large-dense row while costing only a little more per token to run. The configuration, in other words, encodes not just the model’s size but its entire strategy for buying capacity.