SmoothL0: normalize_at_one option (fix gamma-anneal coeff ramp) - #994
Open
Antovigo wants to merge 2 commits into
Open
SmoothL0: normalize_at_one option (fix gamma-anneal coeff ramp)#994Antovigo wants to merge 2 commits into
Antovigo wants to merge 2 commits into
Conversation
Add an opt-in `normalize_at_one` flag to SmoothL0ImportanceMinimalityLoss that rescales the Geman–McClure penalty by `(1 + gamma^2)`, so a fully-on component (c=1) contributes exactly 1 regardless of gamma. Without it, phi(1) = 1/(1+gamma^2) grows as gamma anneals down, silently ramping the effective coeff on saturated components across the schedule. Threads the flag through the loss dispatch; defaults to False, so existing runs are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XygndeoX7JQqqnuNpiCh5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016QbtkPzfQyKcS5L4tE8LAJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in
normalize_at_one: bool = FalsetoSmoothL0ImportanceMinimalityLossConfig. When set, the Geman–McClure per-value penalty is rescaled by(1 + gamma^2):so a fully-on component (
c = 1) contributes exactly 1 regardless ofgamma.Why
The unnormalized penalty gives
phi(1) = 1/(1 + gamma^2). Asgammaanneals down over training (e.g.1.0 -> 0.1), the contribution of a saturated component climbs from0.5toward1.0. This silently couples the sparsity pressure to thegammaschedule in a way that is hard to reason about.normalize_at_onepins the cost of a fully-active component to 1 for the whole schedule, socoeffmeans the same thing at every step.Some tests on Llama-8B’s L18, targeted on addition/subtraction tasks:
In both case, the
gammaparameter is annealed from 1 to 0.01 over the second half of training.The normalized version behaves very similarly to the non-normalized version:


However, if we look at the importance minimality loss throughout training, the un-normalized version has a clear ramp over the annealing period, reflecting a change in the minimality/reconstruction exchange rate:

Changes
param_decomp/core/configs.py: newnormalize_at_onefield (defaults toFalse) + docstring.param_decomp/core/losses.py:smooth_l0_importance_minimality_termstakesnormalize_at_oneand picks between the two full per-value formulas; the flag is threaded through theimp_min_termsdispatch.L_ppath untouched.param_decomp/core/tests/test_smooth_l0_imp_min.py: newtest_normalize_at_one_fixes_saturated_contribution(saturated component → exactly 1; wholelpscales by(1 + gamma^2)); existing call sites updated.Compatibility
Default
False⇒ existing runs are numerically unchanged.Testing
pytest param_decomp/core/tests/test_smooth_l0_imp_min.py— 5 passed. ruff + basedpyright clean (pre-commit).