Skip to content

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

Closed

Description

@pablocs116

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 a1fe5d4, 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.

Activity

  1. pablocs116 commented on Nov 9, 2026

    @pablocs116
    ContributorAuthor

    Fixed by #1998.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions