Skip to content

fix: preserve RecurrentGemma sliding-attention labels - #2062

Merged
jlarson4 merged 1 commit into
TransformerLensOrg:devfrom
emerardd:fix/recurrent-gemma-sliding-attention-labels
Nov 30, 2026
Merged

jlarson4 merged 1 commit into
TransformerLensOrg:devfrom
emerardd:fix/recurrent-gemma-sliding-attention-labels

Conversation

@emerardd

Copy link
Copy Markdown
Contributor

Description

Hugging Face now reports RecurrentGemma's local-attention layers as sliding_attention. The activation cache didn't recognize that value, so residual decomposition returned 2_mixer_out where it previously returned 2_attn_out. Recognize sliding_attention as attention while preserving the labels for recurrent layers. This changes labels only, not the contribution tensors or dependency bounds.

The failing case was noted in #2053. The new regression test exercises the updated config vocabulary even when the test environment uses an older Transformers version.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Validation

  • Transformers 5.13.0: the full hybrid residual-decomposition test file passed (211 passed, 33 skipped).
  • Transformers 5.24.1: the RecurrentGemma subset passed (24 passed, 2 skipped).
  • Changed-file formatting, mypy, and git diff --check passed.

Checklist

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes (full unit suite not run)
  • I have not rewritten tests relating to key interfaces which would affect backward compatibility

@jlarson4

Copy link
Copy Markdown
Collaborator

Looks good! Approved and merging

@jlarson4
jlarson4 merged commit 1aeec5c into TransformerLensOrg:dev Nov 30, 2026
61 of 62 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