Optimizing Reward Model Scoring for Faster RLHF

Venkata Naga Sai Vishnu Rohit Pulipaka, Anish Katta, Deva Rohit Reddy Peddireddy· July 23, 2026 View original

Summary

A systems study compared C++ and PyTorch inference runtimes for reward models in RLHF pipelines, finding that a native C++ engine on ONNX Runtime significantly outperforms PyTorch on CPU, while batching strategy is crucial for overall speedup.

This systems study investigates the performance bottlenecks in Reinforcement Learning from Human Feedback (RLHF) pipelines, specifically focusing on the speed of reward model scoring. Slow scoring directly impedes policy updates, yet many setups default to PyTorch eager mode or `torch.compile` without thorough performance checks. The research highlights that while scoring itself is a small part of the RLHF step, it competes with rollout generation for shared CPU and GPU resources, meaning faster scoring frees up capacity for generation. The researchers developed a native C++ inference engine built on ONNX Runtime, which was first validated for correctness against a PyTorch reference. Benchmarking against PyTorch eager mode, `torch.compile`, and FastAPI revealed significant performance gains on CPU, where the C++ engine consistently outperformed all baselines. On GPU, `torch.compile` showed an advantage, though the C++ engine still beat PyTorch eager and FastAPI. The study concluded that the speedup primarily stemmed from ONNX Runtime, not C++ as a language, and emphasized that batching strategy had a more substantial impact on overall performance than the choice of language or runtime.

Why it matters

AI engineers and researchers can significantly accelerate their RLHF training loops by optimizing reward model inference, leading to faster model iteration and deployment.

How to implement this in your domain

  1. 1Benchmark your current reward model inference runtime on both CPU and GPU.
  2. 2Consider migrating reward models to a native C++ inference engine with ONNX Runtime for CPU-bound scenarios.
  3. 3Experiment with different batching strategies for reward model scoring to maximize throughput.
  4. 4Evaluate `torch.compile` for GPU-bound reward model inference to potentially gain performance.

Who benefits

AI ResearchSoftware DevelopmentGamingRobotics

Key takeaways

  • Reward model scoring speed is a critical bottleneck in RLHF pipelines.
  • A native C++ engine with ONNX Runtime significantly speeds up CPU inference.
  • `torch.compile` can be faster on GPU for reward model inference.
  • Batching strategy is more impactful than language or runtime choice for overall speed.

Original post by Venkata Naga Sai Vishnu Rohit Pulipaka, Anish Katta, Deva Rohit Reddy Peddireddy

"arXiv:2607.19712v1 Announce Type: new Abstract: In RLHF pipelines, reward scoring blocks policy updates. Slow scoring bottlenecks the entire loop, since no update runs until every rollout gets a score. And yet most setups just default to PyTorch eager mode or torch.compile, no on…"

View on X

Originally posted by Venkata Naga Sai Vishnu Rohit Pulipaka, Anish Katta, Deva Rohit Reddy Peddireddy on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses