Python framework for efficient and precise interpretability research on multi-agent conversations.
1
stars
193
commits
Python
primary language
Sep 6, 2026
updated
This library provides a harness, optimized utilities, and interpretability hooks for multi-agent conversation rollouts.
from interlens import Conversation
conv = Conversation.from_models(
("Qwen/Qwen2.5-0.5B-Instruct", "Qwen/Qwen2.5-0.5B-Instruct"), names=("alice", "bob"),
shared_context="Let's debate: is cereal a soup?",
)
conv.run(turns=4, first="alice")
print(conv.transcript)
See docs/examples for sample code, and the API reference for every public class and function.
pip install interlens
# with hosted-API participants (APIParticipant):
pip install "interlens[api]"
torch — install the wheel matching your platform (CUDA / CPU / MPS) before or alongside interlens. E.g. for CUDA 13.0:
pip install torch --index-url https://download.pytorch.org/whl/cu130
See https://pytorch.org/get-started/locally/.
Conversation — turn-taking over a shared, perspective-neutral Transcript; per-speaker view pipeline (system/private framing → context-fit → family-correct chat template).AutoModelParticipant — HF-style factory (from_pretrained / from_model / from_) that returns the family-correct participant (Qwen/Gemma/…); APIParticipant for hosted models.conv.capture(...), SteeringSpec, Patch, token_logprobs, backed by a queryable ActivationCache.conv.rollout(...) / interlens.run([...]): multi-GPU, checkpointed, resumable, batched co-stepping, with in-worker analyzer callbacks; data-driven rollouts via dataset_field, matched compute via TokenBudget.Conversation (with lazy participants) is at once the serializable recipe, the live dialogue, and the rollout driver; build it functionally (.turns(6).data(ds).analyzer(grade)), .set(...) copy-on-write, and save/load (recipe + transcript).See docs/examples/ for a simple→advanced walkthrough of the whole API, and docs/reference/ for the generated per-symbol reference.
git clone https://github.com/Sid-MB/interlens && cd interlens
uv sync # installs the package + dev group (pytest, pre-commit)
uv run pre-commit install # one-time
uv run pytest
# fast tests; opt-in to thorough tests requiring downloading models + a GPU with: pytest -m slow
GNU AGPLv3 — see LICENSE.
186 commits
7 commits
Python
99.3%
Python framework for efficient and precise interpretability research on multi-agent conversations.
1
stars
193
commits
Python
primary language
Sep 6, 2026
updated
This library provides a harness, optimized utilities, and interpretability hooks for multi-agent conversation rollouts.
from interlens import Conversation
conv = Conversation.from_models(
("Qwen/Qwen2.5-0.5B-Instruct", "Qwen/Qwen2.5-0.5B-Instruct"), names=("alice", "bob"),
shared_context="Let's debate: is cereal a soup?",
)
conv.run(turns=4, first="alice")
print(conv.transcript)
See docs/examples for sample code, and the API reference for every public class and function.
pip install interlens
# with hosted-API participants (APIParticipant):
pip install "interlens[api]"
torch — install the wheel matching your platform (CUDA / CPU / MPS) before or alongside interlens. E.g. for CUDA 13.0:
pip install torch --index-url https://download.pytorch.org/whl/cu130
See https://pytorch.org/get-started/locally/.
Conversation — turn-taking over a shared, perspective-neutral Transcript; per-speaker view pipeline (system/private framing → context-fit → family-correct chat template).AutoModelParticipant — HF-style factory (from_pretrained / from_model / from_) that returns the family-correct participant (Qwen/Gemma/…); APIParticipant for hosted models.conv.capture(...), SteeringSpec, Patch, token_logprobs, backed by a queryable ActivationCache.conv.rollout(...) / interlens.run([...]): multi-GPU, checkpointed, resumable, batched co-stepping, with in-worker analyzer callbacks; data-driven rollouts via dataset_field, matched compute via TokenBudget.Conversation (with lazy participants) is at once the serializable recipe, the live dialogue, and the rollout driver; build it functionally (.turns(6).data(ds).analyzer(grade)), .set(...) copy-on-write, and save/load (recipe + transcript).See docs/examples/ for a simple→advanced walkthrough of the whole API, and docs/reference/ for the generated per-symbol reference.
git clone https://github.com/Sid-MB/interlens && cd interlens
uv sync # installs the package + dev group (pytest, pre-commit)
uv run pre-commit install # one-time
uv run pytest
# fast tests; opt-in to thorough tests requiring downloading models + a GPU with: pytest -m slow
GNU AGPLv3 — see LICENSE.
186 commits
7 commits
Python
99.3%