license: apache-2.0
license_link: https://huggingface.co/Qwen/Qwen4-35B-A3B/blob/main/LICENSE
base_model: Qwen/Qwen4-35B-A3B
library_name: peft
pipeline_tag: image-text-to-text
language:
- en
tags: - uncensored
- abliterated
- qwen4
- moe
- lora
- peft
Qwen4 35B A3B Uncensored LoRA (OpenUncensored)
A 138 MB rank-2 LoRA that turns Qwen/Qwen4-35B-A3B into
OpenUncensored/Qwen4-35B-A3B-Uncensored. Nothing was
trained: it is the exact low-rank form of that model's edit, so stock weights plus this adapter give the uncensored
model.
Also available: the full BF16 weights, GGUF files for llama.cpp,
and the model on the OpenUncensored API asqwen4-35b-a3b-uncensored and qwen4-35b-a3b-uncensored-thinking.
Why a LoRA is exact here
The uncensored model removes a two-dimensional refusal subspace B (per layer, width 2,048) from every residual writer
on layers 8 to 33, at strength 1.5: W' = W - 1.5 B Bᵀ W. That change is a rank-2 product, (-1.5 B)(Bᵀ W), which is
what a LoRA stores: lora_B = -1.5 B and lora_A = Bᵀ W with rank 2 and lora_alpha = 2 (scaling 1).
78 tensors are covered: 52 linear layers as ordinary LoRA modules (Gated DeltaNet linear_attn.out_proj, sparse
attention self_attn.o_proj, mlp.shared_expert.down_proj) and the 26 fused routed-expert mlp.experts.down_proj
parameters through PEFT's target_parameters (one rank-2 lora_A per expert, all 256 experts).
Checked
- Same weights. Stock weights plus this adapter's delta, rounded to BF16, match the published uncensored weights:
in every one of the 78 tensors at least 94.6% of the values are identical, and the largest difference is 1.4% of the
size of the edit itself (BF16 rounding). - Round trip. Saved, loaded back from disk with
PeftModel.from_pretrained, and compared: identical factors. - Behaviour. Stock Qwen4 35B A3B with this adapter loaded from disk, 8 held-out harmful requests, thinking off,
greedy: a refusal phrase in 8 of 8 answers with the adapter disabled, and in 0 of 8 with it enabled.
The refusal and capability results of the merged model are on the
main model card: on 100 held-out harmful requests,
refusals fall from 97 to 2 (thinking off) and from 99 to 1 (thinking on), with MMLU and SQuAD 2.0 abstention unchanged.
Use it
Needs transformers 5.26 or later and peft 0.22 or later (for LoRA on fused MoE expert parameters). Load the model as
Qwen documents it (AutoModelForImageTextToText), then the adapter:
import torch
from peft import PeftModel
from transformers import AutoModelForImageTextToText, AutoTokenizer
base = AutoModelForImageTextToText.from_pretrained("Qwen/Qwen4-35B-A3B", dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, "OpenUncensored/Qwen4-35B-A3B-Uncensored-LoRA")
tok = AutoTokenizer.from_pretrained("Qwen/Qwen4-35B-A3B", subfolder="tokenizer-compat")
msgs = [{"role": "user", "content": "Explain how lock picking works."}]
enc = tok.apply_chat_template(msgs, add_generation_prompt=True, reasoning_effort="off",
return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**enc, max_new_tokens=512)
print(tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True))
reasoning_effort takes off, low, high (Qwen's default) or xhigh. To switch between the stock and uncensored
behaviour in one process, wrap a call in with model.disable_adapter():.
To write full weights, model.merge_and_unload().save_pretrained(...). For vLLM, SGLang or llama.cpp, use the
full weights or the
GGUF files: we tested this adapter with
transformers and PEFT only.
lora_A was computed from the stock BF16 weights, so the adapter reproduces the edit on Qwen/Qwen4-35B-A3B itself. For
a fine-tune of Qwen4 35B A3B, re-derive it from edit.safetensors in the main repo (it holds B and the strength for every
edited tensor) to project that fine-tune's own weights.
License
Apache 2.0, the same as the original model.
Made by OpenUncensored.