DistilQwen
Collection
All DistilQwen models and datasets
β’
18 items
β’
Updated
β’
2
In response to the industry challenge of balancing efficient reasoning with cognitive capabilities, the DistilQwen2.5-DS3-0324 series innovatively transfers the fast-thinking capabilities of DeepSeekV3-0324 to lightweight models. Through a two-stage distillation framework, this series achieves high performance while delivering:
Stage 1: Fast-Thinking CoT Data Collection
Stage 2: CoT Trajectory Cognitive Alignment
Model | MMLU_PRO Tokens | AIME2024 Tokens | Speed Gain |
---|---|---|---|
DistilQwen2.5-R1-32B (Slow-Thinking) | 4198 | 12178 | 1x |
DistilQwen2.5-DS3-0324-32B | 690 | 4177 | 5-8x |
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained(
"alibaba-pai/DistilQwen2.5-DS3-0324-7B",
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("alibaba-pai/DistilQwen2.5-DS3-0324-7B")
prompt = "Give me a short introduction to large language model."
messages=[
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant. You should think step-by-step."},
{"role": "user", "content": prompt},
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=2048οΌ
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]