arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.01539cs.LG
收藏

可执行反事实:通过代码提升大语言模型的因果推理能力

Executable Counterfactuals: Improving LLMs' Causal Reasoning Through Code

University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);The University of Chicago(芝加哥大学);TTIC;Microsoft Research India(微软印度研究院)

Aniket Vashishtha, Qirun Dai, Hongyuan Mei, Amit Sharma, Chenhao Tan, Hao Peng

AI总结:

针对现有LLM反事实推理评估跳过溯因步骤导致性能高估的问题,提出可执行反事实框架,发现前沿模型反事实推理准确率降25-40%,且强化学习比监督微调更能提升该能力并实现跨域泛化。

摘要:

反事实推理是智能的核心特征,包含三个步骤:从观测中推断潜变量(溯因)、构建替代场景(干预)以及预测其结果(预测)。该能力对提升大语言模型(LLM)的因果理解水平、拓展其在科研等高风险领域的应用至关重要。然而,现有评估LLM反事实推理能力的研究往往跳过溯因步骤,实质上退化为干预推理,导致对LLM性能的高估。\n为解决这一问题,我们提出可执行反事实(executable counterfactuals)框架,这一全新框架通过代码与数学问题将因果推理落地。该框架明确要求完成反事实推理的全部三个步骤,支持生成不同难度的可扩展合成数据,为评估与提升LLM的推理能力设立了新的前沿基准。实验结果显示,对于o4-mini、Claude-4-Sonnet等前沿模型,从干预推理到反事实推理的准确率出现25%-40%的大幅下降。\n为弥补这一性能差距,我们构建了包含带if-else条件的反事实代码问题的训练集,并在带while循环等域外代码结构上进行测试;同时还测试了在代码上训练的模型能否泛化到反事实数学应用题。在更强模型的推理轨迹上进行监督微调虽能提升Qwen系列模型的域内性能,但会导致反事实数学题等域外任务的准确率下降。相比之下,强化学习能够习得核心认知行为并泛化到新领域,在代码任务(提升1.5-2倍)和数学任务上均优于基础模型。对推理轨迹的分析验证了上述发现,凸显了强化学习在提升LLM反事实推理能力方面的潜力。

英文摘要:

Counterfactual reasoning, a hallmark of intelligence, consists of three steps: inferring latent variables from observations (abduction), constructing alternatives (interventions), and predicting their outcomes (prediction). This skill is essential for advancing LLMs' causal understanding and expanding their applications in high-stakes domains such as scientific research. However, existing efforts in assessing LLM's counterfactual reasoning capabilities tend to skip the abduction step, effectively reducing to interventional reasoning and leading to overestimation of LLM performance. To address this, we introduce executable counterfactuals, a novel framework that operationalizes causal reasoning through code and math problems. Our framework explicitly requires all three steps of counterfactual reasoning and enables scalable synthetic data creation with varying difficulty, creating a frontier for evaluating and improving LLM's reasoning. Our results reveal substantial drop in accuracy (25-40%) from interventional to counterfactual reasoning for SOTA models like o4-mini and Claude-4-Sonnet. To address this gap, we construct a training set comprising counterfactual code problems having if-else condition and test on out-of-domain code structures (e.g. having while-loop); we also test whether a model trained on code would generalize to counterfactual math word problems. While supervised finetuning on stronger models' reasoning traces improves in-domain performance of Qwen models, it leads to a decrease in accuracy on OOD tasks such as counterfactual math problems. In contrast, reinforcement learning induces the core cognitive behaviors and generalizes to new domains, yielding gains over the base model on both code (improvement of 1.5x-2x) and math problems. Analysis of the reasoning traces reinforces these findings and highlights the promise of RL for improving LLMs' counterfactual reasoning.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