Skip to content

Refactor replacement model using hooks#188

Merged
dest1n1s merged 7 commits intodevfrom
frm
Mar 3, 2026
Merged

Refactor replacement model using hooks#188
dest1n1s merged 7 commits intodevfrom
frm

Conversation

@Frankstein73
Copy link
Collaborator

No description provided.

@Frankstein73 Frankstein73 requested a review from dest1n1s March 3, 2026 11:36
…ntested)

- Remove stateful `cache_activations` from `TransformerLensLanguageModel`, passing it as an argument instead to make the class stateless.
- Remove the unused `initialize_replacement_model` method.
- Add `column_id_to_info` method to map column IDs to specific feature, error, and embedding information.
- Implement the core logic of the `attribute` method, including forward pass, building normalized edge matrix via gradient backpropagation, and feature attribution computation (tests not yet written).
…ibute implementation (untested)

Add EdgeMatrix, a torch.Tensor wrapper subclass that carries
cache_activations metadata through tensor operations. This simplifies
the attribute method by encapsulating row/column info, activation
lookups, and edge matrix construction into the class itself.
@dest1n1s dest1n1s merged commit f9e02df into dev Mar 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants