Expand description
Per-layer + per-tensor precision overrides (C.3, 2026-04-25).
Reference: NVIDIA Transformer Engine 2.14 + EAQuant (arXiv:2506.13329)
-
community 2025 mixed-precision recipes. In MoE models, the quantization-sensitivity hierarchy holds across re-tested benchmarks:
- Router (gate weights): hidden × num_experts, tiny in memory, but routing accuracy collapses fast under quant. Keep BF16 wherever feasible.
- LM head: hidden × vocab, large but determines output logit fidelity. BF16 closes the dominant chunk of perplexity gap.
- First 1-2 transformer blocks + last 2-3 blocks: the embedding-adjacent layers carry sink-token outliers and the output-adjacent layers shape final logits. Keep at FP8 (one tier above the bulk).
- Bulk MoE experts: NVFP4 / FP8 — the model has the most slack here.
§Scope
This module ships:
Role— semantic tag for each tensor the loader wants to classify (router, lm_head, attention, expert, etc.).Dtype— target precision values the schedule emits.PrecisionSchedule— the per-(layer, role) → dtype decision table, built from[precision]in MODEL.toml.
The loader consults schedule.dtype_for(layer_idx, role) at
tensor-load time and chooses the matching path. When the
schedule is in its default() state (no [precision] block in
MODEL.toml), every lookup returns Dtype::Inherit — meaning
“use whatever the existing per-checkpoint logic decides.” This
keeps the pre-2026-04-25 behaviour bit-exact.
Structs§
- Precision
Schedule - Per-(layer, role) precision schedule built from MODEL.toml’s
[precision]block. Lookups are O(1) for the common tables; per-layer overrides hit a small sorted set.
Enums§
- Dtype
- Target precision for a tensor.
Inheritmeans “let the existing per-checkpoint logic decide” (preserves pre-C.3 behaviour); the other variants are hard requests. - Role
- Semantic role of a tensor, used for precision lookups. The set is
closed and minimal — adding a new role requires extending the
Dtype::for_rolematch.