Skip to content

About

Example notebooks for Patchbay: mechanistic-interpretability API (read, steer, edit Qwen3.5)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Patchbay examples

Patchbay is a hosted API for mechanistic-interpretability research on open models (Qwen3.5-9B and Qwen3.5-0.8B). Each request can read residual-stream activations at any layer, steer the model with your own vectors, or run under a stored rank-1 weight edit. That includes orthogonalizing a direction out of every matrix that writes to the residual stream. Long generations run as background jobs. You don't need a GPU: everything runs from a notebook through the patchbay-client Python package. See the docs.

Notebooks

Notebook What it shows Open
refusal_direction.ipynb A reproduction of Arditi et al. 2024, Refusal in Language Models Is Mediated by a Single Direction on Qwen3.5-9B: difference-in-means direction, steering, weight orthogonalization and a background job Open In Colab

Results (Qwen3.5-9B, 8 held-out prompts per set)

Intervention Refusals
Weight orthogonalization: one stored edit, pb.edit(u=r, orthogonalize=True) harmful prompts 8/8 → 0/8, with all 8 harmless prompts still answered
Steering: subtract the direction at layer 16 harmful prompts 8/8 → 0/8 in the saved run (1/8 in earlier runs)
Steering: add the direction to harmless prompts harmless prompts 0/8 → 6/8

The layer and token position are chosen on a separate validation split, and the results are reported on held-out test prompts. Exact counts can shift by a prompt between runs, because batched GPU arithmetic isn't bit-for-bit repeatable.

Get an API key

  1. Sign in at patchbay.inductive.ml and open Dashboard → API keys. Create a key; it's shown only once.
  2. In Colab, add the key under Secrets (🔑 in the left sidebar) as PATCHBAY_API_KEY, and let the notebook access it. Locally, run export PATCHBAY_API_KEY=....
  3. Install the client: pip install patchbay-client. The notebook does this in its first code cell.

A full run of the refusal notebook costs about $0.05 of usage. See pricing.

Responsible use

These notebooks reproduce published interpretability results so you can study how model behaviour is represented. The refusal notebook shows that a model's safety behaviour can be removed with one weight edit. The notebook deliberately prints only refusal counts, never completions to harmful prompts. Use it to understand and evaluate refusal mechanisms, and to build better safeguards. Don't use it to generate harmful content or to distribute models with their safety behaviour removed. Follow the Patchbay terms and the Qwen model license.

License

MIT. See LICENSE.

About

Example notebooks for Patchbay: mechanistic-interpretability API (read, steer, edit Qwen3.5)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages