Module model_stats

Module model_stats 

Source
Expand description

2026-09-25: ModelStats: diagnostic counters and one-shot latches owned by one model.

Owner: model-layers ops. Invariants:

  • A new ModelStats starts with zero counters and every latch unfired, so a second model neither inherits the first one’s counts nor finds its dumps already spent.

TransformerModel owns one next to its ModelLevers and lends it to each ForwardContext as stats. The counters are atomics because they are updated through that shared reference.

Structs§

DumpLatches
2026-09-25: One-shot latches for one model, keyed by a &'static str (keyed).
ModelStats
2026-09-25: Per-model diagnostic state.
MoeUnionStats
2026-09-25: Expert-union sampling counters for one model: calls seen, calls sampled, and the running unique-expert and slot totals.