wikillm

Paper · 2026-04-20 · cs.CL

CAPO: Critic-Guided Action-Aligned Policy Optimization for Advancing LLM Agent Capabilities

CAPO trains LLM agents with a critic that scores the state before each complete action. The action gets one GAE advantage, and its token ratios are combined into a length-calibrated, batch-centred ratio that is clipped as one unit. Author-reported: it beats PPO, GRPO, GiGPO and ST-PPO on QA, paper search, ALFWorld and WebShop. The released code lacks the ratio.

Proximal policy optimization (PPO)Actor-criticCredit assignmentLLM agentreinforcement-learningllm-agentspolicy-optimizationcredit-assignment

arXivPDFCodeMarkdown14 min read

AI-compiled by claude-haiku-5-5 on 2026-11-01, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

An AI agent often works in whole steps: it writes one message that contains a short reasoning note and a tool call, the environment answers, and then the next step begins. Standard reinforcement learning for language models scores and adjusts every single word of that message separately, even though the world only reacts once the whole message is finished.

CAPO keeps the step as the unit. A learned critic estimates how good the situation was just before each step, so the step can be credited or blamed for what it led to. The whole step then receives one update weight. Because steps differ in length, CAPO also rescales how the word-level changes inside a step are combined, so a long step does not dominate the update just by containing more words.

The aim is a training method that matches how agents actually act, while still using the usual word-level machinery that language models are built on.

TL;DR

CAPO is a PPO-style method for multi-turn LLM agents. A critic reads the state at the start of each complete action, and GAE gives that action one advantage. The token probability ratios inside the action are summed, divided by the square root of the action length, and centred on a batch mean before clipping. The paper reports gains over PPO, GRPO, GiGPO and ST-PPO on four agent settings with Qwen3-1.7B and Qwen3-4B. The results are author-reported. The released repository does not contain the action-aware ratio.

Problem

Critic-free methods such as GRPO give every token in a trajectory one shared advantage §1. Token-level critic methods such as PPO estimate values, assign credit and clip ratios per token, although the environment changes only after a complete action §1 fig. 1. The paper asks how critic-based policy optimisation can be aligned with the action while staying computable with token-level RL training §1.

The paper also argues that directly multiplying or averaging token ratios within an action makes weighting and clipping depend on action length §1 §3.4.

Method

Overview. CAPO uses complete actions as the decision unit. The advantage says which action to reinforce; the action-aware ratio says how strongly that action is weighted and clipped §3.1 fig. 2.

  1. Decision granularity. At step t the state s_t is the interaction history (M_t tokens). The action a_t is the complete generated response (L_t tokens, reasoning and tool-call tokens). The environment changes only after the full action, and the trajectory is the sequence of (state, action, reward, next state) tuples §3.2 eq. 1.

  2. State value at the action boundary. CAPO reads the critic's value at the last state token, which is conditioned on the whole state prefix but not on the action. No extra state encoder is needed §3.3. Appendix app. A gives the same definition.

  3. Action-level advantage. Steps are ordered within each trajectory. The TD residual uses the next step's boundary value, which is set to zero after the terminal step. GAE runs backwards along the step timeline. The resulting advantage is assigned to every token of the action §3.3 eq. 2. The reward of an action may be intermediate feedback or the sum of token penalties §3.3.

  4. Token ratios. For token i of action t, w_i = π_θ / π_old given the same prefix. Its log is z_i §3.4 eq. 3.

  5. Aggregation family. The exact action likelihood ratio is the product of token ratios. A length-scaled family exp((1/L^α) Σ z_i) interpolates between the product (α = 0) and the geometric mean (α = 1). Clipping fractions grow with length for α = 0 and shrink with length for α = 1, and α = 0.5 gives more comparable fractions in a toy experiment §3.4 fig. 3.

  6. Action-aware ratio (CAPO). Let B be the set of actions in the optimisation batch, and sg the stop-gradient. The batch mean μ̂ is the token-weighted mean of all z in the batch. The action ratio is exp(μ̂ + Σ_i (z_i − μ̂) / √L_t). The paper calls this a length-calibrated ratio, not an exact likelihood ratio §3.4 eq. 4. The centring removes the mean shift that direct square-root aggregation would add §3.4.

  7. Objective. The clipped PPO form is applied to the action ratio and the action advantage: the minimum of the unclipped and clipped products, with clip interval [1 − ε, 1 + ε] §3.5 eq. 5. The paper writes this as J_CAPO, an expectation to be maximised eq. 5; the sign convention below is ours.

  8. Gradient. Before clipping activates, the gradient is the action's advantage times its ratio, divided by √L_t, times the sum of the token score gradients inside the action §3.5 eq. 6. When L_t = 1 the ratio reduces to the ordinary token ratio §3.5.

