PAIR: Prefix-Aware Internal Reward Model for Multi-Turn Agent Optimization

Wonjoong Kim, Yeonjun In, Sangwu Park, Dongha Lee, Chanyoung Park

TL;DR

Training multi-turn LLM agents using reinforcement learning is heavily bottlenecked by sparse rewards and the high computational cost of step-level evaluation. This paper introduces PAIR (Prefix-Aware Internal Reward), a lightweight method that extracts dense, step-level rewards directly from an LLM's own hidden states and attention patterns. By decoupling internal consistency from objective correctness, PAIR provides highly accurate reward signals at a fraction of the cost of traditional external judges or rollout-based methods.

What Problem Does This Paper Address?

When large language models (LLMs) tackle complex, multi-step tasks—like executing a sequence of API calls or using external tools—they often rely on reinforcement learning algorithms like Group Relative Policy Optimization (GRPO). However, GRPO typically operates on a sparse outcome reward: a single success/failure signal at the very end of the trajectory. This makes "credit assignment" incredibly difficult; the model doesn't know which specific intermediate step caused a failure or ensured a success.

Existing solutions to provide denser, step-by-step rewards are highly problematic:

  • Tree-based rollouts require running the model to completion multiple times at every single step, which is computationally ruinous.
  • LLM-as-a-Judge methods call external models (like GPT-4) at every turn, introducing massive API costs and latency.
  • Intrinsic rewards often require knowing the ground-truth answer at every intermediate step, which isn't practical during runtime exploration.

Can we instead look inside the model to see if it knows it made a mistake? While prior work shows internal hidden states can predict correctness, this paper reveals that these probes fail in multi-turn settings due to prefix contamination. If an agent makes an error in step 1, its hidden states in step 2 will track coherence with the mistake (belief-consistency) rather than objective truth (grounded correctness).

Methods

To solve the prefix contamination trap, the authors propose PAIR (Prefix-Aware Internal Reward). PAIR is a two-stage, training-free-at-inference architecture that utilizes the agent's own internal representations:

  1. Stage 1: Belief-Consistency Estimator: A frozen logistic regression probe maps the last-token hidden state to a belief-consistency score ($s_{bc}$). This captures how well the current step aligns with the generated history.
  2. Stage 2: Attention-Based Correction: A second lightweight logistic regression head takes structural attention features (such as peak magnitude, spread, and attention ratios directed at the prefix vs. self tokens) along with $s_{bc}$ to predict a final grounded correctness score ($s_{final}$).
Table 1: Comparison between reward mechanisms for GRPO based on their functional requirements.

To make this score effective for GRPO training, the authors also introduce a Momentum-Based Reward Integration scheme. Instead of using the absolute PAIR score, it contrasts the current step's score against the running mean of the trajectory, preserving the variance required for stable RL advantage estimation.

Datasets

The authors evaluated PAIR on three distinct multi-step benchmarks:

  • GTA (General Tool Agents): A benchmark containing 229 samples where agents compose real-world APIs across 2–8 turns.
  • ToolBench: A massive dataset covering over 16,000 RapidAPI tools, from which the authors stratified a 1,000-sample subset.
  • HotpotQA: A multi-hop reasoning dataset used exclusively to evaluate cross-domain transfer performance without any additional fine-tuning.

Key Insights and Ideas

  • The Asymmetry of Internal Signals: Hidden states and attention patterns behave completely differently under prefix contamination. As shown in Figure 1, hidden-state probes degrade severely when evaluating contaminated prefixes because they optimize for narrative fluency over objective truth. Attention features, conversely, capture structural routing behavior and remain highly robust.
Figure 1: Comparison of AUROC degradation between hid- den state probes and attention probes under clean vs. contam- inated prefix settings.
  • Belief-Consistency vs. Grounded Correctness: In an adversarial diagnostic setup where the two concepts were deliberately placed in opposition (Figure 2), hidden-state probes scored below chance. They actively reward the model for confidently doubling down on an earlier mistake and penalize "repair turns" that attempt to correct the trajectory.
Figure 2: Comparison of hidden state and attention probes on the adversarial diagnostic set, where belief-consistency and grounded correctness are deliberately placed opposite.
  • Architectural Decoupling Wins: Simply concatenating hidden states and attention features fails because the misleading hidden-state signals dominate. PAIR succeeds by treating the hidden-state probe as a baseline and letting the attention head learn an additive correction in logit space.

Key Results

  • Superior Correctness Prediction: PAIR achieved the highest AUROC for step-level correctness prediction across both GTA (0.9217) and ToolBench (0.8129), outperforming all individual internal probes and unsupervised baselines.
Table 2: Step-level correctness prediction performance on GTA and ToolBench. Each evaluation point is a single (prefix, evaluation turn) pair labelled correct or incorrect, not a trajectory-level outcome. AUROC (higher is better) and ECE (lower is better) are reported for each method. All AUROC and ECE values are reported as mean over 3 random seeds (42, 43, 44).
  • Downstream RL Success: When deployed as a dense reward source for GRPO training, PAIR outperformed all baselines—including the computationally expensive LLM-as-a-judge approach—achieving a final success rate of 24.89% on GTA and 44.98% on ToolBench.
  • Negligible Computational Overhead: Because PAIR reuses the activations already computed during the model's forward pass, it takes just ~0.2 ms per step on a single A6000 GPU. This makes it roughly 2,500× faster than calling an external LLM judge.
  • Impressive Cross-Domain Transfer: When trained on GTA and evaluated directly on HotpotQA, PAIR ranked first among all 16 compared methods, proving that its correction mechanism hooks into fundamental transformer mechanics rather than dataset-specific text features.

Limitations and Future Work

While PAIR marks a major step forward for efficient RL training, the authors note a few limitations:

  • Backbone Scope: The experiments were conducted using a single model family (Qwen-2.5-7B-Instruct). It remains to be seen how the belief-consistency bias scales with model size or changes with alternative attention mechanisms (like Grouped-Query Attention).
  • Binary Labels: The offline training corpus currently uses binary correctness labels. Extending PAIR to handle richer, partial-credit feedback structures or human preference rankings is a promising avenue for future research.

Summary updated

BibTeX
@inproceedings{kim2026pair,
  author = {Wonjoong Kim and Yeonjun In and Sangwu Park and Dongha Lee and Chanyoung Park},
  title = {{PAIR: Prefix-Aware Internal Reward Model for Multi-Turn Agent Optimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=0Ut88MX4Oj},
}
Figure