Experimental alpha. Expect breaking changes and major bugs. Your
feedback is much appreciated.
Z-Loss Regulator

Goes between a model's last layer and the Model Core. It hands the scores on unchanged, and while the model trains it adds a small penalty to the loss for scores that have drifted from zero: scores that drift far are where a softmax stops being accurate, and where a run begins to come apart.

Shapes
The model's scores [B×T×V] in, the same out.
Parameters
None. Its penalty weighs 0.0001.
In PyTorch
loss = ce + 1e-4 * logits.logsumexp(-1).pow(2).mean()
Making it
The Fabricator makes it from a photomask of Z-Loss: verify the spec on a Bench, or find a salvaged mask in the ruins, which makes it unfused. See The Bench and the Fabricator.


Residual