explaingit

elementmerc/senbonzakura

Analysis updated 2026-05-18

2PythonAudience · researcherComplexity · 5/5Setup · hard

TLDR

A research tool that permanently removes refusal behavior from open-weight AI language models by adjusting their internal weights in several directions at once.

Mindmap

mindmap
  root((Senbonzakura))
    What it does
      Removes refusal directions
      Multi-direction search
      Permanent weight bake
    Tech stack
      Python
      PyTorch
      Optuna
    Use cases
      Model behavior research
      Refusal measurement
      Coherence tradeoff study
    Audience
      AI researchers
      Model tinkerers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Research how refusal behavior is represented inside a language model's internal weights.

USE CASE 2

Measure how much a model's refusal rate drops after removing multiple internal directions versus one.

USE CASE 3

Compare coherence and refusal rates across different open-weight model architectures.

USE CASE 4

Run an automated search to find the best tradeoff between reduced refusals and preserved output quality.

What is it built with?

PythonPyTorchTransformersOptuna

How does it compare?

elementmerc/senbonzakura0-bingwu-0/live-interpreter0cm-labs/tokenizer-benchmark
Stars222
LanguagePythonPythonPython
Setup difficultyhardmoderatemoderate
Complexity5/52/52/5
Audienceresearchergeneralresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Requires a CUDA GPU with enough VRAM to load and modify the target language model in full precision.

In plain English

Senbonzakura is a research tool for modifying open-weight language models, the kind of AI models you can download and run yourself. Specifically, it targets the behavior where a model refuses to answer certain requests, and works to remove that refusal behavior directly from the model's internal weights rather than just prompting around it. The tool builds on earlier research showing that a model's tendency to refuse tends to concentrate in one main internal direction inside its neural network. This project's contribution is finding and removing several of these directions at once instead of just one, since a small number of stubborn refusals tend to hide in nearby directions that a single-direction approach misses. The README reports measurements on a specific model showing that cutting multiple directions reduces refusals further than cutting just one, while keeping the model's general coherence about the same as before. The process works in three steps. First, it studies the model's internal responses to a set of harmful and harmless example prompts to identify the directions associated with refusal. Second, it runs an automated search that tries different combinations of which internal layers to adjust and by how much, always checking that the model's ability to produce sensible text is not damaged in the process. Third, once a good configuration is found, it permanently rewrites the relevant weights so the change becomes a lasting part of the model rather than a temporary adjustment. It is installed as a Python package and used from the command line, supporting several common open-weight model families and architectures. The project includes a scoring tool to measure how often a modified model still refuses versus produces broken output, so results can be compared consistently across different runs and models. This is a specialized research tool aimed at people already working directly with open-weight AI models, not a general audience application.

Copy-paste prompts

Prompt 1
Explain how the multi-direction approach in this project differs from the original single-direction method it builds on.
Prompt 2
Walk me through running the balanced kageyoshi mode on a specific open-weight model with this tool.
Prompt 3
Help me understand the scoring metrics this project uses to measure hard refusal versus soft refusal.
Prompt 4
Show me how to score a model's coherence using this project's coherence measurement tool.

Frequently asked questions

What is senbonzakura?

A research tool that permanently removes refusal behavior from open-weight AI language models by adjusting their internal weights in several directions at once.

What language is senbonzakura written in?

Mainly Python. The stack also includes Python, PyTorch, Transformers.

How hard is senbonzakura to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is senbonzakura for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.