Official Inference Code of EAGLE-4
docs(pkg): add TokenSpeed TP1, 32K, chain and sampled measurements on 0.1.2
Seyfal Sultanov43afe802aaa3
diff --git a/docs/faq.md b/docs/faq.mdindex c9f23df..65c3650 100644--- a/docs/faq.md+++ b/docs/faq.md@@ -73,7 +73,7 @@ do not establish distribution equivalence for every model and workload.Logprobs are supported on SGLang and vLLM. Each request gets the logprobs of its accepted tokens. SGLanginput logprobs come from its prefill. Use the matching engine with the FlashInfer verify-wrapper graph fix.-TokenSpeed refuses prompt logprobs ([known limits](known-limits.md#tokenspeed)).+TokenSpeed returns no prompt logprobs ([known limits](known-limits.md#tokenspeed)).Requests with images are refused with a reason on sglang.diff --git a/docs/known-limits.md b/docs/known-limits.mdindex a7a3a0b..db9d552 100644--- a/docs/known-limits.md+++ b/docs/known-limits.md@@ -108,23 +108,35 @@ to 512 concurrent requests. These limits apply around it:TokenSpeed serves EAGLE-4 with static and calibrated trees, chains and sampled trees on NVIDIA GPUs. Install theengine, its native packages and `eagle-harness` together with the [install command](install.md#tokenspeed-cuda),-because the adapter needs the matching engine hooks. The 0.1.1 measurements cover serve mode at TP4 and-temperature 0, at concurrency 1, 8 and 64 ([support matrix](support-matrix.md#011-speed-by-engine-and-concurrency)).+because the adapter needs the matching engine hooks. The 0.1.2 measurements cover serve mode at TP1 and TP4,+temperature 0 and 1, 32K-token contexts and four-GPU chains+([support matrix](support-matrix.md#012-speed-by-engine-and-concurrency)).- TokenSpeed runs on CUDA only. On AMD GPUs, serve with SGLang ROCm ([AMD guide](quickstart-amd.md)).- On one GPU, start the server with `--disable-kvstore`. By default TokenSpeed adds a host KV cache tier twice thesize of the GPU's KV cache, and a one-GPU server cannot pin that much host memory. The guide's commands pass theflag.-- TokenSpeed refuses prompt logprobs. Per-request sampled-tree overrides, live cost measurement and native- no-speculation rounds are not available on TokenSpeed yet. A zero-draft speculative round is not a native- no-speculation round.-- Serve mode needs cost tables measured for TokenSpeed. Tree and chain cost data must match the served shape, TP- size, target, draft and recurrent-state dtype.-- These shapes are not yet measured on 0.1.1: serve mode at TP1 and TP8 (the- [candidate rows](support-matrix.md#candidate-speed-by-engine-and-concurrency) have earlier results), temperature 1,- where the sampled-output distribution is being qualified, and 32K-token contexts. TP4 single-request- optimization, four-GPU chains, retraction under serving load and original-row output-logprob checks are also in- progress. The sampled cap-64 path is refused.+- Some request features are limits of the TokenSpeed engine, with or without speculation:+ - Prompt logprobs: a request with `logprob_start_len` 0 returns output-token logprobs only. Top-k logprobs need+ `max_new_tokens` of 1. Output-token logprobs match the engine without speculation (see the support matrix).+ - Sampling filters: with FlashInfer sampling, top-k/top-p and min-p cut the distribution where the engine's own+ sampler cuts it, which is not where SGLang cuts it. The sampled-distribution check therefore covers+ temperature, unrestricted and penalty settings; for top-k/top-p and min-p only its per-token tests apply.+ - Sampling stream: with FlashInfer sampling and a draft tree, TokenSpeed refuses `--sampling-stream per-request`,+ because its tree verifier draws one random stream for the batch. Use `--sampling-stream batch`, or chains.+ - Draft trees run at most 32 requests at a time: the engine sizes its tree buffers for 32. Chains run up to 512.+ - Native no-speculation rounds: TokenSpeed has no hook that skips the draft for a batch yet, so EAGLE-4 cannot+ fall back to plain decoding at high load on TokenSpeed ([high load](#high-load)). A zero-draft speculative round+ is not a native no-speculation round.+ - Live cost measurement: serve mode reads cost tables measured for TokenSpeed.+- Serve mode needs cost tables measured for TokenSpeed. Tree and chain cost data should match the served shape, TP+ size, target, draft and recurrent-state dtype. Only TP4 tables exist; the TP1 measurements reuse them.+- Retraction is not qualified. TokenSpeed reserves pages when it admits a request and queues the rest, so the+ measured servers never retract. With retractions forced by a test-only setting, one prompt in three chain starts+ fails the fp32 rule ([support matrix](support-matrix.md#012-correctness-and-request-features)).+- EAGLE-3 drafts are not checked on TokenSpeed. TP8 is not measured on 0.1.2 (the+ [candidate rows](support-matrix.md#candidate-speed-by-engine-and-concurrency) have earlier results). TP4+ single-request optimization is in progress.- Static mode is a setup check, because its CUDA install smoke generates text with one first divergence above thefp32 gate. The serve-mode install smoke passes its greedy prompts with the CUDA 13.2 JIT. On Ubuntu 26.04 / glibc2.43, set `CUDA_HOME` to CUDA 13.2 ([troubleshooting](troubleshooting.md#install-problems)). These checks coverdiff --git a/docs/quickstart-tokenspeed.md b/docs/quickstart-tokenspeed.mdindex ba084e6..67e498f 100644--- a/docs/quickstart-tokenspeed.md+++ b/docs/quickstart-tokenspeed.md@@ -1,7 +1,7 @@---type: tutorialowner: eagle-harness-last_verified: 2026-10-21+last_verified: 2026-10-23---# TokenSpeed guide@@ -65,5 +65,45 @@ promises a speedup for your workload. The serve-mode check passed twenty greedyfp32-tolerance results. These are first-divergence checks, not bitwise output equality or sampled-distributionqualification.-Prompt logprobs, per-request sampled trees, live cost measurement and native no-speculation rounds are not-supported. The [known limits](known-limits.md#tokenspeed) list the rest.+The same command serves one GPU with `--tensor-parallel-size 1` (it reuses the TP4 tables; no TP1 tables exist+yet) and 32K-token prompts within `--max-model-len 65536`. The+[support matrix](support-matrix.md#012-speed-by-engine-and-concurrency) has one row per setup.++## Sampled requests++For temperature above 0, sample with FlashInfer, one random stream per batch, and speculative sampling. A draft+tree runs at most 32 requests at a time:++```bash+tokenspeed serve Qwen/Qwen3.8-27B --tensor-parallel-size 4 \+ --attention-backend trtllm --max-model-len 65536 --max-num-seqs 32 \+ --disable-kvstore --seed 721 --gpu-memory-utilization 0.6 --disable-prefix-caching \+ --reasoning-parser qwen3 --sampling-backend flashinfer --sampling-stream batch \+ --speculative-algorithm EAGLE_HARNESS \+ --speculative-draft-model-path EAGLE-Corp/Qwen3.8-27B-EAGLE4 \+ --speculative-num-steps 12 --speculative-eagle-topk 4 --speculative-num-draft-tokens 16 \+ --speculative-algorithm-config "{\"mode\": \"serve\", \"data_path\": \"$COST_ROOT\"}" \+ --enable-speculative-sampling+```++To run more than 32 requests at a time, serve chains, which need no cost tables:++```bash+tokenspeed serve Qwen/Qwen3.8-27B --tensor-parallel-size 4 \+ --attention-backend trtllm --max-model-len 65536 --max-num-seqs 64 \+ --disable-kvstore --seed 721 --gpu-memory-utilization 0.6 --disable-prefix-caching \+ --reasoning-parser qwen3 --sampling-backend flashinfer --sampling-stream batch \+ --speculative-algorithm EAGLE_HARNESS \+ --speculative-draft-model-path EAGLE-Corp/Qwen3.8-27B-EAGLE4 \+ --speculative-num-steps 7 --speculative-eagle-topk 1 --speculative-num-draft-tokens 8 \+ --speculative-algorithm-config '{"mode": "serve", "intensity": "chain_intensity", "chain_width_table": [[1, 8], [32, 4]]}' \+ --enable-speculative-sampling+```++At 64 concurrent requests the chain server measured 1.12× its no-spec+control at temperature 1, the tree server 0.87×. `tools/sampling_check.py run --api tokenspeed` compares a sampled+server with a no-spec server; top-k/top-p and min-p follow TokenSpeed's own filters+([known limits](known-limits.md#tokenspeed)).++Prompt logprobs, per-request sampling streams with draft trees, live cost measurement and native no-speculation+rounds are not supported. The [known limits](known-limits.md#tokenspeed) list the rest.diff --git a/docs/support-matrix.md b/docs/support-matrix.mdindex 8c7bcd7..84fe208 100644--- a/docs/support-matrix.md+++ b/docs/support-matrix.md@@ -233,6 +233,11 @@ measured between 0.98× and 1.07× the 0.1.1 packages in every cell where both r| SGLang TP1, quick-start command | ✅ 2.87× | ✅ 1.87× | ⚠️ 0.73× || vLLM TP4 | ✅ 2.83× | ✅ 1.73× | ⚠️ 1.19× || TokenSpeed TP4 | ✅ 3.13× | ✅ 2.00× | ✅ 1.40× |+| TokenSpeed TP4, 32K-token context | ✅ 3.15× | — | — |+| TokenSpeed TP1 | ✅ 3.27× | ✅ 2.14× | ✅ 1.35× |+| TokenSpeed TP4 chain, temperature 0 | ✅ 2.24× | ✅ 1.65× | ✅ 1.02× |+| TokenSpeed TP4 chain, temperature 1 | ✅ 2.19× | ✅ 1.71× | ✅ 1.12× |+| TokenSpeed TP4 sampled tree, temperature 1 | ✅ 2.48× | ✅ 1.74× | ⚠️ 0.87× |Sources:@@ -256,6 +261,23 @@ Sources:Eleven first turns with up to 256 tokens give 819.7 against 280.7 (2.92×). Concurrency 8 and 64 use 22 and 88first turns with up to 256 tokens: 3256.4 against 1628.2 and 6974.1 against 4969.8. Every start gives 6 exact /14 fp32 pass.+6. TokenSpeed TP4, 32K: the same server at running cap 4, one 32,768-token prompt with 256 new tokens, a warm+ request and 3 measured requests per start, 2 starts per arm. 812.1 against 258.0 decode tokens/s (first to last+ streamed token). Every start gives 6 exact / 14 fp32 pass.+7. TokenSpeed TP1: the TP4 recipe on one GPU with the TP4 cost tables (no TP1 tables exist yet), same workloads+ and running caps, 2 starts per arm. 352.5 against 107.9 tokens/s at 1, and 323.4 against 106.9 (3.03×) on eleven+ first turns. 1378.8 against 643.3 at 8 and 2620.4 against 1944.7 at 64. Every start passes the twenty-prompt+ check (5 exact / 15 fp32 pass at running cap 4, 3 exact / 17 fp32 pass at 32).+8. TokenSpeed TP4 chains: one chain per request (7 draft steps, 8 tokens, chain widths 8 from 1 request and 4 from+ 32), FlashInfer sampling with the batch stream and speculative sampling on, running cap 64, against no-spec with+ the same sampler and cap, 2 starts per arm. 11, 22 and 88 first turns with up to 256 tokens. Temperature 0:+ 605.4, 2591.7 and 6384.3 against 270.8, 1567.1 and 6271.5 tokens/s. Temperature 1: 563.8, 2512.9 and 6541.6+ against 258.0, 1473.3 and 5824.0. Every twenty-prompt check gives 3 exact / 17 fp32 pass.+9. TokenSpeed TP4 sampled tree: the serve-mode tree with the same sampler and speculative sampling, running cap 32+ (the most a draft tree runs), against no-spec at running cap 64, same workloads, 2 starts per arm: 639.8, 2560.6+ and 5106.2 against 257.8, 1473.5 and 5839.7 tokens/s. At 64 the tree serves 32 requests at a time and the rest+ queue; chains run all 64. At temperature 0 the same servers measure 2.65×, 1.77× and 0.87×. Every twenty-prompt+ check gives 7 exact / 13 fp32 pass.### 0.1.2 high load@@ -293,10 +315,29 @@ Sources:| Change | Result ||---|---|| `eagle-harness calibrate --engine vllm` completes on the Qwen3.8 hybrid target, and its `serve.sh` loads the tables it wrote | ✅ 20/20 |+| TokenSpeed TP4 chain, 64 prompts with up to 512 tokens at 64 concurrent requests, fp32 rule | ✅ 0 failed in 2 starts |+| TokenSpeed TP4 output-token logprobs, chain and sampled tree, against no-spec on the shared greedy prefix | ✅ largest gap 0.113 |+| TokenSpeed TP4 sampled-output distribution, chain and sampled tree, temperature 1 | ✅ unrestricted, temperature, penalty |+| TokenSpeed TP4 sampled-output distribution with top-k/top-p or min-p | ⚠️ engine filters |+| TokenSpeed TP4 chain with retractions forced every 16 scheduler rounds, 64 prompts at 64, fp32 rule | ❌ 1 failed in 3 starts |The calibration ran on B300 TP4 with the 0.1.1 vLLM engine. Both the printed `serve.sh` and the quickstart commandpass the twenty-prompt check (4 exact / 15 near tie / 1 fp32 pass), 1 start each. No speed is claimed for it.+The TokenSpeed rows use the chain and sampled-tree servers of the speed table. At 64 concurrent requests the chain+gives 11 and 10 exact / 53 and 54 fp32 pass over 64 prompts, and the engine without speculation gives 11 exact /+53 fp32 pass against its own first start. Output-token logprobs cover 8 prompts with up to 128 tokens (755 chain+and 706 tree positions, mean gap 0.006). The distribution check draws 1000 samples per prompt for each setting+(`tools/sampling_check.py --api tokenspeed`) and passes for unrestricted, temperature and repetition-penalty+settings. With top-k/top-p and min-p, every per-token test passes, but the engine without speculation also draws+tokens outside the cuts the check models, so these settings are not qualified+([known limits](known-limits.md#tokenspeed)).+The retraction row uses TokenSpeed's test-only `--debug-force-retraction-interval 16` (51 to 56 retractions per+start, every request completes): one prompt in one start picks the second fp32 token 4.6 BF16 steps below the first.+The engine without speculation under the same setting gives 0 failures in 1 start. Without that setting the+servers above never retract: TokenSpeed reserves pages when it admits a request and queues the rest, also with a+20,480-token pool.+## Unreleased (measured on candidates, not in a release)These rows measure changes that are not in a published release. Each row names the change and its engine build.@@ -307,7 +348,6 @@ A row joins a release only after it passes the release qualification.| Change, engine and setup | 1 | 8 | 32 | 64 ||---|---|---|---|---|| vLLM TP1, served-tree rounds measured on the setup | — | ✅ 1.94× | — | ✅ 1.07× |-| TokenSpeed TP1, serve mode | ⚠️ 3.22× | ⚠️ 2.34× | — | — || TokenSpeed TP8, serve mode | ⚠️ 2.79× | ⚠️ 1.68× | — | — || SGLang ROCm MI355X TP1, draft attention splits sized per batch | — | ⚠️ 2.21× | ⚠️ 1.66× | — |@@ -317,12 +357,12 @@ Sources:the served setup (no TP1 schedule ships). Running cap 64, unchanged vLLM engine, 88 and 220 first turns with upto 512 new tokens. 1366.5 against 705.4 tokens/s at 8 and 3402.4 against 3192.6 at 64, 3 starts per arminterleaved in one allocation. The 64-prompt checks at 64 give 0 failures in 4 pairs (1 fp32 pass).-2. TokenSpeed TP1 and TP8: the 0.1.0 TokenSpeed wheels with the pre-0.1.1 adapter, serve mode with the TP4 cost- tables (no TP-matched tables exist yet). Concurrency 1 is 22 conversations and 31 turns: TP1 346.5 against- 107.6 tokens/s, TP8 962.1 against 345.4. Concurrency 8 is 88 first turns: TP1 1685.3 against 721.3, TP8 3916.6- against 2337.9. Each cell has 2 starts per arm. The first start's twenty-prompt check passes (TP1 3 exact /- 17 fp32 pass, TP8 5 exact / 14 fp32 pass / 1 fp32-argmax pass), and the second start's check was not collected.- Static mode refuses this tree at TP1 and TP8.+2. TokenSpeed TP8: the 0.1.0 TokenSpeed wheels with the pre-0.1.1 adapter, serve mode with the TP4 cost tables+ (no TP-matched tables exist yet). Concurrency 1 is 22 conversations and 31 turns: 962.1 against 345.4 tokens/s.+ Concurrency 8 is 88 first turns: 3916.6 against 2337.9. Each cell has 2 starts per arm. The first start's+ twenty-prompt check passes (5 exact / 14 fp32 pass / 1 fp32-argmax pass), and the second start's check was not+ collected. Static mode refuses this tree at TP1 and TP8. TP1 on 0.1.2 is in the+ [0.1.2 table](#012-speed-by-engine-and-concurrency).3. MI355X: draft attention key splits sized from the batch's programs, on the 0.1.0 ROCm engine, 44 conversationsand 60 turns. 1202.7 against 545.2 tokens/s at 8 and 2201.8 against 1330.3 at 32 (2 EAGLE-4 starts, 1 no-specstart), and every MI355X check passes. The same change on B300 TP4 has one twenty-prompt failure in its first@@ -390,8 +430,7 @@ Sources:5. SGLang TP8 concurrency 8: prefill admission and intermittent stalls.6. SGLang 32K-context acceptance.7. SGLang greedy agreement at concurrency 512.-8. TokenSpeed: the candidate draft head, temperature 1 and 32K contexts, the sampled-output distribution and- prompt logprobs.+8. TokenSpeed: the candidate draft head and TP8 on 0.1.2.9. AMD MI355X at concurrency 64.10. Nemotron 3.5 Super correctness qualification on all three engines.