🧮 Brain Teaser

The Softmax That Forgets Its Past: Invariance to Label Permutation vs. Feature Permutation

Suppose you train a softmax classifier on a KK-class problem. The model outputs

p(y=kx)=eβkxj=1Keβjx,k=1,,K.p(y = k \mid x) = \frac{e^{\beta_k^\top x}}{\sum_{j=1}^K e^{\beta_j^\top x}}, \quad k = 1, \ldots, K.

Now consider two operations:

(A) Label permutation: You relabel the training data by swapping class 1 and class 2 (and retrain from scratch).

(B) Feature sign flip: You replace every feature xx with x-x (and retrain from scratch).

Question: For each operation, describe precisely what happens to the learned coefficient vectors {βk}\{\beta_k\}. In particular:

  • Under (A), is the model equivalent to simply swapping β1\beta_1 and β2\beta_2?
  • Under (B), is the model equivalent to simply negating all βk\beta_k?

Now the punchline: the softmax loss function is

L=1ni=1nlogp(yixi).L = -\frac{1}{n}\sum_{i=1}^n \log p(y_i \mid x_i).

True or False (and explain): The softmax model has an identifiability problem — there exists a non-trivial transformation of {βk}\{\beta_k\} that leaves all predicted probabilities unchanged for every input xx.

Identify this transformation explicitly and explain why it is never resolved by more data.

softmaxidentifiabilitylogistic regressionmultinomialnon-identifiabilityFisher information

Answer: The Softmax That Forgets Its Past: Invariance to Label Permutation vs. Feature Permutation

Key Idea / Intuition

The softmax model is not identifiable: you can shift every coefficient vector by the same arbitrary vector vv — i.e., replace βkβk+v\beta_k \mapsto \beta_k + v for all kk — and the predicted probabilities are completely unchanged for every input. This is because the softmax depends only on differences between the linear scores. No amount of data can break this symmetry, because the likelihood itself is flat along this entire affine subspace of parameters.


Formal Proof / Solution

Part (A): Label Permutation

If you swap class labels 1 and 2 and retrain, the new optimal classifier is obtained by swapping β1β2\beta_1 \leftrightarrow \beta_2 (and leaving all other βk\beta_k unchanged). This is immediate from symmetry of the loss: the relabeled loss is the original loss with the roles of β1\beta_1 and β2\beta_2 exchanged. So yes — label permutation corresponds exactly to permuting the coefficient vectors.

Part (B): Feature Sign Flip

If you replace xxx \mapsto -x and retrain, the new optimal solution satisfies β~k=βk\tilde{\beta}_k = -\beta_k for all kk, since

β~k(x)=β~kx\tilde{\beta}_k^\top(-x) = -\tilde{\beta}_k^\top x

and the model structure is preserved with β~k=βk\tilde{\beta}_k = -\beta_k. So yes — negating features corresponds to negating all coefficient vectors.

The Identifiability Problem

True. The softmax has a fundamental non-identifiability.

The transformation: For any vector vRpv \in \mathbb{R}^p, define

βk=βk+vfor all k=1,,K.\beta_k' = \beta_k + v \quad \text{for all } k = 1, \ldots, K.

Then for every input xx:

e(βk)xje(βj)x=eβkx+vxjeβjx+vx=evxeβkxevxjeβjx=eβkxjeβjx.\frac{e^{(\beta_k')^\top x}}{\sum_j e^{(\beta_j')^\top x}} = \frac{e^{\beta_k^\top x + v^\top x}}{\sum_j e^{\beta_j^\top x + v^\top x}} = \frac{e^{v^\top x} \cdot e^{\beta_k^\top x}}{e^{v^\top x} \cdot \sum_j e^{\beta_j^\top x}} = \frac{e^{\beta_k^\top x}}{\sum_j e^{\beta_j^\top x}}.

The evxe^{v^\top x} factor cancels in numerator and denominator. So every predicted probability is identical under this shift.

Why more data cannot resolve it:

Since the likelihood

i=1np(yixi;{βk})\prod_{i=1}^n p(y_i \mid x_i; \{\beta_k\})

is identical for {βk}\{\beta_k\} and {βk+v}\{\beta_k + v\} for every data point, the log-likelihood surface is flat along the entire (Kp)(K \cdot p)-dimensional family {βk+v:vRp}\{\beta_k + v : v \in \mathbb{R}^p\}. No data distinguishes these parameter values — the Fisher information matrix is singular.

Standard fix: Pin one class, say βK=0\beta_K = 0. This is why logistic regression for K=2K=2 classes only needs one coefficient vector β1\beta_1 (the log-odds of class 1 vs. class 2). For general KK, you effectively model K1K-1 free coefficient vectors, giving a well-identified model.

Summary table:

| Operation | Effect on {βk}\{\beta_k\} | |---|---| | Swap labels 121 \leftrightarrow 2 | Swap β1β2\beta_1 \leftrightarrow \beta_2 | | Flip features xxx \to -x | Negate all: βkβk\beta_k \to -\beta_k | | Shift all by vv | Leaves all probabilities unchanged — not identifiable |

Source: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman (2nd ed.), Section 4.4

Type: ML/StatsSource: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman (2nd ed.), Section 4.4Edit on GitHub ↗