When a neural network predicts a word out of a massive vocabulary or identifies an individual from millions of faces, it typically relies on the softmax function. Mathematically, the probability of choosing a specific class $y$ given an input representation $x$ is expressed as:
$$P(y|x) = \frac{e^{w_y^T x}}{\sum_{j=1}^K e^{w_j^T x}}$$
The core issue lies entirely within the denominator. Computing this normalization constant requires calculating the dot product for every single one of the $K$ classes in the label space. When $K$ scales to hundreds of thousands or millions, this linear dependency ($O(K)$) becomes a severe computational and memory bottleneck.
As noted by Qizhi Zhang et al. in Large scale classification in deep neural network with Label Mapping, the parameter count of the final linear layer grows hyper-linearly at scale, quickly exceeding the physical memory limits of standard hardware. Furthermore, Lei Yang et al. demonstrate in Accelerated Training for Massive Classification via Dynamic Class Selection that these massive matrix multiplications overwhelm GPU memory subsystems during backpropagation.
To make extreme classification practical, researchers have developed techniques designed to bypass or restructure this normalization step.
Smart Sampling and the Bias Wall
The most intuitive way to avoid summing over millions of classes is to estimate the denominator using a small, randomly selected subset of negative classes. However, uniform random sampling introduces high variance and gradient instability.
To stabilize training, Aleksandar Botev et al. introduced Complementary Sum Sampling (CSS) in Complementary Sum Sampling for Likelihood Approximation in Large Scale Classification. They showed that standard sampling methods frequently omit the true target class from the denominator estimation, leading to erratic gradients; by explicitly ensuring the correct class is always included in the sample, training stabilizes significantly.
Other approaches alter the loss formulation itself to accommodate subsampling. In One-vs-Each Approximation to Softmax for Scalable Estimation of Probabilities, Michalis K. Titsias et al. proposed a rigorous lower bound that decomposes the multiclass problem into a product of pairwise comparisons, allowing for "doubly stochastic" training where both data points and labels are sampled simultaneously. To maximize the efficiency of these samples, Shabnam Daghaghi et al. leveraged Locality Sensitive Hashing (LSH) in A Tale of Two Efficient and Informative Negative Sampling Distributions to adaptively sample "hard" negatives—the classes most likely to confuse the model—in near-constant time.
Standard Softmax: [Compute all K class scores] ──> Summation (O(K) Bottleneck)
Sampled Softmax: [Compute Target] + [Sampled Negatives] ──> Approximate Summation
Despite the success of these sampling heuristics, they face a fundamental mathematical limitation. In Sampled Estimators For Softmax Must Be Biased, Li-Chung Lin et al. provided a definitive proof establishing that any softmax estimator relying strictly on a sampled subset of classes must be biased. This impossibility result clarifies why the field has shifted toward minimizing bias or restructuring the output space entirely rather than searching for a perfectly unbiased sparse sampler.
Structural Decompositions and Trees
If sampling introduces unavoidable bias, an alternative strategy is to structurally reorganize the output layer to reduce the computational complexity of inference and training from linear to logarithmic ($O(\log K)$).
One prominent method is to replace the flat softmax layer with a hierarchical tree structure. In Softmax Tree: An Accurate, Fast Classifier When the Number of Classes Is Large, Arman Zharmagambetov et al. utilize a non-greedy optimization algorithm called Tree Alternating Optimization (TAO). Instead of evaluating every category, the model routes the input through a series of binary or low-way decisions, drastically lowering the number of parameters activated per forward pass.
[Root Node]
/ \
[Node A] [Node B]
/ \ / \
C_1 C_2 C_3 C_4 <-- Logarithmic path evaluation instead of evaluating all classes
Rather than building trees, another structural approach compresses the label space via mathematical projections. Zhuoning Yuan et al. demonstrated in Accelerating Deep Learning with Millions of Classes that a model can be trained using a low-dimensional "slimmed" target space created via Random Projection. Once training completes, the full, high-dimensional classifier can be mathematically recovered, achieving massive speedups without sacrificing accuracy.
Bypassing Classification Entirely
A final paradigm shift abandons the discriminative classification framework altogether, converting the problem into a task that avoids the softmax denominator by design.
For instance, large-scale recommendation systems often struggle to classify user actions over millions of items. In Large-scale user modeling with recurrent neural networks for music discovery on multiple time scales, Cedric De Boom et al. circumvented this by framing recommendation as a continuous regression task. Instead of computing probabilities over discrete items, the network maps a user's history directly into a dense "taste vector" within a pre-computed item embedding space, eliminating the final classification layer entirely.
Similarly, in web-scale computer vision, classifying millions of distinct entities creates unsustainable parameter overhead. To address this, Mathilde Caron et al. introduced Generative Entity Recognition (GER) in A Generative Approach for Wikipedia-Scale Visual Entity Recognition. Instead of treating entity recognition as a massive multi-class choice, they represent millions of entities as compact, discriminative semantic codes. The model then generates these codes sequentially as a string of tokens, transforming an intractable extreme classification problem into a highly efficient sequence generation task.
Key Foundational Work
One-vs-Each Approximation to Softmax for Scalable Estimation of Probabilities (2016) — contributed 1 concept elements to this direction.
Complementary Sum Sampling for Likelihood Approximation in Large Scale Classification (2017) — contributed 1 concept elements to this direction.