Fix BLOOM residual branch hook semantics - #1640
Merged
jlarson4 merged 1 commit intoAug 11, 2026
Merged
Conversation
7 tasks
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.
Description
Fixes #1639.
BLOOM's Hugging Face attention and MLP modules return states after adding the residual stream, so the default block aliases made
hook_attn_outandhook_mlp_outpoint at accumulated residual states. This breaks the HookedTransformer-compatible decomposition identities and makes interventions target the wrong tensors.This change overrides those two aliases to use BLOOM's existing output-projection hooks, which sit immediately before each residual addition and remain writable. The integration coverage uses the tiny BLOOM fixture to verify both residual identities on every layer and confirms that an attention-output ablation changes the model output.
Type of change
Validation
uv run pytest tests/unit/model_bridge/supported_architectures/test_bloom_adapter.py tests/integration/model_bridge/test_bloom_hook_semantics.py— 31 passeduv run pytest tests/unit/model_bridge/test_hook_alias_resolution.py tests/unit/model_bridge/test_component_hooks_fire.py tests/integration/model_bridge/test_pretrain_adapter.py— 212 passed, 3 skipped, 10 xfailedmake formatuv run mypy transformer_lens/model_bridge/supported_architectures/bloom.py tests/unit/model_bridge/supported_architectures/test_bloom_adapter.py tests/integration/model_bridge/test_bloom_hook_semantics.pyChecklist