Semantic Pushforward Uncertainty Head / README.md

Mechanism confirmed, baseline not beaten

Raw ⬇ ZIP

Semantic Pushforward Uncertainty Head MVP

experiment.py implements the finite-state semantic pushforward and the proposed calibrated head:

p[j] = sum(response_prob[r] for phi[r] == j)

hat_pi = softmax(a * log(p + eps) + b)

The experiment uses exact synthetic Bayesian posteriors q, a controlled response distortion p proportional to q**gamma, and separate fitting/test splits. This isolates the calibration mechanism while retaining the finite-state total-variation metric.

Reproduce

/home/maxwelhelp/main/bin/python3 experiment.py

The script writes results.json and prints the same JSON.

Mechanism checks

  • Pushforward aggregation error: 0.0.
  • Redistributing mass among synonymous responses changes pushed state mass by only 1.11e-16.
  • Across gamma = 0.5, 0.75, 1, 1.5, 2, fitted mean slopes gave gamma*a = 0.916, 0.983, 0.995, 0.980, 1.026 (near the predicted 1).
  • At gamma=2, calibration reduced TV to exact q from 0.1420 to 0.0070, ECE from 0.1324 to 0.0175, and NLL from 0.8894 to 0.7791; 90% prediction-set coverage rose from 0.8884 to 0.9680.

This is not a transformer integration: response probabilities are supplied by a controlled finite candidate distribution rather than token log-probabilities from an LM. It therefore verifies the measure aggregation and calibration mechanism, not language-model decoding, malformed-output rates, or extra-forward-pass cost.