Module model_stats

Module model_stats 

Source
Expand description

ModelStats — diagnostic counters and one-shot latches owned by the model.

Sibling to ModelLevers: the levers say what a model’s kernels do, this records what they did. Both are owned by TransformerModel and lent to every ForwardContext.

Telemetry is not exempt from scoping. A counter that spans a model swap averages two models together and describes neither, and a one-shot dump latch that has already fired suppresses the next model’s dump — the exact artifact someone asked for by setting the flag. Nothing here changes generation, so the failure is a wrong measurement rather than a wrong answer; for a diagnostic those are the same kind of defect.

Counters are atomics because they are mutated through the shared & that ForwardContext hands out. The change from the statics they replace is where they live, not how they are written.

Structs§

DumpLatches
One-shot diagnostic latches for one model.
ModelStats
Per-model diagnostic state.
MoeUnionStats
Expert-union sampling counters for one model.