TokenShark | Mechanistic Interpretability & Model Steering Research¶
Welcome to the research blog and installation guide for TokenShark (v0.2.1, MIT License) — a pure-Python workbench for opening, inspecting, and rewiring open-weight models in the browser.
Latest Research Walkthrough¶
01. Patching Prompt Injection in the Residual Stream: Hunting and Rewiring Gemma 4 (12B) Refusal Circuits Without Fine-Tuning
Stop prompt-injection refund hijacks on gemma-4-12b-it by hunting the model's internal "detector" and "decision writer" neurons across Blocks 35 to 38 and wiring them together at runtime—including every dead end hit along the way (the Layer 47 trap, wrong token spans, and why Layer 46's layer_scalar decay erased an 8-layer DENY signal).
Installing TokenShark
Launch TokenShark with run.bat / ./run.sh or install via pip install -e .. Includes a copy-paste prompt for AI coding assistants (Cursor / Claude Code) to install TokenShark and connect to tokenshark.mcp_server.