Reproduce “Online normalizer calculation for softmax” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Maxim Milakov, Natalia Gimelshein

NVIDIA researchers developed an "Online Softmax" algorithm and a fused Softmax+TopK operation that significantly reduce memory accesses, achieving up to 1.3x speedup for standalone Softmax and up to 5x for Softmax+TopK on GPUs, while maintaining numerical stability.

Key insights

  • Softmax performance is often bottlenecked by memory bandwidth on GPUs; minimizing memory accesses is crucial for efficiency.
  • The iterative re-normalization of the sum of exponentials allows for a single-pass calculation of the Softmax normalizer (running max and sum) while maintaining numerical stability.
  • Fusing Softmax with commonly co-occurring operations like TopK can dramatically improve performance by eliminating redundant memory loads and kernel launch overheads, especially in inference scenarios.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.