The Magic of IF: Investigating Causal Reasoning Abilities in Large Language Models of Code
Xiao Liu, Da Yin, Chen Zhang, Yansong Feng, Dongyan Zhao

TL;DR
This paper investigates whether large language models trained on code (Code-LLMs) have enhanced causal reasoning abilities, finding that code prompts significantly improve their performance in causal reasoning tasks compared to text-only models.
Contribution
The study demonstrates that Code-LLMs with code prompts outperform text-only models in causal reasoning and highlights the importance of programming structure in prompt design.
Findings
Code-LLMs with code prompts excel in causal reasoning tasks.
Programming structure in prompts is crucial for performance.
Code-LLMs are robust to format perturbations.
Abstract
Causal reasoning, the ability to identify cause-and-effect relationship, is crucial in human thinking. Although large language models (LLMs) succeed in many NLP tasks, it is still challenging for them to conduct complex causal reasoning like abductive reasoning and counterfactual reasoning. Given the fact that programming code may express causal relations more often and explicitly with conditional statements like ``if``, we want to explore whether Code-LLMs acquire better causal reasoning abilities. Our experiments show that compared to text-only LLMs, Code-LLMs with code prompts are significantly better in causal reasoning. We further intervene on the prompts from different aspects, and discover that the programming structure is crucial in code prompt design, while Code-LLMs are robust towards format perturbations.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Software Engineering Research · Natural Language Processing Techniques
