feat(ocl): add Riemannian Walk (RWalk) strategy - #407
Open
tachyonicClock wants to merge 1 commit into
Open
Conversation
RWalk is a regularisation-based continual learning strategy that, like EWC, augments the task loss with a weighted quadratic penalty on parameter changes. The penalty weights combine an exponential moving average of squared gradients with trajectory scores that estimate how sensitive the loss is to parameter updates, accumulated online between periodic checkpoints (Chaudhry et al., 2018). Ported from the `blurry-ocl` draft branch and adapted to the current `capymoa.ocl` module layout. Also: * Inlines `trainable_params`/`weighted_l2_reg` instead of importing them from `_ewc`, for the same reason as MAS: the draft's `_ewc.py` had since diverged from what actually shipped, and this keeps RWalk self-contained like EWC, SI, and MAS. * Drops the draft's leading-underscore module function names (`_rwalk_update_importances`, `_copy_params_`, etc.) in favour of the no-leading-underscore/trailing-underscore-for-in-place convention SI and MAS already use in this stack. * Adds a proper class docstring with a citation, and documents `__init__` parameters, matching EWC/SI/MAS'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, LWF, and MAS. Stacked on `feat/ocl-mas` (#406), which is in turn stacked on `feat/ocl-lwf` (#404) and `feat/ocl-si` (#403); this PR depends on all three 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.
Summary
feat/ocl-mas), feat(ocl): add Learning Without Forgetting (LWF) strategy #404 (feat/ocl-lwf), and feat(ocl): add Synaptic Intelligence (SI) strategy #403 (feat/ocl-si) - this PR only diffs the RWalk-specific changes and depends on the earlier PRs forcapymoa.ocl.util._optim.reset_optimizer_stateandcapymoa.ocl.util._buffer_list.BufferList.blurry-ocldraft branch, adapting it to the currentcapymoa.oclmodule layout.trainable_params/weighted_l2_reginstead of importing them from_ewc, for the same reason as MAS: the draft's_ewc.pyhad since diverged from what actually shipped, and this keeps RWalk self-contained likeEWC,SI, andMAS._rwalk_update_importances,_copy_params_, etc.) in favour of the no-leading-underscore/trailing-underscore-for-in-place conventionSIandMASalready use in this stack.__init__parameters, matchingEWC/SI/MAS's docstring conventions.on_train_task/on_test_taskto_on_train_task_begin/_on_test_task_beginand hasattach_withreturnself, for consistency withSI,LWF, andMAS.RWalkincapymoa.ocl.strategy.__init__.RWalkcases totests/ocl/test_strategy.py.Closes adaptive-machine-learning/backlog#125
Assisted-by: claude-code:claude-sonnet-5