Contextual Credit Policy Optimization

Step-level credit for long-horizon LLM agents. CCPO weights observation-matched peers by contextual similarity and pairs historical credit with future credit, so a step is credited for the progress it makes, not only for its trajectory’s eventual outcome. No value critic.

Huiwen Han1,2,†, Ziyao Zeng3, Zihao Zhu2, Sisong Bei4, Hao Wang2, Hongyu Xu5, Yan Han6, Degui Zhi3, Zhiwen Fan2

1Stanford University   2Texas A&M University   3Yale University   4Amazon   5Meta AI   6Microsoft †Project lead. Huiwen Han was a visiting student at Texas A&M University during this work.

TL;DR Group-based RL derives step-level credit by comparing steps that saw the same observation. Two challenges remain: whom a step should be compared with, and what a step should be credited for. CCPO addresses both in hindsight, from rollouts already collected for training.

Whom should a step be compared with?

Identical observations can occur after different preceding actions, reasoning, exploration depth and accumulated context. Peers that share an observation are not equally informative for the step being evaluated.

→ Weight observation-matched peers by contextual similarity, so peers from similar contexts contribute more to the step’s baseline.

What should a step 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.

→ Pair historical credit with future credit, the change in contextual outcome value over a short realized continuation.

Contributions

  1. Contextual credit estimation from history and future progress.Step-level credit combines 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.
  2. Contextual similarity for step-level peer weighting.Peer returns are aggregated 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.
  3. Semantic and structural context representations.Semantic hidden states of recent interactions are combined with accumulated trajectory statistics, enabling context-sensitive comparisons across trajectories without training an auxiliary value critic.

Method

CCPO credits each step of a rollout without a value critic. It finds the steps in other rollouts of the same task that saw the same observation, and weights these peers by how similar their context is. The weighted peers answer two questions: did this trajectory’s return beat theirs (historical credit), and did the expected outcome rise over the next few steps (future credit)? Their sum is the step’s advantage.

currentquery (i, t) peer(j, s) ∈ 𝒫i,t excluded(same trajectory) history(−KH steps) future(+KF steps)

oBYou arrive at countertop 1. On the countertop 1, you see an apple 1.

→ query exact peers ℰi,t excluded
\begin{aligned}\mathcal{E}_{i,t}=\{(j,s):\ &x_j=x_i,\ j\neq i,\\ &0\le s<T_j,\ o_{j,s}=o_{i,t}\}\end{aligned}

For a query step, exact peers are steps from other trajectories of the same task that saw the same observation. The query’s entire trajectory is excluded.

If no exact match exists, CCPO falls back to all same-task steps from other trajectories.

Contextual credit policy optimization of multi-step tasks. Contextual similarity weights observation-matched peers. A history-conditioned return residual and estimated outcome-value change over a short future window yield step-level credit from collected rollouts without an auxiliary value critic.
Context φ
Frozen LLM hidden state + trajectory summary, each L2-normalized and concatenated with equal weights.
Windows
 KH = 2 history steps, KF = 2 future steps.
Training
150 iterations, 16 tasks × 8 trajectories, learning rate 10−6, γ = 0.95.
Overhead
No value critic to train and no extra rollouts; built on verl-agent.

Results

CCPO is evaluated on two multi-step benchmarks, ALFWorld (text-based household tasks) and WebShop (web shopping), with Qwen2.5-1.5B-Instruct and Qwen2.5-7B-Instruct. It is compared with off-the-shelf LLMs, prompt-based agents and RL training methods. CCPO leads the listed RL baselines in mean success, reaching 96.9% and 97.4% on ALFWorld and 75.0% and 79.4% on WebShop at 1.5B and 7B, and outperforms GRPO by up to 21.6 and 18.5 points.

Success by method

Mean over three seeds. Whiskers show ±1 standard deviation where reported.

Backbone
Metric
Full results table every sub-task, both backbones, with numbers reported in the original papers

Success rate (%) per ALFWorld sub-task and overall; success rate (%) and score for WebShop. Means over three seeds with standard deviations. Within each section the best mean is shaded and the second best underlined. * Baselines reproduced, or off-the-shelf models evaluated, by the authors. Gray rows are results from the original papers and are excluded from ranking. Δ GRPO is the min–max gain over GRPO across both CCPO variants.

Ablations

All ablations use Qwen2.5-1.5B-Instruct, with ACC on ALFWorld and ACC + AEP on WebShop as reference configurations. Contextual weighting outperforms uniform weighting, and historical and future credit serve as complementary learning signals: uniform weights lower success by 3.7 and 2.6 points, and either credit alone lowers it by up to 12.3.

Success lost when one component changes

Percentage points below full CCPO. Mean success of each ablation is shown at the right of its bar.

Where should the window sit?

ALFWorld success as a five-step window shifts from all history to all future.

How wide should it be?

Symmetric windows of one, two and three steps each way.

Markers follow the paper: history step, current step, future step. The default two steps each way outperforms every tested asymmetric window and both one and three steps each way; widening to three reduces success from 96.9% to 91.4%. Window variations are restricted to ALFWorld, where successful 1.5B trajectories average 8.7 steps versus 5.1 on WebShop. Error bars: ±1 SD over three seeds.

Full ablation table all ALFWorld sub-tasks and WebShop score

H and F denote active historical and future credit spans, with W = H + F + 1. Zero marks a disabled credit channel. Channel-only rows retain KH = KF = 2. Temporal-window rows also change the actual window lengths. A dash means the configuration was not run on WebShop.

Contextual credit analysis

Evaluation trajectories, credit magnitudes over training, and credit preferences by action category, all on ALFWorld.

