Abliteration HandbookField guide
Start here

Overview

Full methodology: ../techniques/safety-guardrail-abliteration-methodology.md · hands-on: ../instructions/beginner-reproduction-methodology.md

3 min read 1 examples Source-linked

In this chapter
On this page Interactive companion
Personal reading progress

0/9 sections reviewed

View original Markdown
Interactive companion

Explore the chapter map

Use the visual controls alongside the complete source chapter.

Vocabulary#

TermMeaning
Refusal directionA vector in hidden-state space whose presence correlates with the model entering a refusal / safety-response mode
Residual streamThe main hidden representation passed between transformer blocks
AbliterationPermanent removal or attenuation of a refusal-related direction in weights
Directional ablationSubtracting the component of an activation along a chosen direction (can be inference-time or baked into weights)
Activation steeringAdding/subtracting a direction at inference time — reversible, no checkpoint edit
Harmful / harmless setsCurated prompt pairs used to estimate the mean activation difference that defines the refusal direction

Full methodology: ../techniques/safety-guardrail-abliteration-methodology.md · hands-on: ../instructions/beginner-reproduction-methodology.md

High-level pipeline#

Example
1. Choose base model (safetensors / PyTorch checkpoint — often cloned from GitHub releases or a local path; HF IDs still work as model paths in most tools)
2. Build prompt datasets (harmful vs harmless — or refusal vs compliance)
3. Forward passes → collect residual activations per layer
4. Estimate refusal direction r_ℓ per layer (usually unit-normalized)
5. Choose abliteration strategy (MLP output, attn output, W_out projection…)
6. Apply weight update ΔW_ℓ to remove r_ℓ component
7. Save new checkpoint (safetensors)
8. Evaluate capability + refusal rate + safety regressions

Abliteration vs alternatives#

ApproachPermanent?Typical costReversibility
Prompt jailbreakNoLowN/A
Activation steeringNoMedium VRAMInstant (disable hook)
LoRA fine-tune on uncensored dataYesHigh GPU hoursSwap adapter
AbliterationYesMedium (one-time analysis pass)Keep original weights
Abliteration + 4-bit (QLoRA load)YesLow (8 GB for 4B)Keep original + quant config
LoRA adapter export (ΔW)AdapterLow infer VRAMDetach adapter
QLoRA Jarvis repairAdapterLow–med trainDetach adapter

When abliteration works well#

  • Model family already studied (Llama, Qwen, Mistral variants have public recipes)
  • Refusal is concentrated in a single direction per layer (often true for instruction-tuned models)
  • You want a standalone checkpoint for agentic security / factory QA without steering hooks
  • False refusals block wmic, lspci, firmware strings, CyberGym PoC builds, scoped nmap

Production use cases (this repo)#

DomainWhy abliterate
Factory firmware QABench PCs need USB/disk/BIOS enumeration without chat refusals
Pentest / cyber analysisLab recon, binary analysis, CVE repro in authorized scope
CyberGymAgents must act autonomously on 1,507 real vuln tasks
OSINT / Kali / hashcat600+ tool catalog for recon, cracking, web, AD, forensics

Stack: Heretic abliteration → optional Jarvis v7 tool-repair → hardware-tool-gate.py at runtime.

When it struggles#

  • Refusal is distributed across many features (multi-direction / multi-head)
  • Aggressive abliteration damages MMLU, coding, or reasoning scores
  • Safety for actually dangerous requests collapses — see risks-and-ethics.md

Low VRAM quick paths#

HardwareStart here
8 GB GPU../instructions/low-vram-abliteration.md — Heretic bnb_4bit
12 GB GPU, 8B model4-bit measure + sharded ablate
Inference-only 8 GB RAMGGUF Q4 after cloud abliteration
LoRA / QLoRA theory../techniques/lora-qlora-abliteration.md

Advanced methods (2025–2026)#

Method (T ID)Doc
T03: Projected + norm-preserving../techniques/projected-norm-preserving-abliteration.md
T08: MoE per-expert & hybrid../techniques/moe-hybrid-abliteration.md (builds on T03)
T05/T06/T07: Multi-direction / RDO / SAE../techniques/beyond-single-direction.md
T04: Geometric median + winsorization../techniques/geometric-median-winsorization.md
T12: Steering & alternatives../techniques/steering-and-alternatives.md
T17: Eval-driven prompts & gates../techniques/eval-driven-abliteration.md · ../instructions/eval-driven-workflow.md
T34–T39: ORBA, SOM, COSMIC, SVD, false-refusal, harm≠refusalbleeding-edge.md

Full curriculum (every method + setup + script): complete-curriculum.md · install matrix: setup-encyclopedia.md · commands: ../instructions/method-cookbook.md

See full numbered T-catalog (T01–T20 table, T03+T08 cross-guidance, Heretic params, module targets) in advanced-techniques-catalog.md — this overview is referenced from the catalog for high-level pipeline context.

Production default stack (T03 + T08 + T17): For agentic use cases (factory firmware QA, pentest/cyber analysis, CyberGym, OSINT tooling), use Projected + norm-preserving (T03) as foundation for dense models; MoE per-expert & hybrid (T08) builds directly on T03 with per-expert orthogonalize + row_normalization. Always pair either with eval-driven-abliteration (T17) + ../instructions/eval-driven-workflow.md to align [bad_prompts]/[good_prompts] to your exact deploy corpora (see hardware-factory-prompts, osint-pentest-prompts, cybergym-subset-sample, jarvis-safe-eval, xstest-overrefusal in evaluation.md). Recommended Heretic defaults: orthogonalize_direction = true, row_normalization = "full".

Explicit T03/T08 guidance: always review ../techniques/projected-norm-preserving-abliteration.md before MoE work; the catalog's T03+T08 section + recommended Heretic config (orthogonalize_direction + row_normalization) are the production default for both dense and routed-expert models. Pair T03/T08 stacks with ../techniques/eval-driven-abliteration.md and ../instructions/eval-driven-workflow.md (T17) to align bad/good prompts to your deploy corpora (factory firmware QA, pentest OSINT, CyberGym subsets, XSTest over-refusal).

Full index: research-landscape.md · advanced-techniques-catalog.md

Beginners improving local models#

  1. cxx26-researcher-guide.md — Hour 0 unique cxx-nightly then guide → doctor → limits → self-check → demo (no GPU)
  2. ../techniques/safety-guardrail-abliteration-methodology.md — theory
  3. ../instructions/beginner-reproduction-methodology.md — reproducible first run
  4. ../instructions/setup-environment.md
  5. ../instructions/beginner-local-model-guide.md
  6. ../instructions/run-locally-ollama-lmstudio.md

Research (after first run): refusal-research-beginners-guide.md · ../sources/research/README.md

Next steps#

Trace this chapter to its source.

The complete Markdown remains the editable source. This page adds navigation, typography, and a visual companion.

docs/overview.md
Inspect the source fingerprintSHA-256 2da80ec4efdafc9afa0609919d28a0e453bfd015b198812f50182a655f0f024bSource commit 6fba7436a5914cad7c8f0835a14b480a29dac263