An uncensored version of Qwen3-4B-Instruct-2507 with safety refusals removed via directional abliteration, while preserving the original model's intelligence and capabilities.
Abliteration is a technique that identifies the internal "refusal direction" in a language model's activation space — the specific vector responsible for generating responses like "I can't help with that" — and surgically removes it from the model's weights. Unlike fine-tuning, this modifies the weights directly through orthogonalization, requiring no retraining.
The result is a model that responds to all prompts without artificial gatekeeping, while retaining its core language capabilities.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "n0ctyx/Qwen3-4B-Instruct-uncensored"
4
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForCausalLM.from_pretrained(
7 model_name,
8 torch_dtype="auto",
9 device_map="auto"
10)
11
12messages = [
13 {"role": "user", "content": "Your prompt here"}
14]
15
16text = tokenizer.apply_chat_template(
17 messages,
18 tokenize=False,
19 add_generation_prompt=True,
20)
21model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
22
23generated_ids = model.generate(
24 **model_inputs,
25 max_new_tokens=16384,
26 temperature=0.7,
27 top_p=0.8,
28 top_k=20,
29)
30output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
31content = tokenizer.decode(output_ids, skip_special_tokens=True)
32print(content)
1curl http://localhost:8000/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "n0ctyx/Qwen3-4B-Instruct-uncensored",
5 "messages": [{"role": "user", "content": "Hello!"}],
6 "temperature": 0.7,
7 "top_p": 0.8
8 }'
1# Create a Modelfile
2echo 'FROM n0ctyx/Qwen3-4B-Instruct-uncensored' > Modelfile
3ollama create qwen3-uncensored -f Modelfile
4ollama run qwen3-uncensored
This model has had its safety alignment removed. It may generate harmful, offensive, or factually incorrect content. The creator is not responsible for any misuse. Use at your own risk and in compliance with applicable laws and regulations.