[Bug Report] _BLOCK_LIST_ATTRS hardcoded name list silently drops Raven's blocks from composition-score / head-label analysis
I maintainer di solito rispondono entro 1 giorno
@LightWork666 ci sta già lavorando.
Dal 22/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Describe the bug
_enumerate_blocks() (transformer_bridge.py) walks a hardcoded tuple, _BLOCK_LIST_ATTRS = ("blocks", "encoder_blocks", "decoder_blocks", "L_blocks", "H_blocks") (bridge_core.py), checking self._modules.get(name) for each. Raven/Huginn's three block lists are registered under prelude, core_block, and coda -- none of which are in that tuple -- so _enumerate_blocks() silently returns [] for a Raven bridge, with no error.
This breaks every method built on it, silently:
blocks_with(submodule)-> always[]composition_layer_indices()-> always[]attn_head_labels-> always[](should report labels for every attention head across prelude/core_block/coda)
Inconsistently, some other methods built on the same broken enumeration fail loudly instead of silently, because they separately guard against an empty result: all_composition_scores() raises ValueError("No attention layers found"), and stack_params_for() (used by QK_for_attn_layers()/OV_for_attn_layers()) raises ValueError("No blocks have submodule ..."). Both messages are misleading -- Raven's blocks clearly do have attention -- but at least they don't silently hand back wrong data the way attn_head_labels does.
This is the same class of fragility as #1769 (stop_at_layer's reject-list), which jlarson4 is already having fixed by moving to an allowlist/_modules-based check -- except this one is on the enumeration side rather than the rejection side, and its failure mode is silent wrongness rather than a silent no-op.
Reproduction (no model download needed)
import torch.nn as nn
from transformer_lens.model_bridge.transformer_bridge import TransformerBridge
# Mirrors Raven's actual registered block-list shape (prelude/core_block/coda).
fake = nn.Module()
fake.add_module("prelude", nn.ModuleList([nn.Linear(2, 2), nn.Linear(2, 2)]))
fake.add_module("core_block", nn.ModuleList([nn.Linear(2, 2) for _ in range(4)]))
fake.add_module("coda", nn.ModuleList([nn.Linear(2, 2), nn.Linear(2, 2)]))
result = TransformerBridge._enumerate_blocks(fake)
print(result) # -> [] -- silently drops all 8 blocks, no error
System Info
- Installed from source,
dev-4.x - Pure Python logic, no weights involved; verified without downloading Raven's ~14GB checkpoint
Expected behaviour & fix pointers
Same direction as the fix in progress for #1769: replace the hardcoded name tuple with structural discovery. Every block-list component set via component_setup.py's list-item path carries hook_out_is_single_residual_stream = True on its items (already used for exactly this purpose in all_composition_scores()'s prerequisite check) -- _enumerate_blocks() could instead walk self._modules.items() and treat any nn.ModuleList whose first element is a GeneralizedComponent with that marker set as a block list, picking up prelude/core_block/coda (and any future non-standard adapter) automatically, with no name list to maintain.
Acceptance:
-
_enumerate_blocks()(and everything built on it:blocks_with,composition_layer_indices,attn_head_labels,stack_params_for,all_composition_scores) correctly discovers Raven'sprelude/core_block/codablocks, or raises a clear error consistently -- never silently returns an empty/wrong result - Existing
blocks/encoder_blocks/decoder_blocks/L_blocks/H_blocksbehavior is unchanged - A fast regression test (matching the reproduction above, no checkpoint download) pins the fix
-
make unit-testanduv run mypy .pass
Checklist
- I have checked that there is no similar issue in the repo (required)
- Lingua principale
- Python
- Stelle
- 3.9k
- Fork
- 708
- Merge medio
- 1g 17h
- PR unite (30g)
- 70
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TransformerLensOrg/TransformerLens
-
[Proposal] RoBERTa masked-LM adapter for TransformerBridgeForse già presa @Canonik l’ha presa oggi. Apertacomplexity-moderate new-architecture TransformerBridge
TransformerLensOrg/TransformerLens#1870 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Proposal] Backward Lens: support gated MLP gate/ up/ down gradient factorsForse già presa @janmenjayap l’ha presa 8 giorni fa. Apertacomplexity-moderate enhancement TransformerBridge
TransformerLensOrg/TransformerLens#1832 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Proposal] Sparse probing: optional groups argument so rows from one prompt can't straddle the splitForse già presa @lorenzozanee l’ha presa 13 giorni fa. Apertacomplexity-simple enhancement help wanted TransformerBridge
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
TransformerLensOrg/TransformerLens#1813 ·
I maintainer di solito rispondono entro 1 giorno
-
[Proposal] SVD Circuits: singular-vector decomposition of a head's QK/ OV into causally-validated subfunctionsForse già presa @janmenjayap l’ha presa 29 giorni fa. Apertacomplexity-high enhancement TransformerBridge
TransformerLensOrg/TransformerLens#1767 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Proposal] Relevance Lens (R-lens): a RelP/ LRP-based transport-matrix estimator for Jacobian Lens (J-lens) fit, readout, and interventionForse già presa @janmenjayap l’ha presa 31 giorni fa. Apertacomplexity-high enhancement TransformerBridge
TransformerLensOrg/TransformerLens#1755 · 6 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TransformerLensOrg/TransformerLens
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Multi-day events show "Ended" while still in progressForse già presa @tarunagnihotri534 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
data-umbrella/du-event-board#231 · 2 commenti ·
-
avl_automation: the generated control surface block isn't valid XML (typo in avl_out_parse.py)Forse già presa @brksol l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
PX4/PX4-gazebo-models#164 ·