[Bug Report] Inspect RemoteBridge silently ignores attention_mask
I maintainer di solito rispondono entro 1 giorno
@emerardd ci sta già lavorando.
Dal 5/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Describe the bug
The Inspect backend silently drops an attention_mask passed to RemoteBridge.forward() or run_with_cache(). InspectDriver.forward() accepts the argument in **kwargs, but its profile request contains only input IDs, capture keys, interventions and the logits flag. The HF provider consequently runs an unmasked forward. Returned logits and cached activations can therefore reflect padding as real context, even though RemoteBridge later applies the supplied mask when aggregating loss.
Code example
import torch
from transformer_lens.model_bridge.remote_bridge import RemoteBridge
bridge = RemoteBridge.boot_inspect("gpt2", provider="tl_bridge", device="cpu")
tokens = torch.tensor([[0, 0, 7, 8]])
mask = torch.tensor([[0, 0, 1, 1]])
logits, cache = bridge.run_with_cache(tokens, attention_mask=mask)
On dev at 6affbe99, an offline driver probe for this input sent input_ids=[0, 0, 7, 8] with no attention_mask in the provider request. A separate random tiny eager GPT-2 control compared the provider-equivalent unmasked forward with a masked forward using mask-derived positions: the final-logit maximum difference was about 0.159, while the masked result matched the unpadded [7, 8] control within 3e-8. These checks establish the request omission and its numerical consequence; a live downloaded-model Inspect run was not used for this report.
System Info
TransformerLens installed from source with uv; Windows, Python 3.12.10, Torch 2.11.0+cpu, Transformers 5.13.0. Reproduced on current dev at 6affbe99.
Additional context
The omission spans sources/inspect/driver.py, profiles.py, and transformers_provider.py. This is separate from the local Bridge position-id fix (#1610) and the direct vLLM driver padding fix (#1804).
I plan to propagate and validate a single-sequence 2-D mask through the HF-backed Inspect path, handle padding positions consistently, and add regressions covering logits, captures and masked loss. Providers that cannot honor masks should reject them explicitly before execution; tl_bridge_vllm and third-party provider capabilities need their own handling.
Checklist
- I have checked that there is no similar issue in the repo
- Lingua principale
- Python
- Stelle
- 3.9k
- Fork
- 708
- Merge medio
- 1g 10h
- PR unite (30g)
- 82
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
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
TransformerLensOrg/TransformerLens#1980 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug Report] detect_head fails with a list of sequences and a custom tensor detection patternAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
TransformerLensOrg/TransformerLens#1979 ·
I maintainer di solito rispondono entro 1 giorno
-
[Proposal] Demo: auditing a published LLM-written weight edit (Weight-Space Programming, Qwen3.5-0.8B loop fix) with TransformerBridgeForse già presa @emerardd l’ha presa 1 giorno fa. Apertacomplexity-moderate demo TransformerBridge
TransformerLensOrg/TransformerLens#1978 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug Report] `blocks.N.hook_out` never fires on OpenAI GPT because the HF block returns a listForse già presa @ska2704 l’ha presa 2 giorni fa. Apertabug complexity-simple TransformerBridge
Difficoltà 3/5 Mezza giornata Idoneità per principianti 72/100
TransformerLensOrg/TransformerLens#1969 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement seen_by_maintainers TransformerBridge
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
TransformerLensOrg/TransformerLens#1957 · 3 commenti ·
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 78/100
FinanceFlash/unvibecode#509 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
FAIRmat-NFDI/nomad-distro-dev#161 ·
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
modelcontextprotocol/python-sdk#3821 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug severity:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 2 giorni
-
Log-odds calibration uses upper middle score instead of median for even candidate setsForse già presa @flysheep-ai l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno