Expand description
One-token K3 CPU forward: AttnRes + mixer + MLP, then logits.
Structs§
- Attn
ResStream - Matches HF
KimiDecoderLayer._forward_attn_residual: mix the incoming prefix with already-archived blocks, then atlayer_idx % block_size == 0archive that incoming prefix and reset the intra-block sum. Layer 0 therefore archives the embedding as its own source, notembed + mixer. - K3Layer
Ctx - Per-layer geometry the GPU wrapper and
forward_tokenshare.
Functions§
- forward_
one_ layer - One decoder layer: AttnRes + (KDA|MLA) + MLP. Mutates this layer’s
LayerCacheand the token’sAttnResStream. - forward_
one_ layer_ with_ cores - Same as
forward_one_layer, with replaceable KDA / MLA / routed-expert cores. - forward_
one_ layer_ with_ kda_ decode - Same as
forward_one_layer, with a replaceable KDA conv+recurrent core. - forward_
one_ layer_ with_ mla_ decode - Same as
forward_one_layer, with a replaceable MLA rope+SDPA+gate core. - forward_
token - Embed one token and run every decoder layer at
pos. Updates the hybrid cache. AttnRes is per-token (layer depth), not carried across the sequence. - logits
- LM head over a hidden vector.
Wis[vocab, hidden].
Type Aliases§
- Dense
MlpCore - Optional resident dense/shared MLP, with local TP intermediate width.
- Hidden
Reduce - After row-parallel
o_proj/ dense MLPdown. None at TP=1.