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

*Jongseok Park, Sunga Kim, Alvin Cheung, Ion Stoica*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/155567) · [OpenReview](https://openreview.net/forum?id=4dnBXjV4Za) · [alphaXiv](https://www.alphaxiv.org/abs/2602.01518) · [Open on the map](../papers.html#p155567)

Category: [Efficient LLM Inference & Training](../pcat/14.md) › [KV Cache Optimization](../pgroup/283.md) · Type: new method · Keywords: Top-k sampling, Top-p sampling, pivot-based truncation, vocabulary search, LLM serving, Triton

## Summary
Qrita introduces a pivot-based truncation and selection algorithm that accelerates Top-k and Top-p sampling for large vocabularies, achieving up to 1.4× higher throughput and half the memory usage compared to existing engines.

## Explained to a 5-year-old
When a computer writes sentences, it picks the most likely words. It needs to choose the top words quickly. The old way is slow because it sorts all words. This paper finds a faster way by picking a middle word and then looking left and right. This makes the computer work faster and use less memory.

## Explained to a 5-year-old, longer
Computers that write stories need to pick the best words. They look for the top few words, like the best cookies. Doing this by checking every word is slow and uses a lot of memory. The new idea is to find a middle word first, like a bookmark. Then it looks left and right to find the best words faster. It also uses a special way to cut down the number of words to check. This makes the computer work quicker and use less memory. The result is the same as before, so the stories are still correct. It helps many computers that run language models run smoother. It also saves money because less powerful computers can do the job. The method works for both picking a fixed number of words and picking words based on probability. It works well on popular language model tools. Overall, it makes the computer faster and cheaper. This is useful for anyone who uses AI to write or translate. It helps the AI be more helpful and accessible.

## For a technical reader
Qrita is a Triton-based implementation of Top-k and Top-p sampling that replaces sorting with a pivot-driven search. It applies Gaussian-based σ-truncation to shrink the vocabulary size before searching, and uses a quaternary pivot scheme with duplication handling to cut iterations by half. This yields deterministic outputs while halving memory usage and improving end-to-end serving throughput up to 1.4× on vLLM, SGLang, and FlashInfer. The algorithm is straightforward to integrate into existing inference pipelines and requires no changes to the model. Benchmarks show consistent speedups across a range of model sizes and hardware configurations.

## Problem
Efficient implementation of Top-k and Top-p sampling for large vocabularies remains challenging due to the computational and memory overhead of sorting and the unreliability of stochastic approximations.

## Method
The approach uses a pivot-based search combined with Gaussian-based σ-truncation to shrink the vocabulary search space, and a quaternary pivot search with duplication handling to reduce iterations and ensure deterministic outputs.

## Results
The approach achieves up to 1.4× higher serving throughput and uses half the memory compared to existing engines, while preserving exact output consistency.

## Contributions
It introduces a deterministic pivot-based sampling algorithm with Gaussian σ-truncation and quaternary pivot search that reduces computational cost and memory footprint, and provides an empirical comparison showing performance gains over state-of-the-art LLM serving frameworks.

## Practical relevance
Enables faster and more memory-efficient LLM inference on commodity hardware, reducing serving costs and improving user experience.

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/155567)
