Current implementation: normalized inverse-surprisal token-weighted reconstruction ablation
Current implementation: normalized inverse-surprisal token-weighted reconstruction ablation
Methodology note: Inverse-surprisal token-weighted reconstruction ablation
This note records how the normalized inverse-surprisal token-weighted reconstruction ablation is currently implemented in code.
Current status
This ablation is implemented as the sixth explicit reconstruction term:
normalized_inverse_surprisal_token_weighted_reconstruction_loss
Current definition
The implementation reuses the aligned frozen-reference token NLL tensor computed for token-level surprisal-share weighting. It builds inverse token weights
where is the aligned supervised-token mask, is the shared token-weighting exponent, and is the inverse-token clipping floor.
The latent-conditioned token NLL tensor is then aggregated with to produce a per-example inverse-token reconstruction loss . The implementation also computes the inverse-token z-free base loss and the inverse-token base scale factor
where is the uniformly averaged z-free supervised-token base loss for the same example.
The scalar component is
Where the supporting statistics come from
The shared frozen-reference pass lives in:
path:core/disentanglement/token_weighting.py
The returned statistics now include:
inverse_token_weightsinverse_token_weighted_base_lossinverse_token_base_scale_factor
The high-surprisal token weights and inverse-surprisal token weights are computed from the same aligned z-free token NLL tensor, so the ablation does not add another reference-model forward pass.
Where the term is assembled
The scalar helper lives in:
path:core/disentanglement/losses.py
and is integrated in:
path:core/disentanglement/shared_discrete_cvae.pypath:core/disentanglement/continuous_cvae.py
In the discrete path, each latent-specific token NLL tensor is aggregated three ways: uniform, high-surprisal token-weighted, and inverse-surprisal token-weighted. In the continuous path, the sampled-z token NLL tensor is aggregated with the same three reconstruction aggregators.
Configuration surface
The core configuration fields are:
ReconstructionLossConfig.normalized_inverse_surprisal_token_weighted_weightReconstructionLossConfig.inverse_surprisal_token_weight_epsilonReconstructionLossConfig.token_weight_alphaReconstructionLossConfig.zfree_reference_scale
The trainer CLI exposes:
--normalized-inverse-surprisal-token-weighted-reconstruction-weight--ablation-inv-surp-token-weight--inverse-surprisal-token-weight-epsilon--token-weighted-reconstruction-alpha
The alias --ablation-inv-surp-token-weight writes to the same trainer config field as the canonical weight flag. The exponent --token-weighted-reconstruction-alpha is intentionally shared with the high-surprisal token-weighted terms.
Diagnostics
The implementation logs:
inverse_token_weighted_base_lossinverse_token_base_scale_factorinverse_token_weighting/weight_maxinverse_token_weighting/weight_ratio_max_mininverse_token_weighting/effective_token_count_mean
The readable reconstruction tag uses tokinv when the inverse-token term has positive weight. The run identity keeps token_weighted_reconstruction_alpha and inverse_surprisal_token_weight_epsilon only when an active token-weighted term makes those knobs behaviorally relevant.