Downloads · 30 days
83
51% of all-time downloads
zainkhanz/qwen3-4b-toxic-unsloth
qwen3-4b-toxic-unsloth is a text generation model from zainkhanz. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Fine-tuned version of Qwen/Qwen3-4B-Instruct-2507 using Unsloth and TRL.
Downloads · 30 days
83
51% of all-time downloads
All-time downloads
162
Public
Parameters
4B
8.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8 GB · 100%
From the Hugging Face model README
Fine-tuned version of Qwen/Qwen3-4B-Instruct-2507 using Unsloth and TRL.
This model is trained to be direct and low-refusal: it is preference-optimized to answer user requests instead of declining with policy-style refusals.
| Item | Detail |
|---|---|
| Base model | Qwen/Qwen3-4B-Instruct-2507 |
| Size | ~4B parameters |
| Precision (this repo) | 16-bit / BF16 merged |
| Training | SFT → DPO (Unsloth QLoRA, then merge) |
| Dataset | adamo1139/toxic-dpo-natural-v5 |
| Goal | Reduce over-refusal; prefer helpful, direct completions |
| Framework | Unsloth, TRL, PEFT, Transformers, BitsAndBytes |
Compared with the stock Instruct model, this fine-tune is tuned to:
It still inherits Qwen3-4B limits (factual errors, bias, hallucination). It is not guaranteed to be correct, safe, or legal for every use case. You are responsible for how you use the outputs.
| Repo | Format |
|---|---|
| zainkhanz/qwen3-4b-toxic-unsloth | 16-bit merged (this page) |
| zainkhanz/qwen3-4b-toxic-unsloth-bnb-4bit | bitsandbytes 4-bit (NF4) |
| zainkhanz/qwen3-4b-toxic-unsloth-bnb-8bit | bitsandbytes 8-bit |
chosen responsessystem optional, user = prompt, assistant = chosen)FastLanguageModel + QLoRAr=16, lora_alpha=32, targets q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj(prompt, chosen, rejected)beta ≈ 0.1adamo1139/toxic-dpo-natural-v5system, prompt, chosen, rejectedrejected answersfrom transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "zainkhanz/qwen3-4b-toxic-unsloth"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
messages = [
{"role": "user", "content": "Your question here."}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))