Code_Qwen3-4B_Qwen3-4B-Instruct-2507

Qwen/Qwen3-4B distilled from Qwen/Qwen3-4B-Instruct-2507 with Ask to Distill.

Ask to Distill trains a question generator with RL so that the questions it writes expose bounded, learnable token-level disagreement between a teacher and a student on the student's own solutions (the same signal on-policy distillation learns from). A question bank is then sampled from the generator, filtered and deduplicated, and the student is trained with on-policy distillation (OPD) on it. No real training questions and no reference answers are used.

Training

Student Qwen/Qwen3-4B
Teacher Qwen/Qwen3-4B-Instruct-2507
Question bank gasolsun/Code_Qwen3-4B_Qwen3-4B-Instruct-2507
OPD objective per-token reverse KL on the student's top-16 tokens, weighted by renormalised student probabilities; no outcome reward
OPD recipe lr 1e-6 (constant), AdamW, rollout temperature 1.0, fp32 master weights / bf16 compute

Results

LiveCodeBench v5_v6 MBPP+ APPS-Intro APPS-Interview APPS-Comp CodeContests Avg
35.9 68.5 64.0 36.0 15.9 17.0 39.6

LiveCodeBench v5_v6 (342 problems, n=4, pass@1); MBPP+ (EvalPlus, greedy, lenient answer extraction); APPS intro / interview (1k subset) / competition and CodeContests test (165): n=1, temperature 0.2, top-p 0.95, top-k 20, 4,096 tokens, at most 50 tests per problem. Avg = mean of six.

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "gasolsun/Code_Qwen3-4B_Qwen3-4B-Instruct-2507"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto", device_map="auto")
messages = [{"role": "user", "content": "..."}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", enable_thinking=False).to(model.device)
out = model.generate(inputs, max_new_tokens=4096, do_sample=True, temperature=0.7, top_p=0.95)
print(tok.decode(out[0, inputs.shape[1]:], skip_special_tokens=True))
  • The student was trained and evaluated in non-thinking mode; pass enable_thinking=False to the chat template.
  • Prompts use the LiveCodeBench stdin/stdout template (read from standard input, write to standard output, one fenced Python block).
Downloads last month
56
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 gasolsun/Code_Qwen3-4B_Qwen3-4B-Instruct-2507

Finetuned
Qwen/Qwen3-4B
Finetuned
(1,342)
this model

Collection including gasolsun/Code_Qwen3-4B_Qwen3-4B-Instruct-2507