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

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.01.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
  • r0b0tlab for 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
Safetensors
Model size
4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Ma7ee7/Qwen3.8_4B_Distilled

Finetuned
(261)
this model
Finetunes
1 model
Quantizations
1 model

Dataset used to train Ma7ee7/Qwen3.8_4B_Distilled