MLA attention + MLA KV cache
Multi-head Latent Attention base path for MODEL_DEEPSEEK_V3 (shared primitive for V3.2/V4). New attention path - not a variant of fwd_attention.
Spec: doc/plans/engine-inference-core.md § E2
Part of: #105 (E2) · Epic: #56
Depends on: MultiLinear sibling issue
Tasks - attention (fwd_mla_attention)
Tasks - KV cache
Notes
- Cross-check against mlx-lm
mla.py / deepseek_v3.py, not mlx-serve ds4
- V3.2 dual-cache (
CacheList) is a separate issue on top of this base cache
MLA attention + MLA KV cache
Multi-head Latent Attention base path for
MODEL_DEEPSEEK_V3(shared primitive for V3.2/V4). New attention path - not a variant offwd_attention.Spec:
doc/plans/engine-inference-core.md§ E2Part of: #105 (E2) · Epic: #56
Depends on: MultiLinear sibling issue
Tasks - attention (
fwd_mla_attention)q_a_proj->q_a_layernorm->q_b_proj; first layer may use directq_proj(no LoRA)kv_a_proj_with_mqa-> splitkv_latent(normed) +k_peq_nope+q_pe; RoPE only on pe partsembed_qandunembed_outpe_scoresas mask (q_pe @ k_pe^T)embed_qon q_nope (not kv_latent), unembed_out post-SDPAq_head_dim^(-0.5), optionalmscale_all_dimfromrope_scalingTasks - KV cache
kv_latent([B, 1, T, kv_lora_rank]) +k_pe([B, 1, T, qk_rope_head_dim]), not full K/VNotes
mla.py/deepseek_v3.py, not mlx-serve ds4CacheList) is a separate issue on top of this base cache