Pseudocode
# Action-level advantage  [§3.3] [eq. 2]
# Input:  values (T + 1,) critic values at the boundary before each step,
#         with the value after the terminal step set to 0  [§3.3]
#         rewards (T,) reward of each complete action  [§3.3]
# Output: advantages (T,), one per action, shared by its tokens

def action_advantages(values, rewards, gamma, lam):
    advantages = [0.0] * T
    last = 0.0
    for t in reversed(range(T)):
        # TD residual between this step and the next boundary  [eq. 2]
        delta = rewards[t] + gamma * values[t + 1] - values[t]
        # GAE recursion along the interaction timeline  [eq. 2]
        last = delta + gamma * lam * last
        advantages[t] = last
    return advantages
Pseudocode
# Action-aware policy ratio  [§3.4] [eq. 4]
# Input:  z[b][i] token log-ratios for every action b in the batch
#         L[b] token count of action b
# Output: ratio[b] one ratio per action, used for weighting and clipping

def action_aware_ratios(z, L):
    # Token-weighted batch mean; stop-gradient, so it adds no derivative
    # terms  [§3.4] [eq. 4]
    total = sum(sum(z[b]) for b in range(len(z)))
    mu = stop_gradient(total / sum(L))
    ratios = []
    for b in range(len(z)):
        # Centre each token log-ratio, sum, scale by 1/sqrt(L_b)  [eq. 4]
        centred = sum(z_i - mu for z_i in z[b])
        ratios.append(exp(mu + centred / sqrt(L[b])))
    return ratios
Pseudocode
# Clipped objective per action  [§3.5] [eq. 5]
# The paper maximises J; this loss is its negative  (sign convention ours)
# The paper does not state how the per-action term is averaged over tokens
# or actions.  [not stated]

def capo_loss(ratio, advantage, epsilon):
    unclipped = ratio * advantage
    clipped = clip(ratio, 1 - epsilon, 1 + epsilon) * advantage
    return -min(unclipped, clipped)

Hyperparameters

Values not stated in the paper are marked "not stated". Code values come from the released repository at code_commit.

