Speculative Decoding That Drafts Several Routes at Once: UBTree
The GPU that writes text spends its time waiting for one token. An LLM’s answer is written token by token, and for every single token the target model runs a full forward pass. Meanwhile the card’s large compute sits half idle while the cursor blinks.
In agent environments, that wait is money. An agent loop calls the model dozens of times per task, and slow decoding eats the whole task budget as waiting time. Serving stacks have tried to break this wall for a while with what they call speculative decoding.
On December 2, inclusionAI open-sourced UBTree under the MIT license. It is a speculative decoding method that drafts not one path but many token paths in parallel. Alongside the paper (arXiv 2609.39972) they released SGLang-native inference code, the training code, and draft checkpoints for Qwen3.8-27B and the Ling-3.0 family.
If you run an inference stack or price the execution cost of agents, this is the read for deciding which speculative decoder to put in your serving. The core conclusion up front: single-path drafters that guess one token per position hit a ceiling in high-entropy segments, and UBTree turns that structural weakness into an asset by drafting several candidate paths and verifying them at once. And because the code, training recipes, and weights are all open, you can verify it in your own stack.
UBTree: Parallel Tree Drafting via Unigram and Bigram Models for Speculative Decoding (arXiv 2609.39972)
In plain terms
Picture the target model as a subway dispatch center. The classic drafter is an operator who draws one route and asks, “is this route valid?” at every stop. The newer parallel drafters write many stops of that one route at once, but it is still one route.
UBTree draws several candidate routes at once. If there are 64 candidate ways to reach the same destination, it picks the 12 that connect best to the next segment and puts them on a single route board. The dispatch center scans the whole board in one sweep, approves the routes that actually connect, and discards the broken ones. The approved routes advance together, and from the new position the process draws a fresh board.
The analogy carries to the end of this post. A candidate route is a draft token, the route board is the drafting tree, the dispatch center’s single scan is tree verification, and how many routes get approved in one sweep is the acceptance length.
Why single-path drafters stalled
One term, in one sentence. Speculative decoding is the scheme where a small drafter guesses upcoming tokens and the target model verifies those guesses in a single forward pass. If the guess holds, you get several tokens for the price of one, and the answer quality is unchanged (lossless).
Recent parallel drafters, DFlash and its successor DFlash2, pushed this structure one step further. Instead of guessing token by token, they predict 15 future positions in a single pass, in parallel. But each position still keeps exactly one candidate. A single path of 16 tokens.
That single path has a limit. When the target’s distribution is high-entropy at some position, when the right answer can go many ways, the odds that the drafter’s one candidate matches the target’s choice drop fast. In creative writing, in code with many options, in answers with many branches, the draft gets rejected and the speedup shrinks. The UBTree paper calls this out directly: parallel drafters lose effectiveness “as the entropy of target distributions increases due to insufficient draft diversity.”
A classic parallel drafter writes one token per position: a single path of 16. UBTree drafts 64 candidates per position, scores adjacent pairs with a bigram selector, and keeps up to 12 branches per depth inside a 64-node verification budget. Target verification is one pass in both.
UBTree’s answer is to place several candidates at each position and build a tree from their adjacent combinations. The unigram proposer predicts 64 candidate tokens independently per position. A unigram scores the token itself. The bigram selector scores how naturally adjacent candidate pairs connect, i.e. the transition score. A bigram scores the pair. Combining the two networks’ scores and keeping only the branches that connect within the verification budget gives you the tree.
The budget is strict. For the Qwen3.8-27B production profile: 64 candidates per position, depth 15, at most 12 branches per depth, and 64 total nodes. The target model verifies the entire tree in one forward pass.
flowchart TB
A["Target hidden states<br/>5 of 64 layers selected"] --> B["unigram proposer<br/>64 candidates per position, in parallel"]
B --> C["bigram selector<br/>adjacent-pair transition scores (rank 256)"]
C --> D["tree construction (pruned)<br/>64-node budget, 12 branches per depth max"]
D --> E["target verification<br/>whole tree in one forward pass"]
E -->|"commit accepted paths"| F["accepted tokens out"]
F --> A
The flow above is one round as implemented in the released code. The drafter does not compute the target’s 64 layers. It takes hidden states from five selected layers (5, 19, 33, 47, 61) and predicts from those. The draft network itself is only 5 layers (hidden 5120), about 1.84 billion parameters. It reuses the target’s embeddings and output head, so the draft checkpoint carries no vocabulary tables.
From the same prompt and target hidden states, DFlash2 produces a single line of tokens while UBTree produces a 64-node tree. The target checks it in one forward pass and returns the accepted tokens.
845 tok/s: several candidate routes on one board
The heart of UBTree’s numbers is not the tree shape but the training scheme. The unigram proposer is trained with standard cross-entropy (the loss that measures the gap between predicted and target distributions). The bigram selector is trained with a different loss: a renormalized forward KL (a distance between two distributions) computed only inside the top-K candidate support, on high-temperature sampled data.
The high-temperature training is the key. At low temperature (greedy), the target shows one path, and the selector can only learn that one path. At high temperature the target shows several alternative paths, so the selector learns that “this branch, and that branch, are paths the target actually takes.” The paper calls this tree-native training: supervision beyond the greedy path, encouraging plausible alternative branches and raising the chance of accepting extra tokens during tree verification.
Qwen3.8-27B (TP8) goes from 660.99 tok/s (DFlash2) to 845.18 tok/s (UBTree), a 27.9% gain. Ling-3.0 runs at 3.17x (tiny, TP1) and 3.43x (flash, TP4).
The numbers, organized. In the academic evaluation (Qwen3-4B, Qwen3-8B, seven benchmarks, a single Hopper GPU, batch 1), UBTree reports an average 5.84-6.94x speedup over autoregressive decoding and wins all 28 comparisons against DARTree. The production-scale evaluation appears in the release README and HF cards as throughput. Qwen3.8-27B (TP8, concurrency 1) averages 845.18 tok/s against 660.99 tok/s for DFlash2 in the same setup, a 27.9% gap. Ling-3.0-tiny (TP1) hits 1,467.4 tok/s (3.17x) and Ling-3.0-flash (TP4) 1,009.6 tok/s (3.43x).
One caveat on provenance. The paper’s main table (Table 3) reports speedups under different conditions (TP4: 4.78x vs 4.24x), while the README’s tok/s table is a separate TP8 release profile. They agree in direction but not in conditions, so quote one or the other, not both, without labels. Every number in this post is a reported number, not our measurement.
We ran the released tree builder on CPU
We cloned the repository and checked what the released code actually does. The license is MIT (Copyright (c) 2026 The DeepSpec Authors); the SGLang fork itself keeps Apache-2.0.
The Qwen3.8-27B serving profile (configs/serving/qwen38-27b.json) is TP8 with --max-running-requests 1, --speculative-algorithm UBTREE, a 16K context, BF16 weights, FP32 SSM states, and full decode CUDA Graphs. Six SGLANG_OPT_UBTREE_* environment flags (fused tree attention, fused gate-up, parallel tree convolution, and friends) tell you this is an SGLang fork with UBTree-dedicated kernels, not a plugin bolted onto upstream.
We then ran the released tree builder (build_bigram_tree_cpu in training/specforge/inference/ubtree/tree.py) on CPU with the production settings (pruned, budget 64, width 12). It is a pure index computation that needs no model weights, so it runs on a laptop. Results (run-5.log):
- pruned builder (depth 4): 48 nodes, at most 12 children per parent, every node’s parent present in the tree (prefix-closed), deterministic (same input, same tree), and the best single path (the greedy path) contained in the tree.
- fixed builder (depth 15, budget 64): exactly 64 nodes, the budget spread roughly 5 per depth, and under random scores no guarantee the greedy path lands in the tree.
- The most interesting observation: feed the pruned builder random scores at depth 15 and the released code raises
RuntimeError("Pruned optimized bigram tree is not prefix closed."). It refuses to return a tree whose branch lacks its parent. Real selector scores normally never trip this guard, but the behavior itself shows the design treats an invalid tree as an error, not something to ship.
We also prodded the training loss (candidate_restricted_forward_kl). KL is non-negative everywhere and exactly zero when selector and target logits are identical (temperature 1). The temperature-0 branch gives KL greater than zero even for identical logits, because at T=0 the target distribution degenerates to a one-hot over its best candidate while the selector keeps its full distribution. The production setting uses temperature 1, so this is an edge case.
Full throughput reproduction (845 tok/s class) needs a B200 GPU queue job. We do not run 27B-class inference on a local Mac, so that reproduction is split off into a separate job. The numbers in this post stay as release-reported.
MIT, SGLang-native, and the training recipe
Integration is the shortest of any speculative method we have seen recently. The inference installer builds the bundled SGLang source as an editable package (python scripts/install.py inference). Serving starts with one command.
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
python scripts/serve.py qwen38-27b \
--target-model-path /path/to/Qwen3.8-27B \
--draft-model-path /path/to/Qwen3.8-27B-UBTree-B16-release
The draft checkpoint (1.84B, BF16, 3.68GB) cannot serve alone. The HF card says it plainly: “The draft alone does not provide a text-generation service.” The tokenizer, embeddings, and output head all come from the target. The deployment unit is the target plus draft pair, and the draft is a 3.68GB option per target model.
The training code is fully public as well. training/ holds a SpecForge-based trainer, and the recipes ship as YAML (Qwen3-4B/8B instruct and reasoning). The data are “target-regenerated responses”: the target model rewrites the answers itself, and the drafter learns from that. The academic evaluation uses the OpenPerfectBlend prompt set; the production Ling3 models use regenerated responses from a 2.5M-sample (15B token) SFT corpus. Since drafter quality depends on the target’s own output distribution, training on the target’s data is mandatory, not optional, and this recipe makes that process reproducible.
The comparison with existing parallel drafters, in one table.
| single-path parallel (DFlash2) | UBTree | |
|---|---|---|
| Candidates per position | 1 | 64 |
| Branches | one line | tree, up to 12 branches per depth |
| Training target | greedy path | alternative branches included (tree-native training) |
| High-entropy segments | speedup shrinks | branches reduce rejection odds |
| Concurrency | simple, single path | sensitive at high concurrency, needs adaptive budget |
| Open scope | serving code | MIT + SGLang native + training code + checkpoints |
What this means for ThakiCloud
Two lenses.
The ai-platform lens is direct. Speculative decoding is a “GPU-seconds per token” reducer in serving. If the reported 27.9% over DFlash2 reproduces in our stack, the per-token serving cost for customers running LLM workloads drops by that much. The target engine (SGLang) is already what we run, so the integration cost is closer to adding a profile than changing frameworks. In on-prem and self-hosted environments the benefit is larger. Speculative decoding that cuts decode time 3 to 6x without adding GPUs is the most convincing lever in any cost-efficiency conversation. The next step is a controlled reproduction in the B200 queue: same target (Qwen3.8-27B), same hardware, DFlash2 against UBTree under the same profile, measuring acceptance length and tok/s.
The Paxis lens is agent execution economics. Decode speed is the cost floor of the agent loop. Agents running long tasks accumulate context, and the paper’s long-context evaluation (LongBench-v2, SWE-bench) reports acceptance length 25.6-39.7% above the strongest baseline. “The longer the context, the larger the drafter’s advantage” fits agent workloads better than chat. If the Paxis sandbox runs many agent loops over a shared serving pool, a drafter that is efficient in long contexts is a variable that lowers the marginal cost per loop.
Limits and counterarguments
First, concurrency. Every release profile is a “one concurrent request” profile. The paper states plainly that “tree drafting is sensitive to very high concurrency,” and its adaptive tree strategies rely on pre-searched configurations. In a multi-tenant serving pool with real batches, the reported numbers may not hold, and the policy for choosing tree size at inference time is left as future work. That is the biggest gap between the reported numbers and production reality.
Second, the two-track numbers. The README tok/s table (27.9%, 3.43x, 3.17x) is release-reported, while the paper’s main table is speedups under different conditions (TP4). They agree in direction, but a citation must say which table it comes from. No third party has independently reproduced them yet.
Third, the per-target asset. Draft checkpoints are trained per target: one for Qwen3.8-27B, ones for the Ling-3.0 family. A new target means running the training recipe on that target’s data. It is small, 1.84B, but it is a separate deployment and training unit per target. The 16K context profile is the same: the release profile’s context-length is 16384, and behavior beyond that belongs to the paper’s long-context evaluation, not the release profile.
One small observation to leave behind. The released tree builder raises an error (the prefix-closure guard) on unstructured random scores. Real selector scores normally do not trip it, but if you build downstream experiments directly on this builder, it is a pitfall to know.
In closing
UBTree changed the question of speculative decoding: from “can we draft faster?” to “are we drafting enough branches?” Single-path parallel drafters solved speed but left candidate diversity unsolved, and UBTree fills that slot with two networks, unigram and bigram, plus tree-native training. With the MIT license, SGLang-native integration, training recipes, and checkpoints all open, the cost of verifying it is low.
The first experiment you can run today is simple. Check which speculative algorithm your serving runs. If it is the DFlash or DSpark generation, it is worth measuring whether “several branches, one verification” wins on the same hardware and same target. For us, that measurement lives in the B200 queue. In one line: the single route was the ceiling, and the moment several routes went on one board, speculative decoding moved a step further.
Sources
- Paper: “UBTree: Parallel Tree Drafting via Unigram and Bigram Models for Speculative Decoding” (Chumeng Liang, Linxuan Wang et al., arXiv 2609.39972, submitted 2026-09-30 / revised 10-28)
- Code and serving: https://github.com/inclusionAI/ubtree (MIT; SGLang fork Apache-2.0)
- Draft checkpoint: https://huggingface.co/inclusionAI/Qwen3.8-27B-UBTree (1.84B, BF16)
- Project: https://www.inclusion-ai.org/ubtree/