Skip to content

AsyncGRPOConfig : dtype asyncgrpo training - #6774

Open
AmineDiro wants to merge 1 commit into
mainfrom
async-grpo-dtype-config
Open

AsyncGRPOConfig : dtype asyncgrpo training#6774
AmineDiro wants to merge 1 commit into
mainfrom
async-grpo-dtype-config

Conversation

@AmineDiro

@AmineDiro AmineDiro commented Aug 17, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Added dtype to AsyncGRPOTrainer with inference dtype detection to raise a warning if mismatch is detected

See:
https://huggingface.co/papers/2510.26788
https://huggingface.co/spaces/aminediroHF/trainer-generator-bf16-mismatch


Note

Medium Risk
Changes default model load precision and touches GRPO importance-ratio sensitivity; mismatch handling is warn-only but misconfiguration could skew training.

Overview
Adds a dtype knob on AsyncGRPOConfig (default float32) so the policy is loaded via model_init_kwargs instead of a hardcoded torch.float32 in AsyncGRPOTrainer. A dtype entry in model_init_kwargs still wins.

VLLMClient.get_dtype() reads the served weight precision from vLLM’s /server_info. WeightTransferClient.init_weight_transfer compares that to the trainer’s weight dtypes (mode of dtype_names) and logs a warning with hints to align AsyncGRPOConfig.dtype or vllm serve --dtype, aimed at trainer–generator precision mismatch in async GRPO.

Reviewed by Cursor Bugbot for commit 630d840. Bugbot is set up for automated code reviews on this repo. Configure here.

@AmineDiro
AmineDiro requested a review from qgallouedec August 17, 2026 10:15
@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 630d840. Configure here.

logger.warning(
f"The vLLM server serves in {vllm_dtype} but the weights sent to it are {train_dtype}. Set `dtype` in "
f"`AsyncGRPOConfig` to '{vllm_dtype}', or start the server with `--dtype {train_dtype}`."
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning suggests harmful dtype fix

Medium Severity

The new mismatch warning equally recommends setting AsyncGRPOConfig.dtype to the vLLM dtype or aligning the server to the trainer. In the common case (trainer float32, vLLM bfloat16), the first option pushes users onto bfloat16 training—the precision this change and its cited measurements intentionally move away from—so the remediation text works against the feature’s purpose.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 630d840. Configure here.

@AmineDiro AmineDiro changed the title Údtype asyncgrpo training AsyncGRPOConfig : dtype asyncgrpo training Aug 17, 2026
AmineDiro added a commit that referenced this pull request Aug 17, 2026
The two-node Slurm layout (8 trainer ranks + 8 vLLM engines) becomes one
h200x8 split 4 + 4, with `gradient_accumulation_steps` doubled to keep the
recipe's 128 completions per optimizer step. `resume` is now idempotent: the
in-job script reads `global_step` out of the checkpoint and trains
STEPS_PER_JOB more, up to TOTAL_STEPS, so a 2400-step run is a chain of jobs on
one trackio run. A constant LR is what makes that safe — there is no decay
horizon for a per-job `max_steps` to distort.

Carries over the four things the Slurm runs proved load-bearing: top_p=1.0
(0.95 collapsed four runs), fp32 master weights under bf16/fp16 autocast rather
than bf16 parameters (which went nowhere: +0.031 over 2400 steps), 128
completions per step with token_budget=0, and adam_beta2=0.95. The
precision-mismatch warning from PR #6774 fires in this configuration and is
expected: mixed precision means fp32 weights going to a bf16 server, which is
what every good run did.

Code now reaches the job as a `git archive` of the branch, synced to a bucket
and mounted read-only. Fetching a branch tarball from GitHub in-job failed
three runs in a row with 429/503 — the jobs egress IP is shared and
rate-limited. `origin` stays the record; the bucket is only transport.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant