Agentic training stucks for unclear reason
Hi and thanks for your great work. I try to use ROLL to do GRPO training on math problem with python code tool. But I tried for many times, the training process stucks after 10 epoch like this:
I don't know why this happens. The training has been on for 10 steps and val has been on for 1 time, which may indicate these two processes work fine. Why it always stucks here?
Here is my config:
defaults:
- ../config/traj_envs_gem_math@_here_
hydra:
run:
dir: .
output_subdir: null
exp_name: "agentic_pipeline"
seed: 42
logging_dir: ./output/logs
output_dir: ./output
track_with: wandb
tracker_kwargs:
api_key: 45a892881747965cee940e99858e1486ab122735
project: roll-agentic-demo
name: ${exp_name}_cosine
notes: "agentic_pipeline"
tags:
- agentic
- roll
- baseline
# track_with: tensorboard
# tracker_kwargs:
# log_dir: /data/oss_bucket_0/yali/llm/tensorboard/roll_exp/agentic_sokoban
checkpoint_config:
type: file_system
output_dir: ./output/rl_examples/models/${exp_name}
num_gpus_per_node: 8
max_steps: 1024
save_steps: 10
logging_steps: 1
eval_steps: 10
resume_from_checkpoint: false
rollout_batch_size: 16
val_batch_size: 8
sequence_length: 8192
advantage_clip: 0.2
ppo_epochs: 1
adv_estimator: "grpo"
difficulty_mask: true
difficulty_low_threshold: 0.1
difficulty_high_threshold: 0.95
#pg_clip: 0.1
#dual_clip_loss: True
init_kl_coef: 0.0
whiten_advantages: true
entropy_loss_coef: 0
max_grad_norm: 1.0
pretrain: /mnt/dolphinfs/ssd_pool/docker/user/hadoop-aipnlp/3A/multimodal/zhangmanyuan/huggingface_model/Qwen3-8B
# reward_pretrain: Qwen/Qwen3-4B-Base
actor_train:
model_args:
attn_implementation: fa2
disable_gradient_checkpointing: false
dtype: bf16
model_type: ~
training_args:
learning_rate: 6.0e-7
weight_decay: 0
per_device_train_batch_size: 1
gradient_accumulation_steps: 4
warmup_steps: 10
warmup_ratio: 0
lr_scheduler_type: cosine
data_args:
template: qwen3
strategy_args:
# strategy_name: deepspeed_train
# strategy_config: ${deepspeed_zero3}
strategy_name: megatron_train
strategy_config:
tensor_model_parallel_size: 2
pipeline_model_parallel_size: 1
expert_model_parallel_size: 1
use_distributed_optimizer: true
recompute_granularity: full
device_mapping: list(range(0,8))
infer_batch_size: 2
actor_infer:
model_args:
disable_gradient_checkpointing: true
dtype: bf16
generating_args:
max_new_tokens: ${max_tokens_per_step} # single-turn response length
top_p: 0.99
top_k: 100
num_beams: 1
temperature: 0.9
num_return_sequences: 1
stop_strings: ["</code>"]
strategy_args:
strategy_name: vllm
strategy_config:
gpu_memory_utilization: 0.7
block_size: 16
load_format: auto
device_mapping: list(range(0,8))
reference:
model_args:
attn_implementation: fa2
disable_gradient_checkpointing: true
dtype: bf16
model_type: ~
strategy_args:
strategy_name: hf_infer
strategy_config: ~
device_mapping: list(range(0,8))
infer_batch_size: 2
reward_normalization:
grouping: traj_group_id # 可以tags(env_type)/traj_group_id(group)/batch(rollout_batch)... group_by计算reward/adv
method: mean_std # asym_clip / identity / mean_std
train_env_manager:
format_penalty: -0.1
max_env_num_per_worker: 16
num_env_groups: 32
# under the same group, the env config and env seed are ensured to be equal
group_size: 8
tags: [my_deepscaler_with_python_code]
num_groups_partition: [32] # If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
val_env_manager:
max_env_num_per_worker: 16
num_env_groups: 32
group_size: 1 # should be set to 1 because val temperature is set to 0 and same prompt leads to same output
tags: [aime24]
num_groups_partition: [32] # TODO: If not set, all env names divide nums equally. Under the same group, the env config and env seed (prompt) are equal in each generation
# Here, you can override variables defined in the imported envs. max_tokens_per_step: 128 in custom_env.SimpleSokoban, here replaced by 64
max_tokens_per_step: 2048
math_agent_system_template: Please reason step by step, and put your final answer within '\\boxed{}', e.g. \\boxed{{A}}..
math_agent_template: "{observation}\nEnsure that your response includes the format of '\\boxed{{answer}}', e.g. \\boxed{{A}}."
custom_envs:
dapo_17k:
${gem_math.dapo_17k}
dapo_17k_with_python_code:
${gem_math.dapo_17k_with_python_code}
my_deepscaler_with_python_code: # 添加这一行
${gem_math.my_deepscaler_with_python_code}
aime24:
${gem_math.aime24}
Besides, I print out scores in roll/pipeline/agentic/env_manager/traj_env_manager.py line 290:
scores = [i['reward'] for i in self.rollout_cache.history]
print(f"scores = {scores}")
episode_score = sum(scores)
print(f"sum score = {episode_score}")
But I find that each training step it output 5-7 scores.
From my personal understanding, I set rollout_batch_size=16 and group_size=8. So each step there will be $16 \times 8 =128$ trajectories. Is there anything wrong with my understanding?
I really appreciate your work and I can see that this is a very flexible framework. I'm looking forward to your reply.
同样,您解决了问题了吗?
感谢关注~
最近分析过这个问题,原因是配置中val_batch_size: 8,而
val_env_manager:
num_env_groups: 32
group_size: 1
总共有32个env,rollout 8条轨迹。 在这种设置下,发现rollout scheduler在第二次eval时不能正确处理abort reqest的情况。
另外,val也不应该这样设置,后续会对此增加校验。
当前可以设置val_batch_size: 32,能解决hang住的问题。