← Blog/blog/softmax-hides-state-gap

When a huge hidden-state error changes almost nothing

Two sequence models can update their hidden states in radically different ways and still make nearly identical predictions. Wen, Liu, Zhou, Zeng, and Su prove that this is not merely possible: in a finite-state hidden Markov model, one explicit update gap grows without bound while the decoded predictive KL divergence goes to zero.

A hidden Markov model (HMM) assumes an unobserved mode that changes over time and emits noisy observations. A filter maintains a probability for each mode. The surprising part is where the metric is measured: logits can drift far apart after an update while softmax maps both vectors into almost the same confident categorical belief.

01

The same belief has many logit vectors

Adding one constant to every logit changes nothing after softmax. The paper therefore centers every vector by subtracting its mean and measures differences through pairwise log odds. For K latent modes, the meaningful state lives in K − 1 dimensions.

The HMM stays in its current mode with probability 1 − q and switches uniformly to another mode with probability q. Rare switching makes the natural confidence scale LK(q) = log((K − 1)(1 − q)/q) grow. Exact Bayesian mixing and the paper's radial tanh update both saturate on this scale, but they approach the boundary differently.

def exact_update(h, q):
    return 2 * atanh((1 - 2*q) * tanh(h / 2))

def radial_update(h, q):
    L = log((1 - q) / q)
    return L * tanh((1 - 2*q) * h / L)

def bernoulli_kl(exact, approx):
    p, r = sigmoid(exact), sigmoid(approx)
    return p*log(p/r) + (1-p)*log((1-p)/(1-r))

The binary formulas above expose the mechanism without a machine-learning library. Python is the default; TypeScript and C++ are line-for-line translations. The figures call the tested K-state core implementation, not pasted chart values.

02

Build the counterexample one witness at a time

For each fixed K, the paper chooses centered logits z = L(1/4, −1/4, 0, …, 0). As q falls, L rises. The quotient distance compares every pairwise log-odds change from exact and radial mixing, ignoring the common shift that softmax cannot see.

K = 2K = 4K = 8
Seed-free reproduction of the paper's explicit map-level witness. Each x-position is L = 8, 16, 24, 32, 48, 64; q is solved from L separately for each fixed K.
K = 2K = 4K = 8
The same core-computed witnesses, now showing −log10 predictive KL. Rising curves mean the decoded distributions are getting closer, even as the update gap above grows.
03

Why softmax makes both statements true

Imagine two thermometers that disagree by ten degrees but both read far above the boiling point. For the decision “is it boiling?”, their disagreement barely matters. Here both filters become highly confident in the same mode. Softmax curvature becomes tiny inside that common confidence cone, suppressing a logit-space discrepancy that remains large in absolute units.

The paper formalizes this with a bound proportional to R²e−m, where R bounds the range of the logit discrepancy and m is the shared winning margin. Polynomial growth in R can lose to exponential decay in decoder sensitivity. This is the missing link between representation distance and prediction loss.

Paper-reported finite-scale slope of log predictive KL versus L. More negative means faster illustrated decay; these are Table 5 results with 95% bootstrap intervals, not values recomputed here.
KInternal slope [95% CI]Final gap/L [95% CI]Log-KL slope [95% CI]
20.5794 [0.5788, 0.5800]0.5419 [0.5414, 0.5423]−0.1574 [−0.1661, −0.1454]
40.7493 [0.7487, 0.7499]0.7315 [0.7311, 0.7319]−0.0265 [−0.0292, −0.0241]
80.8688 [0.8681, 0.8696]0.8728 [0.8724, 0.8733]−0.0085 [−0.0090, −0.0080]
Paper Table 5. Four seed blocks supplied 4,096 paired paths per cell; intervals bootstrap complete paths. Negative log-KL slopes illustrate shrinking predictive discrepancy.
04

The finite experiment dodged the rare event

This does not invalidate the theorem: the path-level convergence proof controls the full stationary expectation, including rare paths. It does change what the simulation establishes. The displayed K = 2, 4, 8 subset was also chosen after a broader grid was evaluated; four of five original configurations passed the directional criterion, while one skewed K = 8 setting had an unresolved log-KL slope.

The learned-model evidence is narrower still. End-to-end training met the authors' transfer criterion at four of six q values rather than the prespecified five. At horizons up to 2,048, the analytic tanh recurrence remained stable, but one- and two-block Mamba variants did not establish the same mechanism. A proved hand-designed update is not evidence that a named architecture will discover it.

05

Read each claim at its actual scope

LayerWhat supports itWhat it does not show
Map-level theoremExplicit moving witnessA gap on every bounded input
Path-level theoremStationary symmetric Gaussian HMMUniformity as state count grows
Finite-scale sweep4,096 paired paths per cellRare-switch behavior in tail cells
Learned-model studyMatched models and held-out seedsThat Mamba learns the radial rule
A claim-evidence map for separating the theorem, illustration, and learned-model experiment.
06

What to probe next

If an internal-state metric predicts downstream failure, test the whole bridge: how often separating states occur under the deployment path law, how sensitive the decoder is there, and whether the chosen loss exposes the difference. Report task loss beside representation distance, stratify rare transitions, reverse asymmetric divergences, and extend evaluation far beyond the training horizon.

The paper fixes K before q approaches zero, assumes distinct scalar Gaussian means, symmetric switching, stationary initialization, and a logarithmic horizon. It proves a counterexample, not a general license for pruning or compression. For the decoder mechanics, continue with the site's logistic-regression walkthrough; for the sequence-model connection, see the transformer walkthrough.

References

  1. Wen, Qifu; Liu, Shuaijun; Zhou, Zihan; Zeng, Xi; and Su, Ningxin (2026). How Wrong Can a Good Predictor Be? Diverging Updates with Vanishing Predictive KL. arXiv:2609.11132
  2. Bishop, Adrian N. and Bonilla, Edwin V. (2023). Recurrent Neural Networks and Universal Approximation of Bayesian Filters. AISTATS 2023, PMLR 206
  3. Gu, Albert; Goel, Karan; and Ré, Christopher (2022). Efficiently Modeling Long Sequences with Structured State Spaces. ICLR 2022