Efficient Full-Parameter Reinforcement Learning Training for Large Language Models
This article shares practical engineering experience for running full-parameter reinforcement learning on large language models. It explains why full-parameter RL is harder than it looks, how to split training into four independently scalable pipelines, how to combine parallelism strategies across a limited GPU cluster, how to estimate the memory budget, and how to keep training stable so rewards improve instead of entropy collapsing. It also breaks down where per-task cost savings come from and closes with a deployment checklist covering resources, data, training, observability, and cost measurement.
1. Background: Why Full-Parameter RL Is Harder Than Expected
In the three-stage paradigm of pretraining, supervised fine-tuning, and reinforcement learning, the RL stage is responsible for alignment and capability elicitation. Unlike approaches that update only a small set of adapter layers, full-parameter reinforcement learning brings all weights of the language model into the gradient update scope, including the multi-token prediction auxiliary layers used to accelerate decoding. At the same time, the vision encoder and the sparse attention indexer are usually frozen to keep multimodal input representations stable and to avoid breaking the long-context retrieval structure.
The difficulties concentrate in three areas. First, memory: parameters, gradients, optimizer states, and activations add up to four separate overheads. Second, throughput: RL alternates through sampling, scoring, and updating stages, so compute utilization is naturally lower than in pure pretraining. Third, stability: overly large policy update steps can easily cause output degradation and entropy collapse.
2. Overall Architecture: Splitting Training into Four Independently Scalable Pipelines
A workable setup typically consists of four chains:
- Inference sampling chain: high-concurrency generation of candidate responses, emphasizing batching and continuous batch scheduling;
- Reward and verification chain: rule-based checks, unit test execution, and model-based review, running in parallel as three scoring methods;
- Training update chain: full-parameter backpropagation and optimizer steps;
- Data and checkpoint chain: experience buffers, sample filtering, and periodic persistence.
The four chains have completely different resource profiles, and co-locating them leads to contention. It is therefore advisable to use a container platform for resource pool isolation, a message queue to decouple sampling from training, object storage to hold checkpoints and dataset versions, and a logging service with monitoring and alerting to track throughput, memory watermarks, and reward curves.
3. Compute and Parallelism Strategy: Where the Feasibility of 64 Accelerators in Under Five Days Comes From
To complete one round of full-parameter RL within days on tens of high-end accelerators, what matters is not single-card peak performance but whether the combination of parallel splits matches the model structure.
- Tensor parallelism: splits individual layer matrix multiplications, communicates frequently, and should be confined to the high-bandwidth domain within a single machine;
- Pipeline parallelism: splits by layer and requires careful tuning of the micro-batch count to reduce bubble overhead;
- Data parallelism with a sharded optimizer: shards optimizer states by rank, trading memory for communication;
- Sequence and context parallelism: essential for long-text scenarios, easing activation growth.
Illustrative configuration logic (pseudocode, expressing split intent only):
# Parallelism must satisfy: tp * pp * dp == total number of GPUsparallel = {"tensor_parallel": 8, # confined to a single machine to reduce cross-node communication"pipeline_parallel": 4, # paired with micro-batch count to reduce bubbles"data_parallel": 2, # carries sample throughput"sequence_parallel": True # activation splitting for long sequences}# Frozen modules take no part in gradient or optimizer state allocationfrozen = ["vision_tower", "sparse_attn_indexer"]
Rules of thumb: setting the micro-batch count to 2–3 times the number of pipeline stages pushes bubble overhead into a low range; when cross-machine bandwidth is insufficient, increase pipeline and data parallelism first rather than blindly raising tensor parallelism.
4. Memory Budget: A Method for Quantifying the Four Overheads
Taking a sparse structure with 321B total parameters and roughly 17.4B activated per token as a reference, the budget can be estimated as follows (the numbers illustrate the method and are not measured conclusions):
- Parameters: about 2 bytes per parameter in half precision;
- Gradients: the same order of magnitude as parameters;
- Optimizer states: typically several times the parameter count under mixed-precision training;
- Activations: strongly dependent on batch size, sequence length, and parallel splits.
Per-GPU memory ≈ (parameters + gradients + optimizer states) / shard count + activations / sequence parallelism + communication buffers
Three reduction techniques have been repeatedly proven effective: sharding optimizer states, activation recomputation (trading compute for memory), and freezing the indexer and vision tower so their optimizer states and gradients are eliminated entirely.
5. Training Stability: Making Rewards Rise Instead of Entropy Collapsing
- Decouple sampling from updating while staying “near-policy”: when the version gap between sampling weights and training weights grows too large, the importance sampling ratio goes out of control, so a maximum version lag must be set;
- Clipping and penalty terms: clip the policy ratio above and below, and add a KL penalty to constrain deviation from the reference model;
- Advantage estimation: group-wise normalization significantly reduces variance and dampens jitter caused by scoring noise;
- Entropy monitoring: a rapid entropy drop is an early sign of degradation; roll back to a checkpoint and lower the learning rate;
- Prefer verifiable scoring: tasks that can be judged by rules or test cases carry the lowest noise and are best suited as the main early training signal.
ratio = exp(logp_new - logp_old)ratio = clamp(ratio, 1 - eps_low, 1 + eps_high)loss = -min(ratio * adv, clamp(ratio, 1-eps_low, 1+eps_high) * adv) + beta * kl_penalty
6. Cost Perspective: Where a 30x Reduction in Per-Task Cost Comes From
Per-task cost can be broken down into “tokens consumed per task × compute price per token + failed-retry overhead”. The reduction comes mainly from four engineering gains: sparse activation makes per-token compute far lower than in a dense model of the same size; high-throughput sampling keeps expensive accelerator idle time to a minimum; reusing one sample across multiple tasks reduces repeated generation; and higher success rates directly cut retries. Note that the specific multiplier is strongly tied to hardware model, cluster interconnect, and task distribution, so engineering teams should establish their own baseline measurement methodology rather than quoting external numbers directly.
7. Deployment Checklist
- Resources: do the GPU count, intra-machine bandwidth, and cross-machine bandwidth match the parallelism strategy;
- Data: task difficulty tiers, verifiable ratio, deduplication and contamination filtering;
- Training: gradient clipping, learning rate warmup, checkpoint cadence, and checkpoint-resume drills;
- Observability: a six-panel dashboard covering throughput, memory watermark, reward mean and variance, entropy, and truncation rate;
- Cost: regression comparisons using “cost per thousand tasks” as a unified metric.
For this kind of work on Baidu AI Cloud, the container platform can host heterogeneous resource pools, object storage can manage checkpoints, a message queue can decouple the sampling chain, and a logging service with monitoring and alerting can build the observability described above, so that limited accelerator time is genuinely spent on effective policy updates.