NameValueWhereNotes
BackbonesQwen3-1.7B; Qwen3-4B-Instruct-2507§4.1Ablations and in-depth analyses use Qwen3-4B §4.4
Actor learning rate1e-6§4.1 tab. 7No warm-up app. B
Critic learning rate1e-5§4.1 tab. 7CAPO, PPO and ST-PPO use a learned critic app. B
Critic warm-upnoneapp. BCode sets critic_warmup=0 run_ppo.sh
Discount γ0.99§4.1Code: run_ppo.sh
GAE λ1.0§4.1Code default: ppo_trainer.yaml
Clip ε (CAPO)0.001§4.1 app. B tab. 4Symmetric. Code step scripts use 0.0003 (see Paper vs code)
Clip ε (GSPO baseline)0.0003app. B
KL coefficient0.001§4.1Code: low_var_kl run_ppo.sh; KL type not stated in paper
Training batch size128§4.1
Group baselines8 rollouts × 16 prompts = 128§4.1
Actor micro-batch4 per GPU§4.1 tab. 7
Mini-batch / PPO epochsnot statedCode: mini-batch 128 run_ppo.sh; ppo_epochs=1 default actor.yaml
GPUs8 × H100§4.1 app. ECode webshop script uses 4 GPUs run_ppo.sh
Seeds41, 42, 43app. EResults are mean ± std over 3 seeds tab. 1
Training frameworkAgent-R1 on veRL, vLLM 0.11.0§4.1 app. E
Max environment stepsHotpotQA 5; RealResearchQuery 5; ALFWorld 20; WebShop 15tab. 7 app. B
Max prompt length10240; 10240; 8192; 16384tab. 7Order: HotpotQA, RRQ, ALFWorld, WebShop. Code WebShop script: 8192 run_ppo.sh
Max response length1024; 4096; 4096; 4096tab. 7Code WebShop script: 1024 run_ppo.sh; ALFWorld default 1024 run_ppo.sh
Parallel calls per stepHotpotQA up to 4 search; paper search up to 5app. B
Retrieval encoderBAAI/bge-large-en-v1.5 with FAISSapp. BHotpotQA index
Selector (paper search)pasa-7b-selector, not an agent toolapp. BUsed for reward and final scoring
Total training lengthnot statedCode WebShop script: 10 epochs run_ppo.sh
Eval temperature (RL)not statedReAct eval temperature 0.0 app. B

Results

Author-reported. Setup: 3 seeds per RL method; ReAct evaluated once app. E. Metric columns: HotpotQA (in-domain) and 2Wiki/MuSiQue (out-of-domain) answer accuracy; RealResearchQuery F1@all and Recall@all; ALFWorld win rate on seen and unseen splits; WebShop task score and purchase success §4.1 tab. 1. The paper marks CAPO best in every column for both backbones tab. 1.

Qwen3-1.7B tab. 1

MethodHotpotQA2WikiMuSiQueF1@allRecall@allALF SeenALF UnseenWebShop ScoreWebShop Succ.
ReAct3.622.240.500.0050.0122.862.242.030.80
PPO38.00 ± 0.7550.12 ± 1.0216.55 ± 0.830.284 ± 0.0040.514 ± 0.00467.14 ± 0.6069.40 ± 2.1459.12 ± 0.7834.60 ± 1.34
REINFORCE++37.92 ± 2.6249.01 ± 0.6717.09 ± 0.310.281 ± 0.0010.521 ± 0.00665.00 ± 0.0368.66 ± 2.0061.34 ± 2.1835.40 ± 0.88
GRPO36.76 ± 1.2548.30 ± 1.3516.88 ± 0.760.275 ± 0.0030.530 ± 0.00773.57 ± 0.0675.37 ± 2.2463.15 ± 1.8536.20 ± 0.60
RLOO37.41 ± 0.8347.26 ± 0.2315.93 ± 0.770.279 ± 0.0010.536 ± 0.00571.43 ± 1.5973.88 ± 0.7665.74 ± 0.1535.00 ± 0.83
GSPO39.12 ± 2.3346.83 ± 0.6817.46 ± 2.770.264 ± 0.0080.541 ± 0.00267.86 ± 0.2767.91 ± 1.2259.03 ± 1.4732.40 ± 1.05
GiGPO40.85 ± 2.7952.43 ± 0.6718.37 ± 0.260.298 ± 0.0100.545 ± 0.00270.00 ± 1.2469.40 ± 1.1166.92 ± 0.6541.80 ± 1.83
ST-PPO41.32 ± 0.2251.76 ± 1.2918.91 ± 0.100.294 ± 0.0030.548 ± 0.00469.29 ± 0.9470.90 ± 3.1665.80 ± 0.5940.60 ± 1.11
CAPO45.19 ± 0.5456.64 ± 1.2321.89 ± 0.700.319 ± 0.0070.557 ± 0.00275.71 ± 0.5979.85 ± 0.5570.40 ± 0.7045.60 ± 0.58

