[Bug Report] test_faithfulness_recovery_is_graded_not_binary passes or fails on the sign of float32 rounding

オープン 初心者向け
#1,993 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@pablocs116 がすでに取り組んでいます。

2026年11月6日 から。

  • #1998 @pablocs116 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, pytorch
領域
testing-qa

調査の方向性

まず tests/unit/tools/test_attribution_patching.py::test_faithfulness_recovery_is_graded_not_binary から始め、部分的な回路がどのように選択され、復元された割合がどのように計算されるかを調べてください。issue に記載されたコマンドでテストを実行し、その後、logits までの提案された完全なパスと照らしてアサーションを確認してください。完了条件は、浮動小数点の挙動の違いがあってもテストが決定的であり、段階的な復元を引き続き検証することです。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
tests/unit/tools/test_attribution_patching.py::test_faithfulness_recovery_is_graded_not_binary fails deterministically on my machine, both inside the full unit suite and on its own, while CI is green on the same commit.

The partial circuit is readout[: len(readout) // 2], the first 23 of the 46 edges into the last position. In enumeration order those are all edges into the layer-0 Q/K/V/MLP inputs and the layer-1 Q/K inputs. None of them feeds the logits reader. _EdgeScoringToyBridge is linear, so with every edge into logits ablated, no clean signal reaches the metric. The recovered fraction is therefore exactly 0 in exact arithmetic: building the toy in float64 gives 6.5e-17. In float32 the 0.0 < check comes down to the sign of the rounding error, which is positive on CI and negative here.

Code example
On dev at a1fe5d4d, with no local changes:

uv run pytest tests/unit/tools/test_attribution_patching.py -k faithfulness_recovery_is_graded_not_binary
>       assert 0.0 < report.recovered < 1.0
E       AssertionError: assert 0.0 < -1.3424525621271817e-08

System Info

  • Installed from source with uv
  • Linux under WSL2 on Windows, CPU only
  • Python 3.12, torch 2.11.0, transformers 5.13.0

Additional context
Suggestion: pick the partial circuit so it contains at least one complete path to logits (for example by including the embed→logits edge), so the "recovers part" claim holds structurally. Simply switching to the second half isn't enough on its own: it recovers 0.30 with the float32 toy, but 1.12 with the float64 toy (a different random draw), so the < 1.0 bound isn't guaranteed either.

Checklist
  • I have checked that there is no similar issue in the repo (required)

The checklist box is honest: I searched issues and PRs and found nothing about this test.

主要言語
Python
スター
3.9k
フォーク
708
平均マージ
1日 4時間
マージ済み PR(30日)
87

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TransformerLensOrg/TransformerLens のほかの issue

TransformerLensOrg/TransformerLens の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。