Identical observations can conceal different task progress.

On this ALFWorld evaluation task, GiGPO, HGPO and G2PO keep navigating among places they have already visited and never acquire the target. CCPO reaches the same empty hanger only after picking the toilet paper up, and completes the task in 7 steps.

22.5%±1.8

CCPO’s revisit rate across three ALFWorld evaluation draws, versus 26.8–41.0% for the baselines.

Task

One sampled evaluation trajectory per method at training step 150, temperature 0.4, 50-step limit. Each cell is one step; a revisit is navigation to a previously visited location. CCPO uses ACC only.

Revisit rates on ALFWorld evaluation rollouts

Share of steps whose observation was already seen in the same rollout. Mean ± SD over three evaluation draws; lower means less revisiting.

Contextual credit keeps a learning signal as the episode-level one fades.

Both advantages are computed from the same ACC-only ALFWorld rollouts; AEP is logged for comparison and never backpropagated. As validation success improves, the mean absolute episode advantage diminishes while the contextual advantage remains elevated, so a learning signal remains after most episodes succeed.

Mean absolute credit per training iteration on ALFWorld. Curves are centered 5-iteration means; bands are 95% trajectory-bootstrap confidence intervals. The strip below each panel traces validation success over the same iterations.

The balance shifts from history toward future progress.

Historical credit dominates early. Future credit becomes more prominent later, even though the two are always combined with fixed unit weights. Within 10-iteration windows their magnitudes become less consistently correlated late in training, especially at 7B. The two components evolve differently, supporting complementary roles.

0.25→0.60

Future-to-history magnitude ratio at 1.5B, iterations 1–30 vs 121–150.

0.32→1.01

The same ratio at 7B: by the end, future credit is as large as historical credit.

Shaded spans mark iterations 1–30 and 121–150, over which the ratio E|AF| / E|AH| is computed. The contributions satisfy ACC = AH + AF.

Do the two magnitudes move together?

Pearson r between unsmoothed |AH| and |AF| in non-overlapping 10-iteration windows.

−1+1

Future credit favors reaching new places more than historical credit does.

Within groups matched on task, observation and iteration, both channels favor task operations (cleaning, heating, cooling). They differ on exploration: relative to other actions, AF favors new-location transitions more than AH. Variants without the context summary, and with (4, 0) or (0, 4) windows, show similar patterns.

+0.037

Paired difference AF − AH for new-location transitions in full CCPO. Bonferroni-adjusted CI [0.001, 0.073] over 2,804 groups.

Relative credit preference Positive (+) Negative (−) — Insufficient matched groups (<60) * Significant off Inactive component

Mean category-relative credit within matched task–observation groups and iterations, from successful Qwen2.5-1.5B ALFWorld rollouts at iterations 101–150. Brackets give Bonferroni-adjusted confidence intervals; asterisks mark intervals excluding zero. Context markers denote current, history and future.

Changing the context representation changes when the agent acts.

Each ablated policy is paired with full CCPO on the same 140 evaluation games, comparing the step at which an action type first occurs. Against full CCPO, the future-only policy first opens a receptacle earlier in 72.1% of paired games, and the history-only policy later in 54.3%.

72.1%

Future-only policy: first open comes earlier than under full CCPO.

54.3%

History-only policy: first open comes later.

First occurrence of each action, relative to full CCPO

Share of paired games (%) in which the ablated policy acts earlier, at the same step, or later.

Checkpoint 150, Qwen2.5-1.5B-Instruct, successful and failed episodes. Percentages condition on both policies performing the action; these are descriptive proportions. Categories with fewer than 12 pairs, and those not compatible with a first-occurrence analysis, are omitted.

Absolute changes in matched peer weights from context summaries

Context summaries add accumulated trajectory statistics to the semantic representation: step count, distinct-observation count, novelty fraction and a revisit indicator. Adding them changes normalized peer weights by more than one percentage point for 33.8% of matched query–peer pairs. Removing them lowers mean success by 2.6 points on ALFWorld and 1.3 on WebShop.

Change (pp)> 0.25> 0.5> 1> 5> 10
Pairs (%)62.148.733.88.63.6

Limitations

  • Evaluation breadth.Two multi-step benchmarks and one model family. Broader generalization, and applicability to short-horizon or single-step tasks, remain untested.
  • Matching and hand-designed context.Exact observation matching can limit peer availability, while fixed temporal windows and hand-designed trajectory statistics may require adaptation across environments.
  • Sparse rewards.Future credit vanishes when all rollouts in a task group receive zero terminal reward, which limits the future channel early in training when successful trajectories are scarce.

Future work

  • Adaptive horizons and stage-dependent weighting.Motivated by the changing balance between historical and future credit over training.
  • Streaming and multimodal credit.Credit estimation from incomplete rollouts, and contexts that combine visual observations with textual histories.
  • Beyond exact matching.Semantic peer retrieval, and uncertainty estimates for correlated visits.
  • Broader evaluation.Generalization across model families and domains, computational scaling, and the effects of realized-future conditioning on policy updates.

Citation

If contextual credit is useful in your work, please cite the paper.

BIBTEX
@misc{han2026contextualcreditpolicyoptimization,
  title         = {Contextual Credit Policy Optimization},
  author        = {Huiwen Han and Ziyao Zeng and Zihao Zhu and
                   Sisong Bei and Hao Wang and Hongyu Xu and
                   Yan Han and Degui Zhi and Zhiwen Fan},
  year          = {2026},
  eprint        = {2610.19103},
  archivePrefix = {arXiv},
  primaryClass  = {cs.LG},
  url           = {https://arxiv.org/abs/2610.19103}
}