acceptodds
Published as a conference paper at NeurIPS 2026

Qrita: High-performance Top-k and Top-p using Pivot-based Truncation and Selection

Jongseok Park, Sunga Kim, Alvin Cheung, Ion Stoica

Abstract

Despite their importance in model sampling, efficient implementation of Top-k and Top-p algorithms for large vocabularies remains a significant challenge. 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 a 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 greatly reduces the search space of the vocabulary, 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 vLLM, SGLang, and FlashInfer, improving end-to-end serving throughput up to 1.4× with half the memory usage, while providing the same output as the sorting-based algorithms.

Keywords:
Paris, Main Track

Reviews

Among:
Shape:
123456this paper, Bottom 17%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.00 over 3 reviews, above 17% of the others.
Reviewer_gWeBOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
3
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 σ\sigma-truncation, which discards the noise region in one pass via a threshold t=μ+δσt=\mu+\delta\sigma (δ\delta from a quantile table). The thresholding is correctness-preserving, a bad threshold would fall back to the full vocab when the truncated set is <k<k. And 2. quaternary pivot search with explicit duplicate bookkeeping (termination Nτ≥k∧Nτ−Nzm<kN_\tau \geq k \wedge N_\tau - N_{z_m} < k, 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 ∼2×\sim 2\times kernel throughput at lower memory, and up to 1.41×1.41\times 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 Nτ≥k∧Nτ−Nzm<kN_\tau \geq k \wedge N_\tau - N_{z_m} < k detects when the kk-th element falls inside a run of equal logits, a case where a naive Nτ=kN_\tau = k 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.

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 ∣Zt∣>k|Z_t| > k 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

Paper formatting concerns

N/A

Reviewer_APKUOpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
2
Significance
3
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

  1. 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.
  2. 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.
  3. 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

  1. 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
  1. 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?
  2. 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.

Paper formatting concerns

Algorithm 2 return order (τ, zdup, Ndup) vs line 21 (τ, Ndup, zdup).

Final justification

The rebuttal addresses most of my concerns. I decide to maintain my score.

Reviewer_kShuOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
3
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
  1. Exactness expt: kept-set match rate vs full-sort (k + p) + mismatch causes? Would raise score.
  2. Reconcile cap (20 vs 18) + tolerance (1e-12 vs 1e-9); exactness at cap→midpoint — still exactly k / smallest set >p?
  3. Lookup table under temp scaling + fp16/bf16/quantized — hitrate + exactness vs temp?
  4. 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.

Paper formatting concerns

Nothing to report

Comments on the paper

1 comment
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.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.