Metadata-Version: 2.5
Name: interprelens
Version: 0.3.0
Summary: InterpreLens: find, compare and act on the attention heads behind any LLM behaviour.
Project-URL: Homepage, https://github.com/Aisuko/interprelens
Project-URL: Repository, https://github.com/Aisuko/interprelens
Author: Bowen
License: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: huggingface-hub>=0.20.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: safetensors>=0.4.0
Requires-Dist: torch>=2.0.0
Requires-Dist: transformers>=4.30.0
Provides-Extra: chg
Requires-Dist: pandas>=2.0.0; extra == 'chg'
Requires-Dist: tqdm>=4.65.0; extra == 'chg'
Provides-Extra: datasets
Requires-Dist: datasets>=2.14.0; extra == 'datasets'
Requires-Dist: pyarrow>=12.0.0; extra == 'datasets'
Provides-Extra: position
Requires-Dist: matplotlib>=3.7.0; extra == 'position'
Provides-Extra: quant
Requires-Dist: accelerate>=0.26.0; extra == 'quant'
Requires-Dist: bitsandbytes>=0.45.0; extra == 'quant'
Provides-Extra: viz
Requires-Dist: matplotlib>=3.7.0; extra == 'viz'
Requires-Dist: pandas>=2.0.0; extra == 'viz'
Description-Content-Type: text/markdown

# interprelens

**Find, compare and act on the attention heads behind any LLM behaviour.**

`interprelens` scores attention heads (ablation, attribution patching, Causal Head Gating,
positional bias) and returns one common `HeadMap` you can save, compare and plot.
A paper is not the end: we turn our published research into a tool others can use.

**Used in 2 papers:** [CoCHI](https://aisuko.github.io/confix/) (NeurIPS 2026) and
[CPS](https://aisuko.github.io/cps/) (WSDM '27). Reproduce both with `inteprelens==0.2.1`.

## Install
Not on PyPI yet. From source:
```bash
git clone https://github.com/Aisuko/interprelens && cd interprelens && uv sync
```

## Examples

[`examples/`](examples/README.md): [head scoring](examples/head_scoring.md),
[positional bias](examples/position_bias.md), [tracing and hooks](examples/tracing_and_hooks.md),
[installation and extras](examples/installation.md).

## Acknowledgements
Builds on [Causal Head Gating](https://github.com/jonhanke/nam_causal-head-gating) (Nam et al., NeurIPS 2025).

## License
MIT, see [LICENSE](LICENSE). Contributing: run `make hooks` once; commits need a DCO sign-off (`git commit -s`).
