-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Topk SAE training #370
Open
chanind
wants to merge
9
commits into
main
Choose a base branch
from
topk-aux-loss
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
chanind
force-pushed
the
topk-aux-loss
branch
from
November 11, 2024 15:53
f4d6c41
to
0f3c243
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #370 +/- ##
==========================================
+ Coverage 72.74% 72.88% +0.13%
==========================================
Files 22 22
Lines 3266 3297 +31
Branches 431 438 +7
==========================================
+ Hits 2376 2403 +27
- Misses 762 764 +2
- Partials 128 130 +2 ☔ View full report in Codecov by Sentry. |
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.
Description
This PR implements topk SAE training by adding the topk auxiliary loss. This PR makes several design choices:
topk
is specified as anarchitecture
for training, so it's similar togated
andjumprelu
SAEs. This seems fit the idea of an SAE architecture since it has its own custom training routine and losses, and it seems strange to call "jumprelu" and "gated" architectures, but not topk.Our implementation of topk training is likely less efficient than Eleuther's as they use a custom sparse kernel for the SAE decoder (see https://github.com/EleutherAI/sae/blob/main/sae/kernels.py). We can try to support something like this in the future, but it will likely require a bit of refactoring before we can support a special decoder kernel just for topk.
I'm currently running some test training runs to make sure things look decent, and will upgrade this PR from draft when those are complete.
Fixes #202
training test run dashboard: https://api.wandb.ai/links/chanind/zju8dl70
Type of change
Please delete options that are not relevant.
Checklist:
You have tested formatting, typing and unit tests (acceptance tests not currently in use)
make check-ci
to check format and linting. (you can runmake format
to format code if needed.)