acceptodds
Published as a conference paper at NeurIPS 2026

Counterfactual Distillation: Internalizing Reflective Experience into LLM Agent

Rui Ge, Yichao Fu, Yu-Yang Qian, Junda Su, Yiming Zhao, Hao Zhang

Abstract

Large language models are increasingly deployed as autonomous agents that plan and act over long-horizon interactions, learning from both final outcomes and rich environmental feedback. However, optimizing from such interaction experience remains challenging, as feedback is heterogeneous and rarely carries explicit reward information. Existing post-training approaches rely on outcome-driven methods, such as reinforcement learning with verifiable rewards (RLVR), which primarily exploit final success signals while leaving interaction experience and feedback underutilized. In sparse-reward, long-horizon tasks, this often results in **distribution sharpening**: the policy reinforces a narrow set of already-successful behaviors, without substantially improving the feedback-grounded agency needed for broader problem-solving capacity (e.g., Pass@). We propose ***Counterfactual Distillation***, a framework that converts exploration-derived experience into trainable policy supervision. Specifically, we organize exploration as a tree-structured search process, where the agent reflects on past decision points and makes new experience-guided decisions to form alternative branches. These corrections are then distilled as counterfactual targets: we train the model to predict the revised action from the original history without explicitly providing the experience, thereby introducing out-of-distribution behavior patterns and expanding exploration capacity. Across diverse interactive coding and agentic tasks, our method outperforms outcome-driven baselines such as GRPO and experience-based methods such as Early Experience, with gains of up to **14%** on Pass@128. When interleaved with reinforcement learning updates, it further raises the performance ceiling, yielding over **10%** improvement in Pass@1. We provide an [anonymized implementation](https://anonymous.4open.science/r/Counterfactual-Distillation-0E71).

Keywords:
Atlanta, Main Track

Reviews

Among:
Shape:
123456this paper, Bottom 49%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.33 over 3 reviews, above 49% of the others.
Reviewer_uQLmOpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

The paper proposes Counterfactual Distillation to improve LLM agents by turning reflective interaction experiences into supervised policy training. Concretely, during exploration, the policy identifies a suboptimal step on a weak trajectory and takes a revised action using the reflected experience. During training, the model is prompted from the original history to predict the revised action without seeing the reflection. Experiments on several benchmarks show that the method improves Pass@128 and can further improve GRPO when interleaved with RL.

Strengths and weaknesses

The paper aims to address a vital problem of leveraging rich interaction feedback beyond sparse terminal rewards in long-horizon agent tasks. The proposed solution is clear and practical, and the empirical evaluation is broad and comprehensive. One of the main concerns is that the gains are pronounced for Pass@128, while Pass@1 is mixed or suboptimal. This may render the method less practical, since Pass@1 is sometimes the more deployment-relevant setting when inference-time computation resources are limited or generation latency is sensitive. Another concern is experiment fairness. The paper states that the proposed method is initialized from the GRPO-trained model, so the comparison to GRPO may partly reflect extra data collection and SFT rather than serving as a standalone alternative.

Questions
  1. Could the authors report results for the proposed method without GRPO initialization, so as to ablate this factor?
  2. The benchmarks seem not up to date. Could the authors include more benchmarks from the past two or three years?
  3. One minor question is what benchmark(s) is reported in Fig 1?
Limitations

yes

Paper formatting concerns

References in the submission PDF are not clickable.

Final justification

I am satisfied with the authors' response and would like to maintain my current score.

1 comment

W1: Practicality in the Pass@1 deployment setting

A1: Thank you for raising this point. Our main motivation is that GRPO primarily improves exploitation, while CD is designed to expand the policy's exploration space by introducing experience-guided corrective strategies. Therefore, the main comparison in Table 1 focuses on large-kk Pass@kk, where CD consistently achieves stronger results; we do not claim that standalone CD always maximizes Pass@1. For deployment-oriented single-rollout performance, Table 3 compares extended GRPO with interleaved RL+CD. RL+CD improves Pass@1 from 71.22% to 74.33% on WebShop and from 70.70% to 78.70% on Sokoban. This suggests that the broader strategies introduced by CD can be further reinforced by GRPO and converted into higher Pass@1, raising the ceiling of outcome-only training. Importantly, inference still uses a single rollout without reflection, rollback, or additional test-time search.

W2+Q1: Experiment fairness

A2: Thank you for raising this important fairness concern. We clarify that CD is not designed as a standalone replacement for GRPO. GRPO efficiently provides the agent with basic environment understanding and task-execution competence through large-scale outcome-based training, whereas CD is a lightweight complementary stage that uses feedback-guided revisions to broaden the policy’s behavioral coverage. CD alone is not intended to rapidly acquire such task competence from the base model.

Therefore, CD-from-base and GRPO are not directly comparable because they serve different roles: GRPO provides initial task competence, while CD is a lightweight post-training stage. We therefore apply CD to a near-saturated GRPO checkpoint to test whether it can deliver further gains beyond continued outcome-only optimization.

To control for the additional data and training budget, we compare CD with continued GRPO training:

Sokoban

MetricGRPOGRPO-extendedOursRL+CD
Pass@158.1570.7064.6078.70
Pass@12868.0075.2078.4081.20

WebShop

MetricGRPOGRPO-extendedOursRL+CD
Pass@167.4571.2266.5074.33
Pass@12885.4088.6089.2091.00

Here, GRPO and Ours correspond to the Table 1 checkpoints: Ours applies standalone CD to the original GRPO checkpoint. GRPO-extended and RL+CD correspond to the continued-training setting in Table 3. GRPO-extended allocates these steps entirely to GRPO, whereas RL+CD alternates GRPO updates with CD cycles. The auxiliary data volume and training time introduced by CD are also substantially smaller than those of the original GRPO stage.

Compared with extended GRPO, standalone CD still achieves higher Pass@128 on both tasks. Under the matched continued-training budget, RL+CD achieves the strongest Pass@1 and Pass@128 results. These findings indicate that CD provides a complementary exploration-oriented learning signal beyond simply applying additional GRPO updates. We will clarify this motivation and experimental setup in the revised manuscript.

Q2: Include more recent benchmarks

A3: Thank you for this suggestion. We have added AppWorld (2024), a more recent benchmark that evaluates multi-step agent interaction with applications and tools.

Due to the rebuttal timeline and the scale of AppWorld data collection, we have not yet completed full GRPO training on this benchmark. Instead, we first construct interaction data and perform SFT to obtain an environment-adapted checkpoint, denoted as Tuned, which equips the model with basic environment understanding and task-solving capability. We then apply CD starting from the same Tuned checkpoint.

MethodPass@1Pass@64
Base14.31 ± 3.6442.00
Tuned25.30 ± 3.8656.00
CD (keep exp)25.88 ± 3.4561.00
CD (Ours)26.06 ± 4.0764.00

Here, CD (Ours) denotes our original setting, which trains the model to predict the experience-guided revised action aτ′a'_{\tau} from the experience-free context (hτ,q)(h_{\tau}, q). CD (keep exp) is an additional ablation suggested by the Area Chair and Reviewer 2: it uses the same reflection-generated revisions but retains ee in the conditioning context, predicting aτ′a'_{\tau} from (hτ,q,e)(h_{\tau}, q, e).

The SFT-tuned model substantially improves over the base model, and both CD variants provide further gains. CD (Ours) achieves the best Pass@1 and Pass@64, with a more noticeable improvement at the larger sampling budget.

Due to the limited rebuttal timeline and computational cost, we currently report only preliminary results up to Pass@64. We are continuing the full AppWorld evaluation, including GRPO-based training, additional Pass@kk values, and more complete variability analysis, and will incorporate the completed results into the revised manuscript.

Q3: Benchmark in Fig 1

A4: Figure 1 reports results on the CodeContests coding benchmark. We will revise the figure caption to state this explicitly.

We hope the additional evidence and clarifications could address your concerns.

Reviewer_LbFEOpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
4
Quality
3
Significance
3
Read review
Summary

The paper studies how to train long-horizon, multi-turn LLM agents from interaction experience rather than from terminal rewards alone. The authors argue that outcome-driven RLVR such as GRPO collapses rich step-level feedback into a single episode-level scalar, and tends to sharpen policy toward behaviors it can already produce. They propose Counterfactual Distillation, a two-stage framework. In the first stage, the agent runs a tree-structured exploration to get revised action by replaying. In stage 2, the policy is trained to reproduce the revised action from the original history.

The method is evaluated on CodeContests, WebShop, ALFWorld,ScienceWorld, and Sokoban, using Qwen2.5 and Llama-3/3.1 backbones. Results are reported as Pass@1 and Pass@128, with the main gains appearing at large k (up to 14% on Pass@128).

Strengths and weaknesses

Strengths:

  1. The problem is well-motivated, with the insightful metric. The paper targets the failure mode of outcome-only RL, described as "boosting Pass@1 while yielding limited or even negative gains at large k", and measures capability with Pass@k rather than Pass@1 alone (Section 2.3).
  2. The experiments cover broad cases including web, embodied, scientific, puzzle, and programming.

Weaknesses:

  1. The central mechanism is not isolated. The defining choice is to drop the experience ee at training time and supervise the original context with the experience-guided action. The ablation (Table 4) compares rehearsal alone against rehearsal with counterfactual loss, but it does not compare training with ee in context against training with ee removed. The "counterfactual" step, which is the most interesting part of the method, is therefore not fully tested against the alternative basic baseline.

  2. The paper does not report error bars for Pass@k, and runs 8 trials only for Pass@1. On ALFWorld's 140 instances (Table 8), the Pass@128 gap over GRPO is 94.29 vs. 91.43 (Table 1), about 4 instances. It is not clear whether the gain is from single-estimate variation or not.

  3. The gains are mostly at large k (Pass@128); at Pass@1 the method is sometimes slightly below the baselines (e.g. WebShop Qwen2.5-7B 66.50 vs 68.65, Table 1). Since the paper motivates the work by single-rollout deployment, which is the Pass@1 setting, it would be helpful to clarify how it benefits that case.

Questions
  1. The method supervises the experience-free context (hτ,q)(h_\tau,q) with the experience-guided action aτ′a_{\tau}', removing ee at training time. Table 4a isolates the counterfactual loss against rehearsal, but it does not isolate the removal of ee. Could the authors compare training to predict aτ′a_\tau' from (hτ,q,e)(h_\tau,q,e) vs. from (hτ,q)(h_\tau,q)? This would clarify how much of the gain comes specifically from the experience-removal step.

  2. The reported method is initialized from the GRPO checkpoint and trained further. Table 3 shows extended GRPO plateau on Pass@1, but the main claims are about Pass@128. Do the authors have Pass@128 for the extended GRPO, so the Pass@128 gain can be compared against GRPO?

Limitations

yes

Paper formatting concerns

N/A

1 comment

W1 + Q1: Isolating the experience-removal step

A1:

MethodWebShop Pass@1WebShop Pass@128Sokoban Pass@1Sokoban Pass@128
GRPO-RLVR67.32 ± 1.1785.4058.33 ± 0.5568.00
CD (keep exp)65.86 ± 0.9886.8061.23 ± 0.6572.00
CD (Ours)66.38 ± 1.0989.2065.32 ± 0.9878.40

Thank you for identifying this important missing control. We have added CD (keep exp) to directly isolate the defining choice in Counterfactual Distillation. Both CD (keep exp) and CD (Ours) use the same reflection-generated revision triples (hτ,q,e,aτ′)(h_{\tau}, q, e, a'_{\tau}), as well as the same training budget and evaluation protocol. The difference is the training input:

  • CD (keep exp): predicts aτ′a'_{\tau} from (hτ,q,e)(h_{\tau}, q, e), retaining the explicit experience.
  • CD (Ours): predicts aτ′a'_{\tau} from (hτ,q)(h_{\tau}, q), removing ee and requiring the model to internalize the experience-induced correction.

The results show that the gains cannot be attributed solely to reflection-guided target generation. Removing ee yields clearly stronger performance on Sokoban and improves large-kk performance on WebShop, indicating that the model better learns to make the revised decision under the experience-free context encountered at deployment.

We also note that the gap is moderate in some settings, since ee is a concise prompt-side intervention and may have limited influence during supervised training. More broadly, our counterfactual supervision is generated by summarizing experience ee from environment exploration and using it to elicit a revised action aτ′a'_{\tau}. The revised action, rather than the experience text itself, is the key supervision signal that transfers the exploration-derived correction into the policy. We will include this ablation and clarification in the revision.

W2: Variability and error bars

A2: Thank you for raising the concern about evaluation variability. We have expanded the Pass@1 evaluation from 8 to 32 independent stochastic runs and report the mean ± standard deviation below. All values are percentages.

MethodWebShopALFWorldScienceWorldSokoban
Base0.05 ± 0.0926.35 ± 1.787.37 ± 0.877.35 ± 1.13
GRPO-RLVR67.32 ± 1.1769.72 ± 2.3227.56 ± 1.4558.33 ± 0.55
CD (keep exp)65.86 ± 0.9868.12 ± 1.8927.20 ± 1.0360.23 ± 0.65
CD (Ours)66.38 ± 1.0967.58 ± 2.0528.14 ± 2.3565.32 ± 0.98

We are currently running additional experiments to estimate error bars for Pass@kk, which require a substantially larger number of rollouts and are still in progress; we will report the completed results in Phase 2. We will include the full variability results in the revision.

W3 + Q2: Limited gains in Pass@1 and Pass@128 for the extended GRPO

A3: Thank you for raising this point. Our central motivation is that GRPO is particularly effective at improving exploitation by increasing the probability of already successful behaviors, whereas CD aims to broaden the policy’s exploration space through experience-guided corrective strategies. Accordingly, Table 1 emphasizes large-kk Pass@kk, where CD consistently shows stronger performance; we do not claim that standalone CD always yields the highest Pass@1.

For single-rollout deployment, Table 3 provides the more relevant comparison between extended GRPO and interleaved RL+CD. RL+CD raises Pass@1 from 71.22% to 74.33% on WebShop and from 70.70% to 78.70% on Sokoban. These results indicate that the additional strategies introduced by CD can be consolidated through subsequent GRPO updates, translating broader behavioral coverage into stronger single-rollout performance and a higher ceiling than outcome-only training.

To directly control for the additional training steps and address the reviewer’s concern, we have now evaluated the Pass@128 performance of extended GRPO.

Sokoban

MetricGRPOGRPO-extendedOursRL+CD
Pass@158.1570.7064.6078.70
Pass@12868.0075.2078.4081.20

WebShop

MetricGRPOGRPO-extendedOursRL+CD
Pass@167.4571.2266.5074.33
Pass@12885.4088.6089.2091.00

Here, GRPO and Ours correspond to the checkpoints reported in Table 1: GRPO is the original outcome-only GRPO checkpoint, while Ours applies standalone CD starting from that checkpoint. GRPO-extended and RL+CD correspond to the checkpoints reported in Table 3: GRPO-extended continues GRPO training for additional steps, whereas RL+CD alternates continued GRPO training with CD cycles. Extended GRPO improves Pass@128, but standalone CD still achieves higher results on both tasks. Interleaving the two yields the strongest Pass@1 and Pass@128 performance, supporting our claim that CD provides a complementary exploration-oriented learning signal beyond additional outcome-only training.

We sincerely hope our clarification helps address your concerns.

Reviewer_RxjSOpenReview ↗
Rating
5
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper proposes Counterfactual Distillation (CD), a two-stage method for training long-horizon LLM agents from their own interaction experience. In the first stage, the agent reflects on a trajectory, chooses an earlier step, rolls the environment back by replaying the prefix, and tries an experience-conditioned alternative action. In the second stage, the experience text is removed and the model is trained to produce the revised action from the original history, with rehearsal on successful trajectories to preserve existing behavior.

The main empirical claim is that CD improves large-kk success rates, especially Pass@128, by broadening the model's behavior beyond what outcome-only GRPO learns.

Strengths and weaknesses

Strengths

  1. The core idea is clean and as the authors show, it is generalizable across tasks with informative feedback.
  2. The evaluation is fairly broad, which strengthens the claims.
  3. The ablations are useful. Rehearsal alone is separated from counterfactual distillation, the tree-based rollback strategy is compared with simpler sampling strategies, and the GRPO interleaving experiment suggests that CD may add a signal that outcome-only RL misses.

Weaknesses

  1. The authors do not report error bars even for Pass@1, even though they are available since they run Pass@128 experiments. Also, even though the data is available, the authors do not report Pass@kk values for intermediate kk values.
Questions

None.

Limitations

yes

Paper formatting concerns

None

Final justification

I had only minor concerns which the authors addressed. I still recommend acceptance.

1 comment

W1: Lack error bars for Pass@1 and intermediate values for Pass@k

A1: Thank you for pointing this out. We have conducted additional experiments to address both concerns.

Pass@1 variability: We increased the number of independent Pass@1 evaluation trials from 8 to 32 and report the mean ± standard deviation below. All values are percentages.

MethodWebShopALFWorldScienceWorldSokoban
Base0.05 ± 0.0926.35 ± 1.787.37 ± 0.877.35 ± 1.13
GRPO-RLVR67.32 ± 1.1769.72 ± 2.3227.56 ± 1.4558.33 ± 0.55
CD (keep exp)65.86 ± 0.9868.12 ± 1.8927.20 ± 1.0360.23 ± 0.65
CD (Ours)66.38 ± 1.0967.58 ± 2.0528.14 ± 2.3565.32 ± 0.98

Intermediate Pass@k results. The original Figure 3 reports intermediate Pass@k results for ALFWorld, ScienceWorld, and CodeContests. We additionally report the complete intermediate results for Sokoban and WebShop below.

Sokoban Results:

MethodPass@8Pass@16Pass@32Pass@64Pass@128
GRPO-RLVR63.2064.6066.0067.4068.00
CD (keep exp)69.2070.4071.2071.8072.00
CD (Ours)75.2077.4078.0078.4078.40

WebShop Results:

MethodPass@8Pass@16Pass@32Pass@64Pass@128
GRPO-RLVR76.2077.8082.0084.2085.40
CD (keep exp)76.6078.4081.2083.4084.80
CD (Ours)75.8080.8084.4086.4089.20

Here, CD (Ours) denotes our original setting, which trains the model to predict the experience-guided revised action aτ′a'_{\tau} from the experience-free context (hτ,q)(h_{\tau}, q). CD (keep exp) is an additional ablation suggested by the Area Chair and Reviewer 2: it uses the same reflection-generated revisions but retains ee in the conditioning context, predicting aτ′a'_{\tau} from (hτ,q,e)(h_{\tau}, q, e). This comparison directly isolates the effect of removing and internalizing the experience during distillation.

We are currently running additional experiments to estimate error bars for Pass@kk, which require a substantially larger number of rollouts and are still in progress; we will report the completed results in Phase 2.

We will incorporate these results and the corresponding clarifications into the revised manuscript. We hope the additional evidence could address your concerns.

Comments on the paper

1 comment
Meta-review

Counterfactual Distillation organizes exploration as a tree-structured search, has the agent reflect at past decision points to produce a revised action, and then distills that revision into the experience-free context, so the corrected behavior is internalized rather than prompted. Final scores are 5/4/4, and all three reviewers reaffirmed their positive assessments after the rebuttal. I recommend acceptance.

For the final version, please include: the CD (keep exp) ablation and both variability tables; the terminology clarification; the extended-GRPO comparison reported with the WebShop margin stated plainly; AppWorld marked as preliminary; and the reference-formatting fix uQLm noted (references are not clickable in the submission PDF).

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.