Expand description
2026-09-25: Re-exports the Kimi K3 KDA CPU reference, metrale_model_weights::kimi_k3_host::kda.
Decode runs the CUDA launch in super::kda_cuda instead, unless K3_CUDA_KDA=0.
Owner: model-arch, Kimi K3. Invariants: none beyond the types.
Structs§
- KdaConfig
- KDA geometry. Tiny dims are legal for CPU tests; production is 128/4.
- KdaState
- Per-sequence KDA state. Both buffers are FP32, read-modify-write.
Constants§
- KDA_
L2_ EPS - FLA
use_qk_l2norm_in_kerneleps. CUDAk3_kda_recurrent_step_f32uses the same.
Functions§
- bounded_
gate - KDA forget-gate in log space (FLA
use_gate_in_kernel). - conv_
update - Causal depthwise conv + SiLU. Shifts Metrale-width state left, writes
xinto the last slot, theny[c] = silu(dot(w[c], state[c])). - cuda_
kda_ enabled - LinearAttention BoundLayer uses CUDA
kda_decodeunlessK3_CUDA_KDA=0. Projections, AttnRes, and MLP stay on the host either way. - full_
rank_ output_ gate - Full-rank output gate:
sigmoid(g) ⊙ RMSNorm(core)per head. - kda_
decode_ token - One decode token: conv update then recurrent step.
- kda_
from - Map parsed
ModelConfigonto KDA geometry. - kda_
recurrent_ step - One-token KDA core.
qkvis post-conv[3 * qkv_dim](q|k|v). Updatesstate.recurrentin place. q/k are L2-normalised here.