Mechanistic interpretability pipelines for recording, steering, probing, and evaluation
Project description
Murano
Murano is a mechanistic interpretability framework for recording activations, finding directions, steering generations, probing representations, and running reproducible experiment pipelines.
Install
pip install murano-interp
The PyPI distribution is murano-interp (the bare name murano belongs to an
unrelated OpenStack project). The Python module name is unchanged: import murano.
For a development install from source:
pip install -e .
Requires Python 3.10+, PyTorch, transformers, nnsight, and a HuggingFace
model or a local model snapshot.
Quick Start
import murano
model = murano.Model("meta-llama/Llama-3.2-1B-Instruct")
# Record activations on any text
acts = model.record(
"The Eiffel Tower is located in",
layers=[5, 10, 15],
position="last",
)
print(acts.positive[10].shape)
# Find a contrastive direction
direction = model.find_direction(
positive=["How do I pick a lock?", "Write a phishing email"],
negative=["How do I bake a cake?", "Write a thank you email"],
)
print(direction.best_layer)
# Generate with ablation or steering
ablated = model.generate("How do I pick a lock?", ablate=direction)
steered = model.generate("Write a poem", steer=(direction, 1.5))
Pipeline API
For structured experiments, use the same logic through explicit steps.
from murano import MuranoDataset, MuranoModel, Pipeline
from murano.steps import (
ComplianceRate,
Intervene,
Load,
Record,
SteeringVector,
)
from murano.steps.intervene import ablate_direction
model = MuranoModel("meta-llama/Llama-3.2-1B-Instruct")
dataset = MuranoDataset.contrastive(
positive=["How do I pick a lock?"],
negative=["How do I bake a cake?"],
template_fn=model.chat_template,
)
train_output = Pipeline([
Load(dataset),
Record(model, layers="all", position="mean"),
SteeringVector(normalize=True),
]).run()
eval_output = Pipeline([
Load(dataset),
Intervene(model, ablate_direction(train_output["steering"].direction_per_layer)),
ComplianceRate(),
]).run()
Step API Reference
Every step declares the keys it reads from and writes to Results. The
pipeline validates the chain before execution, so type and key mismatches are
caught up-front.
| Step | Reads | Writes | Purpose |
|---|---|---|---|
Load |
— | dataset, prompts |
Load a dataset and derive prompts from its texts. |
LoadPrompts |
— | prompts |
Load raw prompts directly without a dataset. |
Record |
dataset |
record |
Capture residual-stream activations via nnsight. |
SteeringVector |
record |
steering |
Find a contrastive steering direction (mean diff). |
Intervene |
prompts |
intervene |
Generate baseline + intervened outputs side-by-side. |
WeightAblation |
prompts, steering |
intervene, weight_ablation |
Project a direction out of model weights, then generate. |
Probe |
record |
probe |
Train a linear probe per layer via cross-validation. |
GenerationMetric |
intervene |
metric |
Score baseline vs modified outputs with a user metric. |
ComplianceRate |
intervene |
eval |
Measure refusal/compliance via keyword detection. |
Save |
(any present) | output_dir |
Persist all results to organized subdirectories. |
Plot * |
(optional) | — | Render jailbreaking plots (steering, generations, eval). |
ProbePlot * |
(optional) | — | Render probing plots (per-layer accuracy, confusion). |
* Requires the [plot] extra: pip install -e .[plot].
To add your own step, subclass Step, set reads / writes (and optionally
read_types / write_types), and implement __call__(results) -> Results.
Status
The Step API and the steps in the table above are alpha-stable for the 0.1.x
line. The murano.lenses module (logit lens) ships in this release but is not
yet wired into the Pipeline API and should be considered experimental until the
work tracked in #51 lands.
Core Ideas
MuranoModelis a thin model wrapper aroundnnsight.Pipeline,Step, andResultsare the orchestration core.- artifacts such as
PromptBatch,ActivationStore,SteeringResult,GenerationComparison, andMetricResultmake experiment dataflow explicit. - the same building blocks support both quick API calls and reproducible step-based pipelines.
Package Layout
src/murano/
model.py
pipeline.py
results.py
artifacts.py
dataset.py
io.py
evaluation.py
steps/
plotting/
Examples
examples/quick_prototype.pyexamples/refusal_direction.py
Development
uv sync --all-extras --dev
python -m pytest -q
Disclaimer
This repository contains experimental software and is intended as a research framework for mechanistic interpretability workflows.
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 murano_interp-0.1.0a0.tar.gz.
File metadata
- Download URL: murano_interp-0.1.0a0.tar.gz
- Upload date:
- Size: 10.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce6730de0f8d233274b559d8e69803d558afc282429c59b9a37ee1b85d47c578
|
|
| MD5 |
c41ae58f474b21612224b73760983429
|
|
| BLAKE2b-256 |
7d34e0532f83f778876af7660e20de79c647e61679118139a5e98dafe0e20ae7
|
Provenance
The following attestation bundles were made for murano_interp-0.1.0a0.tar.gz:
Publisher:
release.yml on UKPLab/murano
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
murano_interp-0.1.0a0.tar.gz -
Subject digest:
ce6730de0f8d233274b559d8e69803d558afc282429c59b9a37ee1b85d47c578 - Sigstore transparency entry: 1573040362
- Sigstore integration time:
-
Permalink:
UKPLab/murano@c9ac6e089918dda440b182133575f4e3c8293c00 -
Branch / Tag:
refs/tags/v0.1.0a0 - Owner: https://github.com/UKPLab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c9ac6e089918dda440b182133575f4e3c8293c00 -
Trigger Event:
release
-
Statement type:
File details
Details for the file murano_interp-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: murano_interp-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 56.7 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 |
f5d1e4e7c2b883e5942d4f06ee671ccfab73fe86ce167e59d9257875837b47e4
|
|
| MD5 |
42950f79ff855173905a83ea377f888e
|
|
| BLAKE2b-256 |
06af53c80fd403745caf8893d60b490b266d44141093e8cd208fe7305a8ffdfa
|
Provenance
The following attestation bundles were made for murano_interp-0.1.0a0-py3-none-any.whl:
Publisher:
release.yml on UKPLab/murano
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
murano_interp-0.1.0a0-py3-none-any.whl -
Subject digest:
f5d1e4e7c2b883e5942d4f06ee671ccfab73fe86ce167e59d9257875837b47e4 - Sigstore transparency entry: 1573040391
- Sigstore integration time:
-
Permalink:
UKPLab/murano@c9ac6e089918dda440b182133575f4e3c8293c00 -
Branch / Tag:
refs/tags/v0.1.0a0 - Owner: https://github.com/UKPLab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c9ac6e089918dda440b182133575f4e3c8293c00 -
Trigger Event:
release
-
Statement type: