Repository navigation
Add IEWC (Improved Elastic Weight Consolidation) plugin and strategy - #1702
Open
DavideWiest wants to merge 3 commits into
Open
DavideWiest wants to merge 3 commits into
DavideWiest wants to merge 3 commits into
Conversation
This branch has not been deployed
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.
This adds IEWC as a new regularization method:
IEWCPlugininavalanche/training/plugins/iewc.py(subclass ofEWCPlugin, same penalty and online/separate modes) and anIEWCstrategy wrapper next toEWC.EWC's empirical Fisher weights each old sample by the scale of its loss gradient, so samples the model already fits well barely count. IEWC divides each per-sample term by the squared norm of the loss gradient w.r.t. the model output (plus a small damping relative to the median), which removes that scale for any differentiable loss. EWC-DR fixes a related problem by reversing logits, which only applies to classification. On our held-out ImageNet-R evaluation this change alone gives +2.00 points over EWC.
Paper: https://arxiv.org/abs/2611.16039
The importance uses per-sample gradients, so it is slower than EWC's batched estimate.
ewc_lambdafollows Avalanche's EWC convention (no 1/2). Sample weights can be uniform, residual-diversity weighting (sample_weighting="rdw") or a custom function, andloss_scale_fnsets the output geometry.Tests: new plugin tests (reduction to
EWCPluginwith batch size 1, the damping formula, invariance to loss rescaling, all-zero case, RDW weights) and a strategy test liketest_ewc. I also ran short Permuted MNIST runs next to EWC to check that it trains normally, and addedexamples/iewc.py. Docs lists are updated.