Metadata-Version: 2.4
Name: lie-detectors
Version: 0.1.0
Summary: Load pre-trained lie-detection probes.
Project-URL: Homepage, https://github.com/UKGovernmentBEIS/lie_detectors
Project-URL: Collection, https://huggingface.co/collections/ai-safety-institute/lie-detection
License: MIT License
        
        Copyright (c) 2026 Department of Business, Energy and Industrial Strategy
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: deception-detection,interpretability,lie-detection,probe
Requires-Python: >=3.11
Requires-Dist: huggingface-hub>=0.20
Requires-Dist: jaxtyping>=0.2
Requires-Dist: pydantic>=2
Requires-Dist: torch>=2.1
Description-Content-Type: text/markdown

# lie_detectors

Load the pre-trained lie-detection probes published at [`ai-safety-institute/lie-detection`](https://huggingface.co/collections/ai-safety-institute/lie-detection).

## Install

```bash
uv add lie-detectors        # or: pip install lie-detectors
```

## Usage

```python
import torch
from lie_detectors import get_probe

# Downloads the repo's default checkpoint (probe.pt = the best sweep result).
probe = get_probe("ai-safety-institute/dyl-qwen-qwen3.5-122b-a10b-fp8")

# Which model layer the probe reads activations from.
# Note e.g. the Unrelated Questions probe is instead trained on logprobs
print(probe.layer)  # e.g. 28

# `activations` are residual-stream activations of shape (..., d_model) for the layer the
# probe was trained on.
scores = probe(activations)        # higher score => more likely deceptive
flagged = scores > probe.threshold # threshold is calibrated to ~1% FPR
```

Pick a specific checkpoint from the hyperparameter sweep with `filename=` (see each repo's
`sweep.json` for the full list and their metrics):

```python
probe = get_probe(
    "ai-safety-institute/dyl-qwen-qwen3.5-122b-a10b-fp8",
    filename="l_40_ar_mlp_wd_0_001_lr_0_0001_ep_100.pt",
)
```
