witcheer commited on
Commit
a360ad2
·
verified ·
1 Parent(s): cd52677

Upload reports/keye-vl-2-autopsy.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. reports/keye-vl-2-autopsy.md +86 -0
reports/keye-vl-2-autopsy.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Keye-VL-2.0-30B on a consumer GPU: an autopsy — five measured walls between "open weights" and a running model
2
+
3
+ **Rig:** one RTX 5090 32GB · 64GB RAM · CUDA 12.8 (sm_120) · transformers 4.57.1 through 5.11 + 5.0.0rc0-rc3 tested
4
+ **Model:** [Kwai-Keye/Keye-VL-2.0-30B-A3B](https://huggingface.co/Kwai-Keye/Keye-VL-2.0-30B-A3B) (Apache 2.0, 30B/3B-active MoE, 62.3GB bf16) — Kuaishou's long-video VLM ([arXiv 2606.10651](https://arxiv.org/abs/2606.10651)): DeepSeek-style sparse attention adapted to a GQA multimodal stack, claiming **"lossless" 256K context / hour-level video**. Released ~2 weeks ago; zero community local-run reports existed before this attempt. This is what happened when one tried.
5
+
6
+ ## Wall 1: the 256K claim is dead on arrival at 32GB — by arithmetic
7
+
8
+ DSA here is **compute** sparsity, not KV compression: the full GQA KV cache is stored.
9
+ 48 layers x 2 x 4 KV heads x 128 dim x bf16 = **96 KiB/token → 25.8GB at 256K**, before
10
+ a single weight. With 62.3GB of bf16 weights and no quant path (wall 3), no configuration
11
+ of this model reaches 256K on any consumer card. The headline claim is datacenter-only.
12
+
13
+ ## Wall 2: the "sparse" attention is O(N²)-memory on consumer stacks — measured
14
+
15
+ The official fast path (forked SGLang + DeepGEMM + custom kernels, H800 x2 reference
16
+ config) does not build on sm_120 — DeepGEMM has no consumer-Blackwell support. The shipped
17
+ fallback is a pure-PyTorch reference implementation of DSA, and its indexer **materializes
18
+ the full N x N score matrix** (16 heads, bf16 = 32·N² bytes) before top-k:
19
+
20
+ | context | indexer scores | KV cache |
21
+ |---|---|---|
22
+ | 8K | 2.1GB | 0.8GB |
23
+ | 32K | **32.9GB — measured: one 30.65GiB allocation, OOM** | 3.2GB |
24
+ | 256K | 2.1TB | 25.8GB |
25
+
26
+ A 60-second video prompt (~32K tokens) OOMs a fully-drained 32GB card on the *indexer
27
+ scoring step alone*. The sparse-attention model is **more** memory-hungry than dense
28
+ attention everywhere its custom kernels don't exist.
29
+
30
+ ## Wall 3: 4-bit quantization reaches 4.7% of the model — measured
31
+
32
+ The experts are stored fused — 3D `nn.Parameter` tensors (`[128, 2048, 1536]` per layer),
33
+ not `nn.Linear` — so every consumer quantizer (bnb, torchao) walks right past them:
34
+ **452 Linear modules = 1.46B of 31.12B params (4.7%) is all that 4-bit can touch.**
35
+ No official quants exist, llama.cpp has no arch support (and no GGUFs), vLLM/SGLang
36
+ mainline don't register `KeyeVL2`, so the AWQ route is closed too. The only community
37
+ conversions that reportedly run are MLX 4-bit on Apple silicon (untested here).
38
+ On CUDA, bf16 + CPU offload is the only load that exists: 58GB footprint, 0.5 tok/s.
39
+
40
+ ## Wall 4: the code targets a one-week transformers API window
41
+
42
+ The trust_remote_code modeling file requires, simultaneously: `OutputRecorder` (removed
43
+ in 5.2), factory-form `check_model_inputs` (absent in 4.57), `SlidingWindowCache`
44
+ (removed in 5.0.0rc3), and the pre-flip fused-expert layout (changed in 5.0.0rc2).
45
+ The intersection: **transformers 5.0.0rc0 / rc1 — two release candidates** — and nothing
46
+ else, before or since. On stable 5.0/5.11 it took six compatibility shims (a pure-PyTorch
47
+ Hadamard stand-in for the unbuildable `fast-hadamard-transform`, a metadata-complete
48
+ `flash_attn` stub to pass a module-level availability assert, dead-import cache classes,
49
+ a rope-init function, config attribute patches, a rotary-class method) plus a 62GB
50
+ expert-tensor re-layout just to reach a forward pass.
51
+
52
+ ## Wall 5: it still doesn't work — and the diagnosis trail is exhaustive
53
+
54
+ On rc1, with the untouched original checkpoint and native semantics, generation is
55
+ incoherent noise. The per-layer trace shows **healthy hidden-state norms through all 48
56
+ layers** with garbage logits — well-scaled but semantically destroyed computation.
57
+ Systematically exonerated: the DSA path (the built-in dense fallback is equally broken),
58
+ expert orientation (dimensionally provable — gate_up must map 2048→1536, no transpose
59
+ ambiguity exists), gate/up chunk order (both tested), rope theta (10M, confirmed loaded),
60
+ M-RoPE text positions (explicit equals default), causal-mask alignment. Untried: pure-CPU
61
+ inference, transformers git-commit archaeology, and the official Hopper-only docker —
62
+ each past the point of reasonable cost.
63
+
64
+ **Verdict: thirteen run attempts deep, Keye-VL-2.0-30B does not produce coherent output
65
+ on consumer hardware through any reachable configuration.** For contrast, on this same
66
+ rig: HRM-Text-1B ran after one missing tensor was supplied; LocateAnything-3B ran after
67
+ one config knob. The gap between "open weights" and "runnable weights" has never measured
68
+ wider.
69
+
70
+ ## Honest caveats
71
+
72
+ - A subtle interaction with our compat shims cannot be 100% excluded as the noise source —
73
+ though the text path exercises none of their math (their attention is hand-rolled eager,
74
+ the Hadamard rotation only feeds top-k *selection*, and the dense fallback bypasses it
75
+ entirely and is equally broken).
76
+ - "Lossless 256K" itself was never benchmarkable here; the paper publishes no
77
+ needle-in-video curves either — the claim rests on benchmark aggregates.
78
+ - The model may be excellent inside its intended habitat (H800 pairs, their docker, their
79
+ SGLang fork). Every wall above is about the release engineering, not the research.
80
+
81
+ ## Reproduce
82
+
83
+ `scripts/keye_probe.py` (shims + smoke + quant verdict) · `scripts/keye_convert.py`
84
+ (expert re-layout, unnecessary on rc0/rc1) · `scripts/keye_diag.py` (layer-norm trace) ·
85
+ `scripts/chart_keye_walls.py`. Environment: uv venv, torch 2.11+cu128,
86
+ `transformers==5.0.0rc1`, bf16, `device_map=auto` (28GiB GPU / 42GiB CPU).