Expand description
Generic decoder-only transformer forward pass, assembled from a ModelConfig. Each layer is: RMSNorm -> GQA attention (+RoPE) -> residual -> RMSNorm -> MoE FFN (router + routed experts + shared experts) -> residual. This is the standard decoder block shape shared by the LLaMA/DeepSeek/GLM/Kimi family of open-weight models.
Weight loading from a real GGUF checkpoint lives in loader
(Decoder::from_gguf); Decoder::new_random builds
correctly-shaped, randomly initialized weights so the full pipeline
– embedding lookup, N decoder layers, output head – can be
exercised end to end with real assertions about shapes, finiteness,
and determinism, without requiring a multi-hundred-gigabyte
checkpoint to be present.
Structs§
- Attn
Weights - Decoder
- GptOss
Layer - The per-layer weights the gpt-oss graph carries and the generic GQA layer structs do not.
- GptOss
Weights - gpt-oss side table: one entry per layer, in layer order.
- Layer
Weights - MoeWeights
Enums§
- Expert
Backing - How a layer’s routed experts are held.
Residentis the original always-in-memory form (owned f32 or zero-copy mmap views).Storedholds only byte-range layouts; each use acquires the expert’s bytes from a bounded, lease-protectedferrox_core::expert_store::ExpertStoreshared by every layer (one global byte budget), builds temporaryWeightMatrixviews over the leased buffer (WeightBytes::Shared, which pins the cache entry for the views’ lifetime), and drops them after the expert runs. Dequantized math over identical bytes is identical, so the two backings are bit-equivalent by construction – pinned by an integration test against the MoE fixture. - Multi
SeqKv - Where a batch of independent sequences keeps its KV.