Qwen3-4B tab. 1

MethodHotpotQA2WikiMuSiQueF1@allRecall@allALF SeenALF UnseenWebShop ScoreWebShop Succ.
ReAct37.4548.5910.260.1710.1937.142.9951.5823.80
PPO56.75 ± 1.0258.92 ± 1.1619.82 ± 0.810.303 ± 0.0050.531 ± 0.00276.43 ± 0.0972.39 ± 1.1670.18 ± 2.7146.00 ± 3.35
REINFORCE++55.94 ± 0.6760.48 ± 0.9721.72 ± 1.010.286 ± 0.0030.548 ± 0.00272.86 ± 1.9271.64 ± 0.2067.84 ± 2.2547.20 ± 0.71
GRPO56.61 ± 1.0363.33 ± 0.6225.07 ± 0.850.294 ± 0.0030.572 ± 0.00581.43 ± 2.1674.63 ± 1.0965.83 ± 0.8944.20 ± 1.43
RLOO56.31 ± 1.6661.85 ± 0.8623.91 ± 0.810.297 ± 0.0030.563 ± 0.00875.71 ± 2.1070.90 ± 0.8262.49 ± 1.1242.60 ± 0.71
GSPO57.08 ± 1.4956.14 ± 2.6822.59 ± 0.130.289 ± 0.0070.552 ± 0.00279.29 ± 1.7677.61 ± 1.0069.78 ± 0.2448.80 ± 2.09
GiGPO58.14 ± 0.7861.27 ± 0.1623.50 ± 2.040.306 ± 0.0030.567 ± 0.00188.57 ± 2.5979.10 ± 2.1967.13 ± 0.7450.00 ± 0.75
ST-PPO59.01 ± 2.4160.84 ± 2.7924.16 ± 3.340.302 ± 0.0040.571 ± 0.00287.86 ± 1.7580.60 ± 0.8070.60 ± 0.8749.60 ± 0.98
CAPO64.12 ± 1.2266.48 ± 1.1227.16 ± 0.840.318 ± 0.0020.590 ± 0.00292.86 ± 1.4486.57 ± 1.0078.12 ± 1.1758.20 ± 0.56

Policy-ratio ablation (Qwen3-4B, action-level credit assignment) tab. 2

Policy updateLog-ratio formulationALFWorld SeenWebShop Score
Token-wisez_i84.2973.80
Product aggregationΣ z_i74.2968.72
Mean aggregation(1/L) Σ z_i89.2975.14
Square-root aggregation(1/√L) Σ z_i90.7176.18
Action-aware (CAPO)μ̂ + (1/√L) Σ (z_i − μ̂)92.8678.12

Credit-assignment ablation (WebShop, λ = 1.00, Qwen3-4B) tab. 3

GAE granularityγAction tokensAvg. stepsScoreΔ vs γ = 1.00
Token1.00237.064.6373.74—
Token0.99248.414.4671.86−2.55%
Token0.95275.924.2563.02−14.54%
Action1.00140.084.7974.83—
Action0.99143.374.9478.12+4.40%
Action0.95183.614.1873.46−1.83%

Clipping-threshold sensitivity (Qwen3-4B) tab. 4

εALFWorld OORALFWorld ActiveALFWorld SeenWebShop OORWebShop ActiveWebShop Score
3e-466.8%33.7%91.4370.5%35.6%76.84
1e-348.7%24.5%92.8652.3%26.4%78.12
3e-329.4%14.8%92.1432.8%16.5%77.46
1e-210.8%5.4%89.2912.6%6.3%74.95
1e-11.1%0.6%83.571.4%0.7%69.33

OOR is the share of action ratios outside [1 − ε, 1 + ε]; Active is the share where clipping is applied tab. 4.

