Skip to content
larryllrPublic

About

LLR (Lossless Logit Regrafting): Multi-round filtration-exact speculative tree decoding across Transformers (7B-32B) and Blackwell SM120 hybrid linear-attention models

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LLR: Lossless Logit Regrafting

Filtration-Exact Multi-Source Speculative Tree Decoding, Roofline Fusion & Zero-Dependency Quantization, and Blackwell SM120 Hybrid Linear-Attention Co-Design

License Python PyTorch Lossless Tests vLLM SGLang

LLR (Lossless Logit Regrafting) is a pure inference-time, zero-retraining, multi-round filtration-exact speculative decoding framework that stacks orthogonally on top of any drafter — including ONE single universal, zero-patch vLLM V1 GPU plugin (method="llr", auto-dispatching across Zero-Draft, EAGLE-3/EAGLE, DFlash/DSpark, MTP, and any standalone draft LLM), a one-click, zero-patch SGLang 2D-Tree launcher (llr-sglang-serve on sglang==0.5.23 EAGLEWorkerV2), standalone small draft models (Qwen2.5-0.5B), or zero-draft model-free decoding (0 GB extra VRAM) — across both pure Transformers (1.7B–32B: Qwen3, Llama-3.1, Qwen2.5) and Blackwell SM120 dense hybrid linear-attention models (Qwen3.8-27B Basalt C++20/CUDA NVFP4).

LLR 6-Scale Real-GPU Benchmark Suite

Controlled Same-Engine Head-to-Head vs. Token Recycling (ACL 2025)

LLR SM120 Memory Bound, Long-Context Scaling & Temperature Sweep

LLR Stock vLLM 0.34.0 Continuous Batching (B=1..16) & Cross-Platform RTX 4080 12 GiB Evaluation

LLR Live Online Poisson Serving & Held-Out Starlette Attribution on NVIDIA L4


