A library for training activation monitors on language model activations.
Project description
probelab
probelab trains probes and activation monitors on language model activations.
It is collector-agnostic: use activations from Transformers, TransformerLens,
NNsight, nnterp, vLLM-Lens, mirin, PyTorch hooks, or saved tensors.
Installation
pip install probelab
# or
uv add probelab
probelab does not choose a CUDA, ROCm, XPU, or CPU PyTorch build for you. Use
your environment or lockfile to select the torch backend.
Quick Start
This example trains a probe on synthetic activations. Replace dataset with
activations from any collector and the probing code stays the same.
import torch
import probelab as pl
n_train, n_test = 96, 32
seq_len, hidden_size = 24, 128
n = n_train + n_test
dataset = torch.randn(n, seq_len, hidden_size)
# shape: [(B)atch_size, (S)eq_len, (H)idden_size]
labels = torch.tensor([0, 1] * (n // 2))
train_acts = pl.Activations(dataset[:n_train], dims="bsh")
test_acts = pl.Activations(dataset[n_train:], dims="bsh")
# Simple probes train on one feature vector per sample.
train_features = train_acts.mean("s") # [B, H]
test_features = test_acts.mean("s") # [B, H]
probe = pl.probes.Logistic().fit(train_features, labels[:n_train])
scores = probe.predict(test_features)
print("AUROC:", pl.metrics.auroc(labels[n_train:], scores))
print("Recall@1%FPR:", pl.metrics.recall_at_fpr(labels[n_train:], scores, fpr=0.01))
Development
make test
make test-cov
make test-integration
make test-gpu
make test-e2e
Citation
@software{probelab2026,
title = {probelab: A library for training probes on LLM activations},
author = {Alex Serrano},
url = {https://github.com/serteal/probelab},
version = {0.1.0},
year = {2026},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file probelab-0.1.0.tar.gz.
File metadata
- Download URL: probelab-0.1.0.tar.gz
- Upload date:
- Size: 132.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef4fc0deeed2cd047d0fa28d2d788e4fd69d6fdb70e87e363b3c27ef8df8e04b
|
|
| MD5 |
fcf841030d77ef6ed2a19fd09691d0c3
|
|
| BLAKE2b-256 |
a919da67850c584a4f4f90a99662b678213d4038cef8637024e7f12c00784c54
|
Provenance
The following attestation bundles were made for probelab-0.1.0.tar.gz:
Publisher:
publish.yml on serteal/probelab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
probelab-0.1.0.tar.gz -
Subject digest:
ef4fc0deeed2cd047d0fa28d2d788e4fd69d6fdb70e87e363b3c27ef8df8e04b - Sigstore transparency entry: 1659166123
- Sigstore integration time:
-
Permalink:
serteal/probelab@e4276c64bae295f084138d80c84808cab86f71ac -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/serteal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4276c64bae295f084138d80c84808cab86f71ac -
Trigger Event:
release
-
Statement type:
File details
Details for the file probelab-0.1.0-py3-none-any.whl.
File metadata
- Download URL: probelab-0.1.0-py3-none-any.whl
- Upload date:
- Size: 130.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
706a9086a9b0873b97ff20703aa21033e35979f86701b50d783bf5883e94e517
|
|
| MD5 |
d26a6d4aa9288e7f66b76426ec146ff2
|
|
| BLAKE2b-256 |
1de2e6cc6699198f5f17900686a9650fd4055450c72cf9a96ddb1b339f3777ee
|
Provenance
The following attestation bundles were made for probelab-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on serteal/probelab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
probelab-0.1.0-py3-none-any.whl -
Subject digest:
706a9086a9b0873b97ff20703aa21033e35979f86701b50d783bf5883e94e517 - Sigstore transparency entry: 1659166242
- Sigstore integration time:
-
Permalink:
serteal/probelab@e4276c64bae295f084138d80c84808cab86f71ac -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/serteal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4276c64bae295f084138d80c84808cab86f71ac -
Trigger Event:
release
-
Statement type: