Instructions to use lqfdjbf32n/Qwen3-4B-Stage2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use lqfdjbf32n/Qwen3-4B-Stage2 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-4B") model = PeftModel.from_pretrained(base_model, "lqfdjbf32n/Qwen3-4B-Stage2") - llama-cpp-python
How to use lqfdjbf32n/Qwen3-4B-Stage2 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="lqfdjbf32n/Qwen3-4B-Stage2", filename="qwen4b-s2-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use lqfdjbf32n/Qwen3-4B-Stage2 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M # Run inference directly in the terminal: llama cli -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M # Run inference directly in the terminal: llama cli -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Use Docker
docker model run hf.co/lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use lqfdjbf32n/Qwen3-4B-Stage2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lqfdjbf32n/Qwen3-4B-Stage2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lqfdjbf32n/Qwen3-4B-Stage2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
- Ollama
How to use lqfdjbf32n/Qwen3-4B-Stage2 with Ollama:
ollama run hf.co/lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
- Unsloth Studio
How to use lqfdjbf32n/Qwen3-4B-Stage2 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lqfdjbf32n/Qwen3-4B-Stage2 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lqfdjbf32n/Qwen3-4B-Stage2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for lqfdjbf32n/Qwen3-4B-Stage2 to start chatting
- Pi
How to use lqfdjbf32n/Qwen3-4B-Stage2 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use lqfdjbf32n/Qwen3-4B-Stage2 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use lqfdjbf32n/Qwen3-4B-Stage2 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use lqfdjbf32n/Qwen3-4B-Stage2 with Docker Model Runner:
docker model run hf.co/lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
- Lemonade
How to use lqfdjbf32n/Qwen3-4B-Stage2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
Run and chat with the model
lemonade run user.Qwen3-4B-Stage2-Q4_K_M
List all available models
lemonade list
Qwen3-4B — Stage 2 (Reasoning Injection)
A 4B parameter model built on top of Stage 1, injected with high-quality Claude Opus reasoning traces and curated chain-of-thought data. This is Stage 2 of a multi-stage training pipeline — focused on deep reasoning, structured thinking, and multi-step problem solving.
Model Details
- Base Model: unsloth/Qwen3-4B
- Parameters: 4B
- Architecture: Qwen3 (dense, pure text)
- Training: Stage 1 LoRA → merge → Stage 2 LoRA → merge
- License: Apache 2.0
- Language: English (multilingual via base model)
Files
| File | Description |
|---|---|
adapter_model.safetensors |
Stage 2 LoRA adapter weights (unmerged, applied on top of S1) |
adapter_config.json |
LoRA configuration |
qwen4b-s2-Q4_K_M.gguf |
Quantized GGUF (Q4_K_M, ~2.4GB) |
tokenizer.json |
Tokenizer |
Training Details
Stage 1 → Stage 2 Pipeline
This model is trained in two sequential stages:
Stage 1 — General Foundation (~308k samples, 2 epochs) General chat, instruction following, math, coding, factual QA. See Qwen3-4B-Stage1 for details.
Stage 2 — Reasoning Injection (~5,576 samples, 2 epochs) High-quality Claude Opus reasoning traces and curated chain-of-thought data injected on top of Stage 1.
Stage 2 Dataset Mix
| Dataset | Samples | Purpose |
|---|---|---|
| TeichAI/claude-4.5-opus-high-reasoning-250x | 250 | Claude Opus 4.5 high reasoning traces |
| nohurry/Opus-4.6-Reasoning-3000x-filtered | 2,326 | Claude 4.6 Opus reasoning traces |
| bespokelabs/Bespoke-Stratos-17k | 3,000 | Curated chain-of-thought |
Total Stage 2: ~5,576 samples, 2 epochs
Stage 2 Hyperparameters
| Parameter | Value |
|---|---|
| LoRA rank | 32 |
| LoRA alpha | 32 |
| Learning rate | 5e-5 cosine |
| Epochs | 2 |
| Sequence length | 4096 |
| Batch size | 2 (effective 32) |
| Optimizer | adamw |
| Final loss | 0.5117 |
Hardware
Trained on AMD Instinct MI300X (192GB VRAM), ROCm 6.2.4, Unsloth 2026.3.3, PyTorch 2.7.1+rocm6.2.4. Stage 2 runtime: ~4.4 hours.
Usage
Ollama (GGUF)
ollama run hf.co/lqfdjbf32n/Qwen3-4B-Stage2:Q4_K_M
llama.cpp
llama-cli -m qwen4b-s2-Q4_K_M.gguf \
-p "<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\nYour question here<|im_end|>\n<|im_start|>assistant\n" \
-n 512
Python (LoRA adapter — requires Stage 1 first)
from unsloth import FastLanguageModel
from peft import PeftModel
import torch
# Load base
model, tokenizer = FastLanguageModel.from_pretrained(
"unsloth/Qwen3-4B",
max_seq_length=4096,
dtype=torch.bfloat16,
load_in_4bit=False,
)
# Apply Stage 1
model = PeftModel.from_pretrained(model, "lqfdjbf32n/Qwen3-4B-Stage1")
model = model.merge_and_unload()
# Apply Stage 2
model = PeftModel.from_pretrained(model, "lqfdjbf32n/Qwen3-4B-Stage2")
model = model.merge_and_unload()
Strengths
- Structured
<think>...</think>reasoning blocks for complex problems - Multi-step math and science problem solving
- Claude Opus reasoning style distilled into 4B parameters
- Natural casual conversation (inherited from Stage 1)
- Auto language detection (English/Indonesian)
Limitations
- Stage 2 only — requires Stage 1 as foundation
- English primary (multilingual via base model)
- Not suitable for production without validation
- Complex reasoning may still fail on hardest problems
Part of a Series
| Model | Description |
|---|---|
| Qwen2.5-0.5B-ReasonChat | 0.5B edge model, reasoning + chat merged |
| Qwen3-4B-Stage1 | 4B general foundation |
| Qwen3-4B-Stage2 | 4B + Claude reasoning injection (this model) |
| Qwen3-4B-Stage3 | 4B + alignment (coming soon) |
- Downloads last month
- 8
4-bit