Skip to content

Fix Gemma 4 gated MLP hook aliases - #1672

Closed
LarryHu0217 wants to merge 1 commit into
TransformerLensOrg:dev-4.xfrom
LarryHu0217:codex/fix-gemma4-mlp-hooks-1646
Closed

Fix Gemma 4 gated MLP hook aliases#1672
LarryHu0217 wants to merge 1 commit into
TransformerLensOrg:dev-4.xfrom
LarryHu0217:codex/fix-gemma4-mlp-hooks-1646

Conversation

@LarryHu0217

@LarryHu0217 LarryHu0217 commented Aug 14, 2026

Copy link
Copy Markdown

Description

Gemma 4 dense MLPs use the same gate/up/down projection structure as other gated MLP architectures, but the adapter mapped them as a bare GeneralizedComponent. This prevented the standard hook_pre, hook_pre_linear, and hook_post aliases from being registered.\n\nThis change uses the shared gated-MLP bridge for Gemma 4 and adds unit and integration coverage that verifies the aliases map to the expected projections and are available through run_with_cache across the PLE/KV-sharing, dense K=V, and MoE fixtures.\n\nFixes #1646\n\n## Type of change\n\n- [x] Bug fix (non-breaking change which fixes an issue)\n\n## Testing\n\n- Unit adapter test: 10 passed\n- Gemma 4 integration test: 15 passed\n- Full non-slow unit suite: 5266 passed, 56 skipped, 10 xfailed\n- Format check passed\n- mypy passed for 431 source files\n\n# Checklist\n\n- [x] The implementation is self-explanatory and does not require additional comments\n- [x] No documentation change is required for restoring the existing hook interface\n- [x] My changes generate no new warnings\n- [x] I have added tests that prove the fix is effective\n- [x] New and existing unit tests pass locally with my changes\n- [x] I have not rewritten tests relating to key interfaces

@jlarson4

Copy link
Copy Markdown
Collaborator

Hi @LarryHu0217! Sorry I didn't see your message on the issue before you posted this. The issue is for 3.x, and has already been resolved on dev, the issue will be closed at the next release. The fix on 3.x will be ported to 4.x directly to avoid conflicts from a parallel implementation. Sorry for the confusion

@jlarson4 jlarson4 closed this Aug 14, 2026
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