Instructions to use yakuraku/Qwen2.5-3B-Reasoning-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yakuraku/Qwen2.5-3B-Reasoning-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yakuraku/Qwen2.5-3B-Reasoning-v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yakuraku/Qwen2.5-3B-Reasoning-v1") model = AutoModelForCausalLM.from_pretrained("yakuraku/Qwen2.5-3B-Reasoning-v1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yakuraku/Qwen2.5-3B-Reasoning-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yakuraku/Qwen2.5-3B-Reasoning-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yakuraku/Qwen2.5-3B-Reasoning-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yakuraku/Qwen2.5-3B-Reasoning-v1
- SGLang
How to use yakuraku/Qwen2.5-3B-Reasoning-v1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yakuraku/Qwen2.5-3B-Reasoning-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yakuraku/Qwen2.5-3B-Reasoning-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yakuraku/Qwen2.5-3B-Reasoning-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yakuraku/Qwen2.5-3B-Reasoning-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use yakuraku/Qwen2.5-3B-Reasoning-v1 with Docker Model Runner:
docker model run hf.co/yakuraku/Qwen2.5-3B-Reasoning-v1
Qwen2.5-3B-Reasoning-v1
This is a fine-tuned version of Qwen2.5-3B-Instruct, specialized in Chain-of-Thought (CoT) reasoning.
The model was trained to "think before it speaks" by generating internal reasoning traces enclosed in <reasoning> tags before providing the final <answer>. This process allows the model to self-correct and handle logic puzzles that the base model frequently fails at.
🚀 Model Description
- Developed by: [Yakuraku]
- Base Model: Qwen2.5-3B-Instruct
- Fine-tuning Framework: Unsloth (LoRA)
- Objective: To enable robust logical reasoning in small language models (SLMs) by mimicking the thinking patterns of larger reasoning models.
🛠️ Data Pipeline & Training
The core strength of this model lies in the data engineering pipeline. It was not merely trained on raw datasets but on a rigorously curated corpus.
- Source: Synthetically generated data using SOTA models.
- Cleaning & Augmentation: Applied strict filters for token size, context window usage, and prompt difficulty.
- Validation (The "Human-in-the-Loop" Layer): - Over 75,000 prompts were validated.
- Used a hybrid validation system involving human review and LLM-based verification (via Async API batch processing).
- Categories include: Coding, Math, General Reasoning, and Summarization.
📊 Performance Example
Logical Fallacy Test: "The Chocolate Problem"
Prompt:
"I have 3 chocolates, I eat 2, then i buy 3 more chocolates, I buy 4 more. I eat 5. How many chocolates do i have now?"
Base Model (Before Fine-Tuning) - Failed ❌
The base model makes a critical logical error:
"...Finally, you eat 5 chocolates. Since you only have 8 chocolates, you can't eat 5 of them. Therefore, you eat all 8 chocolates."
Final Answer: You have 0 chocolates now.
Issue: The model hallucinates that 8 chocolates is insufficient to eat 5, incorrectly concluding all chocolates must be eaten.
Fine-Tuned Model (After Training) - Success ✅
Qwen2.5-3B-Reasoning-v1 produces correct step-by-step reasoning:
<reasoning>Let's trace through the problem step by step:
- Start with 3 chocolates
- Eat 2 → Remaining: 3 - 2 = 1
- Buy 3 more → Total: 1 + 3 = 4
- Buy 4 more → Total: 4 + 4 = 8
- Eat 5 → Final: 8 - 5 = 3
</reasoning>
<answer>You have 3 chocolates now.
</answer>
Result: The fine-tuned model correctly performs arithmetic operations and maintains logical consistency throughout the reasoning chain.
💻 How to Use
Using transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "yakuraku/Qwen2.5-3B-Reasoning-v1"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "A farmer has 17 sheep and all but 9 die. How many are left?"
messages = [
{"role": "system", "content": "You are a logical reasoning assistant. Answer the question based on your reasoning."},
{"role": "user", "content": prompt}
]
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.1 # Low temperature for logic
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 10
Model tree for yakuraku/Qwen2.5-3B-Reasoning-v1
Base model
Qwen/Qwen2.5-3B