How to uncensor an LLM with abliteration: the mechanics, step by step Abliteration, a training-free technique for removing refusal behavior from open-weight LLMs, works by computing a "refusal direction" from the difference in average internal activations between refused and answered prompts, then orthogonalizing every weight matrix that writes into the residual stream against that direction. The method traces to the 2024 paper "Refusal in Language Models Is Mediated by a Single Direction" by Arditi, Obeso, Syed, Paleka, Panickssery, Gurnee and Nanda, which found one controlling vector per model across 13 open chat models up to 72B parameters, and is popularized in a Hugging Face write-up by Maxime Labonne. Practitioners select a candidate direction using bypass, induce and KL scores on held-out prompts, and the result is a normal checkpoint with most refusal ability removed plus side effects that should be measured. Abliteration uncensors an open-weight LLM without any training. You run the model on two prompt sets, one it refuses and one it answers, subtract the average internal activations of the two sets to get a "refusal direction", and then edit every weight matrix that writes into the residual stream so it can no longer write along that direction. The result is a normal checkpoint that has lost most of its ability to refuse, plus some side effects you should measure before you trust it. This article walks through the mechanics as the original research describes them, then covers the practical failure modes. It does not ship a ready-made script; the public tools linked below already do that, and their READMEs are the right place for exact commands. The method comes from Refusal in Language Models Is Mediated by a Single Direction https://arxiv.org/abs/2406.11717 by Arditi, Obeso, Syed, Paleka, Panickssery, Gurnee and Nanda 2024 . Across 13 open chat models up to 72B parameters, the authors found one vector per model that controls refusal. Remove that vector's component from the model's hidden states and the model stops refusing harmful instructions. Add it to the hidden states on a harmless prompt and the model refuses something it would normally answer. The paper is careful about what this means. It calls the work an existence proof rather than an optimised recipe, and it notes that the direction might encode something closer to "this looks harmful" than "refuse". For a practitioner the useful part is simpler: a refusal decision passes through a low-dimensional bottleneck, and a bottleneck can be cut. You need instructions the model reliably refuses and instructions it reliably answers. The paper drew the first group from public harmful-instruction sets and the second from Alpaca, with 128 training and 32 validation examples per class. The widely read Hugging Face write-up by Maxime Labonne https://huggingface.co/blog/mlabonne/abliteration uses similar sources repackaged as small Hub datasets. Both sets go through the model with the chat template applied. At every layer you record the residual stream, the running vector that each attention block and MLP block reads from and adds to. The paper records it at the token positions after the instruction, where the model is about to start its reply. The Labonne write-up takes the last token only, which costs less compute and is usually close enough. For each layer and position, average the cached activations of the refused set, average those of the answered set, and subtract. The difference, normalised to unit length, is one candidate refusal direction. With dozens of layers you now have dozens of candidates, and most of them are poor. The paper picks one with three checks on held-out prompts: | Check | What it measures | What a good candidate does | |---|---|---| | Bypass score | refusals on harmful prompts with the direction ablated | drops sharply | | Induce score | refusals on harmless prompts with the direction added | rises above zero | | KL score | how much the output distribution on harmless prompts moves under ablation | stays small | It also skips candidates from the last fifth of the layers, because a direction too close to the output head tends to change word choice rather than the decision. The refusal measure itself is fast to compute: instead of generating text, the authors compare the probability the model gives to its usual refusal-opening tokens against everything else. There are two ways to apply the chosen direction r . Inference-time ablation. On every forward pass, at every layer and token, subtract the projection of the hidden state onto r . This needs hooks in the inference code and is handy for experiments. Weight orthogonalization. Every matrix that writes into the residual stream is changed so its output has no component along r . In Labonne's implementation that is the token embedding matrix, each attention block's output projection and each MLP's output projection; the paper also includes output biases. The paper shows this edit is mathematically equivalent to inference-time ablation, and the result is an ordinary set of weights you can save, quantize and serve anywhere. php import torch def orthogonalize W: torch.Tensor, r: torch.Tensor - torch.Tensor: """W writes into the residual stream d model x d in ; r is the refusal direction d model .""" r = r / r.norm return W - torch.outer r, r @ W remove the component of every output along r That one line, applied to the right matrices, is the whole edit. Everything else in the pipeline is about choosing r well. Doing this by hand means a lot of layer-by-layer trial. Three public projects show the common approaches: Abliteration is a blunt cut through a model that was not designed to have that part removed. The common problems: Abliterating a small model is a reasonable weekend project if you have the GPU memory to run it in full precision with activation caching. For frontier-size open models the weights alone are hundreds of gigabytes, and the evaluation loop multiplies that work. If what you need is the behaviour rather than the experiment, hosted uncensored models are an option: Chainless serves several, listed on the models page https://chainless.one/models , behind one OpenAI-compatible endpoint documented at chainless.one/docs/api https://chainless.one/docs/api . Either way, run the same before-and-after checks described above on prompts from your own work.