Overview
rLLM uses Ray and VERL for distributed training, enabling you to scale experiments across multiple GPUs and nodes. This guide covers configuration, resource allocation, and best practices for distributed training.Training Architecture
rLLM’s distributed training separates computation into specialized workers:- Actor: Runs policy model for generation
- Critic: Runs value model (for actor-critic methods)
- Rollout Workers: Execute environment interactions in parallel
- Trainer: Performs gradient updates
Basic Configuration
Single-GPU Training
Default configuration for single-GPU setup:cookbooks/math/train.py; for distributed launch see cookbooks/math/train_verl.sh.
Configuration Files
rLLM uses Hydra for configuration management. The default config is at:rllm/trainer/config/agent_ppo_trainer.yaml:1.
Scaling Configuration
1
Set batch sizes
Configure batch sizes for throughput:Or via command line:
2
Configure parallelism
Set the number of parallel tasks:Higher values increase throughput but require more memory.
3
Set GPU allocation
Configure GPU resources in the base VERL config:
4
Enable multi-node training
For multi-node setups, configure Ray cluster:Then run training as usual. Ray will distribute workers automatically.
Configuration Overrides
You can override config values in multiple ways:Python Dictionary
Command Line Arguments
Config List
Ray Resource Management
Monitoring Resources
View Ray dashboard:Resource Allocation
Control GPU placement:Memory Management
For large models, enable offloading:Performance Optimization
Rollout Parallelism
Increase parallel tasks for faster data collection:n_parallel_tasks ≈ batch_size / avg_trajectory_length
Async Rollouts
Enable asynchronous rollout mode:Gradient Accumulation
For large batch sizes with limited memory:ppo_mini_batch_size / ppo_micro_batch_size
Model Parallelism
For models that don’t fit on a single GPU:Common Patterns
Multi-GPU Training (Single Node)
Large Model Training (70B+)
High-Throughput Training
Troubleshooting
Out of Memory (OOM)
- Reduce
ppo_micro_batch_size - Enable gradient checkpointing:
enable_gradient_checkpointing: true - Enable offloading:
param_offload: true - Reduce
n_parallel_tasks - Use tensor parallelism:
tensor_model_parallel_size: 2
Slow Training
- Increase
n_parallel_tasksfor better GPU utilization - Enable async rollouts:
mode: async - Increase
ppo_micro_batch_sizeif you have memory - Check Ray dashboard for bottlenecks
- Disable offloading if not needed
Ray Connection Issues
Distributed Training Not Working
- Ensure all nodes can reach each other
- Check firewall settings (Ray uses ports 6379, 8265, 10001)
- Verify same Ray version on all nodes
- Check Ray dashboard for node status
The
from_dict method in your environment and agent classes must be properly implemented for distributed training to work. Ray serializes and deserializes these objects across workers.Best Practices
- Start small: Test on single GPU before scaling
- Monitor metrics: Use Ray dashboard and TensorBoard
- Profile first: Identify bottlenecks before optimizing
- Batch size scaling: Increase batch size with number of GPUs
- Checkpoint frequently: Distributed training can be unstable
- Test serialization: Ensure
from_dictworks correctly
Next Steps
- LoRA fine-tuning for parameter-efficient training
- Multi-agent workflows for complex scenarios
- See VERL documentation for advanced distributed training options

