Abliteration HandbookField guide
Practical guides

Thinking models — step-by-step

For Qwen3-Thinking, DeepSeek-R1 distillates, gpt-oss, and other models that emit reasoning before the final answer.

2 min read 5 examples Source-linked

In this chapter
On this page Interactive companion
Personal reading progress

0/8 sections reviewed

View original Markdown
Interactive companion

Explore the chapter map

Use the visual controls alongside the complete source chapter.

For Qwen3-Thinking, DeepSeek-R1 distillates, gpt-oss, and other models that emit reasoning before the final answer.

Theory: ../techniques/thinking-model-abliteration.md


Step 1 — Confirm your model is "thinking"#

Run one prompt in the base model. If you see <think>, <thought>, or a separate analysis channel before the user-facing answer, use this guide.


Step 2 — Copy thinking config#

bash
cp sources/heretic-tools/config.thinking-model.toml config.toml

Adjust VRAM:

VRAMEdit in config.toml
8 GBquantization = "bnb_4bit", max_batch_size = 8
12 GB+quantization = "none" or bnb_4bit for 8B thinking
Long CoTmax_response_length = 256 or 512

Step 3 — Verify CoT skip tags#

toml
print_responses = true   # temporary — set false after check

Run Heretic for 1 trial or use chat — confirm refusal scoring uses the final answer block, not the thinking block.

If tags differ, add a pair to chain_of_thought_skips:

toml
["<your_open_tag>", "<your_close_tag>"]

Step 4 — Run abliteration#

bash
heretic ./models/Your-Thinking-Model

Expect longer runs than non-thinking 4B — more tokens per forward.


Step 5 — Test final channel only#

Example prompt:

Example
Write a PowerShell one-liner to list disk drive models with WMI.
PassFail
Final answer contains Get-WmiObject or wmicRefusal only inside <think> block
CoT may still show cautionFinal channel refuses

Step 6 — Ollama / LM Studio#

Match the same template the HF model uses. If Ollama strips thinking by default, behavior may differ from Heretic eval — test both.

→ run-locally-ollama-lmstudio.md


Troubleshooting#

ProblemFix
Optuna refusal never dropsWrong chain_of_thought_skips
OOM↓ max_batch_size, ↓ max_response_length, bnb_4bit
Thinking removed but answer bad↓ ablation — winsorization 0.95, tighter KL
gpt-oss channel mismatchUse default gpt-oss pair in thinking config

More: troubleshooting-encyclopedia.md


Eval gates (deploy checklist)#

After abliteration, run the handbook eval workflow — thinking models need final-channel scoring, not CoT text:

GateCommand / doc
Heretic built-in refusal + KLconfig.thinking-model.toml → --evaluate-model
Factory / tool-call corpuseval-driven-workflow.md
XSTest over-refusal sampledata/eval/xstest-overrefusal-sample.jsonl (≤ 5% refusal)
Corpus sizesnpm run eval:stats

Config pin: sources/heretic-tools/config.thinking-model.toml (CoT skips, longer max_response_length).

→ eval-driven-workflow.md · ../techniques/eval-driven-abliteration.md

Trace this chapter to its source.

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

instructions/thinking-models-guide.md
Inspect the source fingerprintSHA-256 9785efa4351b10994252f038bab13a3e2ec9e33e7b230e7b13d1a89a74b576f0Source commit 6fba7436a5914cad7c8f0835a14b480a29dac263