-
Notifications
You must be signed in to change notification settings - Fork 67
wassname's changes #67
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
Closed
Closed
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8b54953
fix fwd with batch and position_ids
wassname e47e2af
fix pos id
wassname cb6c592
layers for gemma
wassname 57313ca
bugfix
wassname 0c5fc01
Update control.py
wassname bc33cc4
refactor: add __getattr__ to ControlModule for transparent block prox…
thiswillbeyourgithub d47f8de
Merge remote-tracking branch 'thisw/fix-qwen3-models'
wassname a291ddb
important sampling,
wassname b24a2d9
fixed weighted PCA
wassname 96b1366
more general way to find model layers
wassname 9a0f9e6
add quantitive unit test
wassname a1148ba
allow choice between weighted and not
wassname 28b07ab
nicer unit test
wassname 982f776
reasoning
wassname 64922a7
use provided attention mask
wassname 8ce7851
this has many problems, it breaks in some models, in GLM the attentio…
wassname 6a16076
wip
wassname d8fbf50
add performance tests
wassname 8824506
sp
wassname File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what happens in those few new lines and why we would want that please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tried out importance sampling. This is an ideal from RL, where you weight online data more. This means data that the model would actually generate, and therefore it's more relevant for behaviour change. The way it's done here is that you mean the mean logprob of a sequence, and that's the importance.
As a result it seems to make more stable vectors that could be ramped up to +4 without incoherence.
As a bonus, here's a visualisation of how a thinking model changes it's answer as it thinks. (I fork the kv-cache, and have it answer a binary question, then I rewind time and have it continue thinking.

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a reference to importance sampling in RL https://people.eecs.berkeley.edu/~jiantao/2902021spring/scribe/EE290_Lecture_23_24.pdf and the most relevant versions are in DPO variants e.g. https://github.com/Vance0124/Token-level-Direct-Preference-Optimization
But it's like saying "here's a video of someone driving a truck on an elephant road in Cambodia, I hope it helps you learn to drive your mini", but in reality this would have a low importance weight because it's not that relevant to how you drive or what you are trying to learn. It might be rated at 0.05, while a video of a mini in London streets might be 0.7, and a video of yourself driving yesterday might be 0.99, and a video of yourself driving at 16 years old might be 0.75.
This can be applied to a sequence or a particular token too, although I haven't seen the token specific version work that well.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the explainer. I'm not good enough to implement this kind of thing myself. But if you have done an implementation in the passed I'm super interested. I think I'd have much greater chance of understanding how it works if I saw it in repeng.