[reproducibility] Huge difference between runs despite the seed
I’m using commit 8b33abd84f360473f05e5a750aef36e974340cce of VERL and observing a huge difference in response length between runs, even though I explicitly set random_seed in the sglang engine.
Here is the config:
actor_rollout_ref:
model:
path: /from_s3/model
enable_gradient_checkpointing: true
enable_activation_offload: false # true
use_remove_padding: true # true
use_fused_kernels: true # false
actor:
entropy_from_logits_with_chunking: true
entropy_checkpointing: false # true
ppo_mini_batch_size: 128
ppo_micro_batch_size_per_gpu: 8
use_dynamic_bsz: False
ppo_max_token_len_per_gpu: 32792 # 16384 n * ${data.max_prompt_length} + ${data.max_response_length}
grad_clip: 1.0
clip_ratio: 0.2
entropy_coeff: 0
use_kl_loss: False # True for original GRPO
kl_loss_coef: 0.01 # for grpo
kl_loss_type: low_var_kl # for grpo
ppo_epochs: 1
ulysses_sequence_parallel_size: 1 # sp size
optim:
lr: 1e-6
lr_warmup_steps: -1 # Prioritized. Negative values mean delegating to lr_warmup_steps_ratio.
lr_warmup_steps_ratio: 0.03 # the total steps will be injected during runtime
min_lr_ratio: 0.0 # only used with cosine lr scheduler, default to 0.0
num_cycles: 0.5 # only used with cosine lr scheduler, default to 0.5
warmup_style: constant # select from constant/cosine
strategy: fsdp
fsdp_config:
offload_policy: false # true
param_offload: false # true
optimizer_offload: false # true
checkpoint:
save_contents: ['model', 'optimizer', 'extra', "hf_model"]
ref:
log_prob_micro_batch_size_per_gpu: 16
rollout:
random_seed: 0
temperature: 1.0
gpu_memory_utilization: 0.6
tensor_model_parallel_size: 1
name: sglang
mode: async
top_p: 1
top_k: -1
ignore_eos: False
enforce_eager: true
free_cache_engine: true
multi_stage_wake_up: false
load_format: safetensors # dummy_dtensor for random weight init
max_num_batched_tokens: 32768
max_model_len: 12288 # 8192 # 32768
prompt_length: 8192 # 16435
response_length: 4096 # 4096 # 16333
max_num_seqs: 1024
log_prob_micro_batch_size_per_gpu: 16
stop_token_ids: [151643, 151645]
do_sample: True
n: 8 # > 1 for grpo, rloo
val_kwargs:
top_k: -1
top_p: 1.0
temperature: 0
n: 1
do_sample: False
reward_model:
enable: False
micro_batch_size_per_gpu: 16
max_length: null
reward_manager: naive
algorithm:
adv_estimator: grpo # gae
use_kl_in_reward: False
trainer:
balance_batch: True
total_training_steps: 301
total_epochs: 1
project_name: rg-dy_samp
entity: 'turbo-alignment'
group: ${trainer.experiment_name}
experiment_name: run_name
logger: ['console', 'wandb']
log_val_generations: 0
nnodes: 1
n_gpus_per_node: 8
save_freq: 50
test_freq: 25
val_before_train: False
critic_warmup: 0
max_actor_ckpt_to_keep: 1
resume_mode: disable
resume_from_path: null
remove_previous_ckpt_in_save: True
del_local_ckpt_after_load: True
default_local_dir: /train_output
I’m using the async sglang engine here, but even when I switch to vLLM, the gap is still present.
This is pretty common in RL because RL is basically exploration. You can read some observations in class RL as a reference. https://www.alexirpan.com/2018/02/14/rl-hard.html
To ensure fair comparison between different training, can fixing the data.seed ensure that the sample order is completely consistent for each training?
为了确保不同训练间的公平对比,将 data.seed 固定,是否就可以让每次训练的样本顺序完全一致呢?
Thanks for the report. Based on the current evidence, I do not think this should be closed as a resolved bug yet, but the behavior is also not fully controlled by the seed shown in the original config.
Evidence:
- In the reported commit
8b33abd84f360473f05e5a750aef36e974340cce, the vLLM async server readsconfig.get("seed", 0), notrandom_seed: https://github.com/verl-project/verl/blob/8b33abd84f360473f05e5a750aef36e974340cce/verl/workers/rollout/vllm_rollout/vllm_async_server.py#L245-L253 data.seedcontrols dataloader shuffling, not rollout generation determinism. Current docs describe it as the seed used when shuffling data: https://github.com/verl-project/verl/blob/main/docs/examples/config.rstdata.seedwas added later in #3815: https://github.com/verl-project/verl/pull/3815- Full vLLM rollout determinism support was added later in #6572, with
actor_rollout_ref.rollout.full_determinism=true,actor_rollout_ref.rollout.seed=..., and deterministic scheduling requirements: https://github.com/verl-project/verl/pull/6572 - Current determinism docs also note that RL training is not bitwise reproducible by default and that backend support is currently vLLM-focused, with SGLang not listed as supported for full determinism: https://github.com/verl-project/verl/blob/main/docs/advance/determinism.md
So, for current main, please try the current deterministic configuration rather than random_seed, for example:
actor_rollout_ref:
rollout:
name: vllm
full_determinism: true
seed: 42
scheduling_policy: priority
actor:
fsdp_config:
full_determinism: true
ref:
fsdp_config:
full_determinism: true
data:
shuffle: true
seed: 42
If the issue still reproduces on current main, please share the exact commit, backend (vllm or sglang), the effective resolved config, and a minimal two-run comparison showing which outputs differ. For the March question: fixing data.seed can make dataloader shuffle deterministic, but by itself it does not guarantee identical rollout outputs or identical end-to-end RL training curves.
中文说明:
谢谢反馈。基于目前证据,我不建议直接关闭这个 issue,但原始配置里的 seed 也不足以控制完整复现性。
证据如下:
- 在报告使用的
8b33abd84f360473f05e5a750aef36e974340cce中,vLLM async server 读取的是config.get("seed", 0),不是random_seed:https://github.com/verl-project/verl/blob/8b33abd84f360473f05e5a750aef36e974340cce/verl/workers/rollout/vllm_rollout/vllm_async_server.py#L245-L253 data.seed只用于 dataloader shuffle,不是 rollout 生成的完整确定性开关;当前文档也是这样描述的:https://github.com/verl-project/verl/blob/main/docs/examples/config.rstdata.seed是后续 #3815 才加入的:https://github.com/verl-project/verl/pull/3815- vLLM rollout 的 full determinism 支持是后续 #6572 加入的,需要
actor_rollout_ref.rollout.full_determinism=true、actor_rollout_ref.rollout.seed=...和确定性调度等配置:https://github.com/verl-project/verl/pull/6572 - 当前 determinism 文档说明 RL training 默认并非 bitwise reproducible;完整复现需要 rollout/actor/ref/reward 多层同时配置,并且 full determinism 的 backend support 目前主要是 vLLM,SGLang 未列为支持:https://github.com/verl-project/verl/blob/main/docs/advance/determinism.md
因此,如果使用当前 main,建议用当前的 determinism 配置复测,而不是 random_seed。如果问题仍然存在,请补充精确 commit、backend(vllm 或 sglang)、解析后的完整配置,以及两次运行的最小差异样例。对于 3 月评论里的问题:固定 data.seed 可以让 dataloader shuffle 可复现,但它本身不能保证 rollout 输出或端到端 RL 曲线完全一致。
This response was generated by a scheduled Codex GPT5.5 issue processing task.