Instructions to use swadeep/Qwen3.5-4b-claude-opus-distilled with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use swadeep/Qwen3.5-4b-claude-opus-distilled with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="swadeep/Qwen3.5-4b-claude-opus-distilled") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("swadeep/Qwen3.5-4b-claude-opus-distilled") model = AutoModelForMultimodalLM.from_pretrained("swadeep/Qwen3.5-4b-claude-opus-distilled", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use swadeep/Qwen3.5-4b-claude-opus-distilled 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 swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M # Run inference directly in the terminal: llama cli -hf swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M # Run inference directly in the terminal: llama cli -hf swadeep/Qwen3.5-4b-claude-opus-distilled: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 swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf swadeep/Qwen3.5-4b-claude-opus-distilled: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 swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
Use Docker
docker model run hf.co/swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use swadeep/Qwen3.5-4b-claude-opus-distilled with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "swadeep/Qwen3.5-4b-claude-opus-distilled" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "swadeep/Qwen3.5-4b-claude-opus-distilled", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
- SGLang
How to use swadeep/Qwen3.5-4b-claude-opus-distilled 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 "swadeep/Qwen3.5-4b-claude-opus-distilled" \ --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": "swadeep/Qwen3.5-4b-claude-opus-distilled", "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 "swadeep/Qwen3.5-4b-claude-opus-distilled" \ --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": "swadeep/Qwen3.5-4b-claude-opus-distilled", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use swadeep/Qwen3.5-4b-claude-opus-distilled with Ollama:
ollama run hf.co/swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
- Unsloth Studio
How to use swadeep/Qwen3.5-4b-claude-opus-distilled 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 swadeep/Qwen3.5-4b-claude-opus-distilled 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 swadeep/Qwen3.5-4b-claude-opus-distilled to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for swadeep/Qwen3.5-4b-claude-opus-distilled to start chatting
- Pi
How to use swadeep/Qwen3.5-4b-claude-opus-distilled with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf swadeep/Qwen3.5-4b-claude-opus-distilled: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": "swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use swadeep/Qwen3.5-4b-claude-opus-distilled with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf swadeep/Qwen3.5-4b-claude-opus-distilled: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 "swadeep/Qwen3.5-4b-claude-opus-distilled: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 swadeep/Qwen3.5-4b-claude-opus-distilled with Docker Model Runner:
docker model run hf.co/swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
- Lemonade
How to use swadeep/Qwen3.5-4b-claude-opus-distilled with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
Run and chat with the model
lemonade run user.Qwen3.5-4b-claude-opus-distilled-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use swadeep/Qwen3.5-4b-claude-opus-distilled with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf swadeep/Qwen3.5-4b-claude-opus-distilled: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 swadeep/Qwen3.5-4b-claude-opus-distilled:Q4_K_M
Run Hermes
hermes
- Atomic Chat
Qwen3.5-4B — Claude Opus Distilled · Multimodal
A LoRA-SFT fine-tune of the full Qwen/Qwen3.5-4B multimodal base
(Qwen3_5ForConditionalGeneration — text + vision tower). Trained in three
stages: an original SFT on angrygiraffe/claude-opus-4.6-4.7-reasoning-8.7k
(8,000 category-balanced samples), a context-bleed-fix SFT on 2,000 samples
taken from the original set (off-topic insertions), and a final SFT on
grpo_data/opus_reasoning_sft_offtopic (6,000 rows from
Gryphe/Opus-4.6-Reasoning-24k: 4,000 coding + 2,000 complex instruction
following, off-topic-augmented). The trained LoRA is merged at scale 0.04.
This release keeps the vision encoder, so the model can process both text
and images (Qwen3.5 chat template; native thinking + response mode).
Capabilities
- Step-by-step reasoning — native
thinking/responseblocks with explicit reasoning traces distilled from Claude Opus 4.6/4.7. - Multi-step instruction following — handles complex, multi-part prompts and multi-turn conversations that require chaining several instructions.
- Agentic / tool-calling tasks — strong on agent-style prompts; supports
tool / function-calling workflows (extensible via the Qwen3.5 chat
template's
tool_callsrole). - Code generation — Python-first coding with step-by-step explanations.
- Vision-language — accepts image inputs (bf16 multimodal build) and can describe / reason about images.
Model Details
| Property | Value |
|---|---|
| Base model | Qwen/Qwen3.5-4B (multimodal Qwen3_5ForConditionalGeneration) |
| Architecture | Qwen3_5ForConditionalGeneration — text + vision |
| Parameters | 4.54B (merged, full weights incl. vision tower) |
| Context length | up to 262,144 tokens |
| Checkpoint | checkpoint-3000 (1 epoch, 3000 steps) |
| Merge scale | 0.04 (LoRA lora_B scaled ×0.04 before merge) |
| Modalities | text + image |
Training Data
Three-stage data lineage:
1. Original training set — angrygiraffe/claude-opus-4.6-4.7-reasoning-8.7k
The original SFT run used this dataset directly (8,000 samples total, category-balanced):
| Category | Samples |
|---|---|
| math | 2,000 |
| coding | 2,000 |
| economics | 2,000 |
| finance | 2,000 |
| Total | 8,000 |
Training used the Qwen3.5 chat template with assistant-only label masking
(<|im_start|>assistant\n<think> marker) and two added think tokens
( thinking, response).
2. Context-bleed fix — off-topic insertion (2,000 samples from the original set)
The model initially bled context across unrelated turns (a later query kept
inheriting constraints/format from an earlier, unrelated question). To fix
this, 2,000 samples were taken from the original dataset (multi-turn
conversations from the trained categories — math/coding/economics/finance)
and modified with build_offtopic_dataset.py:
- single-turn off-topic QA pairs from the non-trained categories are inserted mid-conversation (longer conversations receive more insertions),
- a system instruction is appended telling the model to answer each query independently and only reference prior messages when directly relevant.
This taught the model to treat each turn as its own instruction, eliminating
cross-turn context bleed. Every inserted assistant turn keeps its
thinking / response block. The resulting 2,000-row set is stored as
offtopic_fix_1k/ in the training repo.
3. Final training set — grpo_data/opus_reasoning_sft_offtopic
The final SFT data (this is the dataset the released checkpoint was trained
on) lives in grpo_data/, built in two steps:
3a. Curation (prep_opus_reasoning_sft.py)
Two slices selected from Gryphe/Opus-4.6-Reasoning-24k (24k Claude Opus 4.6
conversations with explicit reasoning steps):
- coding — 4,000 rows: Python-majority. Rows are classified as coding from
code keywords in the prompt (
def,import,numpy,pandas,pytorch,sql,api,gpu, …) or Python code fences anywhere in the exchange. Python-signal rows are taken first, then other coding rows to fill. - complex — 2,000 rows: complex multi-step instruction-following, non-coding. Multi-turn conversations (≥2 assistant turns) prioritized, then long/single-turn complex instructions.
Assistant reasoning_content from the source is inlined into content as a
leading thinking\n…\n response\n\n… block so the step-by-step reasoning
style survives the Qwen3.5 chat template.
3b. Off-topic augmentation (add_offtopic.py)
Single-turn non-coding QA pairs are inserted mid-conversation into multi-turn samples (longer conversations receive more insertions), paired with the "answer independently" system instruction.
3c. Final set (grpo_data/opus_reasoning_sft_offtopic)
| Slice | Rows |
|---|---|
| coding | 4,000 |
| complex_offtopic | 1,499 |
| complex (untouched) | 501 |
| Total | 6,000 |
Average 2.23 assistant turns/row. Every assistant turn begins with a
thinking block.
Training Procedure
Three SFT stages on Kaggle with Unsloth:
- Original SFT on
angrygiraffe/claude-opus-4.6-4.7-reasoning-8.7k(8,000 samples) — produced the base LoRA. - Context-bleed-fix SFT — continued on
offtopic_fix_1k/(2,000 samples taken from the original set, with off-topic insertions) to teach independent per-turn answering and eliminate cross-turn context bleed. - Final SFT on
grpo_data/opus_reasoning_sft_offtopic(6,000 rows: 4,000 coding + 2,000 complex, off-topic-augmented) — the final dataset used to produce the released checkpoint-3000.
SFT hyperparameters:
| Hyperparameter | Value |
|---|---|
| LoRA r / α | 16 / 32 |
| LoRA dropout | 0.05 |
| Target modules | q/k/v/o_proj, gate/up/down_proj |
| Optimizer | AdamW (8-bit) |
| Learning rate | 2e-4, linear schedule |
| Warmup steps | 5 |
| Weight decay | 0.001 |
| Max sequence length | 4096 |
| Batch size / grad accum | 1 / 1 |
| Gradient checkpointing | on |
| Epochs / steps | 1.0 / 3000 |
| Final train loss | ~1.91 |
The original run used packing=True with bfd_split and the two added think
tokens ( thinking, response). The checkpoint-1000 LoRA was weakened
(SCALE=0.0015) before the final stage.
Merge scale note
LoRA lora_B matrices were multiplied by 0.04 before merging. Lower scale
retains base-model stability while applying a meaningful part of the learned
delta. This scale performed best on manual multi-instruction, Python coding,
and agentic evaluations.
Uses
- Direct use: text chat, multi-instruction prompts, step-by-step reasoning, Python code generation, agentic / tool-use prompts, and image understanding (describe / reason about images).
- Out of scope: non-image multimodal (audio/video) input, non-English languages, unsafe content. As with any LLM, outputs can be hallucinated — verify important claims/code.
How to Get Started
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
from PIL import Image
model_id = "swadeep/Qwen3.5-4b-claude-opus-distilled"
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
model_id, dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
)
image = Image.open("test.png")
messages = [{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Describe the image in one sentence."},
],
}]
inputs = processor.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
out = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(out[0], skip_special_tokens=True))
Quantized / alternate formats
All variants in this repo are the same scale-0.04 merge; only the format differs.
| File / dir | Format | Notes |
|---|---|---|
model.safetensors + config.json |
HF bf16 (multimodal) | Full Qwen3_5ForConditionalGeneration, text + vision |
qwen35-4b-claude-opus-distilled-q8_0.gguf |
GGUF Q8_0 | Text-only (LM portion) |
qwen35-4b-claude-opus-distilled-q4_k_m.gguf |
GGUF Q4_K_M | Text-only (LM portion) |
qwen35-4b-claude-opus-distilled-f16.gguf |
GGUF f16 | Text-only (LM portion) |
mlx-q4/ |
MLX Q4 (text-only) | Apple Silicon |
mlx-q8/ |
MLX Q8 (text-only) | Apple Silicon |
The GGUF/MLX variants use the language-model weights only (llama.cpp/MLX
convert the LM portion of the multimodal checkpoint; the vision tower is not
included in GGUF/MLX). Use them for text chat, reasoning, and coding. Use the
bf16 model.safetensors build when you need image input.
# MLX usage
from mlx_lm import load, generate
model, tokenizer = load("swadeep/Qwen3.5-4b-claude-opus-distilled-mlx-q8")
print(generate(model, tokenizer, prompt="What is 23 * 47?"))
Bias, Risks, and Limitations
- Trained on a limited synthetic/reasoning corpus; domain coverage is narrow.
- Vision understanding inherits base-model capabilities; no vision-specific fine-tuning was performed (LoRA targets the language model only).
- May exhibit the base model's biases and hallucinations.
- No alignment/guardrail tuning beyond the source data.
Framework versions
- PEFT 0.19.1
- TRL SFTTrainer
- Unsloth
- Transformers 5.x
- Downloads last month
- -