You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for GRPO multi-GPU training with Qwen2.5? #3901
Thanks for the amazing work on Unsloth – it has been extremely helpful for efficient LLM training.
I’m currently working on a project that uses GRPO (as in TRL’s GRPOTrainer / RL-style optimization) to fine-tune Qwen2.5 models (e.g., Qwen2.5-3B / 7B). On a single GPU everything works well, but I would like to scale the training to multiple GPUs.
My questions are:
Does Unsloth currently support GRPO-style training on multiple GPUs (e.g., via DDP / Accelerate / FSDP)?
Are there any example scripts or recommended patterns for running GRPO with Qwen2.5 on multi-GPU setups?
If not yet supported, is this something on the roadmap, or are there known limitations that prevent GRPO from working in a multi-GPU setting with Unsloth?
Any guidance, pointers, or example code would be greatly appreciated.
Fixed! Sorry on the delay. GRPO now works with multi-GPU DDP. Before, Unsloth's GRPO loss ran the model outside DDP's forward, so gradients were never averaged across GPUs and each rank silently trained its own copy. #12193 averages the gradients across ranks (with unslothai/unsloth-zoo#1498 so the loss normalisation matches a single GPU run, and unslothai/unsloth-zoo#1499 for float32 on T4 / V100). Launch your usual GRPO script with torchrun --nproc_per_node 2 train.py (or accelerate launch) and set ddp_find_unused_parameters = False in GRPOConfig. I checked Qwen2.5-0.5B-Instruct LoRA GRPO on 2 ranks with the latest release, and both ranks end with identical weights. Guide: https://unsloth.ai/docs/basics/multi-gpu-training-with-unsloth/ddp
To update: uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir (if it's not in the current release yet it'll be in the next one). Reopen if it still happens.
Activity
danielhanchen commentedon Oct 9, 2026
Fixed! Sorry on the delay. GRPO now works with multi-GPU DDP. Before, Unsloth's GRPO loss ran the model outside DDP's forward, so gradients were never averaged across GPUs and each rank silently trained its own copy. #12193 averages the gradients across ranks (with unslothai/unsloth-zoo#1498 so the loss normalisation matches a single GPU run, and unslothai/unsloth-zoo#1499 for float32 on T4 / V100). Launch your usual GRPO script with
torchrun --nproc_per_node 2 train.py(oraccelerate launch) and setddp_find_unused_parameters = FalseinGRPOConfig. I checked Qwen2.5-0.5B-Instruct LoRA GRPO on 2 ranks with the latest release, and both ranks end with identical weights. Guide: https://unsloth.ai/docs/basics/multi-gpu-training-with-unsloth/ddpTo update:
uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir(if it's not in the current release yet it'll be in the next one). Reopen if it still happens.