Qrita: High-performance Top-k and Top-p using Pivot-based Truncation and Selection
Not on the map. Why?
Abstract (arXiv)
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 sigma-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 SGLang and FlashInfer, improving end-to-end serving throughput up to 1.4 times with half the memory usage, while providing the same output as the sorting-based algorithms. Qrita is now the default Top-k and Top-p sampler for the GPU execution path of vLLM, and a ternary implementation of Qrita is available at https://github.com/vllm-project/vllm/blob/main/vllm/v1/sample/ops/topk_topp_triton.py.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 10 of its 22 references that are in the map. First posted on arXiv 2 Feb 2026.
Builds on
10 of 22 references.
References · 10
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2016Pointer Sentinel Mixture Modelscited by 2,992
- 2019The Curious Case of Neural Text Degenerationcited by 2,881
- 2022Fast Inference from Transformers via Speculative Decodingcited by 1,615
- 2018Hierarchical Neural Story Generationcited by 1,182
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,107
- 2025FlashInfer: Efficient and Customizable Attention Engine for LLM Inference Servingcited by 248
- 2025Min-p, Max Exaggeration: A Critical Analysis of Min-p Sampling in Language Modelscited by 9
- 2024RTop-K: Ultra-Fast Row-Wise Top-K Selection for Neural Network Acceleration on GPUscited by 7
Built on by
Citing papers per year: 2026: 1.
1 paper.
- 2026FlashSampling: Fast and Memory-Efficient Exact Samplingcited by 2
- 2026FlashSampling: Fast and Memory-Efficient Exact Sampling16 Mar 2026