Safety_Tuning-Qwen3.5-4B
Intermediate safety training checkpoint using GRPO
2 min readupdated
The model is one of the intermediate checkpoints at step 760 of training based on thkim0305-SNU/Safety_Tuning-Qwen3.5-4B-Base-SFT-Mixture8-genv2gp3-lr1e-5-step365, which was originally fine-tuned from Qwen/Qwen3.5-4B-Base. The primary objective of this version is to improve safety (safety RL) across a diverse mix of prompts, including tool-use scenarios. The visual component and MTP head are kept unchanged from the base model, allowing the weights in bf16 format to be loaded standardly via the transformers library.
Key features
- Training using the GRPO (Group Relative Policy Optimization) method with binary rewards and PPO clipping.
- The mixture-8 dataset includes over 11,000 unique prompts, including code safety tasks and agent trajectories.
- Support for reasoning mode (thinking) and function calling via a special Qwen chat template.
- Use of an external judge based on the
Qwen3.8-27Bmodel to evaluate generations against strict criteria.
What you can do
- Test model behavior on trick questions or potentially dangerous requests for research tasks.
- Run inference locally using the
transformerslibrary to analyze reasoning logic. - Integrate the model into pipelines where strict safety control and tool usage are required.
Example
from transformers import AutoTokenizer, Qwen3_5ForConditionalGeneration
model_id = "thkim0305-SNU/Safety_Tuning-Qwen3.5-4B-Base-SFT365-GRPO-Mixture8-binary-lr1e-6-kl0.001-p15-k8-step760"
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))
Read more
Details• Algorithm: GRPO with group normalization of binary rewards and KL regularization (coefficient 0.001).
• Learning rate: constant learning rate of 1e-06 with the AdamW optimizer.
• Infrastructure: training was performed on H100 80GB video cards using a combination of Slime and Megatron-LM.
• Context: support for sequences up to 40960 tokens long and generation of up to 32768 new tokens.










Comments