Normalized Concentration-Corrected Token-Weighted Reconstruction
Normalized Concentration-Corrected Token-Weighted Reconstruction
Back to reconstruction weighting and normalization
This note records an under-consideration token-level reconstruction variant that combines:
- tempered token-level surprisal-share weighting to focus reconstruction inside each example,
- concentration correction to cancel the scale inflation induced when surprisal is concentrated on a short prefix,
- the same distribution-level z-free reference scale used by Distribution-Level Z-Free-Relative Reconstruction Rescaling.
The intended role of this objective is:
focus reconstruction pressure on the most informative tokens within each example, while keeping the overall reconstruction term on the same scale as the ordinary uniform-token reconstruction loss.
Setup
Let the supervised y-region contain active token positions. For one example , define:
- z-conditioned per-token loss:
- z-free base-model surprisal:
- uniform mean z-free loss:
- distribution-level z-free reference scale:
For compactness, define masked raw moments of the z-free token surprisal:
Then .
In the current codebase, the z-free token losses are already computed during token-level weighting from a frozen reference model, aligned to the conditioned sequence. So the extra quantities introduced here can be computed from the same aligned per-token z-free losses without an additional forward pass.
Raw token-weighted reconstruction
Let the tempered token-level surprisal-share weights be
with interpreted by continuity as uniform token weighting.
The corresponding token-weighted reconstruction is
At the z-free baseline, where , this becomes
This is the base-model token loss after reweighting toward tokens with large .
Concentration factor
The corresponding token concentration factor is defined as
This measures how much the -tempered token weighting inflates the z-free base loss relative to ordinary uniform token averaging.
Important properties:
- ,
- for all ,
- increases as surprisal becomes more concentrated,
- increasing makes weakly larger, because more weight is placed on high-surprisal tokens.
For ,
where is the coefficient of variation , so
Thus is the factor by which linear surprisal-share weighting amplifies the z-free base loss relative to uniform token averaging.
Concentration-corrected reconstruction
Define the concentration-corrected token-weighted reconstruction
At the z-free baseline,
So the concentration correction restores the same per-example baseline scale as the uniform-token reconstruction loss.
Equivalently, the corrected loss can be written as
This form makes the main caveat explicit:
- within each example, the relative token emphasis is still determined by ,
- but across examples, the correction introduces an implicit example-level weight .
So this is not a purely token-level intervention. It is a token-level weighting rule plus a concentration-dependent example-level correction.
Distribution-normalized form
Finally, define the normalized concentration-corrected token-weighted reconstruction
At the z-free baseline,
Taking expectation over the data distribution gives
So this objective has two useful normalization properties:
- per example, concentration correction restores the same z-free baseline scale as ordinary uniform reconstruction;
- in expectation over examples, the additional division by makes the baseline value equal to .
Interpretation
This objective can be read as follows:
- the raw token-weighted loss focuses attention on high-residual-surprisal positions;
- the concentration factor removes the scale inflation caused purely by surprisal being concentrated on a small subset of tokens;
- the outer division by expresses the result in the same distribution-level z-free-relative units used by the standard normalized reconstruction loss.
That makes a natural candidate if the design goal is:
concentrate reconstruction pressure inside each example without changing the basic reconstruction scale just because surprisal mass is concentrated on a short prefix.
Useful structural properties
This objective family has several useful structural properties.
One of them is continuity at :
So the family reduces exactly to distribution-level normalized uniform-token reconstruction when .
This makes a clean concentration knob:
- : ordinary distribution-normalized reconstruction,
- : concentration-corrected linear surprisal-share weighting,
- : stronger focus on the highest-surprisal tokens.
Two other important properties are:
- the raw token-weighted loss still concentrates reconstruction pressure within each example according to the token-level surprisal-share rule defined by ;
- the concentration correction and outer division by keep the resulting objective on the same baseline scale as ordinary distribution-normalized reconstruction: per example at the z-free baseline it reduces to , and in expectation it reduces to after dividing by .
Main caveat
The main caveat is that the concentration correction changes more than scale.
Because each example is divided by , examples with more concentrated surprisal are downweighted relative to the raw token-weighted loss. This may be good if the uncorrected objective overemphasizes short strategy-revealing prefixes simply because they induce a large raw scale inflation. But it may also be undesirable if those same concentrated examples are exactly the ones where the latent variable should matter most.
So the concentration-corrected objective should be understood as a distinct methodological proposal, not merely a harmless re-expression of raw token weighting.
Current status in this repository
This variant is implemented as normalized_concentration_corrected_token_weighted_reconstruction_loss, one explicit term in the current reconstruction stack.
The current implementation computes the aligned per-token z-free baseline losses needed for:
- ,
- ,
- ,
- and therefore .
The current code touchpoints are:
- token-weight helper statistics in
path:core/disentanglement/token_weighting.py, - scalar loss helper in
path:core/disentanglement/losses.py, - discrete and continuous loss composition in
path:core/disentanglement/shared_discrete_cvae.pyandpath:core/disentanglement/continuous_cvae.py, - CLI / trainer wiring in
path:experiments/synthetic_sequences/disentangled/config.py,path:experiments/synthetic_sequences/disentangled/train_step.py, andpath:experiments/synthetic_sequences/disentangled/train_disentangled.py.
In the current reconstruction stack, this objective is the normalized high-surprisal token-weighted term alongside the raw token-weighted term rather than a replacement for it. See Current implementation: normalized concentration-corrected token-weighted reconstruction.
Neighboring variants
- Token-level surprisal-share weighting The currently implemented raw token-weighted loss.
- Distribution-Level Z-Free-Relative Reconstruction Rescaling The endpoint of the normalized concentration-corrected family.
- Unified reconstruction aggregation ideas A deferred broader design space that would combine multiple reconstruction weightings inside one configurable family.