Repository navigation
fix(regularize): norm=2 group lasso in RegularizeCallback, honest docs - #97
Merged
Merged
Conversation
With the per-group L1 summed over groups, the granularity never changed the penalty: the groups partition the weights, so the value was the layer's elementwise L1. norm=2 sums the L2 norm of each group within a layer (group lasso); norm=1, the default, is unchanged byte for byte.
nathanhubens
force-pushed
the
fix/regularize-group-norm
branch
from
September 24, 2026 10:30
340e4f7 to
50cba5c
Compare
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.
RegularizeCallbackcomputed a per-group L1 and then summed it over the groups. The groups partition the weights, so the value was the layer's elementwise L1 whatever thegranularity: that parameter never changed the penalty.What changes
RegularizeCallback(..., *, norm=1).norm=1(default) is unchanged, byte for byte: a test compares the loss and every gradient to the previous formula.norm=2sums the L2 norm (not squared) of each group of the chosen granularity, i.e. a group lasso within a layer, viatorch.linalg.vector_norm.RegularizeCallback(large_final, 'filter', 1e-3, norm=2, ...).Evidence
nbdev-testpasses in a clean clone, with CI's nbdev 3.3.21. Clean and export leave the tree unchanged.nbs/tests/test_regularize_callback.ipynb:norm=1byte identity;norm=1, which pins the old behaviour, and a difference undernorm=2;norm=2values;normrefused;#| slowLearner fit for both norms.