steerlab

sandbagkit

The probing core that steerlab is built on: read and edit a language model’s hidden activations, build difference-of-means steering vectors, and score linear probes honestly. Everything comes back as typed results with confidence intervals.

The name comes from where it started: rebuilding an activation probe that detects AI sandbagging (a model deliberately underperforming). steerlab grew out of its steering-vector code.

Install

pip install "sandbagkit[probing]"    # torch, transformers, scikit-learn, peft; the base install never imports torch

In this repo, uv sync --all-packages installs it with steerlab, editable.

Use

from sandbagkit.probing import extract_activations, steering_vector

acts = extract_activations(model, tokenizer, prompts, [14], responses=replies, chat_template=True)[14]
vector = steering_vector(acts, labels, groups=pair_ids, layer=14)  # mean(label 1) - mean(label 0)

MIT licensed.