modelscope / modelscope/ms-swift

qwen3.5和qwen3.6 grpo训练 wandb 奖励函数问题

Open
#9,764 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
15.7k
Forks
1.7k
Avg merge
1d 16h
Merged PRs (30d)
136

Description

Checklist / 检查清单
  • I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述

qwen3.5-9b微调
wandb看输入提示词显示 最后添加了
模型回答 显示 直接就回答了 结尾<\think>,那这样计算格式奖励 是不是就一直为0,是要开头人工加上思考前缀吗
把模型回答 开头添加 再计算格式奖励吗
之前训练的qwen3.6-27b 也有这个问题,模型回答 只有<\think> 没有开始的

How to Reproduce / 如何复现

WANDB_PROJECT=qwen35_9b_rl_priceQA_0517
CUDA_VISIBLE_DEVICES=0,1
NPROC_PER_NODE=2
swift rlhf
--rlhf_type grpo
--model /output/Qwen3.5-9B-price-0516-sft/v1-20260517-232506/checkpoint-430-merged
--external_plugins examples/train/grpo/plugin/price/price_plugin2.py
--reward_funcs price_accuracy price_format
--columns '{"output": "solution"}'
--enable_thinking true
--use_vllm true
--vllm_mode colocate
--vllm_gpu_memory_utilization 0.6
--vllm_tensor_parallel_size 1
--vllm_max_model_len 4096
--sleep_level 1
--tuner_type 'lora'
--torch_dtype bfloat16
--load_from_cache_file true
--max_length 3072
--max_completion_length 2048
--num_train_epochs 2
--per_device_train_batch_size 8
--gradient_accumulation_steps 8
--learning_rate 1e-6
--lr_scheduler_type cosine
--save_steps 20
--save_total_limit 2
--logging_steps 1
--warmup_ratio 0.0
--dataloader_num_workers 4
--num_generations 8
--temperature 1.0
--system "$SYSTEM_PROMPT"
--output_dir output/Qwen3.5-9B-price-0616-grpo
--deepspeed zero2
--log_completions true
--report_to wandb
--max_grad_norm 1.0
--epsilon 0.2
--epsilon_high 0.28
--scale_rewards none

Additional Information / 补充信息

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the external plugin at examples/train/grpo/plugin/price/price_plugin2.py and trace how price_format receives the generated solution. Reproduce the command with WANDB logging enabled, then compare the logged completion delimiters with the format reward result. Done means the handling of missing or mismatched thinking tags is understood and the reward behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.