Safety_Tuning-Qwen3.5-4B-Base-GRPO-Mixture8-binary-lr1e-6-kl0.001-p15-k8-ep2-step1320
Intermediate GRPO checkpoint of Qwen/Qwen3.5-4B-Base (snapshot 1001bb4d826a) after
1320 optimizer updates (Megatron iteration 1319) of safety RL on the
"mixture-8" prompt set. Training is still in progress; this is a snapshot, not a final model.
Weights are bf16 Hugging Face Qwen3_5ForConditionalGeneration; the vision tower and MTP head are
the untouched base weights (only the language model was trained), so the checkpoint loads exactly like
the base model.
Training recipe
| item | value |
|---|
| algorithm | GRPO (group-normalized binary rewards), PPO clip 0.2, TIS on |
| framework | Slime (SGLang rollouts, colocated) + Megatron-LM, bf16 |
| prompts per update x rollouts per prompt | 15 x 8 = 120 sequences |
| learning rate | 1e-06 constant, AdamW betas [0.9, 0.95], weight decay 0.1, grad clip 1.0 |
| KL to the frozen start | low-variance KL loss, coefficient 0.001 |
| sampling | temperature 1.0, top-p 1, up to 32768 generated tokens, 40960 context |
| thinking | Qwen chat template with enable_thinking=true; tool rollouts use qwen3_coder function calling |
| reward | Qwen3.8-27B judge, strict binary (0/1) verdict with the project's model spec; AgentAlign prompts are judged on the whole visible tool trajectory |
| schedule | one padded epoch over 11794 unique prompts = 1574 updates; checkpoints every 40 updates |
Data (mixture-8)
| dataset | prompts |
|---|
| star1_gp3 | 1000 |
| star_benign_v2 | 915 |
| agentalign_harmful | 2000 |
| agentalign_benign | 2000 |
| codesafetybench | 900 |
| magicoder | 1000 |
| difficult_advice | 1982 |
| wildjailbreak_benign | 1997 |
4000 AgentAlign prompts carry synthetic tool definitions and are rolled out as multi-turn
tool-use trajectories against a tool simulator (tool outputs are loss-masked).
Judge score during training (mean binary reward, raw before group normalization)
| window | mean score | judged rollouts |
|---|
| updates 790-800 | 0.808 | 1200 |
| updates 830-840 | 0.815 | 1200 |
| updates 870-880 | 0.855 | 1200 |
| updates 910-920 | 0.877 | 1200 |
| updates 950-960 | 0.853 | 1200 |
| updates 990-1000 | 0.808 | 1200 |
| updates 1030-1040 | 0.828 | 1200 |
| updates 1070-1080 | 0.812 | 1200 |
| updates 1110-1120 | 0.820 | 1200 |
| updates 1150-1160 | 0.853 | 1200 |
| updates 1190-1200 | 0.841 | 1200 |
| updates 1230-1240 | 0.853 | 1200 |
| updates 1270-1280 | 0.838 | 1200 |
| updates 1310-1320 | 0.844 | 1200 |
| dataset | updates 790-800 | updates 830-840 | updates 870-880 | updates 910-920 | updates 950-960 | updates 990-1000 | updates 1030-1040 | updates 1070-1080 | updates 1110-1120 | updates 1150-1160 | updates 1190-1200 | updates 1230-1240 | updates 1270-1280 | updates 1310-1320 |
|---|
| agentalign_benign | 0.61 | 0.62 | 0.73 | 0.69 | 0.72 | 0.69 | 0.61 | 0.63 | 0.67 | 0.68 | 0.67 | 0.72 | 0.68 | 0.59 |
| agentalign_harmful | 0.90 | 0.95 | 0.96 | 0.93 | 0.90 | 0.91 | 0.92 | 0.88 | 0.89 | 0.93 | 0.90 | 0.89 | 0.88 | 0.94 |
| codesafetybench | 0.85 | 0.93 | 0.93 | 0.83 | 0.95 | 0.96 | 0.94 | 0.90 | 0.93 | 0.99 | 0.97 | 0.84 | 0.92 | 0.91 |
| difficult_advice | 0.81 | 0.88 | 0.86 | 0.88 | 0.83 | 0.84 | 0.91 | 0.79 | 0.89 | 0.88 | 0.83 | 0.90 | 0.92 | 0.94 |
| magicoder | 0.76 | 0.26 | 0.77 | 0.87 | 0.54 | 0.53 | 0.57 | 0.58 | 0.71 | 0.59 | 0.75 | 0.65 | 0.53 | 0.84 |
| star1_gp3 | 0.97 | 0.96 | 0.96 | 0.99 | 0.95 | 0.96 | 0.89 | 0.93 | 1.00 | 0.94 | 0.99 | 0.97 | 0.88 | 1.00 |
| star_benign_v2 | 0.84 | 0.83 | 0.86 | 0.94 | 0.94 | 0.88 | 0.92 | 0.92 | 0.72 | 0.96 | 0.93 | 0.83 | 0.98 | 0.90 |
| wildjailbreak_benign | 0.86 | 0.86 | 0.81 | 0.88 | 0.93 | 0.82 | 0.80 | 0.89 | 0.89 | 0.89 | 0.85 | 0.93 | 0.88 | 0.85 |
Usage
from transformers import AutoTokenizer, Qwen3_5ForConditionalGeneration
model_id = "thkim0305-SNU/Safety_Tuning-Qwen3.5-4B-Base-GRPO-Mixture8-binary-lr1e-6-kl0.001-p15-k8-ep2-step1320"
tok = AutoTokenizer.from_pretrained(model_id)
model = Qwen3_5ForConditionalGeneration.from_pretrained(model_id, dtype="bfloat16", device_map="auto")
messages = [{"role": "user", "content": "Explain why phishing emails are dangerous."}]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=True)
out = model.generate(**tok(text, return_tensors="pt").to(model.device), max_new_tokens=512)
print(tok.decode(out[0], skip_special_tokens=True))
Provenance
- Run
grpo-mixture8-qwen35base4b-lr1e6-epoch2-from787-b200-gpu0-20261125-v1 (trainer and rollout engine on 1x NVIDIA B200; Qwen3.8-27B judge on 2x A100 (SGLang TP2) over an SSH tunnel; epoch 2 of the lr1e-6 run, resumed at update 787 from its final checkpoint (model, optimizer state, RNG) with a new prompt shuffle (seed 43)).
- Source checkpoint: Megatron torch_dist
iter_0001319; converted with safety_tuning.hf_export
(GDN projections re-fused, Slime Qwen3.5 name mapping, base vision/MTP weights copied, dtypes matched to the base index).
- Exported 2026-11-28T09:26:57+00:00.