Skip to main content
Glama
agaskell

interp-playground

by agaskell

interp-playground

Tools for looking inside a language model: activations, sparse-autoencoder (SAE) features, steering, and ablation. The goal is an MCP server that lets an AI agent and a human investigate a model's internals together.

It's a learning project. Current target: Gemma 2 2B with Google DeepMind's Gemma Scope residual-stream SAEs, running locally on Apple Silicon (MPS).

Status

  • Nix + uv environment; MPS verified against CPU

  • Reproduce a known SAE feature by hand (activations, steering, random control)

  • MCP server skeleton with run_prompt

  • More tools: feature_info, steer, ablate, logit_lens

Related MCP server: AgentWatch

Setup

Requires Nix with flakes. The flake provides Python 3.12 and uv; uv manages Python packages.

nix develop            # or: direnv allow
uv sync

Gemma 2 is gated on Hugging Face. Accept the license at google/gemma-2-2b, then log in once:

uv run hf auth login

The model (~10 GB in fp32) and SAEs download on first use.

MCP server

claude mcp add interp-playground -- uv run --directory /path/to/interp-playground interp-playground-mcp
uv run python scripts/mcp_smoke.py   # end-to-end check over stdio

run_prompt returns the top SAE features per token and across the text, with Neuronpedia labels. Activations are also given relative to each feature's typical max (rel), and features active on >10% of tokens are hidden by default. The model stays loaded between calls. Feature metadata comes from Neuronpedia's bulk exports and is cached in ~/.cache/interp-playground/.

Scripts

# Does MPS give the same internals as CPU? (fp32: yes; bf16: 1-4% drift)
uv run python scripts/check_mps.py

# Where does a feature fire, token by token?
uv run python scripts/feature_acts.py --feature 7272 "We drove across the old bridge."

# Steer generation along a feature direction, or a random one as a control
uv run python scripts/steer.py --feature 7272 --scales 0 50 100 200
uv run python scripts/steer.py --random 0 --scales 0 50 100 200

Findings so far

Layer-12 feature 7272, labelled "references to various types of bridges" on Neuronpedia:

  • Activations: fires at 35-50 on the word "bridge" in every sense (physical, dental, card game, metaphorical) and at 4-22 on bridge-like concepts without the word (overpass, ferry, river). The label describes the top of the activation range; the low range is broader.

  • Steering: at scale 70-90 the output drifts toward rivers and "connecting the community"; at 100+ it produces "bridge" and degrades. Random directions of the same norm never produce "bridge" and stay fluent up to ~200, so the effect is specific to the feature. (One prompt, two random seeds: suggestive, not conclusive.)

Notes

  • fp32, not bf16. bf16 on MPS drifts 1-4% in the residual stream, enough to flip JumpReLU features near their thresholds.

  • nnsight 0.7: only objects that are themselves .save()d leave a trace. Wrap lists of saved tensors in nnsight.save([...]).

  • transformer-lens is pinned below 4.0 until sae-lens supports it.

License

MIT

Available Tools

1 tool
run_promptA

Run a prompt through the model and report which SAE features are active.

Returns, per layer:
- top_features: the 10 features most strongly active anywhere in the text,
  each at its peak token, with its Neuronpedia label, density (fraction of
  all tokens it fires on) and the output tokens it promotes.
- tokens: for each token, its top_k features.

`act` is the raw activation. `rel` is act / the feature's typical max
activation, so rel near 1 means firing about as hard as it ever does.
Rankings use rel. Features active on >10% of all tokens carry little
meaning and are hidden unless include_dense is true. The <bos> token is
omitted. The first real token often shows position artifacts: features
with very large activations unrelated to its meaning.

Args:
    prompt: Text to run. Gemma 2 2B is a base model, not a chat model.
    layers: Residual-stream layers to read (0-25). Default [12].
    top_k: Features to list per token.
    max_new_tokens: If > 0, greedily generate this many tokens first and
        analyze prompt + completion.
    include_dense: Include features active on >10% of tokens.
ParametersJSON Schema
NameRequiredDescriptionDefault
top_kNo
layersNo
promptYes
include_denseNo
max_new_tokensNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so well: it documents the return structure (top_features, tokens), explains the act vs rel normalization ('rel is act / the feature's typical max activation'), and discloses non-obvious filtering behavior — dense features (>10% of tokens) are hidden unless include_dense, the <bos> token is omitted, and first-token position artifacts occur. It also warns the model is a base model, not a chat model.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded and the body is organized as a bulleted output spec followed by parameter notes, so it scans well. It is on the longer side and repeats return-value detail that the output schema already covers, but nearly every sentence carries operational meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 5-parameter analysis tool with an output schema and no annotations, the description supplies everything needed to invoke it correctly: parameter meaning, activation ranking semantics, dense-feature suppression, and known artifact caveats.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description compensates by explaining prompt, layers (range 0-25), max_new_tokens, and include_dense in semantic terms. top_k ('Features to list per token') is thinner and near-circular, and the description says the layers default is [12] while the schema declares null, a minor inconsistency.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence states a specific verb and resource ('Run a prompt through the model and report which SAE features are active'), naming both the input and the class of output. There are no sibling tools, so no differentiation is needed, and an agent immediately knows what the tool produces.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives conditional usage cues tied to parameters, e.g. 'max_new_tokens: If > 0, greedily generate this many tokens first' and 'include_dense is true', which tells the agent when to flip those switches. It stops short of explicit when-to-use/when-not framing, but with no alternatives to route between, this is clear context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observedrun_prompt

TDQS

A4.3/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no risk of selecting the wrong tool; its purpose is unambiguous. The internally complex output does not create tool-selection overlap.

Naming Consistency5/5

The sole tool name run_prompt follows a clear verb_noun snake_case convention. There are no other names to contradict the pattern, so consistency is trivially maintained.

Tool Count2/5

One tool is very thin for a server branded as a playground. While the operation is rich, the absence of companion tools for discovery, comparison, or feature inspection makes the count feel too low for the apparent scope.

Completeness2/5

The surface covers only running a prompt and viewing active SAE features. It lacks obvious operations such as listing models/layers, searching or inspecting individual features, or comparing prompts, leaving significant gaps for an interpretability playground.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables LLMs to inspect and test other MCP servers by listing and calling their tools, reading resources, and getting prompts. Supports stdio, SSE, and HTTP transports for both local and remote MCP server inspection.
    7
    4 npm
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A terminal live-tail and a browser dashboard — one process, one event stream, served from localhost. Unified timeline across Claude Code, Codex, Gemini CLI, Cursor, Hermes, and OpenClaw. Token + cost accounting, compaction + anomaly detection, hybrid search, SVG call graphs, monaco-style diff attribution, agent-aware replay ("what would the agent say if I edited the prompt?"), policy editor, MCP s
    16 npm
    15
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Local MCP server that enables AI clients to read and search memories from the Fovea macOS app, with privacy-focused local operation and optional semantic search.
    Apache 2.0