Instructions to use RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k") model = AutoModelForCausalLM.from_pretrained("RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k", 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 RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k
- SGLang
How to use RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k 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 "RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k" \ --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": "RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k", "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 "RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k" \ --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": "RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k with Docker Model Runner:
docker model run hf.co/RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k
Qwen3-4B distilled from Qwen3-30B-A3B — On-policy 5k (code)
On-policy KD for a Qwen3-4B student toward the Qwen3-30B-A3B teacher, on 5,000 code prompts from OpenThoughts-3.
Domain-transfer companion to qwen3_30b_a3b_to_4b_onpolicy_science_5k and the math-domain onpolicy_5k_src* chain: same student starting point and recipe, different domain slice. Training exposure of this checkpoint:
- Off-policy KD on 20k math prompts →
qwen3_30b_a3b_to_4b_offpolicy_20k - On-policy KD (this run) on 5k code prompts → this checkpoint
Models
| Role | Model |
|---|---|
| Student | RockToken/qwen3_30b_a3b_to_4b_offpolicy_20k |
| Teacher | Qwen/Qwen3-30B-A3B-Instruct-2507 (MoE) |
enable_thinking=False throughout.
Training data
- Source:
open-thoughts/OpenThoughts3-1.2M,domain == "code"slice - 5,000 single-user-turn prompts; 70 exceeding
prompt_max_len=2560were filtered, leaving 4,930 - Only the prompts are used; on-policy KD never reads the dataset's reference answers
Training setup
Framework: KDFlow — FSDP2 + SGLang rollout, Ray-orchestrated GPU co-location with sleep/wakeup. Same pipeline revision as the math-domain onpolicy_5k_src* runs.
Hardware: 1× node, 4× H100 (94 GB), 33 h 09 min wall-clock (~133 GPU-hours).
Key hyperparameters
| Group | Value |
|---|---|
| Backend | fsdp2, bf16, gradient ckpt on |
| Epochs | 1 (2,465 rollout iterations) |
| Train batch | 4 (micro 1) |
| Learning rate | 2e-6, cosine, warmup 5% |
| KD ratio | 1.0 |
| KD loss | reverse KL (rkl) |
| KD algorithm | vanilla_kd |
| Rollout engine | SGLang, TP=2, 1 engine |
| Rollout batch | 2 prompts × 4 samples/prompt |
generate_max_len |
8000 |
prompt_max_len |
2560 (total max_len 10816) |
| Sampling | temperature 1.0, top-p 1.0 |
| Teacher | TP=4, sleep/wakeup enabled |
prompt_max_len is 2560 instead of the math runs' 800: code prompts carry problem statements and starter code (p99 ≈ 2,356 tokens).
Note on the LR schedule: as in the earlier runs of this series, the scheduler's horizon is sized to 4× the actual number of updates, so the cosine decay is only partially traversed — the LR moves from 2.00e-6 to 1.79e-6 over the run rather than reaching zero. Kept as is for comparability within the series.
Training dynamics
Means over 500-step blocks (per-step values are noisy at batch 4):
| steps | loss (reverse KL) | mean gen length |
|---|---|---|
| 1–500 | 0.190 | 6,814 |
| 501–1000 | 0.178 | 6,611 |
| 1001–1500 | 0.175 | 6,471 |
| 1501–2000 | 0.166 | 6,647 |
| 2001–2465 | 0.166 | 6,378 |
The loss starts near 0.19 rather than the ~3 seen when distilling from a raw instruct model — the student has already been through off-policy KD against the same teacher, so on-policy training starts close and grinds out the remaining distribution gap.
âš Truncation caveat
Code responses run long, and a substantial share of rollouts hit the 8,000-token generation cap: per-step mean lengths sit at p50 = 7,069 against the cap, and in 20% of steps the whole batch was truncated (step-mean ≥ 7,990). Truncated rollouts contribute KD signal only for their first 8,000 tokens, and the student receives no supervision on how the teacher would have ended those responses. Treat comparisons against the science and math checkpoints (which trained essentially truncation-free) with this in mind.
Intended use
Research on distillation dynamics, in particular whether on-policy KD gains transfer across domains (math-trained off-policy base → code on-policy round). Domain: code (OpenThoughts-3 code split).
Limitations
- The on-policy round is code-only; not tuned for chat or safety.
enable_thinking=False— this student does not emit thinking traces.- Heavy generation-length truncation during training; see the caveat above.
- Single checkpoint at the end of one epoch; no intermediate checkpoints were kept.
- Downloads last month
- 24
Model tree for RockToken/qwen3_30b_a3b_to_4b_onpolicy_code_5k
Base model
RockToken/qwen3_30b_a3b_to_4b_offpolicy_20k