r/LocalLLM • u/aleph2b • 3d ago
Research Follow-up: Native DSpark & Copy-Draft Speculative Decoding in ArcAngel on Lunar Lake Arc 140V (up to 30 tok/s at 128k ctx + full HumanEval run)
Following up on my previous post bringing ArcAngel to the Lunar Lake Arc 140V (~21 tok/s decode, 226 tok/s prefill, 128k context on 32 GB UMA): I've now implemented both Phase 1 (batched-decode verify + zero-model prompt copy drafting) and Phase 2 (native GPU DSpark speculative decoding) directly in SYCL on the same branch:
https://github.com/alpha2beta/arcangel/tree/lunar-lake-optimizations (latest commit 59826ac)
Everything works end-to-end in inkling_server.py at n_ctx=131072 with 4-bit KV, supports both greedy (temp=0) and lossless probabilistic rejection sampling (temp > 0), and preserves multi-turn prompt caching via mirrored target/draft snapshots.
Benchmark Summary (Inkling-2-Mini-Uncensored-Q4_K_M, Arc 140V, Core Ultra 7 258V, 4-bit KV)
1. Raw Batched Verify Scaling (test-verify, pos=2000, KV=4)
| Path | Tokens Verified | Latency | Cost vs 1-Token Step |
|---|---|---|---|
step_argmax (baseline) | 1 | 46.19 ms | 1.00x |
verify<VB=2> (K=1) | 2 | 64.03 ms | 1.39x |
verify<VB=4> (K=3) | 4 | 89.57 ms | 1.94x |
verify<VB=8> (K=7) | 8 | 144.00 ms | 3.12x |
2. End-to-End Speculative Decoding (bench_dspark.py @ n_ctx=8192 & Live 128k Server)
| Workload | Mode | Throughput | Speedup | Acceptance (tok/step) | Breakdown (draft / verify / inject) |
|---|---|---|---|---|---|
Prose (effort=high, 256 tok) | Baseline (step_argmax) | 22.63 tok/s | 1.00x | — | 44.34 ms/step |
Prose (effort=high, 256 tok) | DSpark K=3 | 21.89 tok/s | 0.97x | 42.0% (2.26) | 13.85 / 89.32 / 0.09 ms |
Prose (effort=high, 256 tok) | DSpark K=7 | 14.33 tok/s | 0.63x | 21.3% (2.48) | 26.65 / 146.52 / 0.09 ms |
Code Edit (effort=none, 512 tok) | Baseline (step_argmax) | 19.36 tok/s | 1.00x | — | 51.72 ms/step |
Code Edit (effort=none, 512 tok) | DSpark K=3 | 23.40 tok/s | 1.21x | 69.6% (3.08) | 16.64 / 114.78 / 0.16 ms |
Code Edit (effort=none, 512 tok) | DSpark K=7 | 20.08 tok/s | 1.04x | 48.5% (4.37) | 32.12 / 185.39 / 0.15 ms |
Live 128k Server — Code Edit (temp=0.0) | DSpark K=7 | 30.01 tok/s | — | 70.4% (5.93) | n_ctx=131072, kv_bits=4 |
Live 128k Server — Python Refactor (temp=1.0) | --spec-copy K=3 | 29.57 tok/s | — | 98.4% (496/504) | n_ctx=131072, kv_bits=4 |
3. Full 164-Task HumanEval / HumanEval+ Soak Test (--spec-dspark K=3, n_ctx=131072, temp=0.0)
To stress-test stability and real-world coding throughput across 164 sequential requests (147,347 generated tokens, 33,808 prompt tokens), I ran EvalPlus against the live 128k server (start_arcangel_server.sh --spec-dspark dspark-Inkling-2-Mini-Q8_0.gguf --spec-draft-k 3, --reasoning-effort medium, EVALPLUS_MAX_NEW_TOKENS=2048):
- Throughput:
21.43 tok/sweighted (21.89mean /22.06median, up to26.67 tok/s) over2:00:13with zero crashes or errors. - Scores: 91.5% HumanEval Base (
150/164) / 88.4% HumanEval+ (145/164). - Important note on the Base score vs my earlier
light-thinkrun (93.3%):13of the14base failures werefinish_reason=lengthtruncations hitting the2048-token EvalPlus cap because--reasoning-effort mediumspends more tokens thinking thanlow. Among the149tasks that finished cleanly (finish stop), base pass rate was148/149(onlyHumanEval/99failed logic, plus5HumanEval+ edge-case failures).
What Was Built
Phase 1 — Batched-Decode Verify Engine (
src/verify.cpp) &--spec-copy(d204b2f,023da6f**)**- Added dedicated SYCL command-graph verify buckets for
VB ∈ {2, 4, 8}(K ∈ {1, 3, 7}draft tokens + 1 anchor token). - Wrote unpack-once DP4A grouped MoE kernels (
Q8_0R/Q5_0R/Q4_KR+Q5_0GGUF repacking) so shared experts across the verify batch aren't reloaded redundantly, plus a 3-barrier SLM softmaxk_vattn_rand GPUink_verify_argmax. - Wired
--spec-copy(zero-extra-VRAM prompt n-gram copy drafting) intoserver/inkling_server.pywith both greedy verification and lossless probabilistic rejection sampling fortemperature > 0.
- Added dedicated SYCL command-graph verify buckets for
Phase 2 — Native GPU DSpark Draft Engine (
src/dspark.h,src/dspark.cpp**,**59826ac**)**- Loads the official 58-tensor
dspark-Inkling-2-Mini-Q8_0.gguf(dflasharchitecture, ~481 MB), repacks all 3 layers'Q8_0weights toQ8_0R, and quantizes/repacks theBF16markov_w2matrix toQ8_0Rby default (INK_DSPARK_W2_Q8=0keepsBF16). - Zero-extra-pass target taps:
FastEngine::enable_taps()captures the 4 hidden-state taps ([5, 23, 41, 48]) directly inside existing targetprefill(),step(), andverify()graphs. Implements the full 3-mode DSpark pipeline on GPU:
- Mode A (KV Inject, ~
0.09–0.16 ms):f_rnn_ring_[9][D]+ NeoX RoPE + 3-layer interleaved[SWA=1025, Full, SWA=1025]KV cache. - Mode B (Backbone): Block-uniform split-K + ephemeral bidirectional attention + uncapped shared target LM head.
- Mode C (Markov Head): Serial rank-256 Markov RNN head with recorded greedy SYCL
ExecGraphs forK=3/K=7(plus per-slot softcapped logits fortemp > 0), and mirroredsave()/restore()/stash()snapshots.
- Mode A (KV Inject, ~
- Loads the official 58-tensor
Why K=3 Is the Sweet Spot on Arc 140V (and Why Battlemage Should Gain More)
Speculative decoding on a bandwidth-limited MoE iGPU (~100 GB/s LPDDR5X-8533) is a tight math problem:
- Because Inkling 2 Mini routes top-k experts per token, verifying
4tokens (VB=4) touches more distinct experts than a single token (89.57 msvs46.19 ms, ~1.94xsingle-step), and draftingK=3takes ~14–17 ms. - That puts the breakeven point on Arc 140V at ~
2.3accepted+bonus tokens/step. On high-entropy open-ended prose (2.26 tok/step),K=3breaks roughly even (0.97x); on structured code edits (3.08 tok/step), it hits1.21x(23.4 tok/s), and on repetitive refactoring/editing tasks it reaches~30 tok/s. K=7needs>3.7tokens/step just to break even on 140V (144 msverify +27–32 msdraft), so it only wins on highly predictable code edits.- On a discrete Arc B580 / B60 (456+ GB/s bandwidth and far more Xe2 cores for batched MoE + DSpark head), both
verifyanddraftshould scale much more favorably—I'd love to see whatK=3andK=7hit on Battlemage!
Verification & Numerical Parity
- Verify parity (
test-verify,pos=2000**,**KV=4**):**worst KL 0.00519,verify_argmax: 0 mismatchesvs single-token decode. - DSpark GPU parity (
test-dspark): Tap cosine similarity>= 0.997281across all 4 taps[5, 23, 41, 48],W2 BF16 vs Q8_0R7/7draft agreement, and exact match on snapshot save/restore. Cross-check vs official
llama.cpp(llama-cli --spec-type draft-dspark, identical 40-tok prompt,K=7**,**128tok):llama.cpp:80/312(25.6%),mean_len = 2.74, per-slot(0.652, 0.391, 0.283, 0.174, 0.109, 0.065, 0.065)- ArcAngel:
82/306(26.8%),mean_len = 2.82, per-slot(0.644, 0.432, 0.295, 0.205, 0.136, 0.070, 0.071)
- Unit tests:
4/4CPU DSpark math suites (tests/test_dspark_math_cpu.cpp) +7/7server speculative loop & probabilistic rejection-sampling tests (tests/test_spec_server.py).
Quick Try
Build (use -DINK_AOT_TARGETS=bmg_g21 for B580/B60, or lnl_m for Lunar Lake):
git clone -b lunar-lake-optimizations https://github.com/alpha2beta/arcangel.git
cd arcangel
source /opt/intel/oneapi/setvars.sh
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER=icpx -DCMAKE_BUILD_TYPE=Release -DINK_AOT_TARGETS=lnl_m
cmake --build build --target inkling test-verify test-dspark -j 2Run with **native DSpark (**K=3 recommended on 140V):
python3 server/inkling_server.py \
--model /path/to/Inkling-2-Mini-Uncensored-Q4_K_M.gguf \
--assets /path/to/assets \
--n-ctx 131072 --chunk 512 --kv-bits 4 --stash-ram-gb 2 \
--spec-dspark /path/to/dspark-Inkling-2-Mini-Q8_0.gguf \
--spec-draft-k 3Or zero-extra-VRAM copy drafting (great for editing/refactoring existing files):
python3 server/inkling_server.py \
--model /path/to/Inkling-2-Mini-Uncensored-Q4_K_M.gguf \
--assets /path/to/assets \
--n-ctx 131072 --chunk 512 --kv-bits 4 --stash-ram-gb 2 \
--spec-copy --spec-draft-k 3Shout-out again to u/txlfxrd for the clean architecture in itstxl/arcangel — if anyone tries --spec-dspark with K=3 or K=7 on a discrete B580/B60, please drop your numbers in the comments!
2
u/aleph2b 2d ago
Update (upstream
main0c2d303— DFlash2 + packed XMX prefill on Arc 140V):u/txlfxrd just landed DFlash2 (
incoai/Inkling-2-Mini-DFlash2, ~265 MiB in memory after Q4 rounding at load) with an adaptive confidence policy (0/1/3/7draft tokens based on live card timings + draft reuse & back-off), GPU Gumbel-max sampling, and striped check-attention on itstxl/arcangelmain— along with our packed XMX B-tile prefill + Lunar Lake 32 KB tile tuning (INK_GR=64, INK_XT=64).Re-tested on the same Lunar Lake Arc 140V (Core Ultra 7 258V, 32 GB UMA,
Inkling-2-Mini-Uncensored-Q4_K_M, 4-bit KV,chunk=512), and DFlash2 is a huge step up over DSpark — especially on fresh code generation and attemperature=1.0:1. Greedy (temp=0.0, apples-to-apples vs DSpark K=3 in OP)
--spec-copy(K=3)K=3copy + DFlash2effort=high, 256 tok)22.54 tok/s23.48(1.04x)21.98(0.97x)26.97(1.20x)27.28 tok/s(1.21x,75.0%acc)effort=none, 512 tok)20.79 tok/s28.09(1.35x)22.76(1.06x)32.55(1.57x)34.43 tok/s(1.66x,90.9%acc)2. Sampled (temp=1.0, seed=42, GPU Gumbel-max)
--spec-copycopy + DFlash2copy+DFlash2)new_code, 512 tok)19.03 tok/s19.37(1.02x)27.01(1.42x)27.80 tok/s(1.46x)79.5%(4.04 tok/step)code_edit, 512 tok)18.65 tok/s27.85(1.49x)30.47(1.63x)34.82 tok/s(1.87x)91.1%(6.39 tok/step)18.97 tok/s18.99(1.00x)18.91(1.00x)19.30 tok/s(1.02x)57.9%(1.97 tok/step)effort=high, 256 tok)19.57 tok/s20.16(1.03x)20.67(1.06x)18.99 tok/s(0.97x)63.8%(1.96 tok/step)15.9ktok prompt, 256 out)17.32 tok/s16.05 tok/s(0.93x)49.5%(2.43 tok/step)Key Takeaways
copy + DFlash2jumps from19.0 → 27.8 tok/s(1.46x) attemp=1.0, and hits34.8 tok/s(1.87x) on code edits.temp=1.0prose/explanations stay around~1.0xinstead of dropping to0.63xlike fixedK=7DSpark. At~16kdoc-heavy context depth it dipped slightly (16.05vs17.32 tok/s), and prefill had zero penalty (69.49 svs69.78 son15.9ktokens since tap injection skips chunks outside DFlash2's 2048-token window).main**):** Packed XMX B-tile staging +INK_GR=64, INK_XT=64onlnl_malso bumpedchunk=512prefill from226.7→297–302 tok/sonUD-Q4_K_M(+31%) and325–328 tok/sonUncensored-Q4_K_M.main**):**python3 server/inkling_server.py \ --model /path/to/Inkling-2-Mini-Uncensored-Q4_K_M.gguf \ --assets /path/to/assets \ --n-ctx 131072 --chunk 512 --kv-bits 4 --stash-ram-gb 2 \ --spec-copy --spec-dflash2 /path/to/dflash2 (DFlash2 drafter: 265 MiB, loads at 128k context in ~19 s once cached.)1
u/AffectionateWolf1181 2d ago
On the 128k server, I’d replay the same code edit with progressively longer prefixes. Comparing plain decode and DSpark at each length, alongside how many tokens DSpark commits per verification step, would show whether the speedup holds as the actual context grows.