Manuscript Offprint

arXiv:2610.19103

Contextual Credit Policy Optimization

Huiwen Han, Ziyao Zeng, Zihao Zhu, Sisong Bei, Hao Wang, Hongyu Xu, Yan Han, Degui Zhi, Zhiwen Fan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Huiwen Han 1,2,†^{1,2,\dagger}, Ziyao Zeng 3^{3}, Zihao Zhu 2^{2}, Sisong Bei 4^{4}, Hao Wang 2^{2}, Hongyu Xu 5^{5}, Yan Han 6^{6}, Degui Zhi 3^{3}, Zhiwen Fan 2^{2}

1^{1}Stanford University, 2^{2}Texas A&M University, 3^{3}Yale University, 4^{4}Amazon, 5^{5}Meta AI, 6^{6}Microsoft †^{\dagger}Project lead

Group-based reinforcement learning enables large language model agents to learn from sparse outcome rewards in long-horizon tasks. Recent methods derive step-level credit by comparing observation-matched experiences across trajectories. However, identical observations can occur in different contexts, and matched peers are not equally informative for a given decision. Moreover, favorable terminal outcomes can obscure redundant actions or detours within successful trajectories. To address these two challenges, we propose Contextual Credit Policy Optimization (CCPO). For the first, CCPO weights observation-matched peers from other trajectories by contextual similarity, computed from frozen LLM representations and accumulated trajectory statistics, allowing peers from similar contexts to contribute more to a step's baseline. For the second, CCPO pairs historical credit, which compares the realized return against the weighted peer baseline, with future credit, which measures the change in contextual outcome value over a short realized continuation. A step is thus credited for the progress it makes, not only for its trajectory's eventual outcome. Both credits are computed in hindsight from rollouts already collected for training, enabling CCPO to address these challenges without an auxiliary value critic. Across two Qwen2.5-Instruct backbones (1.5B and 7B), CCPO achieves up to 97.4% success on ALFWorld and 79.4% on WebShop and outperforms GRPO by up to 21.6 and 18.5 points. Ablations show that contextual weighting outperforms uniform weighting, and that historical and future credit serve as complementary learning signals.

Affiliation Note: Huiwen Han was a visiting student at Texas A&M University during this work.

Project Page: agent-ccpo.github.io

Code: github.com/phai-lab/CCPO

PHAI

01 Match peers

Figure

02 Weight by context

03 Assign credit

04 Update policy

Figure 1 Overview of CCPO. CCPO combines contextually weighted peer comparisons and short-horizon future progress for critic-free step-level credit assignment.

1 Introduction

Large language model (LLM) agents increasingly undertake long-horizon tasks through sustained environment interaction (Wang et al., 2024; Zhang et al., 2026). Benchmarks such as WebArena (Zhou et al., 2024a) and SWE-bench (Jimenez et al., 2024) require information gathering, coordinated actions, and adaptation to feedback. Reinforcement learning (RL) (Sutton and Barto, 2018) provides a post-training framework that optimizes policies using rewards from interaction trajectories. Recent applications span open-web research, web navigation, and multi-step software engineering (Zheng et al., 2025b; Qi et al., 2025; Luo et al., 2025). However, feedback often arrives only after many decisions.

Learning from such delayed feedback depends on how it is translated into policy updates. PPO-based actor-critic methods use learned value estimates to guide optimization, at the cost of training an additional value model (Schulman et al., 2017). Alternatively, group-based methods such as GRPO (Shao et al., 2024) estimate relative advantages from multiple sampled outcomes without a separately learned value critic. When applied at the trajectory level, however, a single advantage is shared across all actions in a rollout. Such comparisons differentiate outcomes across trajectories but provide limited information about the contributions of individual decisions, especially when rewards are sparse and delayed (Zhang et al., 2026). To enable fine-grained policy updates, recent methods extend this approach to construct step-level advantage estimates: GiGPO (Feng et al., 2025) compares actions encountered at shared observations, and G2PO (Wang et al., 2026d) incorporates the structure of transitions between observation groups. HGPO (He et al., 2026) accounts for historical context by organizing comparisons into hierarchical groups. In each case, step-level credit comes from comparing experiences in existing rollouts, so it depends on how they are compared.

Two challenges remain when steps are compared at matched observations. The first is whom a step should be compared with. Identical observations can occur after different preceding actions, reasoning, exploration depth, and accumulated contexts. Peers that share an observation are therefore not equally informative for the step being evaluated (the query). Requiring peers to share the same history instead leaves few peers per step, and a baseline averaged over so few returns gives noisy advantages (He et al., 2026). Our premise is that, within observation-matched groups, contextual similarity should determine each peer's contribution to the query's baseline and value estimates. The second is what a step should be credited for. A return comparison credits a step for belonging to a trajectory that ended well, but an eventual success can include redundant actions or detours. Separating a step that inherits a favorable context from one that makes progress from it requires a complementary comparison of realized gains over a short continuation.

To address both challenges, we propose Contextual Credit Policy Optimization (CCPO). For the first, CCPO represents each step's context with semantic features of an interaction window from a frozen LLM and accumulated trajectory statistics, and gives greater weight to observation-matched peers with higher contextual similarity (Figure 1). For the second, CCPO builds two credit signals on these weighted peers. Historical credit compares the realized return with its contextual peer baseline. Future credit measures short-horizon progress as the change in contextual value, a weighted average of peers' discounted terminal rewards, between the current step and a later step of the same rollout. Both are computed in hindsight from collected rollouts without requiring an auxiliary value critic or additional environment interactions. On agentic multi-step benchmarks, ALFWorld (Shridhar et al., 2021) and WebShop (Yao et al., 2022), CCPO outperforms prompting- and RL-based baselines using Qwen2.5-1.5B-Instruct and Qwen2.5-7B-Instruct backbones (Qwen et al., 2025).

Our main contributions are as follows:

  • Contextual credit estimation from history and future progress. We assign step-level credit by combining a history-conditioned return residual with estimated value change over a future horizon, capturing outcome-relative performance and local progress. Analysis shows complementary effects of history and future credit as learning evolves.

  • Contextual similarity for step-level peer weighting. We aggregate peer returns with continuous weights set by the similarity between query and peer context representations, producing a context-dependent baseline. Replacing these weights with uniform ones lowers success by 3.7 and 2.6 points.

• Semantic and structural context representations. We combine semantic hidden states of recent interactions with accumulated trajectory statistics, enabling context-sensitive comparisons across trajectories without training an auxiliary value critic.

References (82)