Paper-search tool use (Qwen3-4B) tab. 5: CAPO F1@all 0.318 with 2646.35 action tokens per trajectory, 3.21 search calls and 19.84 expansion calls. The baselines are PPO (0.303; 2719.78; 1.98; 16.76), GRPO (0.294; 2951.57; 2.74; 15.48), GiGPO (0.306; 2814.79; 4.57; 16.54) and ST-PPO (0.302; 2798.10; 3.85; 17.17). Format: F1@all; action tokens; search; expand tab. 5.

Training time (WebShop, 8 × H100, seconds per iteration) tab. 6: PPO 14.12 rollout, 76.65 actor, 104.60 critic, 195.37 total. CAPO 14.01, 74.35, 101.18, 189.54. The paper reports a single measurement per method §4.4.

Figures (described, not reproduced)

  • fig. 1: the granularity mismatch between agent actions and token-level optimisation.
  • fig. 2: the three parts of CAPO: (a) action as decision unit, (b) action-level GAE along the step timeline, (c) the action-aware ratio.
  • fig. 3: toy experiment on α across action lengths, with ε = 0.001; it motivates α = 0.5 §3.4.
  • fig. 4: ablation on four benchmarks removing credit assignment (CA), policy updates (PU), or both. Values are only in the plot; the text says CA matters more on RealResearchQuery, ALFWorld and WebShop, and PU more on HotpotQA §4.3.
  • fig. 5: training curves on HotpotQA and ALFWorld against PPO and others; the paper says CAPO's critic loss is more stable on ALFWorld §4.4.
  • fig. 6: on WebShop, the variance of the centred log-ratio sums grows about as L^0.90, and batch-mean restoration removes the negative shift of plain square-root aggregation §4.4.
  • fig. 7: ALFWorld success and step gap by golden-step group; CAPO has the lowest step gap in every group from three to nine golden steps §4.4.
  • fig. 8: a paper-search trajectory mixing search and citation/reference expansion §4.4.

Paper vs code

Repository: https://github.com/AgentR1/CAPO, linked by the paper's code field, with the same author list in its citation block. Cloned at code_commit. The repository has no LICENSE at its root; the bundled verl/ directory has an Apache-2.0 LICENSE. Code is cited by path and line only.

  • The action-aware ratio is not in the release. No code computes the square-root-scaled, centred ratio of eq. 4 or clips it. A search for sqrt, length-calibration and action-aware names in the project code finds nothing relevant. The only ratio implementation the step-level scripts use is GSPO, which takes the mean of token log-ratios over the action (α = 1, the geometric mean) and clamps the log-ratio at 10 core_algos.py. The registered gspo_ratio_diag loss only wraps GSPO and adds diagnostics policy_losses.py. The released step-level scripts pair action-level GAE with that GSPO loss run_steppo.sh. Whether the paper's tables used these scripts is not stated.

  • Clip ε differs. The paper gives ε = 0.001 for CAPO §4.1 app. B. The step-level scripts set clip_ratio_low and clip_ratio_high to 0.0003 run_steppo.sh run_steppo.sh run_steppo.sh. The paper gives 0.0003 for its GSPO baseline app. B.

  • Step advantages are whitened over the batch. The released step-level GAE normalises raw step advantages by batch mean and standard deviation (+1e-8) core_algos.py. Equation 2 has no such step §3.3.

  • Action value and reward follow the paper. The critic value is read at the last prompt token core_algos.py, the step reward is the sum of token rewards in the step core_algos.py, and the value after the terminal step is zero core_algos.py. These match §3.3.

  • γ, λ, KL and learning rates match. γ = 0.99 run_ppo.sh; λ = 1.0 ppo_trainer.yaml; KL coefficient 0.001 run_ppo.sh; actor LR 1e-6 run_ppo.sh; critic LR 1e-5 run_ppo.sh.

  • Length limits differ. The paper gives WebShop max prompt 16384 and max response 4096 tab. 7. The WebShop script uses 8192 and 1024 run_ppo.sh. The ALFWorld script defaults to 1024 response tokens run_ppo.sh.

  • GPU count differs. The paper uses 8 H100s §4.1; the WebShop script sets 4 GPUs run_ppo.sh.

  • Not checked. Reward functions in recipe/ and the environment servers were not compared with Appendix B.

