RAPID: An Efficient Reinforcement Learning Algorithm for Small Language Models

Lianghuan Huang, Sagnik Anupam, Insup Lee, Shuo Li, Osbert Bastani

TL;DR

Reinforcement learning (RL) is a powerful tool for boosting the reasoning skills of Small Language Models (SLMs), but the training process is notoriously slow. This paper introduces RAPID, an algorithm that slashes training times by 11% to 34% by decoupling the batch sizes used for inference and backpropagation. By combining massive-batch generation with a novel importance-weighted off-policy gradient update, RAPID achieves state-of-the-art efficiency without sacrificing accuracy.

What Problem Does This Paper Address?

Fine-tuning SLMs on complex reasoning tasks (like math and coding) via knowledge distillation from larger models often falls short because the student model's output distribution differs significantly from the teacher's. On-policy RL offers a better alternative by letting the model learn from its own successes and failures.

However, standard RL training is painfully slow. The core bottleneck lies in hardware utilization: generation (inference) is highly memory-efficient and thrives on massive batches, while backpropagation (gradient updates) is memory-heavy and requires much smaller batches. Alternating between the two using a single compromise batch size, or splitting GPUs between tasks, leaves significant hardware performance on the table.

Methods

RAPID (Reweighted Avantage for Preemptive Inference of Data) solves this mismatch by letting all available GPUs alternate between two highly optimized phases:

  1. Preemptive Large-Batch Inference: The model generates a massive batch of data using high-throughput inference servers (like vLLM) to maximize GPU memory utilization.
  2. Mini-Batch Off-Policy Updates: The algorithm takes multiple gradient steps on this data using small, memory-efficient mini-batches.

Because the policy changes during these multiple gradient steps, the sampled data quickly becomes "off-policy." To correct for this bias, the authors introduce Importance Weighted Group Relative Policy Gradient (IW-GRPG). This method adapts group advantage estimation—which compares multiple completions for a single prompt to calculate rewards—by adding an importance-weighting correction factor and standard clipping to prevent variance explosion.

Datasets

The authors evaluated RAPID across three distinct reasoning benchmarks:

  • MBPP+: For Python code generation.
  • MATH: A dataset of challenging competition-level mathematics problems.
  • MiniF2F: A formal theorem-proving benchmark.

No new datasets were introduced; the focus remains on accelerating training on these standard baselines.

Key Insights and Ideas

  • Decoupling is Key: Inference and backpropagation have fundamentally different memory profiles. Forcing them to share a batch size is a massive bottleneck. Decoupling them allows inference engines to run at maximum throughput.
  • PPO's Limitations: While PPO is the standard choice for off-policy corrections via KL-divergence regularization, the authors found it struggles when taking a large number of off-policy gradient steps. Importance weighting directly on the policy gradient proves much more robust.
  • The Verbosity Trap ($H$ Tuning): Increasing the batch size ratio $H$ (the number of off-policy steps per inference batch) generally speeds up training. However, if $H$ is too high, the distribution shift can cause the model to generate excessively long, verbose answers, which paradoxically slows inference back down.

Key Results

RAPID was tested against competitive baselines like GRPO, SFT, and Direct Alignment Policy Optimization (DAPO) using model families like Qwen2.5, Llama 3.2, and Gemma 3.

  • Speedups: RAPID reduced total training time by 34% on MBPP+, 32% on MiniF2F, and 11% on MATH compared to the strongest baselines.
  • Accuracy Gains: Not only is it faster, but RAPID often matches or beats baseline accuracy. For instance, on MBPP+ using Qwen2.5-0.5B, RAPID ($H=4$) achieved a Pass@8 score of 47.4%, significantly outperforming standard GRPO at 37.1%.
Figure 1: RAPID can reduce running time by 89% compared to a na¨ıve GRPO that uses the same inference and training batch size with separate GPUs for inference and backpropagation.
Accuracy and runtime comparison on Qwen2.5-0.5B

Limitations and Future Work

  • Hyperparameter Sensitivity: The batch size ratio $H$ is a sensitive parameter that requires careful tuning per dataset to balance sample staleness against computational speedups.
  • Scale Constraints: The study primarily focuses on Small Language Models (SLMs) up to 1.5B parameters in resource-constrained environments. While the authors hypothesize that these benefits will translate to larger models, extensive testing on LLMs (e.g., 7B+ parameters) remains future work.

Summary updated

BibTeX
@misc{huang2025rapid,
  author = {Lianghuan Huang and Sagnik Anupam and Insup Lee and Shuo Li and Osbert Bastani},
  title = {{RAPID: An Efficient Reinforcement Learning Algorithm for Small Language Models}},
  year = {2025},
  eprint = {2510.03515},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.03515},
}
Figure