Counterfactual Self-Evolving Agents for Evidence-Grounded Reasoning
Organizations: Johns Hopkins University · MIT · University of Texas at Austin · Bayesian Health
Abstract
Self-play proposer--solver methods improve reasoning by generating tasks and learning from verified solutions. However, for evidence-identifiable tasks, where case-specific evidence and domain knowledge determine a checkable answer, self-play requires generating plausible cases whose answers can be independently verified. We introduce counterfactual self-evolution, which generates counterfactual context for reconsidering the original case. A trainable Proposer constructs targeted evidence edits and describes potential outcome changes with causal explanations. We handcraft an expert-verified counterfactual instruction-tuning dataset to teach the Proposer to generate high-quality counterfactuals across a broad range of action--outcome scenarios. Each counterfactual instruction-tuning example specifies an edit within a defined category and explains its hypothesized causal effect on the decision, teaching the Proposer to reason systematically about what changes and why. We instruction-tune the Proposer on these examples, then formulate a fine-tuning reward that integrates feedback from the Solver and Verifier. Across diverse counterfactual scenarios, this reward favors high-quality counterfactuals and warranted revisions, while penalizing changes that overturn correct decisions. The counterfactual context aims to correct errors and strengthen confidence in correct decisions. Accepted counterfactuals accumulate in memory that supplies in-context evidence to the frozen Solver; the Solver adapts through evolving context rather than weight updates. We apply the framework to clinical reasoning, fact verification, and business reasoning. Our evaluation tracks performance over successive rounds as counterfactual memory grows, including transfer to harder cases. Our method achieves superior results across diverse frontier models.
Figures & tables
Appendix figures & tables30 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Training | Validation | Test |
|---|---|---|---|
| DiagnosisArena | 640 | 137 | 138 |
| MMMU Business | 677 | 145 | 145 |
| Proposer | Solver | Accuracy | AUROC | AUPRC | F1 |
|---|---|---|---|---|---|
| None (zero-shot) | Qwen | .5839 | .7000 | .2252 | .3052 |
| SFT | Qwen | .7372 | .7543 | .2985 | .3723 |
| None | Qwen SFT | .8786 | .7584 | .3128 | .1216 |
| Solver-specific SFT | Qwen SFT | .8630 | .7595 | .3212 | .3521 |
| SFT + GRPO | Qwen | .8417 | .7553 | .3237 | .3720 |
| Configuration | Test correct | Accuracy (%) | Corrected | Harmed |
| Zero-shot Solver | 48 | 34.8 | — | — |
| CF-IT, seed 20260728 | 84 | 60.9 | 36 | 0 |
| CF-IT, seed 20260730 | 87 | 63.0 | 41 | 2 |
| CF-IT, seed 20260731 | 81 | 58.7 | 34 | 1 |
| Three-seed mean | 84.0 | 37.0 | 1.0 | |
| Validation-selected consensus | 87 | 63.0 | 39 | 0 |
| Training records | Test correct | Accuracy (%) | Corrected | Harmed | Different wrong option |
|---|---|---|---|---|---|
| 133 | 48 | 34.8 | 1 | 1 | 0 |
| 266 | 48 | 34.8 | 0 | 0 | 0 |
| 400 | 77 | 55.8 | 36 | 7 | 6 |
| 533 | 84 | 60.9 | 36 | 0 | 1 |
| Setting | Value |
|---|---|
| Base model | Qwen2.5-7B-Instruct |
| Training scale | records; epochs |
| Adapter | LoRA rank , scaling , dropout |
| Target projections | Attention: q, k, v, o ; MLP: gate, up, down |
| Trainable parameters | |
| Learning rate and schedule | ; warm-up; cosine decay |
| CF role | Initial answer | Intended effect |
|---|---|---|
| Safe-preserving | Correct | Preserve support for the reference answer after a non-decisive evidence change. |
| Sufficient corrective | Incorrect | Address the key reasoning error and make the reference answer clearly best. |
| Insufficient corrective | Incorrect | Address the same diagnostic boundary while leaving the reference answer non-unique. |
| Operation | Required fields | Effect |
|---|---|---|
| delete | Exact target_span | Remove the specified source text. |
| add | Exact anchor_span , position , new_text | Insert explicitly hypothetical evidence at the specified location. |
| replace | Exact target_span , new_text | Replace a finding with a hypothetical alternative. |
| Base model | Type 2 preserve | Type 3 correct | Paired Type 3 | Pool | Train / val. |
|---|---|---|---|---|---|
| Qwen2.5-7B | 200 | 426 | 426 | 626 | 533 / 93 |
| Llama3-8B | 204 | 428 | 324 | 632 | 569 / 63 |
| MedGemma-4B | 255 | 375 | 296 | 630 | 567 / 63 |
| Base model | Type 2 preserve | Type 3 correct | Pool | Train / val. |
|---|---|---|---|---|
| Qwen2.5-7B | 352 | 181 | 533 | 480 / 53 |
| Llama3-8B | 216 | 228 | 444 | 400 / 44 |
| MedGemma-4B | 213 | 248 | 461 | 415 / 46 |
| Target field | Learning target |
|---|---|
| boundary_verdict | Predict CROSSED , NOT_CROSSED , or UNRESOLVED . |
| proposed_answer | Predict the proposed A–D answer. |
| closest_competitor | Identify the competing option relevant to the evidence boundary. |
| think | Explain the reasoning error or retained support and cite relevant evidence IDs. |
| x_cf.primary , x_cf.contrast | Generate the primary executable CF and an optional insufficient contrast. |
| y_cf | Explain the expected effects on decision support. |
| Base model | Training records | After oversampling | Stopping epoch |
|---|---|---|---|
| DiagnosisArena | |||
| Qwen2.5-7B | 533 | 703 | 4 |
| Llama3-8B | 569 | 749 | 3 |
| MedGemma-4B | 567 | 567 | 3 |
| MMMU Business | |||
| Qwen2.5-7B | 480 | 648 | 3 |
| Base model | Embedding checkpoint | Dim. |
|---|---|---|
| Qwen2.5-7B | Qwen/Qwen3-Embedding-0.6B | 1,024 |
| Llama3-8B | nvidia/llama-nemotron-embed-1b-v2 | 2,048 |
| MedGemma-4B | google/embeddinggemma-300m | 768 |
| Knowledge corpus | Collections | Chunks |
|---|---|---|
| DiagnosisArena medical | 39 | 84,572 |
| MMMU Business | 5 | 16,302 |
| Business collection | Chunks |
|---|---|
| business_accounting | 4,189 |
| business_economics | 4,767 |
| business_finance | 2,789 |
| business_management | 2,182 |
| business_marketing | 2,375 |
| Total | 16,302 |
| Dataset / task | Metric | Base model | Zero-shot | RAG | GSEM | MILM | Ours |
|---|---|---|---|---|---|---|---|
| MIMIC-IV / IHM | AUROC | Qwen2.5-7B | 0.7000 | – | – | 0.7235 | 0.7553 |
| Llama3-8B | 0.7025 | – | – | 0.7089 | 0.7466 | ||
| MedGemma-4B | 0.7117 | – | – | 0.7157 | 0.7374 | ||
| MIMIC-IV / LOS | MAE | Qwen2.5-7B | 69.76 | – | – | 59.77 | 58.60 |
| Llama3-8B | 59.42 | – | – | 65.26 | 55.20 | ||
| MedGemma-4B | 56.29 | – | – | 60.14 | 55.42 |
| Solver | Proposer context | Accuracy | AUROC | AUPRC |
|---|---|---|---|---|
| Qwen | None (zero-shot) | 0.5839 | 0.7000 | 0.2252 |
| Qwen | Heuristic CF | 0.5839 | 0.6968 | 0.2225 |
| Qwen | SFT Proposer | 0.7372 | 0.7543 | 0.2985 |
| Qwen | SFT + GRPO | 0.8417 | 0.7553 | 0.3237 |
| Qwen SFT | None | 0.8786 | 0.7584 | 0.3128 |
| Qwen SFT | Solver-specific SFT | 0.8630 | 0.7595 | 0.3212 |
| Edit type | What changes | Clinical (MIMIC-IV) | Span edit (MCQ) |
|---|---|---|---|
| Remove | An evidence item or channel is withheld | modality_ablation | delete |
| Add | Hypothetical evidence or an alternative explanation is introduced | evidence_addition , cause_swap | add |
| Replace | A finding, observation time, treatment, or support state is substituted | action_change , temporal_shift | replace |
| Mixed | Several atomic edits of different types | – (single edit) | combination |
| Base model | Context | Accuracy | AUROC | AUPRC |
|---|---|---|---|---|
| Qwen2.5-7B | None / learned CF | 0.5839 / 0.7372 | 0.7000 / 0.7543 | 0.2252 / 0.2985 |
| Llama3-8B | None / learned CF | 0.6065 / 0.7424 | 0.7025 / 0.7466 | 0.2268 / 0.2830 |
| MedGemma-4B | None / learned CF | 0.7620 / 0.8027 | 0.7117 / 0.7374 | 0.2344 / 0.2906 |
| Accuracy (%) | Answer changes | |||||
| Base model | Zero-shot | RAG | GSEM | Ours | Corrected | Harmed |
| DiagnosisArena ( ) | ||||||
| Qwen2.5-7B | 34.8 | 26.8 | 26.8 | 66.7 | 47 | 3 |
| Llama3-8B | 30.4 | 29.7 | 31.2 | 61.6 | 43 | 0 |
| MedGemma-4B | 37.7 | 33.3 | 33.3 | 63.0 | 35 | 3 |
| MMMU Business ( ) | ||||||
| Base model | Initial correct | Final correct | Corrected | Harmed | Gain (pp) |
| DiagnosisArena ( ) | |||||
| Qwen2.5-7B | 48 | 92 | 47 | 3 | +31.9 |
| Llama3-8B | 42 | 85 | 43 | 0 | +31.2 |
| MedGemma-4B | 55 | 87 | 35 | 3 | +23.2 |
| MMMU Business ( ) | |||||
| Qwen2.5-7B | 89 | 92 | 4 | 1 | +2.1 |
| Category | Count | Share (%) |
| Adopted outcomes ( ) | ||
| Wrong correct | 39 | 95.1 |
| Wrong different wrong | 2 | 4.9 |
| Correct wrong | 0 | 0.0 |
| Primary CF operation ( ) | ||
| Replace | 19 | 46.3 |
| Policy | Val. acc. | Test acc. | Adopted | Corrected | Harmed | Preserved (%) |
|---|---|---|---|---|---|---|
| Ignore RAG signal | 67.9 | 66.7 | 55 | 47 | 3 | 93.8 |
| Veto explicit REJECT | 56.9 | 52.9 | 32 | 27 | 2 | 95.8 |
| Positive-only (PASS/FLAG) | 52.6 | 48.6 | 21 | 19 | 0 | 100.0 |
| Single-vote + REJECT veto | 67.2 | 66.7 | 51 | 46 | 2 | 95.8 |
| Single-vote + positive support | 66.4 | 64.5 | 44 | 41 | 0 | 100.0 |
| Base model | Zero-shot | Solver-SFT | Ours |
|---|---|---|---|
| DiagnosisArena ( ) | |||
| Qwen2.5-7B | 34.8 | 74.6 | 66.7 |
| Llama3-8B | 30.4 | 79.0 | 61.6 |
| MedGemma-4B | 37.7 | 70.3 | 63.0 |
| MMMU Business ( ) | |||
| Qwen2.5-7B | 61.4 | 62.1 | 63.4 |