Long-tail learning via logit adjustment

Aditya Krishna Menon, Sadeep Jayasumana, Ankit Singh Rawat, Himanshu Jain, Andreas Veit, Sanjiv Kumar · ICLR 2021 · 2021

In one paragraph

Plain softmax cross-entropy learns p(y\mid x)\propto\pi_y\,p(x\mid y), which bakes the class prior \pi_y into the logit. The metric on a long-tailed benchmark is the balanced error, the average of per-class errors, whose optimal rule uses the prior-free quantity p(x\mid y)\propto p(y\mid x)/\pi_y:

\hat y(x)=\arg\max_y\ \big[f_y(x)-\tau\log\pi_y\big]\qquad(\tau=1\ \text{is the Bayes rule}).

Post-hoc: apply this to a trained model’s logits. In the loss: train with \ell(y,f)=-\log\frac{e^{f_y+\tau\log\pi_y}}{\sum_{y'}e^{f_{y'}+\tau\log\pi_{y'}}}, so the network is pushed to a larger raw margin on rare classes, and at test time use f directly. The two are consistent for the balanced error, which the paper proves; LDAM and similar margin losses are special cases.

Checked

Two unit-variance Gaussians at \pm1 with minority prior 0.05: the plain Bayes threshold is 1.47 (balanced accuracy 0.656, minority recall 0.318); the adjusted threshold is 0 (balanced accuracy 0.841, recall 0.841), and brute force over thresholds agrees. See checks.py.

Questions and doubts

Takeaways