Description
Background
Follow-up to #367. #367 routed Turbo4Asym decode through an exact rotated-codec-basis dequant-SDPA, raising it from 0.14x fp16 (the old lossy sparse-V path) to ~0.40x and making it exact. But it still materializes a full dequantized V and runs attention as two passes, and the 4bit PolarQuant + Walsh-Hadamard V dequant is ~2x costlier than int8's linear dequant, so it caps around 0.40x fp16.
Measured on M1 Ultra, qwen2.5-7b-4bit decode tok/s:
| mode | 4k | 16k |
|---|---|---|
| fp16 | 98 | 70 |
| int8 | 75 | 48 |
| turbo4-asym (after #367) | 39 (0.40x) | 30 (0.43x) |
| turbo4-delegated | 78 (0.80x) | 51 (0.73x) |
Turbo4Delegated reaches 0.73-0.80x because it FUSES the cold-V dequant into the attention kernel (the steel-envelope attention_turbo4_delegated_steel / attention_turbo4_delegated_fused), never materializing the full V. Turbo4Delegated is effectively "Turbo4Asym + hot/cold split + fused decode".
Proposed work
Bring the fused dequant-into-attention approach to Turbo4Asym so it reaches int8/delegated decode throughput (0.7-0.8x fp16) without the hot/cold split, OR decide that the advisor should recommend Turbo4Delegated (already fast) for the fp16-K + 4bit-V use case and keep Turbo4Asym as the exact/simple fallback. Either adapt the delegated steel-envelope kernel for the non-hot/cold asym layout, or evaluate the recommend-Turbo4Delegated route.
Acceptance criteria
- Turbo4Asym decode reaches >= 0.7x fp16 at 4k/16k/32k on M1 Ultra, OR a documented decision that Turbo4Delegated is the recommended fast fp16-K+4bit-V mode and Turbo4Asym stays the exact/simple option.
- Numerically exact (parity with the dequant reference).
- No regression to other modes.
Activity
docs(cache): add ADR 0002 on Turbo KV split-dequant vs fused (sparse-…
inureyes commentedon Jun 20, 2026
Why fusion is the one lever (empirical, from the #354 sweep + A/B)
Cross-checked mlxcel's Turbo4Asym decode against the upstream turboquant_plus sparse-V paper to see whether reviving sparse-V (instead of fusing) could close the gap. It cannot. Full writeup in ADR 0002 (lands with #376).
A/B, M1 Ultra, decode tok/s, turbo4-asym:
Findings:
tau=1e-6skips only positions whose attention weight is below FP16 round-off (matches the paper's 0.0000 PPL delta). So the choice here is purely about speed.+22.8%is the skip kernel vs its own full-dequant baseline. The mlxcel analog (kernel vs graph) is +1.4% at 32K on the paper's exact model. Skipping the entire V weighted-sum (tau=1.0) equals full dequant.+22.8%lives inside a fused flash-attention where V dequant is a large, eliminable slice.Implication for this issue. Neither dequant-SDPA nor sparse-V can beat the 0.24x to 0.40x decode ceiling on cache-bound standard-attention models, because both leave the V dequant as a separate, non-overlapped step. The fused kernel (#370) is the only path that captures all three wins at once: V never materialized, the dequant rides inside the fused scores + softmax + accumulate, and the sparse-V skip finally removes hot-path work. When #370 lands, re-run the A/B above; the prediction is that a fused dequant-in-SDPA kernel is the first mlxcel path where the skip and the long-context bandwidth win both appear.
fix(cache): align Turbo KV advisor, gates, and docs with measured swe…
docs(cache): record #370 fused-V attempt regression, keep Turbo4Asym …
fix(cache): align Turbo KV advisor, gates, and docs with measured swe…
docs(cache): record lablup#370 fused-V attempt regression, keep Turbo…