Instructions to use exnivo/Qwen3.8-20B-Minitron with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use exnivo/Qwen3.8-20B-Minitron with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="exnivo/Qwen3.8-20B-Minitron") 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("exnivo/Qwen3.8-20B-Minitron") model = AutoModelForMultimodalLM.from_pretrained("exnivo/Qwen3.8-20B-Minitron", 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 exnivo/Qwen3.8-20B-Minitron with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "exnivo/Qwen3.8-20B-Minitron" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "exnivo/Qwen3.8-20B-Minitron", "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/exnivo/Qwen3.8-20B-Minitron
- SGLang
How to use exnivo/Qwen3.8-20B-Minitron 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 "exnivo/Qwen3.8-20B-Minitron" \ --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": "exnivo/Qwen3.8-20B-Minitron", "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 "exnivo/Qwen3.8-20B-Minitron" \ --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": "exnivo/Qwen3.8-20B-Minitron", "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 exnivo/Qwen3.8-20B-Minitron with Docker Model Runner:
docker model run hf.co/exnivo/Qwen3.8-20B-Minitron
Qwen3.8-20B-Minitron
An experimental structurally-pruned derivative of Qwen/Qwen3.8-27B.
This is not a quantization of the 27B model.
The language model was physically reduced from 64 to 44 decoder layers using iterative marginal-KL group pruning, followed by knowledge-distillation recovery and targeted repair training.
Architecture
| Qwen3.8-27B | This model | |
|---|---|---|
| Measured parameters | 27.357B | 19.746B |
| Language layers | 64 | 44 |
| Hybrid groups | 16 | 11 |
| Parameter reduction | — | 27.82% |
Approximately 7.61 billion parameters were physically removed.
Original language-layer pattern:
[linear_attention, linear_attention, linear_attention, full_attention] × 16
Surviving groups:
[0, 2, 4, 6, 7, 8, 11, 12, 13, 14, 15]
Removed groups:
[1, 3, 5, 9, 10]
The surviving layers retain their original Qwen weights and are reindexed after pruning.
Recovery
The raw 19.746B child remained coherent but showed noticeable reasoning and factual instability.
Recovery was performed in multiple stages using:
- original Qwen3.8-27B teacher logits
- top-k knowledge distillation
- next-token training
- mixed educational/instruction/math/code data
- targeted repair examples
- custom LoRA recovery
- final LoRA merge into the standalone weights
The uploaded checkpoint contains the fully merged weights. No adapter or pruning script is required to load it.
Internal release checks
A custom held-out evaluation used during release selection scored:
- overall accuracy: 81.2%
- arithmetic: 100%
- logic: 100%
- money/Dutch: 83%
- probability: 80%
- Python: 75%
- strict instruction following: 83%
- sequence/pattern reasoning: 20%
These are custom internal checks, not standardized benchmark scores, and should not be compared directly with official Qwen benchmark results.
The final legacy regression suite scored 11/12 (91.7%).
Known limitations
This is an experimental compressed model.
In particular:
- pattern/sequence reasoning remains a weakness
- some unusual wording can still produce incorrect reasoning
- pruning may have removed capabilities not represented by our tests
- recovery and evaluation focused primarily on text
- the vision tower is retained from the parent model but was not the focus of the recovery process
- this model should not be assumed to match Qwen3.8-27B quality
Usage
import torch
from transformers import AutoModelForMultimodalLM, AutoTokenizer
model_id = "exnivo/Qwen3.8-20B-Minitron"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "user", "content": "What is the capital of Australia?"}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(
text,
return_tensors="pt",
).to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=128,
)
print(
tokenizer.decode(
output[0][inputs.input_ids.shape[1]:],
skip_special_tokens=True,
)
)
Method
The pruning process did not rank all layers once and then remove them simultaneously.
Instead, after every group removal, candidate importance was measured again on the current pruned model using marginal KL divergence.
This mattered because layer importance changed substantially after earlier groups were removed.
The process was:
- start with 16 four-layer hybrid groups
- protect boundary groups
- temporarily bypass each candidate group
- measure marginal KL divergence
- permanently remove the least disruptive group
- recompute all candidate scores
- repeat until 11 groups remained
- recover the resulting model using distillation
- run targeted repair training
- merge recovery weights into this standalone checkpoint
Attribution
Based on Qwen/Qwen3.8-27B.
This is an independent experimental derivative and is not an official Qwen release.
- Downloads last month
- 2,649