Papers
arxiv:2607.19712

How Fast Can Reward Models Score? A Systems Study of C++ and PyTorch Inference Runtimes for RLHF

Published on Jul 22
· Submitted by
Vishnu Pulipaka
on Jul 29
Authors:
,
,

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 one checks if that's actually fastest. Scoring itself is small. Rollout generation eats far more of a typical RLHF step. But scoring and generation fight over the same CPU and GPU resources, so a faster scoring engine doesn't shrink step time on its own. It mainly frees up capacity generation can use instead. We built a native C++ inference engine on ONNX Runtime. First step: confirm correctness. Output matched the PyTorch reference to 5.7 x 10^-6 on CPU and 4.2 x 10^-3 on GPU, close enough to trust. Then we tested it against PyTorch eager mode, torch.compile, and FastAPI, on both CPU and GPU. CPU was decisive. Our engine beat every baseline, confidence intervals didn't even overlap. GPU gave a different view: we beat PyTorch and FastAPI, but torch.compile came out ahead. Further testing traced the speedup to ONNX Runtime itself, not C++ as a language. And batching strategy mattered more than either the language or the runtime choice, more than we expected. The results are from repeated, independent runs, since single runs just aren't reliable enough to trust.

Community

Paper submitter

We’re excited to share our paper on reward model serving for RLHF: How Fast Can Reward Models Score? A Systems Study of C++ and PyTorch Inference Runtimes for RLHF. We built and benchmarked a native C++ ONNX Runtime engine against PyTorch eager mode, torch.compile, and FastAPI on CPU and GPU, with repeated independent launches for statistical rigor. The paper shows that on CPU the C++/ONNX Runtime path clearly outperforms PyTorch baselines, while on GPU torch.compile is faster at both median and tail latency. We also found that batching strategy matters more than language wrapper choice: naive padding hurts throughput badly, while length-aware bucketing helps only on GPU.

Sign up or log in to comment

Get this paper in your agent:

hf papers read 2607.19712
Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash

Models citing this paper 0

No model linking this paper

Cite arxiv.org/abs/2607.19712 in a model README.md to link it from this page.

Datasets citing this paper 0

No dataset linking this paper

Cite arxiv.org/abs/2607.19712 in a dataset README.md to link it from this page.

Spaces citing this paper 0

No Space linking this paper

Cite arxiv.org/abs/2607.19712 in a Space README.md to link it from this page.

Collections including this paper 1