Abliteration HandbookField guide
Practical guides

llm-abliteration workflow

Manual measure → analyze → ablate pipeline from jim-plus/llm-abliteration v1.2. NousResearch/llm-abliteration last push 2025-11-27 — treat as frozen; do not use it as the handbook path.

1 min read 7 examples Source-linked

In this chapter
On this page Interactive companion
Personal reading progress

0/7 sections reviewed

View original Markdown
Interactive companion

Explore the chapter map

Use the visual controls alongside the complete source chapter.

Manual measure → analyze → ablate pipeline from jim-plus/llm-abliteration v1.2. NousResearch/llm-abliteration last push 2025-11-27 — treat as frozen; do not use it as the handbook path.

Clone#

bash
git clone https://github.com/jim-plus/llm-abliteration.git tools/llm-abliteration
cd tools/llm-abliteration
pip install -r requirements.txt

1. Measure directions#

bash
python measure.py -m <path_to_model> -o directions.pt

Custom datasets (local .txt, .jsonl, .parquet):

bash
python measure.py -m <model> -o directions.pt \
  --data-harmful ./data/harmful.txt \
  --data-harmless ./data/harmless.txt

Advanced flags#

FlagEffect
--quant 4bitOn-the-fly bitsandbytes quant for measurement (low VRAM)
--projectedProjected abliteration (orthogonalize vs harmless dir)
--deccpAdd AUGMXNT/deccp topics to the harmful set. That repo is a Qwen2 PoC + dataset, not a peer CLI.

2. Analyze#

bash
python analyze.py directions.pt -c

Use charts to pick middle-to-late layers as refusal direction sources.

3. Ablate#

Edit example YAML (see repo), then:

bash
python sharded_ablate.py abliteration_config.yaml
FlagEffect
--projectedBiprojected measurement
--normpreserveNorm-preserving ablation

4. Test#

bash
python chat.py -m <abliterated_model_path>
python compare.py -a <base> -b <abliterated>

Low VRAM path#

Pair --quant 4bit measure with sharded_ablate.py when Heretic OOMs:

→ low-vram-abliteration.md · LoRA export after ablate: ../methods/lora-adapter-export.md

Refresh docs#

bash
node scripts/fetch-docs.mjs
# reads sources/fetched/llm-abliteration-readme.txt

Trace this chapter to its source.

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

instructions/llm-abliteration-workflow.md
Inspect the source fingerprintSHA-256 e579e2e7eb1c504a5425650fda3fc45db205675cebb528dc8f485fdcf09021faSource commit 6fba7436a5914cad7c8f0835a14b480a29dac263