Skip to content

Murano

Mechanistic interpretability for LLMs — record, steer, probe, evaluate.

Why Murano?

10 LINES OF CODE, NOT 40.

Murano handles activation hooks, tokenisation, and direction math. You write the science.

Without Murano
import torch
from nnsight import NNsight
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")
hf_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B-Instruct")
nn_model = NNsight(hf_model)
positive = ["What a wonderful, delightful day", "This is fantastic and uplifting"]
negative = ["What a miserable, dreadful day", "This is awful and depressing"]
def get_activations(prompts, layer):
acts = []
for p in prompts:
enc = tokenizer(p, return_tensors="pt")
with nn_model.trace(enc):
h = nn_model.model.layers[layer].output[0][:, -1, :].save()
acts.append(h.value.squeeze(0))
return torch.stack(acts)
LAYER = 12
pos = get_activations(positive, LAYER)
neg = get_activations(negative, LAYER)
direction = pos.mean(0) - neg.mean(0)
direction = direction / direction.norm()
def ablation_hook(module, inp, out):
h = out[0]
proj = (h @ direction).unsqueeze(-1) * direction
out[0][:] = h - proj
return out
hook = hf_model.model.layers[LAYER].register_forward_hook(ablation_hook)
enc = tokenizer("The movie was", return_tensors="pt")
output = hf_model.generate(**enc, max_new_tokens=200)
hook.remove()
print(tokenizer.decode(output[0], skip_special_tokens=True))
With Murano
import murano
model = murano.Model("meta-llama/Llama-3.2-1B-Instruct")
direction = model.find_direction(
positive=["What a wonderful, delightful day", "This is fantastic and uplifting"],
negative=["What a miserable, dreadful day", "This is awful and depressing"],
)
print(model.generate(
"The movie was",
ablate=direction,
))

People

Built by researchers, for researchers.

Murano is developed at UKPLab, TU Darmstadt — released under the MIT License.

Submit Your Reproduction.

Share your Murano-powered reproduction of an interpretability paper. Upload a notebook and we'll feature it in the gallery.

Submit a notebook ↓
Opens a pre-filled GitHub issue. We review every submission before publishing.