library_name: transformers
license: apache-2.0
pipeline_tag: image-text-to-text
base_model: Qwen/Qwen4-35B-A3B
base_model_relation: finetune
tags:
- abliterated
- uncensored
- qwen4_moe
- moe
Qwen4-35B-A3B-abliterated
Qwen/Qwen4-35B-A3B with its refusal behaviour removed by weight orthogonalization
("abliteration", Arditi et al., 2024). No fine-tuning and no new data: 85 weight
tensors of the language model are edited in place, everything else (vision tower, embeddings, routers, MTP head, tokenizer,
chat template, config) is byte-identical to the original.
[!WARNING]
This model will follow harmful instructions. It has no safety tuning left. You are responsible for how you use it and for
complying with applicable law and the Apache-2.0 license of the original model.
Results
Original vs. this model, same prompts, greedy decoding, bf16, transformers 5.27.0.dev0.
| Qwen4-35B-A3B | abliterated | |
|---|---|---|
| Refusals, harmful_behaviors test (104 prompts, thinking off) ¹ | 102 / 104 | 2 / 104 |
| Refusals, JailbreakBench JBB-Behaviors harmful (100, thinking off) ¹ | 94 / 100 | 2 / 100 |
| Refusals, Russian harmful prompts (16, thinking off) ¹ | 16 / 16 | 0 / 16 |
| Refusals, thinking on (48 EN + 16 RU harmful, 1536 tokens) ¹ | 62 / 64 | 1 / 36 finished ² |
| Refusal keywords on harmless prompts (100, alpaca) ¹ | 4 / 100 | 4 / 100 |
| MMLU, 600 random test questions, 0-shot, thinking off (letter logits) | 80.3 % | 75.2 % |
| MMLU, same questions, answer parsed from generation | 77.3 % | 72.8 % |
| GSM8K, 200 random test problems, thinking off | 97.5 % | 95.5 % |
| KL(original ‖ abliterated), full 64-token answers to 96 harmless prompts | 0 | 0.186 |
| KL, first answer token, harmless prompts, thinking off / on | 0 | 0.34 / 0.017 |
¹ Keyword-based refusal detection on the first ~240 characters of the answer (English + Russian refusal phrases).
² With thinking on, the abliterated model reasons longer before answering harmful requests (it plans the answer instead of a
refusal); 36 of 64 finished thinking within 1536 tokens, 1 of those 36 refused.
Read these numbers with the caveats below. Keyword counts understate what is left of the refusal behaviour:
- Soft refusals / deflections. Abliteration removes the refusal, not the model's notion of harm. On some prompts the model
now answers a reinterpreted, harmless version of the request (e.g. a malware simulation, asks a clarifying question, or a
short "pushback" paragraph). An LLM judge that counts these as refusals (Gemini 3.8 Flash) labelled 19/104 answers of a closely related
configuration (the same edit applied from layer 0) as refusals; a stricter and noisier local judge (the original
Qwen4-35B-A3B) labelled 31/104 answers of this model as refusals, though many of those are in fact compliant. Realistic
substantive compliance on these prompts is roughly 70–85 %.
Some requests (e.g. CSAM) are still refused. - Capability cost. MMLU drops by ~4.5–5 points and GSM8K by 2 points. This model was unusually resistant to
abliteration (see below), and removing its refusals took a stronger edit than usual. Long-form writing, coding and chat in
English/Russian looked unaffected in spot checks, but expect some degradation on knowledge-heavy tasks.
Method
Qwen4's residual stream is unusual: 4 hyper-connection streams of width 2048 ("gated residual"), and every sublayer
(Gated DeltaNet / sparse attention, MoE) adds the same 2048-d output o to each stream with a learned per-token scale.
Projecting o off a subspace Q therefore removes Q from every stream, and since o is linear in the output weights this
is exactly the weight edit W ← W − λ_l Qᵀ Q W on
linear_attn.out_proj/self_attn.o_proj,mlp.experts.down_proj(all 256 experts) andmlp.shared_expert.down_proj
of decoder layer l.
- Directions. Mean last-token residual (all 4 streams, after every layer) for 400 harmful (
mlabonne/harmful_behaviors)
and 400 harmless (mlabonne/harmless_alpaca) prompts, in both chat formats: thinking off (last token</think>) and
thinking on (last token<think>). The two formats give quite different refusal directions (cosine ≈ 0.3), and a
single direction barely worked: the best rank-1 edit still refused 37/104. The final edit removes, at each layer, the
rank-2 subspace spanned by the difference-of-means directions of both formats (averaged over the 4 streams, each
orthogonalized against the harmless mean, "biprojection"), measured at that layer's own output. - Search. Per-component layer kernels (peak weight, position, width, floor) for attention and MoE writers were tuned
with Optuna TPE over ~160 trials (3 rounds), minimising refusals (104 held-out harmful prompts, thinking off + 32 prompts
with thinking on) against KL divergence on harmless answers, Heretic-style. Layers 0–7 are left untouched (that alone cut
the KL by ~20 % at equal refusal rate). - Bake + verify. The chosen edit (layers 8–39; λ up to 1.54 for attention, 1.21 for MoE) was written into the
original safetensors shards. The saved checkpoint was re-loaded and re-evaluated: 0/104 and 2/100 keyword refusals,
0/16 Russian, 4/100 on harmless prompts, GSM8K 95.3 % (64 problems); first-token KL to the hook-based version is 0.047
with thinking off and 0.001 with thinking on (bf16 rounding of the edited weights).
Final parameters, the per-layer directions and all scripts are in this repo: abliteration/ and refusal_direction.pt.
Usage
Identical to the original model (same architecture, tokenizer, chat template and sampling recommendations) — see the
Qwen4-35B-A3B card. Transformers support for qwen4_moe is currently only onmain:
pip install "git+https://github.com/huggingface/transformers.git" tiktoken xgrammar flash-linear-attention
from transformers import AutoModelForImageTextToText, AutoTokenizer
repo = "salyamq/Qwen4-35B-A3B-abliterated"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(repo, dtype="bfloat16", device_map="auto")
inputs = tok.apply_chat_template([{"role": "user", "content": "Hello!"}], add_generation_prompt=True, tokenize=True,
return_dict=True, return_tensors="pt", reasoning_effort="off").to(model.device)
out = model.generate(**inputs, max_new_tokens=256)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
vLLM / SGLang should work as for the original. The MTP (speculative decoding) head was not modified, so its draft
acceptance rate on previously-refused topics may be somewhat lower.
License
Apache-2.0, same as Qwen/Qwen4-35B-A3B.