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#
git clone https://github.com/jim-plus/llm-abliteration.git tools/llm-abliteration
cd tools/llm-abliteration
pip install -r requirements.txt1. Measure directions#
python measure.py -m <path_to_model> -o directions.ptCustom datasets (local .txt, .jsonl, .parquet):
python measure.py -m <model> -o directions.pt \
--data-harmful ./data/harmful.txt \
--data-harmless ./data/harmless.txtAdvanced flags#
| Flag | Effect |
|---|---|
--quant 4bit | On-the-fly bitsandbytes quant for measurement (low VRAM) |
--projected | Projected abliteration (orthogonalize vs harmless dir) |
--deccp | Add AUGMXNT/deccp topics to the harmful set. That repo is a Qwen2 PoC + dataset, not a peer CLI. |
2. Analyze#
python analyze.py directions.pt -cUse charts to pick middle-to-late layers as refusal direction sources.
3. Ablate#
Edit example YAML (see repo), then:
python sharded_ablate.py abliteration_config.yaml| Flag | Effect |
|---|---|
--projected | Biprojected measurement |
--normpreserve | Norm-preserving ablation |
4. Test#
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#
node scripts/fetch-docs.mjs
# reads sources/fetched/llm-abliteration-readme.txt