Instructions to use barozp/Qwen3.8-27B-Opus-Distill-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use barozp/Qwen3.8-27B-Opus-Distill-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="barozp/Qwen3.8-27B-Opus-Distill-v2") 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("barozp/Qwen3.8-27B-Opus-Distill-v2") model = AutoModelForMultimodalLM.from_pretrained("barozp/Qwen3.8-27B-Opus-Distill-v2", 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
- vLLM
How to use barozp/Qwen3.8-27B-Opus-Distill-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "barozp/Qwen3.8-27B-Opus-Distill-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "barozp/Qwen3.8-27B-Opus-Distill-v2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/barozp/Qwen3.8-27B-Opus-Distill-v2
- SGLang
How to use barozp/Qwen3.8-27B-Opus-Distill-v2 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 "barozp/Qwen3.8-27B-Opus-Distill-v2" \ --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": "barozp/Qwen3.8-27B-Opus-Distill-v2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "barozp/Qwen3.8-27B-Opus-Distill-v2" \ --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": "barozp/Qwen3.8-27B-Opus-Distill-v2", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use barozp/Qwen3.8-27B-Opus-Distill-v2 with Docker Model Runner:
docker model run hf.co/barozp/Qwen3.8-27B-Opus-Distill-v2
Qwen3.8-27B-Opus-Distill-v2
Qwen/Qwen3.8-27B fine-tuned (LoRA, merged) on verified-genuine Claude Opus
reasoning traces. This release fixes a reasoning-loop bug reported against
the first release (barozp/Qwen3.8-27B-Opus-Distill,
"v1") while keeping the reasoning-quality gains v1 was known for.
Why this release exists
A community member (zxbc2023) reported a
clean, deterministic bug on v1: certain stacked output-format constraints
(most notably "no prose" combined with a second constraint like "no markdown") sent the model into a non-converging self-verification loop —
burning the entire token budget on repeated "wait, let me re-check…" passes
with zero visible output. Their repro was exact and reproducible at
temp=0, and they correctly diagnosed it as likely inherited from the
distillation data rather than a capability gap. Full credit to them for the
report that made this fix possible.
Root cause. Investigating v1's training data (opus-reasoning-distill-train)
showed that 83% of it had actually been sourced from Jackrong's
TraceInversion datasets — reasoning traces reconstructed by a small
auxiliary model (Trace-Inverter-4B) from a compressed summary, not the
teacher model's real output (openly documented on those datasets' own
cards). That reconstruction process appears to have baked in a rigid
"enumerate constraints, then re-verify" template — plausibly both the
source of v1's reasoning-quality gains and the loop bug, two sides of the
same mechanism.
The fix, in two steps:
- First attempt: retrain purely on a genuine-trace dataset (
lordx64/reasoning-distill-claude-opus-4-7-max). This fixed the loop bug completely but collapsed the reasoning-transfer gain (GPQA-Diamond dropped back to base/random level) — the domain mix mattered as much as trace authenticity. - This release: reconstructed v1's exact prompt distribution, but
replaced every row traced back to Jackrong's fabricated sets with the
verified genuine trace for the same prompt (from
lordx64orRoman1111111/claude-opus-4.6-10000x). Then ran a full-dataset scan (30 parallel LLM-judge passes over all 14,250 rows) for the specific pathological pattern and removed every flagged row (169) plus every row whose source was never verified against a known-genuine dataset (2,429). Net: 14,250 → 11,716 rows, 100% traced to verified sources.
Bug fix validation
Re-ran zxbc2023's exact repro (temp=0, seed=1234, fib(n) with stacked
constraints) against this model:
| Test | v1 | v2 |
|---|---|---|
| "no prose" + "no markdown" | 3000/3000 tokens, 0 visible output | 87/4096 tokens, clean code |
| "no prose" + "no comments" | 3000/3000 tokens, 0 visible output | 73/4096 tokens, clean code |
| Generalization (different task, same constraints) | — | 43/4096 tokens, clean code |
All three converge quickly with </think> closing normally — no loop, no
budget exhaustion.
Benchmark results
Measured with lm-evaluation-harness, 0-shot, loglikelihood (multiple-choice),
chat template OFF, QUICK mode (--limit 500) — identical protocol to v1,
so the Δ column is the meaningful signal.
| Task | Metric | Base | v2 | Δ | (v1's Δ, for reference) |
|---|---|---|---|---|---|
| wikitext | word perplexity ↓ | 8.4335 | 8.3788 | −0.055 | −0.09 |
| mmlu | acc | 0.8494 | 0.8476 | −0.002 | −0.001 |
| hellaswag | acc_norm | 0.7420 | 0.7500 | +0.008 | −0.002 |
| arc_challenge | acc_norm | 0.5880 | 0.6220 | +0.034 | +0.042 |
| gpqa_diamond | acc_norm | 0.2323 | 0.4697 | +0.237 | +0.263 |
Reading the table: knowledge (MMLU) and language modeling (wikitext) are unaffected; reasoning (ARC, GPQA) shows a large, real gain — slightly smaller than v1's (expected: v1's gain was partly driven by the same fabricated content that caused the bug), but still far above noise. GPQA in particular is a same-protocol delta vs. base, not comparable to Qwen's own published 89.2 (thinking-mode-on, different harness) — see v1's card for the full caveat.
Model overview
- Base model: Qwen/Qwen3.8-27B — dense 27B, native vision-language, native MTP.
- Method: LoRA (
r=64, alpha=64, dropout=0.05), merged into the base weights. - LoRA targets: attention
q/k/v/o_projon the 16 full-attention layers only; FFNgate/up/down_projon all 64 layers. - Training data:
barozp/opus-reasoning-distill-v2(11,716 examples, 100% verified-genuine Opus traces). - Training run: 1 epoch (696 steps),
lr=1e-4cosine with 3% warmup, effective batch 16,MAX_SEQ=4096, bf16, ~4h15m on an A100 80GB. - Final validation loss:
0.4334— lower than both v1 (0.4647) and the intermediate pure-genuine attempt (0.805), despite less data. - Vision + MTP: carried over from base, never trained.
Quick start
from transformers import AutoModelForImageTextToText, AutoProcessor
import torch
model = AutoModelForImageTextToText.from_pretrained(
"barozp/Qwen3.8-27B-Opus-Distill-v2", dtype=torch.bfloat16, device_map="auto",
)
processor = AutoProcessor.from_pretrained("barozp/Qwen3.8-27B-Opus-Distill-v2")
Text-only inference also works via AutoModelForCausalLM.
Related
- Qwen3.8-27B — the base model.
- barozp/Qwen3.8-27B-Opus-Distill — v1. Still works well for most use cases; this release specifically fixes the stacked-constraint reasoning-loop edge case.
- barozp/opus-reasoning-distill-v2 — the training dataset, with full provenance notes.
- Thanks to zxbc2023 for the bug report that led to this release.
- Downloads last month
- 18