Instructions to use Ma7ee7/Qwen3.8_4B_Distilled with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ma7ee7/Qwen3.8_4B_Distilled with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ma7ee7/Qwen3.8_4B_Distilled") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Ma7ee7/Qwen3.8_4B_Distilled") model = AutoModelForCausalLM.from_pretrained("Ma7ee7/Qwen3.8_4B_Distilled", 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 Ma7ee7/Qwen3.8_4B_Distilled with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ma7ee7/Qwen3.8_4B_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": "Ma7ee7/Qwen3.8_4B_Distilled", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Ma7ee7/Qwen3.8_4B_Distilled
- SGLang
How to use Ma7ee7/Qwen3.8_4B_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 "Ma7ee7/Qwen3.8_4B_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": "Ma7ee7/Qwen3.8_4B_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 "Ma7ee7/Qwen3.8_4B_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": "Ma7ee7/Qwen3.8_4B_Distilled", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Ma7ee7/Qwen3.8_4B_Distilled with Docker Model Runner:
docker model run hf.co/Ma7ee7/Qwen3.8_4B_Distilled
Qwen3.8 4B Distilled
Qwen3.8 4B Distilled is a 4-billion-parameter reasoning model created by distilling outputs from Qwen3.8-Max into the smaller Qwen3-4B-Thinking-2507 student model.
The model was fine-tuned on r0b0tlab/qwen3.8-max-distillation-50k, a dataset of responses and reasoning traces generated by qwen3.8-max-preview.
Model Lineage and Naming
The name Qwen3.8 4B Distilled describes the model's distillation lineage:
- Teacher model:
qwen3.8-max-preview - Student/base model:
Qwen/Qwen3-4B-Thinking-2507 - Resulting model size: Approximately 4 billion parameters
- Distillation dataset:
r0b0tlab/qwen3.8-max-distillation-50k
This is a Qwen3-architecture student model distilled from Qwen3.8-Max-generated outputs.
The repository does not claim that the underlying architecture or original weights are from Qwen3.8-Max. Qwen3.8-Max is the teacher whose generated responses and reasoning traces were used as training targets for the 4B student.
This is an independently fine-tuned community model and is not an official Qwen or Alibaba release.
Links
- Full model: Ma7ee7/Qwen3.8_4B_Distilled
- GGUF quantizations: Ma7ee7/Qwen3.8_4B_Distilled_GGUF
- Base model: Qwen/Qwen3-4B-Thinking-2507
- Training dataset: r0b0tlab/qwen3.8-max-distillation-50k
Model Details
| Property | Value |
|---|---|
| Model type | Decoder-only causal language model |
| Architecture | Qwen3 |
| Parameters | Approximately 4B |
| Base model | Qwen/Qwen3-4B-Thinking-2507 |
| Teacher model | qwen3.8-max-preview |
| Training method | Sequence-level supervised distillation |
| Weight format | Safetensors |
| Primary task | Reasoning and conversational text generation |
| Primary language | English |
| Thinking mode | Enabled |
Distillation Dataset
The model was trained on:
r0b0tlab/qwen3.8-max-distillation-50k
The dataset contains teacher-generated examples across areas including:
- Mathematics
- Programming
- General reasoning
- Scientific reasoning
- Instruction following
- Limited tool use
Teacher responses were generated by qwen3.8-max-preview. Visible <think>...</think> reasoning traces were retained when present in the dataset.
What “Distilled” Means Here
This model uses sequence-level knowledge distillation.
The smaller student was trained on complete responses produced by the larger teacher. This transfers parts of the teacher's behavior, reasoning patterns, solution structure, and response style without copying the teacher's architecture or weights.
Therefore:
- The architecture and original student weights come from Qwen3-4B-Thinking-2507.
- The distillation targets come from Qwen3.8-Max-generated outputs.
- The resulting checkpoint remains a 4B Qwen3 model.
- The model is not expected to reproduce the full capabilities of Qwen3.8-Max.
Installation
pip install --upgrade transformers accelerate torch
Transformers Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_ID = "Ma7ee7/Qwen3.8_4B_Distilled"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype="auto",
device_map="auto",
)
messages = [
{
"role": "user",
"content": (
"A farmer has 120 meters of fencing and wants to build a "
"rectangular enclosure. What dimensions maximize the area?"
),
}
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
max_new_tokens=4096,
do_sample=True,
temperature=0.6,
top_p=0.95,
top_k=20,
repetition_penalty=1.05,
)
new_tokens = output_ids[0, inputs["input_ids"].shape[-1]:]
response = tokenizer.decode(new_tokens, skip_special_tokens=True)
print(response)
Pipeline Usage
from transformers import pipeline
MODEL_ID = "Ma7ee7/Qwen3.8_4B_Distilled"
generator = pipeline(
task="text-generation",
model=MODEL_ID,
device_map="auto",
torch_dtype="auto",
)
messages = [
{
"role": "user",
"content": "Explain why the square root of 2 is irrational.",
}
]
result = generator(
messages,
max_new_tokens=4096,
do_sample=True,
temperature=0.6,
top_p=0.95,
top_k=20,
repetition_penalty=1.05,
)
print(result[0]["generated_text"])
Recommended Generation Settings
| Setting | Recommended value |
|---|---|
| Temperature | 0.6 |
| Top-p | 0.95 |
| Top-k | 20 |
| Repetition penalty | 1.0–1.1 |
| Maximum new tokens | 4096 or higher |
For difficult mathematics, programming, or long-form reasoning, allow enough output tokens for the model to complete both its reasoning and final answer.
Thinking Output
The model inherits a thinking-oriented chat format from Qwen3-4B-Thinking-2507. Depending on the inference application and reasoning parser, visible reasoning may be displayed in a form similar to:
<think>
Reasoning process
</think>
Final answer
Some applications may hide the thinking section or render it separately from the final answer.
vLLM
Install vLLM:
pip install --upgrade vllm
Start an OpenAI-compatible server:
vllm serve Ma7ee7/Qwen3.8_4B_Distilled \
--max-model-len 32768 \
--enable-reasoning \
--reasoning-parser deepseek_r1
Example request:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Ma7ee7/Qwen3.8_4B_Distilled",
"messages": [
{
"role": "user",
"content": "Solve x^2 - 5x + 6 = 0 and explain your reasoning."
}
],
"temperature": 0.6,
"top_p": 0.95,
"max_tokens": 4096
}'
Intended Uses
This model is intended for experimentation with:
- Mathematical reasoning
- Programming and code generation
- Logical reasoning
- Scientific question answering
- General instruction following
- Long-form problem solving
- Research into teacher-to-student distillation
- Local conversational assistants
Limitations
- This is a 4B student model and does not contain the complete knowledge or capabilities of Qwen3.8-Max.
- Distillation transfers patterns from teacher-generated outputs; it does not copy the teacher's architecture or weights.
- Teacher-generated answers may contain factual, mathematical, or programming errors.
- Visible reasoning traces should not automatically be assumed to be correct.
- The model may hallucinate or produce confidently incorrect answers.
- Tool-use examples represent only a small portion of the training data.
- The training mixture is primarily English.
- The training dataset may include prompts derived from common evaluation benchmarks.
- Results on overlapping benchmarks should not be treated as uncontaminated evaluations without additional controls.
- Outputs should be reviewed before use in high-stakes medical, financial, legal, or security-sensitive settings.
License and Training-Data Notice
This repository is published under the Apache License 2.0.
That license does not override any separate licenses, attribution requirements, or usage terms associated with:
- The Qwen3 base model
- The Qwen3.8-Max teacher provider
- The distillation dataset
- Upstream datasets from which prompts were sourced
Users are responsible for reviewing the base model license, the distillation dataset card, its provenance documentation, and any applicable upstream terms before use or redistribution.
Acknowledgements
This model builds upon work from:
- The Qwen team for Qwen3-4B-Thinking-2507
r0b0tlabfor the Qwen3.8-Max Distillation 50K dataset- Unsloth
- Hugging Face Transformers and TRL
Citation
@misc{r0b0tlab2026qwen38distillation50k,
title = {Qwen3.8-Max Distillation 50K},
author = {r0b0tlab},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/datasets/r0b0tlab/qwen3.8-max-distillation-50k}}
}
Disclaimer
Qwen3.8 4B Distilled is an independent community fine-tune by Ma7ee7.
It is not produced, endorsed, or officially released by the Qwen team, Alibaba, or Alibaba Cloud.
- Downloads last month
- 90
Model tree for Ma7ee7/Qwen3.8_4B_Distilled
Base model
Qwen/Qwen3-4B-Thinking-2507
docker model run hf.co/Ma7ee7/Qwen3.8_4B_Distilled