Key Highlights (All Real-GPU Measured & Lossless Audited)

  • ONE Single Universal Zero-Patch vLLM V1 Plugin (method="llr") & SGLang 2D-Tree CLI (llr-sglang-serve):

    • vLLM V1 (vllm>=0.34.0, zero patches — ONE method name method="llr" auto-dispatches everywhere!):
      • No-Draft-Model ({"method": "llr", "num_speculative_tokens": 8}, ~4 MiB GPU Triton state): outperforms BOTH stock vLLM AR AND built-in GPU suffix across all 8/8 (GPU, Batch) offline-wave cells ($B \in {1,4,8,16}$, cold-corpus reset per B, every 95% CI > 1.000×): L4 Qwen3-8B BF16 +7.2% to +11.4% over suffix (1.99× to 1.14× AR, -10.2% P95 at B=16 where ngram drops to 0.85×); RTX 4080 Qwen3-1.7B BF16 +5.2% to +7.5% over suffix (206.9 → 1,447.3 tok/s, 32/32 vs suffix). In live online Poisson serving (vllm serve, 64 reqs, l4_vllm_online_poisson.json), llr_shared_k8 achieves 1.116× ($\lambda{=}2.0$, block CI [0.980, 1.207]) and 1.186× ($\lambda{=}4.0$, block CI [1.159, 1.222], -63.7% client TTFT P50, +12.1% sustained tok/s) over suffix_k8.
      • Auto-Dispatched Neural EAGLE-3 ({"method": "llr", "model": "Tengyunw/qwen3_8b_eagle3", "num_speculative_tokens": 8} — SM89 FP8 draft + Zero-Sync Prefill + Uniform-Batch Dynamic K [(1,8,8),(9,16,5),(17,1024,4)]):
        • Offline Waves (l4_vllm_universal_offline.json): accelerates cold L4 eagle3_k8 by +23.6% at B=1 (37.1 → 45.8 tok/s, 32/32 exact parity, TTFT -23.4 ms), +12.5% at B=4 (E2E P95 -18.6%), and +16.3% at B=8 (164.1 → 190.8 tok/s) while flipping old v3's +52 ms B=8 TTFT stall into a -33.1 ms speedup (363.8 → 330.7 ms).
        • Live Online Poisson HTTP/SSE Sweep (l4_vllm_universal_poisson.json, request-scoped VLLM_LLR_TENANT_ISOLATION=1): beats BOTH eagle3_k8 AND tuned eagle3_k5 across EVERY metric at BOTH rates with zero manual K tuning: at $\lambda{=}2.0,\text{req/s}$, 1.174× vs eagle3_k8 (4-req block CI [1.154, 1.194]) and 1.068× vs eagle3_k5 (block CI [1.055, 1.084], E2E 5.04 / 6.27 s); at saturated $\lambda{=}4.0,\text{req/s}$, 1.462× vs eagle3_k8 (block CI [1.372, 1.548], -80.0% P95 TTFT) and 1.111× vs tuned eagle3_k5 (block CI [1.065, 1.153], E2E P95 9.69 → 8.08 s, 420.7 tok/s sustained).
        • Decisive Matched Multi-Seed Natural-EOS Online Controls (outputs_l4_paper/l4_vllm_matched_online_ablation.json & l4_vllm_matched_fp8_nograft_h2h.json, 3 independent Poisson seeds 101/202/303 × 48 = 144 reqs/arm/rate, max_tokens=384, 83.3%–85.4% natural EOS, text_sha256 archived): gives stock eagle3 the exact same vLLM native Dynamic K ([(1,8,8),(9,16,5),(17,1024,4)]) and matches BF16 draft weights across Arms 2–4, decomposing the 1.276× / 1.352× total E2E speedup over static e3_k8 into: (1) vLLM native Dynamic K: 1.159× (blk4 [1.131, 1.187]) / 1.223× ([1.209, 1.238]); (2) Pure BF16 Fast-Path + Decoupled Steps + Mid-Chain (enable_regraft=false, enable_ngram_bank=false): +3.97% ([1.015, 1.067], 3/3 seeds) / +3.65% ([1.018, 1.058], 3/3 seeds; TTFT P95 888 → 525 ms); (3) Honest Marginal Regraft+Bank cost in request-scoped 1D neural EAGLE-3: -2.56% (0.974×) / -1.25% (0.988×) under BF16, and a dedicated same-VM SM89 FP8 head-to-head (l4_vllm_matched_fp8_nograft_h2h.json, kept separate from VM#1 to avoid cross-VM bias) confirms disabling both (speculator_options: {"enable_regraft": false, "enable_ngram_bank": false} or VLLM_LLR_ENABLE_REGRAFT=0 VLLM_LLR_ENABLE_NGRAM_BANK=0) adds +2.13% (blk4 [1.011, 1.032], 3/3 seeds) at $\lambda{=}2.0$ and matches parity (1.002×, [0.995, 1.009]) at $\lambda{=}4.0$; and (4) Pure SM89 FP8 Draft Quantization: +8.65% ([1.078, 1.096], 3/3 seeds) / +7.94% ([1.070, 1.089], 3/3 seeds) — delivering 1.101× ([1.075, 1.128], 3/3 seeds) / 1.105× ([1.085, 1.127], 3/3 seeds, 417.9 tok/s, TTFT P95 -44.8%) net over matched Dynamic-K stock eagle3. Observed full-text text_sha256 match rates (99/144–108/144; same-VM FP8 nograft vs full 100/144, 104/144) fall in a similar range to stock e3_dyn vs e3_k8 (105/144, 110/144); first-divergence logits were not archived in these online HTTP runs.
      • Auto-Dispatched DFlash / DSpark / MTP / Standalone Draft LLMs (l4_vllm_universal_dflash.json): passing {"method": "llr", "model": "z-lab/Qwen3-4B-DFlash-b16"} auto-detects DFlash, auto-infers K=15, preserves FULL_DECODE_ONLY CUDA graphs and 27/32 AR parity (vs stock DFlash 26/32), hits 0.991× statistical parity at cold B=8 (563.8 vs 568.8 tok/s; transparently disclosing -14.9% / -7.5% cold-scan overhead at B=1,4 on fast 4B models), and reaches 1.725× (590.5 tok/s, 6.16× AR) at warm B=4 and 1.518× (878.7 tok/s, 4.68× AR) at warm B=8 (aggregate warm-burst wave throughput without per-wave records or a full pre-warm protocol; workload-specific stress test).
  • Controlled Head-to-Head vs. Same-Engine Token Recycling (ACL 2025) Re-Implementation (outputs_l4_paper/l4_token_recycling_head2head.json, 10,000-resample paired bootstrap CIs):

    • Under the identical engine (LLREngine + Triton GQA CUDA Graphs), identical single fixed bucket, and identical suffix setting across 3 suites on NVIDIA L4 BF16 (re-implementing Token Recycling's $|V|\times 8$ adjacency map as a sparse Python dictionary + dynamic Zipfian priority-BFS heap, whereas upstream Luo et al. uses a fixed static tree template and a GPU-resident adjacency tensor):
      • Wide Zero-Draft (B=32, 0 GB draft VRAM): same-engine $|V|\times 8$ Token Recycling beats sparse single-branch RegraftOnly, BankOnly, and Regraft+Bank standalone by filling all 32 slots (32.40 vs 29.38 Qwen3; 29.92 vs 27.70 Llama-3.1); however, composing TR + 3-Way Regraft wins ALL 4/4 tested $B=32$ settings with strictly positive 95% CIs: Qwen3-8B Suffix ON +6.74% ([+4.21%, +9.37%], 34.58 tok/s = 2.19× AR, 27/32 wins, LowRep +7.88%, BF16 parity 15/32 vs 11/32 TR) and Suffix OFF +7.87% ([+5.37%, +10.36%], 28/32, LowRep +10.94%, parity 14/32); Llama-3.1-8B Suffix ON +4.36% ([+1.15%, +7.45%], LowRep +5.80%, parity 12/24 vs 13/24 TR) and Suffix OFF +6.39% ([+4.54%, +8.28%], 21/24, LowRep +8.64%, parity 12/24).
      • Tight-Budget 1D EAGLE-3 Chain (B=16, Suffix OFF, ~10 spare slots): transparently reports the -1.67% [-2.87%, -0.43%] crowd-out tradeoff (40.98 vs 41.68 tok/s, parity 13/32 vs 15/32) in this tested regime without extrapolating a fixed slot threshold across untested budgets/drafters.
    • SGLang 2D-Tree LLR (llr-sglang-serve on unmodified sglang==0.5.23 EAGLEWorkerV2, D=32, zero patches):
      • Cold-Corpus 32-Prompt Suite (l4_sglang_2d_tree_bench.json): Zero-Draft depth-24 2D Suffix Fast-Path + zero-sync novel passthrough + high-signal 2D grafting lifts stock SGLang 2D EAGLE-3 to 50.2 tok/s (3.01× AR, +19.9% [+9.6%, +35.1%] vs e3, JSON 94.1 tok/s = 2.12×, Code-Edit 57.2 tok/s = +58.5%) at B=1, with positive point estimates (crossing-zero CIs) at B=4 (115.0, +1.6%) and B=8 (174.2, +5.8% / +6.9% vs overlap).
    • Held-Out Third-Party starlette 1.10.0 Attribution & AST Structural Check (l4_vllm_heldout_starlette.json & l4_sglang_heldout_starlette.json):
      • Indexing 36 held-out starlette Python files (58,877 corpus tokens scanned+tokenized in 269–278 ms) across 16 AST-extracted edit prompts (max_tokens=320), every mode passes 16/16 AST structural checks, 16/16 finish below the 320-token cap, and 16/16 (100%) exact parity: vLLM llr_eagle3 hits 113.4 tok/s (3.30×) at B=1 and 406.0 tok/s (4.65×) at B=4; SGLang 2D-Tree LLR hits 118.9 tok/s (3.30×) at B=1 and 284.6 tok/s (3.01×; +7.56% [-0.37%, +15.28%] vs nocorpus, +3.98% [-0.31%, +9.66%] vs repo_nograft, both CIs crossing zero) at B=4. Controlled attribution confirms that on verbatim in-prompt edits, Prompt/Suffix Fast-Path drives nearly the entire 3.3×–5.2× speedup over neural EAGLE-3 (our same-repo suffix-only plugin control suffix_repo_k16 reaches 114.2 / 450.3 tok/s).
  • Up to 112.33 tok/s (7.80× vs BF16 AR / 2.45× vs same-precision W4A16 AR / 1.46× vs W4A16 E3-Tree) on a single NVIDIA L4 (Qwen3-8B) in just 5.73 GiB total VRAM (0/48 audit errors!):

    • Stacking our zero-dependency Target Operator Fusion (F.rms_norm + Fused QKV + Fused GateUp + single-pass HBM Triton SwiGLU) + Single-Weight-Read Split-K W4A16 INT4 + Rowwise FP8 lm_head + LLR Ultra (LLRConfig.ultra()) slashes Q=1 pass time from 68.94 → 20.65 ms and B=48 from 85.92 → 40.13 ms:
      • Code-Edit (T=0): 112.33 tok/s (7.80× vs BF16 AR, 2.45× vs W4A16 AR, +45.7% vs W4A16 E3-Tree, err=0) — and Zero-Draft LLR (0 GB draft VRAM) hits 97.39 tok/s (+26.3% over Vanilla E3-Tree!)
      • HumanEval (T=0): 94.96 tok/s (6.59× vs BF16 AR, 2.02× vs W4A16 AR, +28.0% vs W4A16 E3-Tree, err=0)
    • Rowwise FP8 + FP8 lm_head (8.85 GiB total VRAM): 95.55 tok/s on Code-Edit (4.16× vs FP8 AR, +51.3% vs FP8 E3-Tree), 85.10 tok/s on HumanEval (3.68× vs FP8 AR, +33.0% vs FP8 E3-Tree).
  • 32B Pure Transformer Scale Proof on Blackwell G4 96GB (Qwen/Qwen3-32B + RedHatAI/Qwen3-32B-speculator.eagle3, 0/48 audit errors!):

    • BF16 Fused Ops (257× F.rms_norm + 64× Fused QKV + 64× Fused GateUp + Triton SwiGLU, 63.81 GiB): Code-Edit 111.03 tok/s (5.50× vs BF16 AR, +31.1% vs E3-Tree, τ=6.44), HumanEval 88.10 tok/s (4.34×, +13.5% vs Tree); Zero-Draft LLR (0 GB draft) reaches 63.39 tok/s (3.14×) on Code-Edit!
    • Fused Ops + Split-K W4A16 v2 + Rowwise FP8 lm_head (20.07 GiB total VRAM — fits a single 24GB GPU!): Code-Edit 127.98 tok/s (6.34× vs BF16 AR, 2.16× vs W4A16 AR, +22.2% vs W4A16 Tree), HumanEval 107.17 tok/s (5.28× vs BF16 AR, 1.78× vs W4A16 AR, +12.9% vs W4A16 Tree).
  • 3-Family BF16 Cross-Architecture Proof & Three-Regime Paired Attribution on NVIDIA L4 (N=16–32, cap 256 tok):

    • Qwen3-8B + EAGLE-3: Code-Edit 60.21–60.75 tok/s (3.87–4.18× same-run AR, +43.9% to +46.4% vs Triton E3-Tree), HumanEval 57.73 (4.00×, +31.9%), GSM8K 49.46 (3.43×), MT-Bench T=0.7 32.98 (+4.4%); External Tier-2 Corpus proof +6.5% with 2.5× more Fast-Path hits (123/137).
    • Three-Regime Paired Attribution (Clean Post-CE4, graft_attempts == 0 asserted on all baselines, 95% paired bootstrap CIs, same Triton GQA kernel):
      • Regime 1 — Zero-Draft (0 GB extra VRAM, 55/56 faster paired runs across 2 families: 31/32 Qwen3 + 24/24 Llama-3.1 with overlapping prompt IDs): 3-way counterfactual regrafting alone adds +13.83% ([+11.84%, +15.90%], 31/32; +13.63% CE, +13.83% LowRep 16/16) on Qwen3-8B and +14.48% ([+12.31%, +16.70%], 24/24, +15.65% on the low-repeat HumanEval/MT-Bench subset) on Llama-3.1-8B-Instruct.
      • Regime 2 — 1D Chain Speculation (Qwen3-8B + 1-layer EAGLE-3 head beam=1, N=32, fixed B=16 bucket, ZERO Suffix): pure 3-way regrafting alone adds +4.41% ([+3.11%, +5.63%], 28/32, 1,120 tokens salvaged), pure rejected-logit recycling (3-way regraft + 3-gram bank, no Suffix) adds +13.02% ([+11.17%, +14.87%], 31/32; +16.59% CE, +9.35% on the low-repeat subset, 2,187 tokens salvaged), 1D Chain + Full LLR adds +38.78% (+61.91% CE), and Full LLR Tree adds +53.07% (32/32 wins, +67.60% CE, +40.03% low-repeat)!
      • Regime 3 — Wide B=48 EAGLE-3 Tree (Qwen3-8B, N=32, clean post-CE4 l4_rev5_table3_clean.json, commit 2d6a01d): the online 3-gram bank adds +4.57% ([+2.92%, +6.24%], 27/32; +6.46% on CE, +2.69% on LowRep) over an in-engine SuffixDecoding-style baseline (C5), while passive 3-way regrafting (C1b, enable_graft_fast_path=False, now default in LLRConfig.recommended()) achieves the highest overall τ = 4.82 and 60.75 tok/s (τ = 5.41, +46.4% vs E3-Tree, 16/16 wins) on Code-Edit.
    • Llama-3.1-8B-Instruct + RedHatAI EAGLE-3 (29/88 raw exact, 59/88 BF16 near-tie ≤0.5, 0/88 >0.5 gap): Code-Edit 61.30 tok/s (4.10×, +18.5% vs Triton E3-Tree), HumanEval 54.20 (3.62×, +4.9%), GSM8K 50.80 (3.40×, parity), MT-Bench 40.71 (2.72×).
    • Qwen2.5-7B-Instruct + 0.5B (Odd G=7 GQA; 18/72 raw exact, 54/72 BF16 near-tie ≤0.5, 0/72 >0.5 gap): Code-Edit 42.98 tok/s (2.66×, +49.5% vs Std-SD), HumanEval 29.13 (+23.2%), GSM8K 34.45 (+22.4%), MT-Bench 22.52 (+33.9%).
  • Blackwell G4 96GB (RTX PRO 6000 SM120) Dense Hybrid Gated-DeltaNet + Full-Attention GQA + DFlash 2 (Basalt C++20/CUDA — 11/11 Byte-Exact Decoded Text!):

    • End-to-End SM120 Multi-Branch Tree Verifier Inside Basalt (integrations/basalt/, BASALT_LLR_TREE=1, passes 4/4 Basalt CI checks & 4/4 SM120 ctest in 1.60s): wires our Fused 4-Block SM120 Cluster Fork-Join GDN Kernel (T<=32) (dec_gdn_rec_tree_fused_dev, early_trigger PDL overlap, register-cached conv for T<=16 & reverse-DFS in-place SMEM conv for T=32, 0.000e+00 / 0 BF16 mismatches), Bit-Exact Logical-Tail MMA GQA (decode_tree_tail_mma_kernel, 0.000e+00 across 1-chunk & 2-chunk T=32 boundaries) + FP16/INT8/NVFP4 KV Compaction (0 mismatches), GPU DFlash2 Markov Tree extractor (candidate_tree_kernel), rejected-node outv 3-way counterfactual spine & 3-gram bank harvesting, and 3-Regime (T ∈ {8, 16, 32}) Tree Planner directly into dense hybrid Qwen3.8-27B-QUASAR-NVFP4:
      • Recommended T<=16 (2 blk/SM, 43.1 KB, 11/11 Byte-Exact Archived Text!): cuts target passes by -12.2% (403 → 354), reaching 447.56 tok/s (5.27× vs Plain AR 84.90 tok/s, +2.23% 95% CI [-0.64%, +5.15%] decode-only / +2.11% [-0.61%, +4.91%] incl. prefill vs Upstream 1D Chain16 ABBA 437.79 tok/s, single run), winning Structured (+4.21%, 414.44), HumanEval (+2.86%, 374.82, +10.4% on humaneval_1), and Code-Edit (+2.66%, 579.99, 620.16 on code_edit_3) with zero text consistency cost!
      • 3-Regime T<=32 (--spec 32, 76.8 KB 2-slot runtime / 91.0 KiB 3-slot < 99 KiB, 11/11 Byte-Exact Archived Text!): 438.34 tok/s (5.16× vs AR, +0.12% [-2.41%, +2.63%] vs Chain16 ABBA; +1.49% [-1.76%, +4.70%] overall / +6.32% Code-Edit vs 1D Chain32; ~3% of windows reach 32 slots), peaking at 673.86 tok/s (+17.2% vs Chain16, 7.94× vs AR) on code_edit_3 (WIDE=0), while quantifying the SM120 T=32 occupancy wall (2 blk/SM → 1 blk/SM: 1.78 → 4.60 ms/48L).
    • 1D Linear Route C v2/v3 (BASALT_LLR=1, ABBA OFF/ON/ON/OFF, 11/11 bit-exact): +18.14% on Turn-2 code_edit_2 (445.05 → 525.79 tok/s), zero-regression across all 4 categories (426.49 → 433.57 tok/s).
    • Provable Heavy-Child-Last DFS LIFO Bound (Proposition 1): $D_{\text{fork}} \le \lfloor \log_2 L \rfloor \le 3 \implies \le 69{,}504,\text{B}$ (67.88 KiB, non-fused) and $\le 71{,}808,\text{B}$ (70.13 KiB, fused cluster) < 101,376 B (99 KiB SM120 limit) for every 16-node tree, 43,136 B (2 blocks/SM, 37.0 μs/L, 1.51× vs 2-slot) at $T=16, D_{\text{fork}} \le 1$, and 76,800 B (75.00 KiB < 99 KiB) for nested 2-slot $T=32$ super-trees!
  • Long-Context Scaling (512 → 8192) & Cross-Round Filtration-Exact Stochastic Sweep (T = 0.0 → 1.0, Qwen3-8B BF16 on L4):

    • Triton Dynamic-KV GQA (B=48, 8K cap): 1.57× faster than Static-KV HF SDPA at L=512 (77.35 vs 121.78 ms) and 1.52× faster than Dynamic-KV HF SDPA (1.36× vs Static-KV SDPA) at L=8192 (90.45 vs 137.87 ms, 4.2× flatter slope!).
    • Stochastic Sampling (top_p=0.9, N=12 mixed, Clean Post-CE4 Filtration-Exact Verifier, graft_attempts == 0 on Vanilla E3-Tree): LLR sustains +31.01% at T=0.0 (54.57 vs 41.65, CI [+19.94%, +44.31%], 12/12 wins), +21.96% at T=0.6 (46.17 vs 37.86, CI [+9.25%, +37.42%], 8/12), +24.64% at T=0.8 (45.81 vs 36.75, CI [+13.52%, +38.91%], 11/12), and +24.58% at T=1.0 (46.96 vs 37.69, CI [+12.71%, +39.27%], 11/12), backed by a reproducible 30,000-trial 6-regime all-lineage $\chi^2$ audit + 4-counterexample suite (python scripts/run_chi2_audit.py --trials 5000 --seed 20261129 --max-nodes 10, all $p \in [0.125, 0.779]$).
  • Turnkey Ecosystem & Production Serving Plugins:

    • One-click native vLLM V1 general plugin (method="llr" & method="llr_eagle3", auto-registered via vllm.general_plugins, zero patches, ~4 MiB extra VRAM, VLLM_LLR_CORPUS_PATH, VLLM_LLR_TENANT_ISOLATION=1);
    • OpenAI-compatible local server (llr-serve) with real SSE streaming ("stream": true), per-tenant corpus isolation (X-LLR-Tenant / tenant_id), bounded global FIFO corpus eviction (--max-corpus-sequences, --max-corpus-tokens), live /v1/llr/corpus endpoint, and VS Code / Cursor Companion Extension (integrations/vscode-llr-corpus);
    • SGLang EAGLEWorker adapter, llr-index-repo Git corpus CLI, and 7.05 μs/query C++17 FastSuffixIndex.

Core Architecture

  1. Counterfactual Spine Salvage & 3-Way Edit Regrafting (Sub / Ins / Del + Top-2 Sibling + $p_{\text{cf}}$): Recycles already-computed target logits from rejected branches into the next verification lattice (llr/spine.py, llr/graft.py).
  2. Two-Tier Persistent CorpusSuffixIndex + 3-Gram Target Bank + C++17 Accelerator: Captures session-local and repository/RAG/multi-turn continuations in 7.05 μs (llr/suffix_bank.py, llr/fast_cpu/), firing Dual-Confirmed Zero-Draft Fast-Paths.
  3. Custom Triton Dynamic-KV GQA Tree Attention (llr/triton_tree_attn.py): Zero-model-edit HF registration (ALL_ATTENTION_FUNCTIONS["llr_tree"]) supporting odd GQA (G=7), dynamic CUDA-Graph KV bounds, and -8.5% to -10.2% faster tree verification.
  4. Roofline Target Fusion + Zero-Dependency Quantization (llr/target_opt.py, llr/quant.py): F.rms_norm + fused QKV + fused GateUp + single-pass Triton SwiGLU stacked with Per-Token Rowwise FP8 and Single-Weight-Read Split-K W4A16 INT4 (5.73 GiB for 8B, 20.07 GiB for 32B!).
  5. Hardware-Calibrated DP Tree & Online EMA Controller (llr/tree_dp.py, llr/adaptive.py): Strictly-causal dynamic bucket & frontier control (LLRConfig.ultra() / LLRConfig.recommended()).
  6. Basalt & Strata C++20 / SM120-CUDA Integrations (integrations/basalt/, integrations/strata/):
    • Basalt (v0.5.7+ HEAD 148bc44): Complete End-to-End SM120 Multi-Branch Tree Verifier (integrations/basalt/apply_llr_tree_patch.py, BASALT_LLR_TREE=1 — fused 4-block SM120 cluster GDN kernel, tree-masked GQA + FP16/INT8/NVFP4 KV compaction, GPU DFlash2 Markov tree extractor, and 2-regime T∈{8,16} planner), plus 1D linear Route C v2/v3 (apply_llr_patch.py, BASALT_LLR=1), C++20 DeltaNetTreeVerifier, and self-contained Colab G4 notebook (notebooks/colab_llm_unified_LLR_Bench.ipynb).
    • Strata (v0.2.23+ HEAD 4560d03): Backend-agnostic C++20 strata::spec::DraftSource plugin (integrations/strata/, +17 / -3 lines across 5 upstream files, STRATA_LLR=1 + STRATA_LLR_CORPUS_FILE with --lookup-chain), compiling across CPU, CUDA, HIP, Metal, and SYCL (7/7 Strata ctest passing, 2.50× multi-turn step speedup, 60/60 3-way counterfactual spine salvage, 0 regression on unseen text).

Quickstart

Installation (from Source)

git clone https://github.com/larryllr/LLR.git
cd LLR
pip install -e ".[dev,bench]"

Note on Consumer 12 GiB GPUs & Platform Support (Verified on Physical RTX 4080 Laptop 12 GiB): On Linux / WSL2 with Triton (triton>=3.0), you can use EITHER the third-party vLLM V1 plugin (method="llr", 206.9 → 1,447.3 tok/s across offline waves B=1..16 on Qwen3-1.7B) OR our standalone Triton Split-K W4A16 INT4 (--quant int4) engine (Qwen3-8B + EAGLE-3 fits in 5.09 → 6.19 GiB alloc with >4.5 GiB headroom, reaching 125.54 tok/s short / 162.51 tok/s edit / 342.4 tok/s peak JSON!). On native Windows without Triton (triton=False), use --quant fp8 (native cuBLASLt torch._scaled_mm, 8.27 → 9.39 GiB alloc, 11.95 GiB peak host RSS), reaching 77.61 tok/s (3.39× AR, +27.1% vs E3-Tree; 100.82 tok/s edit/struct). llr-serve supports UTF-8 multi-byte-safe OpenAI SSE streaming ("stream": true), per-tenant corpus isolation (X-LLR-Tenant), and bounded global FIFO corpus eviction.

1. One-Click Universal vLLM V1 Plugin (method="llr") & SGLang 2D-Tree CLI (Zero Patches)

# Works on stock vLLM >= 0.34.0 AND stock SGLang >= 0.5.10 / 0.5.23+ with ZERO source patches:
pip install -e .

# ONE single universal method name ("llr") auto-dispatches across ALL vLLM V1 drafter families:

# 1) Zero-Extra-VRAM GPU LLR (~4 MiB Triton state, works on ANY LLM):
vllm serve Qwen/Qwen3-8B \
    --speculative-config '{"method": "llr", "num_speculative_tokens": 8}'

# 2) EAGLE-3 / EAGLE + GPU LLR (auto SM89 FP8 draft + Zero-Sync Prefill + Uniform Dynamic K):
vllm serve Qwen/Qwen3-8B \
    --speculative-config '{"method": "llr", "model": "Tengyunw/qwen3_8b_eagle3", "num_speculative_tokens": 8}'

# 3) DFlash / DSpark Parallel Block-Diffusion + GPU LLR (auto-infers K=block_size-1):
vllm serve Qwen/Qwen3-4B \
    --speculative-config '{"method": "llr", "model": "z-lab/Qwen3-4B-DFlash-b16"}'

# 4) Built-in MTP or ANY Standalone Small Draft LLM + GPU LLR:
vllm serve Qwen/Qwen2.5-7B-Instruct \
    --speculative-config '{"method": "llr", "model": "Qwen/Qwen2.5-0.5B-Instruct", "num_speculative_tokens": 8}'

# 5) SGLang 2D-Tree LLR (EAGLEWorkerV2 D=32, 50.2 tok/s cold / 118.9 tok/s = 3.30x held-out starlette):
llr-sglang-serve \
    --model-path Qwen/Qwen3-8B \
    --speculative-draft-model-path Tengyunw/qwen3_8b_eagle3 \
    --repo /path/to/your/codebase \
    --attention-backend triton --port 30000

See integrations/serving/README.md for complete cold-corpus & workspace repo-corpus tables, VLLM_LLR_CORPUS_PATH, VLLM_LLR_TENANT_ISOLATION=1, and Python API examples.

2. Ultimate Single-Stream Speed on an 8–24 GB GPU (Fused Ops + Split-K W4A16 + LLR Ultra, 5.73 GiB for 8B / 20.07 GiB for 32B!)

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from llr import (
    Eagle3DraftBackend, Eagle3DraftModel, HFModelBackend, LLRConfig, LLREngine,
    optimize_target_model_lossless, quantize_target_int4_triton,
)

target_id = "Qwen/Qwen3-8B"
tok = AutoTokenizer.from_pretrained(target_id)
# Stage on CPU before quantizing so 8B models fit 12 GiB GPUs without a 15.3 GiB BF16 startup peak:
model = AutoModelForCausalLM.from_pretrained(target_id, dtype=torch.bfloat16, device_map="cpu").eval()

# 1. Fuse F.rms_norm + Fused QKV + Fused GateUp + Triton SwiGLU (0% loss)
optimize_target_model_lossless(model)
# 2. Single-weight-read Split-K W4A16 INT4 + Rowwise FP8 lm_head (~5.7 GiB on 8B, ~20.1 GiB on 32B)
quantize_target_int4_triton(model, group_size=128, quantize_lm_head_fp8=True)
model = model.to("cuda")

target = HFModelBackend(model, tok, use_tree_cuda_graph=True, use_triton_tree_attn=True, max_cache_len=2048)
target.enable_eagle3_aux_capture()
e3 = Eagle3DraftModel.from_pretrained(
    "Tengyunw/qwen3_8b_eagle3",
    target_embed_weight=model.get_input_embeddings().weight,
    device="cuda",
    dtype=torch.bfloat16,
    max_cache_len=2048,
)
e3.quantize_fp8_sm89(quantize_lm_head=True, quantize_fc=True)
draft = Eagle3DraftBackend(e3, use_cuda_graph=True)
engine = LLREngine(target=target, draft=draft, config=LLRConfig.ultra(temperature=0.0))

prompt_ids = tok.encode("def quicksort(arr):", return_tensors="pt")[0].tolist()
result = engine.generate(prompt_ids, max_new_tokens=256)
print(tok.decode(result.generated_ids))
print(f"Speed: {result.telemetry.tokens_per_sec:.2f} tok/s | tau: {result.telemetry.mean_accepted_per_pass:.2f}")

3. Zero-Draft Mode (0 GB Draft VRAM — up to 97.39 tok/s on L4 8B / 84.11 tok/s on G4 32B!)

engine = LLREngine(target=target, draft=None, config=LLRConfig.zero_draft())
result = engine.generate(prompt_ids, max_new_tokens=256)

4. Turnkey Local OpenAI Server + VS Code / Cursor Tier-2 Corpus Plugin

# Pre-index a Git repo into Tier-2 CorpusSuffixIndex (optional) & start OpenAI-compatible server:
llr-serve --model Qwen/Qwen3-8B --eagle3 Tengyunw/qwen3_8b_eagle3 --quant int4 --repo /path/to/your/repo --port 8000

# Offline repo indexing CLI (JSON for vLLM/SGLang + plain int32 stream for Basalt C++):
llr-index-repo /path/to/your/repo --tokenizer Qwen/Qwen3-8B --out .llr_corpus.json --basalt-out .llr_corpus.basalt

Install the companion VS Code / Cursor extension in integrations/vscode-llr-corpus to push saved files live to POST /v1/llr/corpus.

5. Reference Serving Plugins (vLLM V1 & SGLang)

See integrations/serving/README.md for complete VLLMLLRProposer (VLLM_LLR_ENABLE=1), VLLMSpecDecodeLLRPlugin, and SGLangLLRAdapter / install_sglang_llr_hook examples.


Benchmark Summary (All 6 Model Scales, Audited vs. Target Logits)

Losslessness Scope: Under Theorem 1, given identical target logits per verified prefix, stochastic decoding ($T{&gt;}0$) preserves the exact multi-round joint output distribution of the target logits and greedy decoding ($T{=}0$) preserves exact smallest-index torch.argmax parity (in real BF16 GEMM/attention runs across all 248 greedy prompts in Table A: 68/248 full-sequence raw exact matches, 179/248 BF16 near-ties with gap ≤0.5, and 1/248 >0.5 gap resolved locally in FP32). Quantized configurations (Table B) are lossless with respect to their quantized target model (0/96 errors vs. same-precision AR).

A. 3-Family BF16 Comprehensive Suite on NVIDIA L4 (N=16–24, max_new=256, Triton Dynamic-KV GQA)

Model Family (VRAM) Split (N) AR-HF Zero-Draft LLR E3-Chain / SD E3-Tree (Triton) LLR Full (Ours) Speedup vs AR / vs Tree
Qwen3-8B + EAGLE-3 (15.71 GiB) Code-Edit (16) 14.40 42.20 35.88 41.85 60.21 (±12.45, τ=5.29) 4.18× / +43.9%
Qwen3-8B + EAGLE-3 HumanEval (24) 14.42 29.64 36.30 43.77 57.73 (±9.41, τ=5.20) 4.00× / +31.9%
Qwen3-8B + EAGLE-3 GSM8K (24) 14.42 27.72 38.84 47.64 49.46 (±5.05, τ=4.45) 3.43× / +3.8%
Qwen3-8B + EAGLE-3 MT-Bench T=0 (24) 14.43 18.88 30.21 37.42 37.95 (±5.02, τ=3.25) 2.63× / +1.4%
Qwen3-8B + EAGLE-3 MT-Bench T=0.7 (24) 14.24 — — 31.60 32.98 (±5.49, τ=3.21) 2.32× / +4.4%
Llama-3.1-8B + EAGLE-3 (16.42 GiB) Code-Edit (16) 14.94 38.63 42.85 51.75 61.30 (±8.83, τ=5.38) 4.10× / +18.5%
Llama-3.1-8B + EAGLE-3 HumanEval (24) 14.96 28.19 41.87 51.65 54.20 (±5.33, τ=4.80) 3.62× / +4.9%
Llama-3.1-8B + EAGLE-3 GSM8K (24) 14.95 31.08 41.22 50.79 50.80 (±4.46, τ=4.53) 3.40× / +0.0%
Llama-3.1-8B + EAGLE-3 MT-Bench T=0 (24) 14.95 20.32 32.47 40.05 40.71 (±6.08, τ=3.38) 2.72× / +1.6%
Llama-3.1-8B + EAGLE-3 MT-Bench T=0.7 (24) 14.79 — — 34.57 34.84 (±5.52, τ=3.27) 2.36× / +0.8%
Qwen2.5-7B + 0.5B (Odd G=7, 15.19 GiB) Code-Edit (12) 16.17 — 28.75 — 42.98 (±15.45, τ=4.58) 2.66× / +49.5%
Qwen2.5-7B + 0.5B HumanEval (20) 16.18 — 23.65 — 29.13 (±4.50, τ=3.01) 1.80× / +23.2%
Qwen2.5-7B + 0.5B GSM8K (20) 16.19 — 28.15 — 34.45 (±3.30, τ=3.78) 2.13× / +22.4%
Qwen2.5-7B + 0.5B MT-Bench (20) 16.19 — 16.82 — 22.52 (±3.60, τ=2.14) 1.39× / +33.9%

B. Roofline Fusion + Zero-Dependency Quantization across 8B (NVIDIA L4) & 32B (Blackwell G4, N=8, 256 tok)

Model & GPU Target Precision & Fusion Stack Total VRAM Q1 / B16 / B32 / B48 (ms) Split AR Zero-Draft LLR Vanilla E3 Tree LLR (Ours) Speedup vs BF16 AR
Qwen3-8B (L4) Rowwise FP8 + FP8 lm_head 8.85 GiB 42.7 / 43.7 / 45.2 / 48.5 Code-Edit 22.99 72.13 63.14 95.55 6.64× (+51.3% vs Tree)
Qwen3-8B (L4) Rowwise FP8 + FP8 lm_head 8.85 GiB 42.7 / 43.7 / 45.2 / 48.5 HumanEval 23.10 47.31 64.00 85.10 5.90× (+33.0% vs Tree)
Qwen3-8B (L4) Fused Ops + Split-K W4A16 v2 + FP8 Head 5.73 GiB 20.7 / 30.2 / 34.2 / 40.1 Code-Edit 45.79 97.39 (err=0) 77.09 112.33 (err=0) 7.80× (+45.7% vs Tree)
Qwen3-8B (L4) Fused Ops + Split-K W4A16 v2 + FP8 Head 5.73 GiB 20.7 / 30.2 / 34.2 / 40.1 HumanEval 47.08 61.17 (err=0) 74.17 94.96 (err=0) 6.59× (+28.0% vs Tree)
Qwen3-32B (G4) BF16 Fused Ops (257 RMS + 64 QKV/MLP) 63.81 GiB 49.5 / 50.8 / 52.4 / 53.3 Code-Edit 20.20 63.39 (err=0) 84.71 111.03 (err=0) 5.50× (+31.1% vs Tree)
Qwen3-32B (G4) BF16 Fused Ops 63.81 GiB 49.5 / 50.8 / 52.4 / 53.3 HumanEval 20.29 38.22 (err=0) 77.59 88.10 (err=0) 4.34× (+13.5% vs Tree)
Qwen3-32B (G4) Fused Ops + Split-K W4A16 v2 + FP8 Head 20.07 GiB 16.2 / 34.5 / 37.0 / 43.5 Code-Edit 59.35 84.11 (err=0) 104.75 127.98 (err=0) 6.34× (+22.2% vs Tree)
Qwen3-32B (G4) Fused Ops + Split-K W4A16 v2 + FP8 Head 20.07 GiB 16.2 / 34.5 / 37.0 / 43.5 HumanEval 60.30 52.33 (err=0) 94.90 107.17 (err=0) 5.28× (+12.9% vs Tree)

C. Blackwell G4 96GB Hybrid Linear-Attention (Basalt C++20 Qwen3.8-27B NVFP4 — End-to-End SM120 Multi-Branch Tree, 11/11 Bit-Exact!)

End-to-End Serving on Qwen3.8-27B-QUASAR-NVFP4 (100% VRAM-resident, 11 prompts × 256 tok = 2,809 tok, Plain AR = 84.90 tok/s; outputs_g4/g4_basalt_route_a_results.json):

Mode (All 7/7 Audits = 11/11 Bit-Exact!) code_edit humaneval gsm8k structured Overall vs AR / vs Chain16 Exact Match
Plain AR (--spec 0) 84.85 84.93 84.92 84.91 84.90 tok/s 1.00× / — 11/11 (ref)
Upstream Basalt 1D Chain16 (--spec 16, ABBA) 564.94 364.38 458.74 397.72 437.79 tok/s 5.16× / baseline 11/11
Basalt 1D Chain32 (--spec 32) 539.64 357.29 466.30 394.82 431.92 tok/s 5.09× / -1.34% 11/11
Basalt + SM120 Tree T<=16 (BASALT_LLR_TREE=1, Rec.) 579.99 (+2.66%) 374.82 (+2.86%) 457.20 (-0.34%) 414.44 (+4.21%) 447.56 tok/s 5.27× / +2.23% 11/11 (100%)
Basalt + SM120 Tree T<=16 (WIDE=0) 561.13 (-0.67%) 359.84 (-1.25%) 461.07 (+0.51%) 420.40 (+5.70%) 440.69 tok/s 5.19× / +0.66% 11/11 (100%)
Basalt + SM120 Tree T<=32 (--spec 32, ABBA) 573.74 (+6.32% vs Ch32) 369.47 (+3.41%) 442.77 (-3.48%) 403.57 (+2.22%) 438.34 tok/s 5.16× / +1.49% vs Ch32 11/11 (100%)
Basalt + SM120 Tree T<=32 (WIDE=0, peak CE-3: 673.9) 572.96 (+1.42%) 362.57 (-0.50%) 444.42 (-3.12%) 414.14 (+4.13%) 438.17 tok/s 5.16× / +1.45% vs Ch32 11/11 (100%)
Basalt + 1D LLR Route C v2/v3 (BASALT_LLR=1, ABBA) 562.37 (+5.01%) 363.44 (+0.22%) 445.47 (+0.68%) 397.39 (+1.82%) 433.57 tok/s 5.13× / +1.66%* 11/11 (+18.1% Turn-2)

Live Blackwell SM120 CUDA Fork-Join GDN & Bit-Exact Tail-MMA GQA Kernels (gdn_tree_window.cu & gqa_attn.cu, nvcc 13.0.88 -arch=sm_120, Qwen3.8-27B n_embd=5120, h_k=16, h_v=48, S=128):

Kernel Configuration LIFO Slots SMEM / Block Max Error Latency / Layer 48-Layer Total Occupancy / Speedup
Upstream Linear Fused Cluster dec_gdn_rec (T=8 / T=16) 0 32.2 / 42.9 KB Reference 17.5 / 28.7 μs 0.84 / 1.38 ms 2 blocks/SM (baseline)
SM120 Fused Cluster Tree dec_gdn_rec_tree_fused_dev (T=8, D_fork=1) 1 32,448 B 0.000e+00 22.5 μs 1.08 ms 2 blocks/SM (+0.24 ms / 48L)
SM120 Fused Cluster Tree dec_gdn_rec_tree_fused_dev (T=16, D_fork=1) 1 43,136 B 0.000e+00 37.0 μs 1.78 ms 2 blocks/SM (1.51× vs 2-slot!)
SM120 Fused Cluster Tree dec_gdn_rec_tree_fused_dev (T=16, D_fork=2) 2 55,424 B 0.000e+00 55.8 μs 2.68 ms 1 block/SM (fallback tier)
SM120 Fused Cluster Tree dec_gdn_rec_tree_fused_dev (T=32, D_fork=1) 1 64,512 B 0.000e+00 96.1 μs 4.61 ms 1 block/SM (reverse-SMEM conv)
SM120 Fused Cluster Tree dec_gdn_rec_tree_fused_dev (T=32, D_fork=2) 2 76,800 B 0.000e+00 95.9 μs 4.60 ms 1 block/SM (75.0 KiB < 99 KiB!)
Multi-Layer gdn_tree_commit_layers (4 / 20-tok wide non-contiguous path) — 1,536 B 0.000e+00 10.24 μs 0.49 ms Single-launch pipelined across 48L
Bit-Exact Logical-Tail MMA GQA (decode_tree_tail_mma_kernel, T<=32) — 1–2 tail chunks 0.000e+00 — — Zero cross-chunk drift → 11/11 exact!

D. Cross-Platform 12 GiB Consumer Laptop Evaluation (Same Physical NVIDIA RTX 4080 Laptop, SM89)

Comparing Native Windows (triton=False), WSL2 Linux (triton=True, Split-K W4A16 INT4), and Stock Unpatched vllm==0.34.0 on the exact same physical laptop GPU (11.99 GiB VRAM, fair outer-sync AR timing, live HTTP SSE streaming TTFT, 50 ms continuous host RSS sampling, 5-stage VRAM curves, 10,000-resample paired bootstrap CIs, commit 850b5f9):

Stack & Workload (RTX 4080 Laptop 12 GiB) Precision / Backend Alloc VRAM (Graphs / Peak) Peak RSS SSE TTFT AR Zero-Draft LLR (0G) Vanilla E3 / vLLM suffix LLR (Ours) (vs AR / Base)
Win Qwen3-1.7B (Short 5p) BF16 (triton=False) 3.83 / 6.76 GiB 4.02 GiB 58.5 ms 39.94 83.37 (2.09×) — —
Win Qwen3-1.7B (4K Repo) BF16 (triton=False) 3.83 / 6.76 GiB 4.02 GiB 501.2 ms 36.42 88.04 (2.42×) — —
Win Qwen3-8B + E3 (Short 5p) SM89 FP8 (triton=False) 9.39 / 14.98* GiB 11.95 GiB 144.6 ms 22.89 54.10 (2.36×) 61.04 (gr=0) 77.61 (3.39× / +27.1%)
Win Qwen3-8B + E3 (Edit+Str) SM89 FP8 (triton=False) 9.39 / 14.98* GiB 11.95 GiB 144.6 ms 22.87 76.29 (3.34×) 63.18 (gr=0) 100.82 (4.41× / +59.6%)
WSL2 Qwen3-8B + E3 (Short 5p) W4A16 INT4 (triton=True) 6.19 / 7.48 GiB 14.37 GiB 141.4 ms 69.55 103.57 (1.49×) 96.86 (gr=0) 125.54 (1.81× / +29.6%)
WSL2 Qwen3-8B + E3 (Edit+Str) W4A16 INT4 (triton=True) 6.19 / 7.48 GiB 14.37 GiB 141.4 ms 68.30 149.93 (2.20×) 102.18 (gr=0) 162.51 (2.38× / +59.0%)
WSL2 Qwen3-8B + E3 (4K Repo) W4A16 INT4 (triton=True) 6.19 / 7.48 GiB 14.37 GiB 1,965 ms 34.25 50.65 (1.48×) 43.29 (gr=0) 50.50 (1.47× / +16.7%)
WSL2 Stock vLLM Qwen3-1.7B (B=1) BF16 (vllm==0.34.0) 3.57 GiB (+4 MiB LLR) — 22.1 ms 108.3 — 195.1 (suffix) 206.9 (1.91× / +6.1%)

*Windows Qwen3-8B FP8 14.98 GiB peak alloc occurs only during unchunked 4K AR prefill (WDDM shared-RAM spill); WSL2 Triton Split-K W4A16 INT4 eliminates WDDM spill completely (5.09 GiB target, 6.19 GiB after graphs, 7.48 GiB peak across 4K, leaving >4.5 GiB headroom) and runs 3.0× faster AR and +62% faster Full LLR on the exact same physical GPU!

E. Stock Unpatched vLLM V1 Offline Waves (B = 1..16), Live Online Poisson SSE, & Held-Out starlette 1.10.0

Offline cold-corpus waves on stock vllm==0.34.0 (scripts/run_vllm_concurrent_bench.py, 32 balanced prompts, max_tokens=160, enable_prefix_caching=False, cold-corpus reset_state() before every B):

GPU & Model Batch B Stock vLLM AR ngram / e3_5 Base (suffix / eagle3) One-Click LLR v2/v3 (Ours) vs AR (or e3_5) vs Base (95% CI) E2E P95 (Base → LLR)
NVIDIA L4 (Qwen3-8B BF16, llr K=8) 1 16.6 22.0 30.8 (τ=1.99) 33.0 (τ=2.14) 1.99× (4/4 dom.) +7.2% [+4.3%, +9.7%] 8.04s → 7.32s (-9.0%)
NVIDIA L4 (Qwen3-8B BF16, llr K=8) 4 50.9 49.1 (0.97×) 60.7 (τ=1.99) 66.7 (τ=2.16) 1.31× (8/8 wav.) +10.0% [+7.2%, +12.9%] 9.18s → 8.37s (-8.8%)
NVIDIA L4 (Qwen3-8B BF16, llr K=8) 8 99.6 93.0 (0.93×) 112.5 (τ=1.97) 124.1 (τ=2.13) 1.25× (4/4 wav.) +10.3% [+7.8%, +13.1%] 9.75s → 9.05s (-7.1%)
NVIDIA L4 (Qwen3-8B BF16, llr K=8) 16 192.9 163.2 (0.85×) 197.0 (τ=1.97) 219.5 (τ=2.14) 1.14× (2/2 wav.) +11.4% [+11.3%, +11.6%] 10.71s → 9.62s (-10.2%)
RTX 4080 (Qwen3-1.7B BF16, llr K=8) 1 108.3 137.1 195.1 (τ=1.90) 206.9 (τ=2.04) 1.91× (32/32 sfx; 26/32 AR) +6.1% [+4.5%, +7.4%] 1230 → 1143 ms (-7.1%)
RTX 4080 (Qwen3-1.7B BF16, llr K=8) 4 342.4 341.6 (1.00×) 431.1 (τ=1.92) 463.5 (τ=2.06) 1.35× (32/32 sfx; 26/32 AR) +7.5% [+4.7%, +9.9%] 1317 → 1234 ms (-6.3%)
RTX 4080 (Qwen3-1.7B BF16, llr K=8) 8 666.7 628.4 (0.95×) 780.0 (τ=1.89) 820.4 (τ=2.04) 1.23× [1.21, 1.28] +5.2% [+1.0%, +8.7%] 1433 → 1349 ms (-5.9%)
RTX 4080 (Qwen3-1.7B BF16, llr K=8) 16 1256.6 1063.5 (0.85×) 1353.6 (τ=1.88) 1447.3 (τ=2.03) 1.15× [1.14, 1.17] +6.9% [+6.1%, +7.8%] 1623 → 1529 ms (-5.8%)
NVIDIA L4 (Qwen3-8B+E3, llr_eagle3 v3 K=8) 1 16.6 38.1 (e3_5) 37.1 (e3_8, τ=3.38) 46.0 (τ=3.35, 32/32) +20.7% [+12.9,+30.8] +24.1% [+16.3%, +34.3%] (4/4 dom.) 5.59s → 4.74s (-15.3%)
NVIDIA L4 (Qwen3-8B+E3, llr_eagle3 v3 K=16) 1 16.6 43.6 (BF16) 37.1 (e3_8, τ=3.38) 44.1 (τ=3.51, 25/32) 2.01× JSON (92.2) +19.0% [+9.8%, +32.5%] 5.59s → 5.23s (-6.5%)
NVIDIA L4 (Qwen3-8B+E3, llr_eagle3 v3 K=8) 4 50.9 96.1 (e3_5) 90.9 (e3_8, τ=3.36) 102.4 (τ=3.37, 29/32) +6.6% [-0.6,+13.2] +12.7% [+3.6%, +20.7%] 7.08s → 5.49s (-22.4%)
NVIDIA L4 (Qwen3-8B+E3, llr_eagle3 v3 K=8) 8 99.6 168.4 (e3_5) 163.8 (e3_8, τ=3.37) 191.0 (τ=3.37) +13.4% [+11.8,+15.6] +16.7% [+11.6%, +20.0%] 6.45s → 5.77s (-10.6%)

(See integrations/serving/README.md for the full Single-Trace Live Online Poisson HTTP/SSE table (l4_vllm_online_poisson.json) and the Held-Out Third-Party starlette 1.10.0 Attribution & AST Structural Check table (l4_vllm_heldout_starlette.json, l4_sglang_heldout_starlette.json).)


Mathematical Losslessness

Run the complete 62-test Python verification suite (including all 4 stochastic counterexamples—saturated budgets, 3-round cross-round INS/SUB collision, and tight-budget best-first beam overlay chronological replay—greedy exact-tie torch.argmax parity across FP32/BF16, non-injective EAGLE-3 d2t scatter_add_ parity, Target-First reference verifier parity, disabled-regraft 0-extraction & eager fallback max_nodes budget tests, bounded FIFO CorpusSuffixIndex eviction, per-tenant llr-serve isolation & UTF-8 multi-byte-safe SSE streaming tests, third-party vllm.general_plugins and SGLang 2D-Tree runtime hook tests, AST repository prompt & structural verifier tests, --max-cache-len propagation & SM89 CPU-staged FP8 tests, 30,000-trial 6-regime all-lineage $\chi^2$ audit, and 20,001-tree Proposition 1 verification) locally (CPU or CUDA):

pytest -v
python scripts/run_chi2_audit.py --trials 5000 --seed 20261129 --max-nodes 10

And inside Basalt (integrations/basalt/), both the 4 end-to-end SM120 tree ctest suites (tree_e2e_cuda_test, dense_ops_parity, suffix_drafter_test, draft_policy_test in 1.60s, plus 4/4 Basalt CI checks) and the 5 1D/kernel ctest suites (llr_regrafter_test, deltanet_tree_verify_test, gdn_tree_cuda_test, ...) pass on Blackwell G4, proving 0.000e+00 bit-exact parity (0 BF16 mismatches) for fused 4-block SM120 cluster Gated-DeltaNet trees up to T=32, multi-layer wide path commits, logical-tail MMA GQA across 1-chunk and 2-chunk boundaries, and 0-mismatch FP16/INT8/NVFP4 KV compaction (11/11 bit-exact end-to-end vs Plain AR).


Citation

@misc{li2026llr,
  title  = {LLR: Lossless Logit Regrafting for Multi-Source Speculative Tree Decoding across Transformer and Hybrid Linear-Attention LLMs},
  author = {Liangrui Li},
  year   = {2026},
  url    = {https://github.com/larryllr/LLR}
}

License

Licensed under the Apache License 2.0.

About

LLR (Lossless Logit Regrafting): Multi-round filtration-exact speculative tree decoding across Transformers (7B-32B) and Blackwell SM120 hybrid linear-attention models

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages