Qrita: High-performance Top-k and Top-p Algorithm for GPUs using Pivot-based Truncation and Selection
Jongseok Park, Sunga Kim, Alvin Cheung, Ion Stoica
NeurIPS 2026
TL;DR. We implement fast Top-k and Top-p sampling kernel for GPUs using pivot-based Truncation and Selection, achieving 2 times speedup against baselines.
Abstract. Despite their importance in model sampling, efficient implementation of the Top-k and Top-p algorithms poses a significant challenge as model vocabulary grows with each new model release. Existing approaches often rely on sorting, which incurs significant computation and memory overhead on GPUs, or on stochastic approaches that alter the algorithm’s output. In this work, we propose Qrita, an efficient Top-k and Top-p algorithm based on pivot-based truncation and selection. Qrita leverages pivot-based search for both Top-k and Top-p with two key techniques: 1. Gaussian-based σ-truncation, which limits the complexity of the algorithm to O(n), and 2. Quaternary pivot search with duplication handling, which halves the number of pivot search iterations and guarantees deterministic output. We implement Qrita using Triton and evaluate its performance against the Top-k and Top-p kernels of high-performance LLM execution engines such as SGLang and FlashInfer, improving end-to-end serving throughput up to 1.4× with half the memory usage, while providing the same output as stable sort-based Top-k and Top-p algorithms. Qrita is now the default Triton Top-k and Top-p sampler of vLLM, and its implementation is available at https://github.com/vllm-project/vllm/blob/main/vllm/v1/sample/ops/topk_topp_triton.py.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:42 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
Qrita presents a practical Triton implementation of pivot-based Top-k/Top-p selection that avoids full-vocabulary sorting while aiming to preserve the exact, deterministic candidate set. The problem is relevant to LLM serving, and the method is simple, well motivated, and supported by broad multi-platform results showing substantial kernel speedups, end-to-end gains, and lower memory use.
The main concern is that the central exactness claim is asserted rather than directly measured against full sort. The paper should also reconcile reported paper/code inconsistencies concerning iteration limits, numerical tolerances, and Algorithm 2. Further clarification is needed on Gaussian truncation robustness under temperature and low precision, Top-p fallback and tail latency, large-batch scalability, and comparisons with radix-based approaches.
I lean accept because the contribution is practically useful and the evaluation is otherwise comprehensive. A rebuttal providing direct exactness verification and resolving the implementation discrepancies is important; failure to do so could lower my assessment.
Final justification
The paper get an origin score of 4-4-4 and without changing afterwards. The rebuttal address the reviewers main concern, which also convincing me that the paper meets the quality of NIPS. So I recommend Acceptance.
Read meta-review
Meta-review
Qrita presents a practical Triton implementation of pivot-based Top-k/Top-p selection that avoids full-vocabulary sorting while aiming to preserve the exact, deterministic candidate set. The problem is relevant to LLM serving, and the method is simple, well motivated, and supported by broad multi-platform results showing substantial kernel speedups, end-to-end gains, and lower memory use.
The main concern is that the central exactness claim is asserted rather than directly measured against full sort. The paper should also reconcile reported paper/code inconsistencies concerning iteration limits, numerical tolerances, and Algorithm 2. Further clarification is needed on Gaussian truncation robustness under temperature and low precision, Top-p fallback and tail latency, large-batch scalability, and comparisons with radix-based approaches.
I lean accept because the contribution is practically useful and the evaluation is otherwise comprehensive. A rebuttal providing direct exactness verification and resolving the implementation discrepancies is important; failure to do so could lower my assessment.
Final justification
The paper get an origin score of 4-4-4 and without changing afterwards. The rebuttal address the reviewers main concern, which also convincing me that the paper meets the quality of NIPS. So I recommend Acceptance.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This submission presents Qrita, an exact, deterministic Top-k/Top-p algorithm for LLM decoding. It replaces full-vocabulary sort with 1. Gaussian -truncation, which discards the noise region in one pass via a threshold ( from a quantile table). The thresholding is correctness-preserving, a bad threshold would fall back to the full vocab when the truncated set is . And 2. quaternary pivot search with explicit duplicate bookkeeping (termination , plus a first-occurrence keep rule) that resolves boundary ties deterministically. Evaluated on four models (vocab 128k–262k) across H100/RTX4090/MI355X vs. PyTorch/vLLM/FlashInfer/SGLang. It reports up to kernel throughput at lower memory, and up to end-to-end vLLM serving.
Strengths and weaknesses
Strengths
- Qrita returns the full, exact, deterministic candidate set that is useful for scenarios like speculative-decoding verification and RL, which is lacking from single-token rejection samplers like FlashInfer.
- Qrita presents solid overall performance gains across four models and three hardware platforms, outperforming the baselines in most configurations, with up to 2 times kernel throughput and 1.41 times end-to-end.
- Duplicate logits are handled carefully. The termination condition detects when the -th element falls inside a run of equal logits, a case where a naive would loop forever, and it resolves the boundary with a cumsum occurrence map and a fixed first-occurrence keep rule.
Weakness
Lack of comparisons with radix top-k/radix top-p based sampling algorithms.
- Radix Top-K https://github.com/flashinfer-ai/flashinfer/pull/2119
- Radix Top-P https://github.com/flashinfer-ai/flashinfer/pull/2752
and some recent data-dependent kernel optimizations on top-k: https://arxiv.org/abs/2604.22312 (in the domain of sparse attention, but might also be useful in sampling).
Questions
- Table 3 shows quaternary search is about 2% slower than binary in the truncation-hit case and is only faster on the fallback path. Since the reported Top-k hit-rate is 1.0 (Table 1), truncation almost always hits, so the evaluated regime is essentially the one where binary is faster. Given that the kernel already knows at runtime whether truncation hit or missed (the check in Algorithm 1), could it dispatch binary search on a hit and quaternary on a miss, for example via a templated/constexpr kernel? Would this give a speedup?
Limitations
yes
Formatting concerns
N/A
1 comment
- Rating
- 4/6
- Confidence
- 3/5
- Quality
- 2/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
Qrita is an algorithm for computing exact top-k and top-p candidate sets faster during LLM sampling, with a Triton GPU implementation. Instead of sorting the whole vocabulary every step, it first uses a simple statistical cutoff to keep only likely high-logit tokens, then searches for the top-k/top-p boundary with a pivot-based procedure, and finally handles tied boundary logits so the output remains deterministic. If the statistical cutoff misses too much, the method falls back to searching the full vocabulary, so the goal is to preserve the same semantics as sorting while reducing the common-case cost. The paper implements this algorithm as optimized Triton kernels and evaluates it against PyTorch sort, vLLM, FlashInfer, and SGLang on H100 / RTX4090 / MI355X using logits from several LLMs. The reported claims are up to ~2× faster sampling, up to 1.41× end-to-end vLLM throughput, and lower memory use while producing the same top-k/top-p candidate set as sorting-based methods.
Strengths and weaknesses
Strengths
- Important practical bottleneck. Top-k/top-p sampling is run at every decoding step, and avoiding full-vocabulary sorting can matter in real serving systems. Unlike FlashInfer-style single-token samplers, Qrita returns the full candidate set, which is useful for speculative decoding, RL, and other workflows.
- Simple and practical algorithmic design. The combination of statistical pre-filtering, pivot search, and duplicate handling is easy to understand and well motivated: reduce the common-case search space, then preserve exact top-k/top-p semantics.
- Promising systems results and implementation. The paper reports 1.06–1.41× end-to-end vLLM throughput gains, lower memory use, multiple GPU platforms, useful ablations, and a full Triton implementation.
Weaknesses
- Production scalability is not fully solved. The current persistent-kernel design maps roughly one Triton program per SM, and the paper notes that throughput stops scaling linearly once batch size exceeds the number of SMs. Since real LLM serving often relies on large continuous batches, it is important to show that Qrita remains beneficial under realistic high-load serving rather than only in the tested batch range.
Questions
- Serving tail latency. How does Qrita affect p95/p99 latency in realistic serving workloads, especially for top-p cases where the Gaussian truncation sometimes misses and falls back to a full-vocabulary search?
- Large-batch behavior. Since the current implementation stops scaling linearly once batch size exceeds the number of SMs, what speedup should we expect under real continuous batching in vLLM-style serving?
Limitations
The authors acknowledge several useful limitations, including the current batch-scaling cap, conservative truncation thresholds, and the fact that a lower-level CUDA implementation could be faster. I would like the limitations section to more directly discuss how Qrita behaves under realistic high-batch serving and whether top-p fallback cases create tail-latency spikes.
Final justification
The rebuttal addresses most of my concerns. I decide to maintain my score.
Formatting concerns
Algorithm 2 return order (τ, zdup, Ndup) vs line 21 (τ, Ndup, zdup).
1 comment
1. Tail latency and hitrate on serving benchmarks
We empirically measure the p50 TTFT (time to first token), TPOT (time per output token), and E2EL (end-to-end latency), their p95 and p99 tail latency, and top-k and top-p hitrate, using vLLM’s serving benchmark with inputs sampled from the ShareGPT dataset, with Poisson arrival at a rate of [1.0, 4.0, 16.0]. All time values are in milliseconds, and the results are from an Nvidia H100 GPU.
| Model | Temp | Rate | p | k | Impl | p50 TTFT | p95 TTFT | p99 TTFT | p50 TPOT | p95 TPOT | p99 TPOT | p50 E2EL | p95 E2EL | p99 E2EL | TopK Hit Rate | TopP Hit Rate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3.5-35B-A3B-FP8 | 1.0 | 1.0 | 0.9 | 50 | Qrita | 31.88 | 101.27 | 109.74 | 6.53 | 7.55 | 7.98 | 1698.58 | 1974.90 | 2080.74 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 1.0 | 0.9 | 50 | vLLM | 32.84 | 100.58 | 116.99 | 6.70 | 7.68 | 8.37 | 1743.95 | 2012.51 | 2182.98 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 1.0 | 0.9 | none | Qrita | 31.58 | 97.30 | 121.68 | 6.49 | 7.44 | 7.97 | 1695.00 | 1946.69 | 2079.36 | n/a | 100.00% |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 1.0 | 0.9 | none | vLLM | 32.18 | 91.28 | 104.97 | 6.69 | 7.68 | 8.33 | 1723.51 | 1989.84 | 2174.23 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 1.0 | none | 50 | Qrita | 32.63 | 99.71 | 131.83 | 6.51 | 7.49 | 8.07 | 1694.47 | 1942.33 | 2117.47 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 1.0 | none | 50 | vLLM | 31.15 | 96.18 | 108.62 | 6.68 | 7.74 | 8.20 | 1733.71 | 2003.44 | 2137.91 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 4.0 | 0.9 | 50 | Qrita | 40.20 | 108.37 | 144.81 | 10.34 | 11.89 | 12.41 | 2638.55 | 3071.84 | 3204.92 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 4.0 | 0.9 | 50 | vLLM | 42.16 | 113.00 | 143.90 | 11.00 | 12.78 | 13.47 | 2836.30 | 3303.48 | 3476.51 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 4.0 | 0.9 | none | Qrita | 41.21 | 99.57 | 121.34 | 10.16 | 11.71 | 12.26 | 2616.57 | 3035.47 | 3169.75 | n/a | 99.99% |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 4.0 | 0.9 | none | vLLM | 41.95 | 103.19 | 128.08 | 10.91 | 12.42 | 13.13 | 2780.79 | 3241.24 | 3390.31 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 4.0 | none | 50 | Qrita | 41.43 | 111.63 | 126.25 | 10.34 | 11.89 | 12.46 | 2673.59 | 3064.59 | 3208.22 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 4.0 | none | 50 | vLLM | 41.49 | 100.29 | 123.77 | 10.69 | 12.36 | 12.76 | 2677.95 | 3204.54 | 3293.57 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 16.0 | 0.9 | 50 | Qrita | 102.93 | 183.64 | 205.67 | 27.55 | 31.40 | 32.84 | 6968.81 | 8115.68 | 8190.84 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 16.0 | 0.9 | 50 | vLLM | 113.85 | 199.40 | 221.32 | 30.87 | 35.38 | 35.76 | 7841.55 | 9107.80 | 9189.81 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 16.0 | 0.9 | none | Qrita | 99.99 | 177.28 | 311.60 | 26.40 | 29.96 | 30.55 | 6733.10 | 7764.92 | 7910.95 | n/a | 99.98% |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 16.0 | 0.9 | none | vLLM | 109.66 | 193.50 | 220.88 | 29.71 | 33.78 | 35.02 | 7501.24 | 8698.17 | 8768.40 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 16.0 | none | 50 | Qrita | 104.66 | 186.29 | 213.84 | 27.84 | 31.58 | 32.44 | 7017.02 | 8162.28 | 8255.66 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 16.0 | none | 50 | vLLM | 110.08 | 190.61 | 226.68 | 30.61 | 35.08 | 35.90 | 7660.48 | 9024.21 | 9126.68 | n/a | n/a |
Comparing the Qrita and vLLM results, we see that there indeed are cases where Qrita delivers slower p95/p99 tail latencies for TTFT. However, Qrita delivers lower TPOT latencies overall, which results in around a 5-10% reduction in end-to-end latencies.
2. Large-batch behavior
Sampling is an embarrassingly parallel workload where each processor (SM/CU) can be utilized independently. Therefore, throughput scales linearly with the number of utilized resources, as parallelism across the resources simply adds up to the total throughput.
Once we exhaust the parallel resources, the sampling scaling pattern is analyzed as a memory-bound operation, and the total amount of memory accesses required divided by the bottleneck memory bandwidth becomes the maximum achievable throughput. Increasing the batch size will amortize overheads such as kernel launch or buffer cache warmups, and make it possible to achieve closer to the maximum achievable throughput.
The same scaling pattern applies not only to Qrita, but also to other sampling kernels as well. However, the key benefit of Qrita compared to other sampling algorithms is that 1. it first reduces the search space in a single pass (Gaussian Sigma-Based Truncation), and 2. pivot-based search is write-free, which combines to greatly reduce the total amount of memory accesses required for the operation, and thus allowing for a higher maximum achievable throughput as seen in the evaluations on batch size of 256, 512, and 1024.
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
Qrita is a Triton GPU kernel for exact, deterministic Top-k/Top-p truncation that avoids full-vocab sorting. Adapts RTop-k pivot selection to large vocabularies via (1) Gaussian σ-truncation: a k/p→σ lookup table drops the noise region in one pass, shrinking the search to a few hundred–few thousand candidates (full-vocab fallback on a miss); (2) quaternary pivot search testing 3 pivots/iter while tracking the smallest above-pivot logit + its count, giving deterministic termination under ties. A dup-handling mask keeps exactly the right tied boundary tokens. Vs PyTorch sort/vLLM/FlashInfer/SGLang on 4 models, 3 accelerators: up to ~2x kernel, up to 1.4x e2e, lower memory, output identical to sort.
Strengths and weaknesses
Strengths
- Real, underrated problem; key edge over FlashInfer/SGLang = returns full deterministic set, not 1 stochastic token (matters for spec-decode verify, RL, exact-set tasks).
- Clean framing: statistical cutoff as lossless pre-filter, not the sampling rule → exact semantics + most single-pass speed. Dup bookkeeping = genuine algo piece.
- Broad eval (multi-vendor incl AMD, per-technique ablations, code released); Table 3 honest.
Weaknesses
- Headline exactness claim asserted, not measured. Need kept-set match rate vs ref sort + mismatch counts.
- Paper/code mismatches: iter cap 20 (Alg 2) vs 18 (kernel), + on-cap pivot = midpoint (not provably exact k-th); tolerance 1e-12 (text) vs 1e-9 (code), governs tie counting for bf16/fp16→fp32. Reconcile.
- Gaussian robustness undertested: Top-k hitrate 1.0 only b/c very conservative; Top-p drops to 0.90–0.94 → falls to expensive full-vocab path; no tail latency. Temp/quantization never tested vs fixed table.
- Originality: all ingredients borrowed; new = dup handling + prefilter framing. Legit combo under General criteria → 3.
Questions
- Exactness expt: kept-set match rate vs full-sort (k + p) + mismatch causes? Would raise score.
- Reconcile cap (20 vs 18) + tolerance (1e-12 vs 1e-9); exactness at cap→midpoint — still exactly k / smallest set >p?
- Lookup table under temp scaling + fp16/bf16/quantized — hitrate + exactness vs temp?
- Tail latency / hit-vs-fallback distribution, esp low-hitrate Top-p?
Score change: exactness verification + cap/tolerance fix → toward Accept. If exactness holds only under conservative settings or degrades under temp/at cap → toward reject.
Limitations
Mostly addressed (batch ceiling, buffer cost, model-dependent e2e upfront). Underdiscussed: dependence on float tolerance + iter cap; robustness under temp/quantization. Broader-impact N/A reasonable.
Formatting concerns
Nothing to report
2 comments
Response Part 2
4. Tail Latency, Hitrate, and Effect of Quantization and Temperature (Continued From Response Part 1)
Table 1: Qrita vs vLLM Serving Benchmarks
| Model | Temp | p | k | Impl | p50 TTFT | p95 TTFT | p99 TTFT | p50 TPOT | p95 TPOT | p99 TPOT | p50 E2EL | p95 E2EL | p99 E2EL | TopK Hit Rate | TopP Hit Rate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3.5-35B-A3B-FP8 | 1.0 | 0.9 | 50 | Qrita | 102.93 | 183.64 | 205.67 | 27.55 | 31.40 | 32.84 | 6968.81 | 8115.68 | 8190.84 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 0.9 | 50 | vLLM | 113.85 | 199.40 | 221.32 | 30.87 | 35.38 | 35.76 | 7841.55 | 9107.80 | 9189.81 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 0.9 | none | Qrita | 99.99 | 177.28 | 311.60 | 26.40 | 29.96 | 30.55 | 6733.10 | 7764.92 | 7910.95 | n/a | 99.98% |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 0.9 | none | vLLM | 109.66 | 193.50 | 220.88 | 29.71 | 33.78 | 35.02 | 7501.24 | 8698.17 | 8768.40 | n/a | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | none | 50 | Qrita | 104.66 | 186.29 | 213.84 | 27.84 | 31.58 | 32.44 | 7017.02 | 8162.28 | 8255.66 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | none | 50 | vLLM | 110.08 | 190.61 | 226.68 | 30.61 | 35.08 | 35.90 | 7660.48 | 9024.21 | 9126.68 | n/a | n/a |
| Qwen3.5-35B-A3B | 1.0 | 0.9 | 50 | Qrita | 71.86 | 123.28 | 132.75 | 19.28 | 20.51 | 20.87 | 4882.88 | 5288.63 | 5322.34 | 100.00% | n/a |
| Qwen3.5-35B-A3B | 1.0 | 0.9 | 50 | vLLM | 77.24 | 114.55 | 145.80 | 21.90 | 23.51 | 24.20 | 5512.51 | 6064.16 | 6090.64 | n/a | n/a |
| Qwen3.5-35B-A3B | 1.0 | 0.9 | none | Qrita | 75.95 | 147.27 | 179.28 | 20.63 | 22.11 | 22.27 | 5254.81 | 5705.91 | 5738.00 | n/a | 99.99% |
| Qwen3.5-35B-A3B | 1.0 | 0.9 | none | vLLM | 75.96 | 114.73 | 140.62 | 22.09 | 23.64 | 23.73 | 5631.94 | 6106.15 | 6125.16 | n/a | n/a |
| Qwen3.5-35B-A3B | 1.0 | none | 50 | Qrita | 77.15 | 136.00 | 163.68 | 20.56 | 22.25 | 24.63 | 5196.33 | 5727.92 | 5739.14 | 100.00% | n/a |
| Qwen3.5-35B-A3B | 1.0 | none | 50 | vLLM | 78.10 | 114.45 | 134.24 | 22.05 | 23.56 | 23.97 | 5491.71 | 6068.22 | 6086.06 | n/a | n/a |
Comparing the Qrita and vLLM results, we see that there are cases where Qrita delivers a slower p95/p99 tail latency for TTFT and TPOT. However, Qrita constantly delivers lower average (p50) latencies, resulting in around an 8-11% reduction in end-to-end latencies (E2EL), even in the p95/p99 case.
We observe minimal changes to top-k or top-p hitrate across the original BF16 model and the FP8 model. The reduction in latencies is largely due to the use of EP=2 in the BF16 model, which the baseline vLLM execution shares. We believe that quantizations, by design, should have minimal impact on the distribution of the output logits and thus the operation of Qrita.
Table 2: Temperature sweep (0.8/1.0/1.2)
| Model | Temp | p | k | Impl | p50 TTFT | p95 TTFT | p99 TTFT | p50 TPOT | p95 TPOT | p99 TPOT | p50 E2EL | p95 E2EL | p99 E2EL | TopK Hit Rate | TopP Hit Rate |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3.5-35B-A3B-FP8 | 0.8 | 0.9 | 50 | Qrita | 102.18 | 160.65 | 187.96 | 27.70 | 31.21 | 32.30 | 7031.88 | 8068.94 | 8113.28 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 0.8 | 0.9 | none | Qrita | 104.55 | 170.05 | 198.95 | 27.68 | 31.55 | 35.91 | 7029.23 | 8159.81 | 8226.75 | n/a | 100.00% |
| Qwen3.5-35B-A3B-FP8 | 0.8 | none | 50 | Qrita | 100.14 | 181.94 | 197.70 | 27.40 | 31.40 | 31.91 | 6920.49 | 8088.11 | 8167.35 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 0.9 | 50 | Qrita | 102.93 | 183.64 | 205.67 | 27.55 | 31.40 | 32.84 | 6968.81 | 8115.68 | 8190.84 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.0 | 0.9 | none | Qrita | 99.99 | 177.28 | 311.60 | 26.40 | 29.96 | 30.55 | 6733.10 | 7764.92 | 7910.95 | n/a | 99.98% |
| Qwen3.5-35B-A3B-FP8 | 1.0 | none | 50 | Qrita | 104.66 | 186.29 | 213.84 | 27.84 | 31.58 | 32.44 | 7017.02 | 8162.28 | 8255.66 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.2 | 0.9 | 50 | Qrita | 109.70 | 190.10 | 221.52 | 27.99 | 31.69 | 32.23 | 6950.28 | 8176.55 | 8250.96 | 100.00% | n/a |
| Qwen3.5-35B-A3B-FP8 | 1.2 | 0.9 | none | Qrita | 95.16 | 167.37 | 270.06 | 26.42 | 29.81 | 31.13 | 6558.24 | 7720.29 | 7813.97 | n/a | 96.87% |
| Qwen3.5-35B-A3B-FP8 | 1.2 | none | 50 | Qrita | 101.28 | 186.24 | 204.78 | 27.55 | 31.11 | 33.96 | 6795.85 | 8010.11 | 8120.73 | 100.00% | n/a |
Qrita does show a slight decrease in top-p truncation hitrate as the temperature increases, possibly due to tighter grouping between the noise and the outlier regions with increased temperatures. However, we believe that the impact of temperature on the performance of Qrita is minimal, as no clear correlation between temperature and tail latencies is shown, with some temperature=1.2 results even showing the lowest end-to-end latencies compared to temperature=0.8 or 1.0 results.
Response Part 1
Thank you for your reviews! Here are our answers to your concerns and questions.
1. Cap/Tolerance Mismatch
We apologize for the mismatch between the reconcile cap and tolerance values in the paper (, ) and the code (, ). The tighter values in the paper are our original values, used for the evaluations included in the paper.
The values in the included code are the ones we updated for our vLLM PR, as the original values were considered unnecessarily tight and were loosened for additional performance gains in production. We included our updated code but did not update the paper's values accordingly, and we apologize for the confusion.
2. Empirical Exactness Measurements
We use vLLM's top- & top- sampler test suite
(tests/v1/sample/test_topk_topp_sampler.py) to empirically compare the exactness of
our algorithm against the PyTorch sort-based reference. The tests sweep across:
- Different batch sizes, vocab sizes, and / values (including none or partial skips)
- Edge cases: extreme (, vocab_size), extreme (near-, ), identical logits, near-identical logits ( spread), logits, and NaN logits
Our algorithm passes all tests in the given test suite. Therefore, our empirical match rate against the PyTorch reference is , and the miss rate is , for the given test suite.
3. Theoretical Exactness Analysis
Despite the empirical exactness measured by the test suite, there are a few possible cases where a mismatch against the PyTorch reference could occur.
a. Gaussian Sigma-Based Truncation
As we gather outlier logits strictly larger than the threshold, the outlier set must contain the top- values of the set, where is the number of elements in the outlier set. Therefore, as long as , the outlier set is a superset of the top- set. The same applies to top-, as long as the sum of the outliers is larger than .
If the outlier set does not satisfy this property, we return the full logit set. Therefore, it is guaranteed that the set returned by Gaussian sigma-based truncation is a superset of the top- or top- set, and the correctness claim holds as long as the remaining algorithm can find the exact top- or top- set within it.
b. Quaternary Pivot Search
Quaternary Pivot Search is correct as long as its "resolution", or its ability to differentiate between two adjacent values, is finer than the gap between the two values adjacent to the correct pivot. Quaternary Pivot Search has two resolutions: (1) absolute resolution and (2) relative resolution.
b-1. Absolute resolution.
The absolute resolution between two logits is , roughly . Therefore, if logits near the cutoff pivot have an absolute difference smaller than , they may be incorrectly treated as identical (duplicate) values.
However, this is near-impossible in practice, as logits are typically FP16 or BF16 values upcast to FP32. The finest resolution of FP16 itself is , still coarser than . For BF16, resolution finer than only occurs in the range , due to its 7-bit mantissa. In practical LLM serving with reasonable / values and real model predictions, pivots rarely land in such extreme near-zero values.
b-2. Relative resolution.
The relative resolution is times the original search range, since we reduce the search range by for up to iterations. Therefore, if logits near the pivot have an absolute difference smaller than times the original search range, the search may return an incorrect pivot value.
However, most logit distributions fall within , and probabilities within . As such, the relative resolution provided by quaternary search iterations is between and , even tighter than the absolute resolution.
c. Duplication Handling
Duplication handling keeps the first-occurrence set, which is equivalent to a stable sort that preserves
the order of identical elements. Unfortunately, PyTorch's sort is
unstable by default unless a flag is set. Therefore, Qrita may return results that
differ from PyTorch's sort reference, since the order of identical values is undefined
in PyTorch's default sort. However, this difference is not necessarily "incorrect", and
we believe keeping our algorithm equivalent to a stable sort is the most reasonable
design choice.
4. Tail Latency, Hitrate, and Effect of Temperature or Quantization
We measure the p50/p95/p99 TTFT (time to first token), TPOT (time per output token), and E2EL (end-to-end latency), and top-k/p hitrate, with inputs from the ShareGPT dataset following a Poisson arrival rate of 16.0. All time values are in milliseconds, and the Qwen3.5-35B-A3B-FP8 results are from an H100, while the Qwen3.5-35B-A3B results are from H100s with EP=2.
(Results in Part 2)
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Thank you for your reviews! Here are our answers to your concerns and questions.
1. Comparison to Radix Top-k, Radix Top-p, and other GPU Top-k/p Algorithms
Qrita is composed of three distinct components serving different purposes. The component comparable to Radix Top-k/p or other GPU top-k/p algorithms is the Quaternary Pivot Search, as it is the main "exact top-k/p" algorithm. For Gaussian Sigma-Based Truncation, the goal is to reduce the top-k/p search space in a single pass, and for Duplication Handling it is to ensure deterministic results in the presence of identical values.
The choice for these components comes from the characteristics of the LLM logits, similar to the method mentioned in Data-Dependent Kernel Optimizations. Logit sampling has an extreme search-space-to-output ratio. The vocabulary size of modern LLMs ranges from 100K+ and is actively growing as LLMs increase their functionality, but the output predictions are selected from fewer than 100 candidates. Also, with the widespread use of quantization schemes such as FP8 or NVFP4/MXFP4, it is quite common for logits to have duplicate (identical) values, due to the limited resolution of these low-bit representations.
Therefore, it was critical to introduce a method that quickly truncates the ever-increasing LLM vocabulary space into a more constant space representative of the top-k/p outputs, and thus we introduced Gaussian Sigma-Based Truncation. Similarly, with output stability and determinism increasing in importance, we designed Duplication Handling, which returns results identical to stable sort-based approaches that preserve the order of duplicate values. However, for Duplication Handling to work, we must know the value and the number of duplicate logits that fall on the top-k/p pivot.
We considered several candidate algorithms for the "exact top-k/p" component, and we chose the search-based approach as it was the easiest to fold detection and counting of duplicate logits into the algorithm itself. Radix Top-k/p, RadiK, and other radix-based algorithms often exhaust all remaining bits in the presence of duplicate values, requiring more search iterations compared to our Quaternary Search which can directly detect the pivot falling on duplicate values.
Similarly, many high-performance GPU top-k/p algorithms are inefficient or non-deterministic in the presence of duplicate values. Our choice of Quaternary Search for the exact top-k/p component is based on the ease and effectiveness it brings to duplicate handling, and not a because it is necessarily better than radix-based algorithms in isolation.
2. Dispatch Between Quaternary and Binary Search
Thank you for the suggestion! Yes, it should be straightforward to add switching between binary and quaternary search, and doing so would likely yield speedup. We experimented with several search algorithms and settled on quaternary search for tail latency control and ease of algorithm presentation. In practice, however, dispatching between algorithms could be beneficial for maximum performance.