This model is a fine-tuned version of
Qwen3-4B (Unsloth 4-bit) optimized for
reasoning distillation (chain-of-thought) using
Unsloth for
2x faster training and
60% less VRAM.
Trained on the
claude-reasoning-distillation dataset, which contains 10,477 samples of Claude's reasoning traces with
<think> blocks for chain-of-thought learning.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "ermiaazarkhalili/Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11)
12
13messages = [
14 {"role": "user", "content": "Solve step by step: What is the sum of the first 10 prime numbers?"}
15]
16
17text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
18inputs = tokenizer(text, return_tensors="pt").to(model.device)
19
20outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
21response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
22print(response)
1from unsloth import FastLanguageModel
2
3model, tokenizer = FastLanguageModel.from_pretrained(
4 "ermiaazarkhalili/Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth",
5 max_seq_length=2048,
6 load_in_4bit=True,
7)
8
1from transformers import AutoModelForCausalLM, BitsAndBytesConfig
2import torch
3
4quantization_config = BitsAndBytesConfig(
5 load_in_4bit=True,
6 bnb_4bit_compute_dtype=torch.bfloat16,
7 bnb_4bit_use_double_quant=True,
8 bnb_4bit_quant_type="nf4",
9)
10
11model = AutoModelForCausalLM.from_pretrained(
12 "ermiaazarkhalili/Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth",
13 quantization_config=quantization_config,
14 device_map="auto",
15)
Quantized GGUF versions for CPU and edge inference are available at:
Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth-GGUF
1ollama pull hf.co/ermiaazarkhalili/Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth-GGUF:Q4_K_M
2ollama run hf.co/ermiaazarkhalili/Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth-GGUF:Q4_K_M "Solve step by step: What is the sum of the first 10 prime numbers?"
1@misc{ermiaazarkhalili_qwen3_4b_sft_claude_opus_reasoning_unsloth,
2 author = {ermiaazarkhalili},
3 title = {Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth: Fine-tuned Qwen3-4B (Unsloth 4-bit) with Unsloth},
4 year = {2026},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/ermiaazarkhalili/Qwen3-4B-SFT-Claude-Opus-Reasoning-Unsloth}}
7}