transformer_lens.tools.analysis.jacobian_lens_causal_swap_benchmark_cli module

Artifact-generation entry point for the causal coordinate-swap benchmark.

Kept separate from transformer_lens.tools.analysis.jacobian_lens_causal_swap_benchmark because the analysis package’s __init__ imports that module: running it as a script would execute it twice and runpy would warn. This module is not imported by the package, so python -m runs it once.

Reproduce the frozen artifact with (no HF_TOKEN needed – GPT-2 is not gated):

uv run python -m transformer_lens.tools.analysis.jacobian_lens_causal_swap_benchmark_cli
transformer_lens.tools.analysis.jacobian_lens_causal_swap_benchmark_cli.main(argv: Sequence[str] | None = None) → None

Generates the frozen GPT-2 causal-swap benchmark artifact.

Loads the published GPT-2-small lens (the same artifact tests/integration/test_jacobian_lens.py uses), runs the reused country corpus over every one of the lens’s fitted source layers, and writes the versioned, fingerprinted JSON artifact consumed by demos/Jacobian_Lens_Coordinate_Patch_Benchmark_Demo.ipynb.