MCPcopy Create free account
hub / github.com/RiddleHe/llm-interp

github.com/RiddleHe/llm-interp @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
204 symbols 511 edges 6 files 17 documented · 8% updated 5mo ago★ 91

Browse by type

Functions 204 Types & classes 0
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

LLM Brain Surgeon

A collection of lightweight, standalone scripts to perform mechanistic interpretability observations on chosen LLMs. Topics include the geometric mechanism of attention sinks, the isolated simulations of non-deterministic attention outputs, etc.

In each subdir, which is headed by a research topic, a readme.md is (or will be) available for instructions on how to run the single python script.

Research topics

Attention sinks (actively developing)

We want to understand when attention sinks occur, and what are some causal factors that contribute to its emergence.

We find that token 0 manipulates a particular layer output to reside in a low-variance manifold, which it can then linearly transform into strong signals for alignment when doing QK computation.

Deterministic attention

We want to understand when nondeterministic inference occurs even with temperature=0.

We find that by changing the prefilling strategy or batch size, softmax outputs drift from the baseline.

Thinking budget

We want to study how models track and budget the number of thinking tokens in their CoT, especially for ByteDance-Seed/Seed-OSS-36B-Instruct by ByteDance.

We find that special layers are activated before the budgeting occurs to only focus its attention on the last two tokens.

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 204

Languages

Python100%

Modules by API surface

attention_sink/analyze_sink.py171 symbols
attention_nondeterministic/analyze_attention_nondeterministic.py15 symbols
thinking_budget/analyze_seed_thinking_budget.py11 symbols
thinking_budget/utils.py5 symbols
thinking_budget/rope.py2 symbols

For agents

$ claude mcp add llm-interp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page