From Outcomes to Components: A Counterfactual Evaluation Framework for LLM-Proposed Repairs
Organizations: ShanghaiTech University · City University of Hong Kong
Abstract
An LLM-generated repair action specifies which records to change and by how much. A failed action may still contain a useful target set or numerical update, depending on how the two are paired. We evaluate this problem in traffic networks and databases, where aggregate observations obscure the records that need correction. We examine the pairings by executing each combination from the same initial state, using a reference action that restores the affected records. In 76 of 114 traffic actions, the gain from correcting both parts exceeds the sum of the gains from correcting each part alone. Six of these actions become worse after either correction alone, but improve when both parts are corrected. In database repair, replacing only the proposed update with the reference update worsens 17 of 108 model actions, all of which select unaffected records. We also test whether parts of two proposals can be reused. On held-out observations, selecting among the proposals and their recombined target-update pairs recovers 61.6% of the reference action's loss reduction, compared with 58.0% from selecting between the proposals alone.
Figures & tables
| Analysis | Included observations |
|---|---|
| Traffic survey | 77 episodes from 11 models and seven conditions. Five numerical-repair conditions yield 55 actions. Sensor bias and the healthy control contribute recognition outcomes. |
| Traffic components | 140 demand episodes yield 117 demand-scaling actions. Three empty target sets leave 114 for component analysis. A sparse-target subset contains 54 actions and 28 distinct state–target combinations for search. |
| Database components | 108 actions from three models, six faults, two evidence conditions, and three generations. |
| Traffic preview | 72 directional evaluations from three models, four faults, three generations, and two panel directions. Averaging directions yields 36 paired results. |
| Model | Excess targets | Harm among all actions | Harm with excess targets | Harm counts by repetition |
|---|---|---|---|---|
| DeepSeek-Flash | 21/36 | 15/36 | 15/21 | 7, 3, 5 |
| K3 | 4/36 | 2/36 | 2/4 | 1, 0, 1 |
| GLM-5.3 | 1/36 | 0/36 | 0/1 | 0, 0, 0 |
| Action | DeepSeek-Flash | GLM-5.3 |
|---|---|---|
| Agent action | 0.427 | |
| Replace targets | 0.517 | |
| Replace update | 1.000 | |
| Reference action | 1.000 | 1.000 |
| Candidate set | Candidates | Mean recovery rate |
|---|---|---|
| Original record-level proposal | 1 | 0.030 |
| Original grouped proposal | 1 | 0.506 |
| Two original proposals | 2 | 0.580 |
| Originals + midpoint updates | 4 | 0.605 |
| Originals + crossed components | 4 | 0.616 |
| Candidate | Targets | Multiplier | Selection loss | Held-out |
|---|---|---|---|---|
| Record targets, record update | 5 | 1.250 | 40.224 | 0.046 |
| Grouped targets, grouped update | 103 | 1.450 | 71.762 | 0.218 |
| Record targets, grouped update | 5 | 1.450 | 35.856 | 0.079 |
| Grouped targets, record update | 103 | 1.250 | 13.749 | 0.680 |
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
| Target F1 | Actions | ||
|---|---|---|---|
| Below 0.5 | 60 | 0.583 | 0.247 |
| 0.5 to below 0.9 | 18 | 0.449 | 0.224 |
| 0.9 and above | 36 | 0.000 | 0.063 |
| Model | Eligible actions | Agent | ||
|---|---|---|---|---|
| K3 | 23 | 0.664 | 0.274 | 0.062 |
| DeepSeek-Flash | 23 | 0.345 | 0.487 | 0.168 |
| GLM-5.3 | 23 | 0.575 | 0.229 | 0.196 |
| GLM-Flash | 23 | 0.465 | 0.378 | 0.157 |
| MiMo-Pro | 22 | 0.122 | 0.527 | 0.351 |
| Execution | Mean | Median | Max | |
|---|---|---|---|---|
| Agent action | 0.113 | 0.117 | 0.291 | 0/54 |
| Replace update | 0.206 | 0.176 | 0.432 | 0/54 |
| Fixed-target search | 0.437 | 0.450 | 0.696 | 0/54 |
| Replace targets | 0.794 | 0.867 | 1.000 | 22/54 |
| Reference action | 1.000 | 1.000 | 1.000 | 54/54 |
| Fault | Affected intersection | Injected change |
|---|---|---|
| Amount | Shipping mode and return status | Multiply amount by 1.270 |
| Rate | Shipping mode and return status | Add 0.023 to adjustment rate |
| Amount | Handling instruction and return status | Multiply amount by 0.790 |
| Rate | Handling instruction and return status | Subtract 0.018 from adjustment rate |
| Amount | Shipping mode and handling instruction | Multiply amount by 1.340 |
| Rate | Shipping mode and handling instruction | Add 0.017 to adjustment rate |
| Model | Round | Excess | Harm/all | Harm/excess | Mean | Median |
|---|---|---|---|---|---|---|
| DeepSeek-Flash | 1 | 8/12 | 7/12 | 7/8 | -0.570 | -0.042 |
| 2 | 6/12 | 3/12 | 3/6 | 0.137 | 0.001 | |
| 3 | 7/12 | 5/12 | 5/7 | 7.192 | 0.000 | |
| K3 | 1 | 1/12 | 1/12 | 1/1 | -0.112 | 0.000 |
| 2 | 2/12 | 0/12 | 0/2 | 0.449 | 0.000 | |
| 3 | 1/12 | 1/12 | 1/1 | 0.034 | 0.000 |
| Repeat | Fault | Evidence | Target F1 | Excess | ||||
|---|---|---|---|---|---|---|---|---|
| 1 | Amount | Direct | 1.000 | 0 | 1.000 | 1.000 | 1.000 | 1.000 |
| 1 | Amount | Time-grouped | 0.395 | 64572 | 0.341 | 0.760 | -2.036 | 1.000 |
| 1 | Rate | Direct | 0.673 | 42266 | 0.055 | 0.051 | -0.008 | 1.000 |
| 1 | Rate | Time-grouped | 0.941 | 5402 | 0.973 | 1.000 | 0.951 | 1.000 |
| 1 | Amount | Direct | 1.000 | 0 | 1.000 | 1.000 | 1.000 | 1.000 |
| 1 | Amount | Time-grouped | 0.393 | 113858 | -3.507 | -0.946 | -6.873 | 1.000 |
| Repeat | Fault | Evidence | Target F1 | Excess | ||||
|---|---|---|---|---|---|---|---|---|
| 1 | Amount | Direct | 1.000 | 0 | -0.828 | -0.828 | 1.000 | 1.000 |
| 1 | Amount | Time-grouped | 0.225 | 145540 | -0.369 | 0.807 | -3.844 | 1.000 |
| 1 | Rate | Direct | 1.000 | 0 | 1.000 | 1.000 | 1.000 | 1.000 |
| 1 | Rate | Time-grouped | 1.000 | 0 | 1.000 | 1.000 | 1.000 | 1.000 |
| 1 | Amount | Direct | 1.000 | 0 | 1.000 | 1.000 | 1.000 | 1.000 |
| 1 | Amount | Time-grouped | 0.931 | 0 | 0.646 | 0.691 | 0.953 | 1.000 |
| Repeat | Fault | Evidence | Target F1 | Excess | ||||
|---|---|---|---|---|---|---|---|---|
| 1 | Amount | Direct | 0.932 | 0 | 0.949 | 0.996 | 0.955 | 1.000 |
| 1 | Amount | Time-grouped | 1.000 | 0 | 0.589 | 0.589 | 1.000 | 1.000 |
| 1 | Rate | Direct | 1.000 | 0 | 0.907 | 0.907 | 1.000 | 1.000 |
| 1 | Rate | Time-grouped | 0.941 | 5402 | 0.766 | 0.904 | 0.951 | 1.000 |
| 1 | Amount | Direct | 0.931 | 0 | 0.953 | 1.000 | 0.953 | 1.000 |
| 1 | Amount | Time-grouped | 1.000 | 0 | -1.973 | -1.973 | 1.000 | 1.000 |
| Case | Condition | Injected multiplier | Planted targets |
|---|---|---|---|
| Broad deficit | Demand deficit | 0.616 | 168 OD pairs |
| Broad surplus | Demand surplus | 1.268 | 168 OD pairs |
| Capacity reduction | Capacity reduction | 0.781 | 3 links |
| Localized deficit | Demand deficit | 0.532 | 48 OD pairs |
| Localized surplus | Demand surplus | 1.878 | 48 OD pairs |
| Sensor bias | Sensor bias | 1.878 | 6 sensors |
| Model | Recognized | Recognized numerical cases | Mean | ||
|---|---|---|---|---|---|
| K3 | 4/7 | 2/5 | 0.023 | 0/5 | 0/5 |
| GLM-Flash | 4/7 | 2/5 | 0.036 | 0/5 | 0/5 |
| DeepSeek-Flash | 2/7 | 0/5 | 0.000 | 0/5 | 0/5 |
| GLM-5.3 | 6/7 | 4/5 | 0.083 | 0/5 | 0/5 |
| MiMo-Pro | 5/7 | 3/5 | 0.015 | 0/5 | 0/5 |
| Short name | Endpoint identifier | Evaluation date (2026) |
|---|---|---|
| Astra | openai/gpt-6-astra | Sep 12 |
| Sol | openai/gpt-5.6-sol | Sep 12 |
| Terra | openai/gpt-5.6-terra | Sep 12 |
| Opus | anthropic/claude-opus-4.8 | Sep 12 |
| Sonnet | anthropic/claude-sonnet-4.6 | Sep 12 |
| Gemini | google/gemini-3.8-flash | Sep 12 |
| Model | Endpoint identifier | Date (2026) | Max tokens | Reasoning |
|---|---|---|---|---|
| K3 | kimi-k3 | Sep 14 | 16,384 | unspecified |
| DeepSeek-Flash | deepseek-flash | Oct 17 | 8,192 | disabled |
| GLM-Flash | z-ai/glm-5.3-flash | Sep 14 | 16,384 | high |
| GLM-5.3 | z-ai/glm-5.3 | Sep 15 | 16,384 † | high † |
| MiMo-Pro | xiaomi/mimo-v2.5-pro | Sep 15 | 16,384 | unspecified |
| Model | Conditions | Returned provider |
|---|---|---|
| K3 | All | native endpoint |
| DeepSeek-Flash | All | native endpoint |
| GLM-Flash | All | StreamLake |
| GLM-5.3 | Broad deficit, broad surplus | DeepInfra |
| GLM-5.3 | Capacity reduction, localized deficit, sensor bias | Reka |
| GLM-5.3 | Localized surplus, healthy | Morph |
| Model | Endpoint identifier | Gateway | Max tokens | Reasoning |
|---|---|---|---|---|
| K3 | moonshotai/kimi-k3 | OpenRouter | 49,152 | high |
| DeepSeek-Flash | deepseek-flash | native endpoint | 65,536 | high |
| GLM-5.3 | z-ai/glm-5.3 | OpenRouter | 49,152 | high |
| GLM-Flash | z-ai/glm-5.3-flash | OpenRouter | 49,152 | high |
| MiMo-Pro | xiaomi/mimo-v2.5-pro | OpenRouter | 49,152 | provider default |
Counterfactual Evaluation
Counterfactual evaluation tests how models, explanations, and policies behave under hypothetical changes to inputs, evidence, actions, or environments.
See all 93 papers