ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

奖励函数一直震荡不上升,似乎学不到东西

Open HT-NEKO opened this issue 1 year ago • 6 comments

python==3.10.0

ms_swift==3.5.0.dev0
deepspeed==0.16.0
vllm==0.9.1
transformers==4.52.4
export WANDB_API_KEY=xxx
export WANDB_MODE=dryrun
export WANDB_PROJECT=ms-swift
export WANDB_RUN_NAME=Qwen3-1.7B

NPROC_PER_NODE=4
CUDA_VISIBLE_DEVICES=0,1,2,3
MASTER_PORT=45678
PYTORCH_CUDA_ALLOC_CONF='expandable_segments:True'
export VLLM_USE_V1=1
swift rlhf \
    --rlhf_type grpo \
    --model /primus_source_checkpoint/Qwen3-1_7B \
    --model_type "qwen3" \
    --external_plugins /root/code/examples/train/grpo/plugin/plugin.py \
    --reward_funcs external_countdown format \
    --use_vllm true \
    --vllm_mode colocate \
    --vllm_max_model_len 2048 \
    --sleep_level 1 \
    --offload_optimizer true \
    --offload_model true \
    --gc_collect_after_offload true \
    --vllm_gpu_memory_utilization 0.7 \
    --train_type lora \
    --torch_dtype bfloat16 \
    --dataset 'zouxuhong/Countdown-Tasks-3to4#50000' \
    --max_length 2048 \
    --max_completion_length 2048 \
    --num_train_epochs 1 \
    --per_device_train_batch_size 1 \
    --learning_rate 5e-7 \
    --gradient_accumulation_steps 8 \
    --save_steps 200 \
    --save_total_limit 3 \
    --logging_steps 1 \
    --output_dir output/GRPO_COUNTDOWN \
    --logging_dir output/tensorboard_logs \
    --warmup_ratio 0.01 \
    --dataloader_num_workers 4 \
    --num_generations 4 \
    --temperature 1.0 \
    --system 'You are a helpful assistant. You first thinks about the reasoning process in the mind and then provides the user with the answer.' \
    --deepspeed zero2 \
    --log_completions true \
    --report_to "all" \
    --beta 0.001 \
    --num_iterations 1 \
    --sequence_parallel_size 4 \
    --tensor_parallel_size 4
Image Image

我猜测是由于qwen3已经经过RLHF的步骤,并且Countdown-Tasks-3to4比较简单,所以没有训练效果,不知道是否是这样?请问您能给我一些GRPO的训练意见吗?

HT-NEKO avatar Jun 23 '25 11:06 HT-NEKO

try full parameter training

hjh0119 avatar Jun 23 '25 14:06 hjh0119

try full parameter training

全参训练也还是不行呢,一直在震荡,是否是countdown任务对于qwen3-1.7b太简单呢?

Image

HT-NEKO avatar Jun 24 '25 07:06 HT-NEKO

+1 我也遇到了同样的问题,请问你现在解决了吗?@HT-NEKO

wowlza avatar Jul 22 '25 07:07 wowlza

+1,我用的qwen3-vl-2b训练的,也是一直震荡,连json的格式都没发保持的很好

xealml avatar Dec 24 '25 12:12 xealml

+1

sjy-1995 avatar Dec 31 '25 03:12 sjy-1995

please retry with latest swift and vllm, feel free to create a new issue if it the problem persists.

z0o0ey avatar Jul 01 '26 03:07 z0o0ey