Pitfalls

  • Implement eq. 4 yourself. The released repository does not contain it, so any reproduction needs a new implementation. The paper does not say how μ̂ is computed: over the mini-batch or the whole rollout batch [not stated]. Its own text says μ̂ is an empirical statistic that depends on the optimisation set app. A.
  • Per-action loss aggregation is not stated. The paper does not say whether the per-action term is averaged over tokens, actions or the batch [not stated]. The GSPO code uses sequence-mean token-mean aggregation core_algos.py.
  • ε = 0.001 clips a lot. At ε = 1e-3 the paper's measured out-of-range fraction is 48.7% on ALFWorld and 52.3% on WebShop, and active clipping is 24.5% and 26.4% tab. 4. Larger ε weakens performance, and ε = 0.1 reaches 83.57 on ALFWorld tab. 4.
  • The length-calibration argument is a toy plus an approximation. fig. 3 is a toy experiment. The variance argument assumes i.i.d. centred token log-ratios §3.4. Figure 6 gives only the empirical exponent 0.90 on WebShop §4.4.
  • Not an importance-sampling correction. The paper says the action ratio is not an unbiased correction and that a TRPO-style guarantee does not apply app. A. Its gradient analysis holds only near the rollout policy §3.5.
  • Critic cost remains. CAPO trains a critic, unlike GRPO-style methods app. F. On WebShop it is about 3% faster per iteration than PPO in one measurement tab. 6.
  • Prompt construction matters. On ALFWorld and WebShop the prompt is rebuilt from the current observation and recent actions at each step rather than accumulated as a dialogue app. B.
  • Paper-search scores depend on a selector. Reward and final scoring both use pasa-7b-selector, a Qwen2.5-7B-based relevance model that the agent cannot call app. B. Scores therefore inherit that model's judgments. The test set is 50 queries app. B.
  • Small test sets. ALFWorld uses 140 seen and 134 unseen validation tasks app. B. The paper search test set has 50 queries.
  • Gaps versus variance. Several CAPO margins are a few standard deviations of a 3-seed estimate, for example RealResearchQuery F1@all on Qwen3-1.7B, 0.319 ± 0.007 against GiGPO's 0.298 ± 0.010 tab. 1.
  • Setup-dependent claims. Results are for two backbones on four tasks. The limitations section names single ReAct-style agents, multi-agent settings, very large backbones and non-agent post-training as untested app. F.
  • Released scripts are not the paper's configuration. The scripts above differ in ε, length limits and GPU count. Use tab. 7 and §4.1 for the paper's settings, and treat the scripts as starting points.

Lineage

  • Builds on: PPO, arXiv:1707.06347; GAE, arXiv:1506.02438 (cited in the code core_algos.py); GRPO, arXiv:2402.03300; GSPO, arXiv:2507.18071 (cited in the code core_algos.py).
  • Compared against: ReAct; PPO; REINFORCE++ (arXiv:2501.03262); GRPO; RLOO; GSPO; GiGPO [feng2026gigpo, no arXiv id in the paper's bibliography]; ST-PPO (arXiv:2511.20718) §4.1.
  • Training framework: Agent-R1 (arXiv:2511.14460) on veRL §4.1.
  • Superseded by: not known.

Source and license

Adapted from “CAPO: Critic-Guided Action-Aligned Policy Optimization for Advancing LLM Agent Capabilities” by Daoyu Wang, Qingchuan Li, Mingyue Cheng, Jie Ouyang, Shuo Yu, Chunli Liu, Shijin Wang, Qi Liu, Enhong Chen (arXiv:2604.18401), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/AgentR1/CAPO at commit 175e6b6af4d4 (none (no LICENSE file in repository; bundled verl/ is Apache-2.0)). Any quoted code is shown under that license.