OPTD-Qwen3-4B-Mid

arXiv · Hugging Face Paper · Project Page · All OPTD models

An OPTD model trained from Qwen/Qwen3-4B with specialists in mathematics and coding. This is a complete model that can be used directly for text generation.

OPTD teaches a student both the teacher’s final prediction and how its predictions change across layers, using responses generated by the student. This checkpoint accompanies On-Policy Transition Distillation.

Mid identifies the placement of transition supervision during training. Mid and Late use different sets of layers; these names do not denote release versions or a quality ranking.

Use non-thinking mode (enable_thinking=False) for this Qwen3-4B model, as in the paper.

Quick start

Install PyTorch for your hardware, Transformers, and Accelerate:

python -m pip install torch transformers accelerate

The example below uses BF16. Teacher models and the OPTD training framework are not required for inference.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "ModalityDance/OPTD-Qwen3-4B-Mid"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id, torch_dtype=torch.bfloat16, device_map="auto"
)
messages = [{"role": "user", "content": "Solve 2x + 5 = 17."}]
text = tokenizer.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = tokenizer(text, add_special_tokens=False, return_tensors="pt").to(model.device)
with torch.inference_mode():
    output = model.generate(
        **inputs, max_new_tokens=1024, do_sample=True, temperature=0.7, top_p=0.95
    )
response = output[0, inputs.input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))

The short generation limit is for the example. Paper evaluation uses benchmark-specific token limits and sample counts.

Download

hf download ModalityDance/OPTD-Qwen3-4B-Mid --local-dir models/optd-qwen3-4b-mid

Install huggingface_hub to use the hf command. To load a downloaded copy, replace model_id with its local directory.

Training and release details

Configuration and file contents
  • Student initialization: Qwen/Qwen3-4B.
  • Training updates: 50.
  • Intermediate layers (zero-based): 7 / 13 / 19.
  • Training domains: mathematics and coding.
  • Full BF16 safetensors weights, tokenizer, and generation configuration are included.
  • training_metadata.json records the training configuration; checksums.json records checkpoint/tokenizer SHA256 hashes.
  • Optimizer state is not included.

Evaluation

Compare this checkpoint using the paper’s prompt mode, dataset revisions, sample counts, and graders. The example above demonstrates inference rather than reproducing benchmark scores. Generated answers can be incorrect; execute generated code only in an isolated sandbox.

Citation

XXXX.XXXXX and PROJECT_PAGE_URL are placeholders for the arXiv id and the project page.

@misc{optd2026,
  title         = {On-Policy Transition Distillation},
  author        = {Authors},
  year          = {2026},
  eprint        = {XXXX.XXXXX},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CL},
  url           = {https://arxiv.org/abs/XXXX.XXXXX}
}

License and attribution

The underlying student and specialist models retain their respective upstream license terms. Consult the linked base model's license and notices before redistribution or deployment. No new license grant for upstream model weights is implied by this model card.

Downloads last month
18
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 ModalityDance/OPTD-Qwen3-4B-Mid

Finetuned
Qwen/Qwen3-4B
Finetuned
(1204)
this model

Collection including ModalityDance/OPTD-Qwen3-4B-Mid