feat(ocl): add Memory Aware Synapses (MAS) strategy - #406
Open
tachyonicClock wants to merge 1 commit into
Open
Conversation
Memory Aware Synapses (MAS) is a regularisation-based continual learning strategy that estimates per-parameter importance from the sensitivity of the model's output (rather than the task loss) to small parameter perturbations, then penalises changes to parameters that were important for previous tasks (Aljundi et al., 2018). Ported from the `blurry-ocl` draft branch and adapted to the current `capymoa.ocl` module layout. Also: * Drops the draft's `ReplayBuilder` abstraction and `capymoa.ocl.replay` import (neither exist on `main`) in favour of using `SlidingWindow` from `capymoa.ocl.util._replay` directly, matching EWC. * Inlines `trainable_params`/`weighted_l2_reg` instead of importing them from `_ewc`, whose current signature no longer matches (the draft's `_ewc.py` had since diverged from what actually shipped). This also matches the self-contained pattern EWC and SI already follow, rather than adding cross-file coupling between strategies. * Adds a proper class docstring with a citation, and documents `__init__` parameters, matching EWC/SI's docstring conventions. * Renames `on_train_task`/`on_test_task` to `_on_train_task_begin`/ `_on_test_task_begin` and has `attach_with` return `self`, for consistency with SI and LWF. Stacked on `feat/ocl-lwf` (#404), which is in turn stacked on `feat/ocl-si` (#403); this PR depends on both for `capymoa.ocl.util._optim.reset_optimizer_state` and `capymoa.ocl.util._buffer_list.BufferList`. Assisted-by: claude-code:claude-sonnet-5
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.
feat/ocl-lwf), which is stacked on feat(ocl): add Synaptic Intelligence (SI) strategy #403 (feat/ocl-si) - this PR only diffs the MAS-specific changes and depends on both forcapymoa.ocl.util._optim.reset_optimizer_stateandcapymoa.ocl.util._buffer_list.BufferList.blurry-ocldraft branch, adapting it to the currentcapymoa.oclmodule layout.ReplayBuilderabstraction andcapymoa.ocl.replayimport (neither exist onmain) in favour of usingSlidingWindowfromcapymoa.ocl.util._replaydirectly, matchingEWC.trainable_params/weighted_l2_reginstead of importing them from_ewc, whose current signature no longer matches what the draft's (diverged)_ewc.pyhad. This also matches the self-contained patternEWCandSIalready follow, rather than adding cross-file coupling between strategies.__init__parameters, matchingEWC/SI's docstring conventions.on_train_task/on_test_taskto_on_train_task_begin/_on_test_task_beginand hasattach_withreturnself, for consistency withSIandLWF.MASincapymoa.ocl.strategy.__init__.MAScases totests/ocl/test_strategy.py.Closes adaptive-machine-learning/backlog#147
Assisted-by: claude-code:claude-sonnet-5