docs/tests: feature_intervention_generate logits changed from 3D to 2D - document / test this#90
Open
hijohnnylin wants to merge 1 commit intodecoderesearch:mainfrom
Open
docs/tests: feature_intervention_generate logits changed from 3D to 2D - document / test this#90hijohnnylin wants to merge 1 commit intodecoderesearch:mainfrom
hijohnnylin wants to merge 1 commit intodecoderesearch:mainfrom
Conversation
…D - update tests/docs to reflect this
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.
When adding support for nnsight engine, we slightly changed the return shape of feature_intervention_generate's logits tensor. It changed from batch, seq_len, vocab_size to just seq_len, vocab_size. This broke downstream code/users that assumed the previous shape.
Previous: No squeeze(0), returned logits is 2D
circuit-tracer/circuit_tracer/replacement_model.py
Line 900 in e49c213
New: squeeze(0). returned logits is 3D
circuit-tracer/circuit_tracer/replacement_model/replacement_model_transformerlens.py
Line 900 in 9317b2a
The new shape is fine since the batch size is always 1 anyway, so this commit is a Claude-assisted update that doesn't update the behavior - it only adds documentation about this as well as a few tests and new asserts.
Possibly it's too verbose a PR for the relatively small change, so feel free to edit/change/minimize it.
(Downstream we added a check to ensure it's dimension 2 which is our workaround for now.)