FlashSampling: Fast and Memory-Efficient Exact Sampling
Not on the map. Why?
Abstract (arXiv)
Sampling from a categorical distribution is mathematically simple, but in large-vocabulary decoding, it often triggers extra memory traffic and extra kernels after the LM head. We present FlashSampling, an exact sampling primitive that fuses sampling into the LM-head matmul and never materializes the logits tensor in HBM. The method is simple: compute logits tile-by-tile on chip, add Gumbel noise, keep only one maximizer per row and per vocabulary tile, and finish with a small reduction over tiles. In tensor-parallel decoding, FlashSampling replaces the all-gather of logits with streaming peer-to-peer writes: This overlaps GPU-to-GPU communication with computation and HBM loads across up to 8 GPUs, with near-ideal scaling at large batch sizes. Our kernel is exact because argmax decomposes over partitions; grouped variants for online and tensor-parallel settings are exact by hierarchical factorization of the categorical distribution. FlashSampling demonstrates kernel-level speedups on decode workloads across 4 different datacenter GPUs (H100, H200, B200, B300), and in end-to-end vLLM experiments, it reduces time per output token by up to 10% on the models we test. These results show that exact sampling, with no approximation, can be integrated into the matmul itself, consolidating the bandwidth-bound sampling step in an efficient epilogue.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 29 of its 43 references that are in the map. First posted on arXiv 16 Mar 2026.
Builds on
29 of 43 references.
References · 29
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021Training Verifiers to Solve Math Word Problemscited by 10,109
- 2025Qwen3 Technical Reportcited by 8,820
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,944
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2019The Curious Case of Neural Text Degenerationcited by 2,916
- 2016Categorical Reparameterization with Gumbel-Softmaxcited by 2,739
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2019Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelismcited by 1,868
- 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 519
- 2025FlashInfer: Efficient and Customizable Attention Engine for LLM Inference Servingcited by 258
17 more
- 2019Stochastic Beams and Where to Find Them: The Gumbel-Top-k Trick for Sampling Sequences Without Replacementcited by 211
- 2018Online normalizer calculation for softmaxcited by 162
- 2014A* Samplingcited by 151
- 2024Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM Outputscited by 150
- 2024Liger Kernel: Efficient Triton Kernels for LLM Trainingcited by 130
- 2021A Review of the Gumbel-max Trick and its Extensions for Discrete Stochasticity in Machine Learningcited by 82
- 2024Cut Your Losses in Large-Vocabulary Language Modelscited by 40
- 2019Sampled Softmax with Random Fourier Featurescited by 33
- 2024FlashRNN: I/O-Aware Optimization of Traditional RNNs on modern hardwarecited by 7
- 2024Approximate Top-k for Increased Parallelismcited by 5
- 2020Fast Generating A Large Number of Gumbel-Max Variablescited by 3
- 2025FlashFormer: Whole-Model Kernels for Efficient Low-Batch Inferencecited by 3
- 2025From Projection to Prediction: Beyond Logits for Scalable Language Modelscited by 1
- 2025SIMPLE: Disaggregating Sampling from GPU Inference into a Decision Plane for Faster Distributed LLM Servingcited by 1
- 2026Entropy-Aligned Decoding of LMs for Better Writing and Reasoningcited by 1
- 2026Qrita: High-performance Top-k and Top-p using Pivot-based Truncation and Selectioncited by 1
- 2026Deep Kernel Fusion for Transformerscited by 1
Built on by
Citing papers per year: 2026: 3.
3 papers.
Similar, not cited
Close in wording, no citation either way
- 2024Flash Communication: Reducing Tensor Parallelization Bottleneck for Fast Large Language Model Inference
- 2024Optimized Speculative Sampling for GPU Hardware Accelerators
- 2025EasySpec: Layer-Parallel Speculative Decoding for Efficient Multi-GPU Utilization
- 2025SpecOffload: Unlocking Latent GPU Capacity for LLM Inference on Resource-Constrained Devices
- 2025Sampling-Efficient Test-Time Scaling: Self-Estimating the Best-of-N Sampling in Early Decoding
- 2026Parallel Track Transformers: Enabling Fast GPU Inference with Reduced Synchronization
- 2026The Economics of AI Decoding Chips: Rebalancing Compute, Capacity, and Bandwidth for Efficient LLM Inference
- 2024Dovetail: A CPU/GPU Heterogeneous Speculative Decoding for LLM inference