Skip to content

Kimi-Linear STRICT close: device NoPE-MLA + chunk_kda/incremental (row/KIMI-STRICT-CLOSE) - #107

Closed
localai-bot wants to merge 1 commit into
mainfrom
row/KIMI-STRICT-CLOSE
Closed

Kimi-Linear STRICT close: device NoPE-MLA + chunk_kda/incremental (row/KIMI-STRICT-CLOSE)#107
localai-bot wants to merge 1 commit into
mainfrom
row/KIMI-STRICT-CLOSE

Conversation

@localai-bot

@localai-bot localai-bot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Row row/KIMI-STRICT-CLOSE — closing Kimi-Linear-48B-A3B toward the STRICT 128-token gate (spec §15 residuals c/d/e).

Baseline (#104, spec §15): device-KDA (VT_KIMI_DEVICE_KDA) = 122/128 + 4.24 tok/s, default OFF; sole divergence = p7 pos-6 comma near-tie.

Result: device NoPE-MLA lever MEASURED-NEGATIVE — STRICT owes vLLM's ACTUAL kernels

The §15 residual (d) was attempted in its device-COMPUTE form and measured on the full 48.9B GB10 gate:

Config (VT_KIMI_DEVICE_COMPUTE=1) /128 tok/s verdict
control DEVICE_KDA=1 122 4.24 reproduces §15 EXACTLY
+ DEVICE_MLA=1 109 3.89 REGRESSION both axes

VT_KIMI_DEVICE_MLA routes the 7 NoPE-MLA layers' softmax core through vt::Attention (f32 online softmax; value zero-padded qk=192 vs v=128, out[:,:,:v] byte-exact). It is the right MATH but a DIFFERENT reduction order than vLLM's FA2, so it coin-flips near-ties (breaks p3 16→3 into the §14 163586× repeat) and the per-(t,h) build slows the O(n²) recompute — the §14 razor re-proven: an approximation of vLLM's kernel is not enough.

Verdict: VT_KIMI_DEVICE_MLA STAYS OFF, kept as a documented-MEASURED-NEGATIVE A/B knob (§14 ISLAND_F32ACC precedent). No default flip. Row STAYS ACTIVE.

Bricks

  • Device NoPE-MLA attention (VT_KIMI_DEVICE_MLA) — implemented, CPU RED-first gate 14/14·825, GB10-measured NEGATIVE. Kept as A/B knob.
  • chunk_kda prefill (residual c) — the named prime suspect; Triton-AOT regen for sm_121a. Substantial multi-kernel port, scoped.
  • paged FA2 mla::ForwardMlaAttentionBlock (residual d, the ACTUAL kernel) + paged-incremental decode (residual e, needs a decode/paged-attn op — query_len≠key_len, which vt::Attention cannot express). Scoped.

Gates: CPU test_kimi_linear_forward 14/14·825; GB10 CUDA build clean (210 GDN + 23 KDA syms); all doc/record gates green. Box left clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_014fZAcg1WcU8V629k6HWKys

…A) — MEASURED-NEGATIVE on GB10, STRICT owes the actual FA2/chunk_kda kernels (#107)

The spec §15 residual (d) — the 7 NoPE-MLA layers still run a host f64 softmax
island that is MORE precise than vLLM's FA2 and coin-flips near-ties — was
attempted in its device-COMPUTE form (the §15 device-KDA pattern applied to the
MLA half) and MEASURED NEGATIVE on the full 48.9B GB10 gate.

Implementation (additive, default OFF): `VT_KIMI_DEVICE_MLA` + `MlaAttnCoreDevice`
(kimi_linear_device.cpp) route the NoPE causal softmax over per-head
[k_nope|k_pe(shared)]/v through the shared device op vt::Attention (f32 online
max-subtracted softmax = vLLM's FA2 regime) instead of the f64 host
MlaSoftmaxIsland. vt::Attention carries one head-dim; MLA is asymmetric
(qk=qk_nope+qk_rope=192, v=128), so value is zero-PADDED to qk — the weighted sum
over the 0 tail is 0, so out[:,:,:v] is byte-exact. Wired into the f32 and bf16
paths. MLA dims VERIFIED from the real 48.9B config.json (nah=32, qk_nope=128,
qk_rope=64, v=128, kv_lora=512, q_lora=None; 7 full-attn/20 KDA) — not the K3 nums.

Unit gate (RED-first, CPU) GREEN: test_kimi_linear_forward 14/14·825 (was
13/13·656) — NEW case (g2) KimiMlaAttnCoreDevice (pad-V + vt::Attention) == a
from-first-principles f64 causal-softmax reference (rtol 3e-3); a perturbed scale
fails 108 assertions. Env-gated whole-forward green (VT_KIMI_DEVICE_MLA=1 alone
and with VT_KIMI_DEVICE_KDA=1). Same on the GB10 CUDA binary (210 GDN + 23 KDA
syms linked, CUTLASS-NVFP4 + FA2 + Triton-AOT).

Full 48.9B GB10 gate vs the §12 STRICT golden (single-load per config, flock
gpu.lock, min-avail 21 GiB, no reboot): control device-KDA reproduces 122/128 +
4.24 tok/s EXACTLY; +device-MLA REGRESSES to 109/128 AND 3.89 tok/s. Why (the §14
razor, re-proven): device-KDA works because its recurrence is the SAME algorithm
as vLLM's decode kernel (f32-on-bf16); but vLLM's MLA prefill uses FA2 (a specific
reduction ORDER) and vt::Attention's plain online-softmax is the right MATH in a
DIFFERENT order, so it coin-flips near-ties (breaks p3 16→3 into the §14 163586x
repeat) while p7 stays diverged, and the per-(t,h) build + pad-V waste slow the
O(n^2) recompute. An approximation of vLLM's kernel is not enough.

VERDICT: VT_KIMI_DEVICE_MLA STAYS OFF, kept as a documented-MEASURED-NEGATIVE A/B
knob (parity-lever precedent: §14 ISLAND_F32ACC). device-KDA (122/128, 4.24)
remains the best config, itself default OFF. The one-brick STRICT-close did NOT
land. STRICT residual, sharpened: needs vLLM's ACTUAL kernels — (c) chunk_kda
prefill family (Triton-AOT regen for sm_121a) + (d) paged FA2
mla::ForwardMlaAttentionBlock (NOT this vt::Attention approximation) + (e)
paged-incremental decode (needs a decode/paged-attn op, query_len != key_len).

Records: spec §16, benchmark-record entry, state.md anchored entry, NOW.md +
model-matrix row + docs/STATUS/BENCHMARKS/FEATURES one-liners. All doc/record
gates green. Box left clean (build tree/markers removed, worker restored, golden
preserved, no reboot).

FOLLOWING_AGENTS_PROTOCOL
Assisted-by: Claude Code:claude-opus-4-8 [ClaudeCode]
@mudler
mudler force-pushed the row/KIMI-STRICT-CLOSE branch from 8056c9b to 6a368df Compare August 7, 2026 10:40
mudler added a commit that referenced this pull request Aug 7, 2026
…ICT needs vLLM's actual kernels (#107)

row/KIMI-STRICT-CLOSE squash. The tractable §15 brick — routing the 7
NoPE-MLA layers through shared vt::Attention (f32 online softmax,
pad-V for the asymmetric qk=192/v=128 dims, MLA geometry VERIFIED from
the real 48.9B config) — implemented, RED-first unit-gated
(14/14-825), and MEASURED NEGATIVE on the full GB10 gate: 109/128 +
3.89 tok/s vs device-KDA's 122 + 4.24 — the right math in a DIFFERENT
reduction order than vLLM's FA2 coin-flips near-ties. VT_KIMI_DEVICE_MLA
stays OFF as a documented measured-negative A/B knob; no flips (122 !=
STRICT). Control reproduced #104 EXACTLY. Re-proves the razor: only
vLLM's ACTUAL kernels close the last near-tie. The real STRICT path,
scoped: (c) the FLA chunk_kda prefill family (4 Triton kernels +
sm_121a AOT regen — prime suspect); (d) paged FA2
mla::ForwardMlaAttentionBlock; (e) paged-incremental decode
(query_len != key_len paged attention; kills the O(n^2)).

FOLLOWING_AGENTS_PROTOCOL
Assisted-by: Claude Code:claude-opus-4-8 [ClaudeCode]
@localai-bot

Copy link
Copy Markdown
Collaborator Author

Landed on main as the squash (mudler authorship). The three real STRICT bricks are the scoped next campaign; its GPU leg must RE-PARK local-ai-worker first (restored, 35GB resident — cannot co-tenant the 92GB Kimi load).

🤖 Generated with Claude Code

https://claude.ai/code/session_014fZAcg1WcU8V629k6HWKys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants