Manuscript Offprint

arXiv:2610.12828

TreeHCA: Hindsight-Guided Exploration and Credit Assignment for Multi-Turn LLM Agents

Debajoy Mukherjee, Jeremy Carleton, Sushil Vemuri, Srinivas Shakkottai, Dileep Kalathil

ABSTRACT

Outcome-supervised group-relative policy optimization (GRPO) gives every token in an LLM agent's trajectory the same advantage, leaving useful and unhelpful decisions undifferentiated. Hindsight credit assignment (HCA) can refine this feedback, but its estimates depend on trajectories containing informative alternatives at consequential histories. We introduce TREEHCA, which couples sampling via hindsight ratios to generate these alternatives with hindsight credit assignment to evaluate their contribution. We use changes in reference-answer likelihood to revisit intermediate histories and select alternative continuations, forming a tree of reasoning and tool interactions. This exploration changes the distribution of sampled continuations. We derive the corresponding inverse-hindsight importance correction, including an exact finite-pool identity, and use its structure in a normalized tree backup that propagates terminal outcomes into turn-level advantages. This common hindsight structure is TREEHCA's central design principle, linking informative exploration to hindsight-guided credit assignment. Across seven question-answering benchmarks and three Qwen backbones, TREEHCA outperforms every baseline in aggregate exact match, validating our paired design for multi-turn LLM training. Our code is available at github.com/TheBlackCat22/TreeHCA.

(a) Hindsight-guided exploration

Figure

(b) Hindsight-guided credit assignment

Figure

Figure 1: TREEHCA pairs exploration with credit assignment. (a) A drop in hindsight score identifies a parent history to revisit. The sampled alternative continues alongside the retained original path, here illustrated with successful and unsuccessful outcomes. (b) Outcome signals propagate backward using normalized inverse-score weights to construct turn-level advantages.

1 INTRODUCTION

An LLM agent solves a multi-turn task through reasoning steps and tool calls. With terminal verification, success feedback arrives only after a rollout is completed. Outcome-supervised group-relative policy optimization (GRPO) converts this feedback into a trajectory advantage and assigns it to every generated token (Shao et al., 2024). A successful trajectory can reinforce unhelpful turns, while a failed one can penalize useful decisions. Therefore, a central challenge in providing feedback for training multi-turn LLM agents is to score intermediate decisions by their contribution to success.

How should we assign credit to intermediate decisions? Hindsight credit assignment (HCA) relates an action’s probability to the subsequent outcome (Harutyunyan et al., 2019). An action that appears

*Correspondence to: Debajoy Mukherjee debajoym98@tamu.edu.

disproportionately often in successful continuations receives a larger success-conditioned hindsight ratio. This ratio has an exact change-of-measure interpretation, which connects outcome-conditioned observations to the action value under the original policy. In a language agent, the space of interaction histories is large, so the usefulness of this construction depends on obtaining informative alternatives from comparable histories. GiGPO forms groups of comparable states to obtain step-level relative advantages, and HCAPO uses outcome-conditioned LLM scores to refine trajectory feedback (Feng et al., 2025; Tan et al., 2026). These methods make intermediate credit available from policy-generated chains. However, their estimates critically depend on these chains containing informative alternatives. In practice, such alternatives may be sparse at consequential histories, leaving the sampled trajectories insufficiently informative for turn-level credit assignment.

It is therefore crucially important to gather this information by revisiting histories from which alternative decisions can change the outcome. When an observed turn reduces the likelihood of success, we need to return to its parent and sample new continuations while retaining the original path. This produces comparisons under a shared prefix. Entropy-guided exploration allocates sampling effort to uncertain decisions (Dong et al., 2026; Zong et al., 2026). However, uncertainty alone does not reveal a decision's contribution to success. We instead use hindsight to guide exploration toward successful outcomes. Hindsight scores identify turns worth revisiting and promising alternatives to sample from their parent histories. We therefore introduce hindsight-guided sampling as an exploration strategy for obtaining the information needed to evaluate intermediate decisions.

We then make a complementary connection that is key to this paper: how we gather evidence through exploration determines how we must weight it when estimating turn-level advantages. By selecting continuations through hindsight, we change their distribution in the rollout tree. We must therefore account for that selection when estimating advantages for the original rollout policy. For a hindsight-tilted proposal, we derive the inverse hindsight ratio as the required importance weight. Our central insight is this correspondence: the hindsight ratio guides exploration toward informative continuations, and its inverse accounts for that sampling preference when estimating credit.

We develop this correspondence in TREEHCA. Its core idea has two parts. First, we use hindsight-guided sampling to generate informative trajectories. Changes in the model's likelihood of the reference answer identify turns to revisit and guide our selection of alternative continuations. Second, we use credit assignment to samples to accord advantages to intermediate turns according to the outcomes of their continuations. We propagate group-normalized terminal rewards through the tree using inverse hindsight weights to counterbalance the selection preference. The resulting turn-level signals reflect the successful and unsuccessful continuations supported by each intermediate decision. The key to TREEHCA is that these operations follow the same hindsight change of measure: the score that directs exploration also determines the inverse correction used to compute credit. This pairing is the central design principle behind the gains evaluated in Section 6. See Figure 1.

We make three contributions. (1) Hindsight-guided exploration. We formulate an exploration rule that uses turn-level hindsight scores to select histories and alternative continuations, connecting the exact hindsight ratio to candidate action values. (2) Hindsight-guided credit assignment. We derive the importance correction for hindsight-guided selection, including an exact finite-pool identity, and use its inverse-score structure to construct turn-level advantages through a normalized tree backup. (3) Experimental validation of the paired construction. We evaluate TREEHCA on seven question-answering benchmarks with Qwen2.5-3B-Instruct, Qwen3-4B, and Qwen3-8B. Across the reported model and task settings, TREEHCA outperforms all compared methods in aggregate exact match (EM). The paired design also achieves the strongest EM and F1 in the component study.

References (54)

  • TreeGRPO: Tree-Advantage GRPO for Online RL Post-Training of Diffusion Models
  • Toward Generalized Web Agent Training: A Deep Dive into Entropy-Balanced Reinforcement Learning
  • Group-in-Group Policy Optimization for LLM Agent Training
  • Hindsight credit assignment
  • Constructing A Multi-hop QA Dataset for Comprehensive Evaluation of Reasoning Steps
  • Tree Search for LLM Agent Reinforcement Learning
  • Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning
  • TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension
  • Natural questions: A benchmark for question answering research (opens the publisher in a new tab)
  • When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memories
  • Measuring and Narrowing the Compositionality Gap in Language Models
  • DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
  • HybridFlow: A Flexible and Efficient RLHF Framework
  • ZeroSearch: Incentivize the Search Capability of LLMs without Searching, 2025 (opens arXiv in a new tab)
  • Hindsight Credit Assignment for Long-Horizon LLM Agents, 2026 (opens arXiv in a new tab)
  • MuSiQue: Multihop questions via single-hop question composition (opens the publisher in a new tab)
  • Information Gain-based Policy Optimization: A Simple and Effective Approach for Multi-Turn Search Agents
  • Qwen3 Technical Report
  • HotpotQA: A Dataset for Diverse, Explainable Multi-Hop Question Answering
  • ReAct: Synergizing Reasoning and Acting in Language Models
  • A Framework for Training Large Language Models for Code Generation via Proximal Policy Optimization
  • Information Gain-based Rollout Policy Optimization: An Adaptive Tree-Structured Rollout Approach for Multi-Turn LLM Agents, 2026 (opens arXiv in a new tab)
  • Group Sequence Policy Optimization
  • StepSearch: Igniting LLMs Search Ability via Step-Wise Proximal Policy Optimization
  • AT $^{2}$PO: Agentic Turn-based Policy Optimization via Tree Search
  • We organize the relevant methods by how they collect alternatives and translate outcomes into learning signals
  • Bayes' rule relates this posterior-to-policy ratio to the action's effect on future outcomes
  • It matches environment-state keys, using sequence similarity for search-QA histories
  • Its process-supervised formulation instead accumulates intermediate reward-model scores
  • It combines length-normalized answer likelihood with improvement over the parent and exponentially transforms this score into expansion probabilities
  • conditional weighting recovers the pool mean, and averaging over candidate generation recovers the base-policy expectation
  • GSPO uses a length-normalized sequence ratio, while GSPO-token allows token-specific advantages through a stop-gradient construction (Zheng et al., 2025a)
  • The optimizer and learning rate govern parameter updates, while clipping controls the likelihood-ratio range in the policy objective
  • The experiments with the Qwen2.5-3B-Instruct model use the codebase for IGRPO (Zhang et al., 2026)
  • ><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td colspan=
  • The corresponding validation scores recorded for the six rows are 51.56, 50.00, 49.41, 48.05, 47.66, and 39.26, respectively
  • The states of our process are complete interaction histories
  • For a binary terminal reward, only $r = 1$ contributes
  • The corresponding ratio is
  • A fresh policy continuation supplies this conditional estimate of the selected child's value
  • The reward-value integral can still satisfy coverage when its integrand vanishes on those children
  • The same calculation holds conditionally for a candidate pool containing these two children
  • Exchangeability gives the marginal density of the selected child as
  • Hence $\widehat{\mu}_m \to \mathbb{E}_p[f]$ almost surely
  • A single-child node propagates its child's signal unchanged
  • The implemented learning rule combines proxy scores, a finite adaptive tree, group-relative leaf normalization, and a clipped GSPO objective
  • Rather than first completing a fixed set of initial trajectories and branching afterward, we monitor the hindsight ratio during rollout generation
  • Dataset annotations supply reference answers for training-time hindsight scoring and evaluation
  • First, I should confirm who Juwan Howard is
  • Juwan Howard
  • Juwan Howard NBA Finals
  • So he was on the Heat team that won the 2012 NBA Finals
  • 2012 NBA Finals
  • >*** Shared prefix omitted; see Appendix table 10 ***</td></tr><tr><td colspan=