Reproduce “The Magic of IF: Investigating Causal Reasoning Abilities in Large Language Models of Code” on OpenResearch
Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Xiao Liu, Da Yin, Chen Zhang, Yansong Feng, Dongyan Zhao
Researchers enhanced causal reasoning in AI by using Large Language Models of Code (Code-LLMs) with custom 'code prompts' that translate natural language reasoning tasks into a programming code format. A Code-LLM (CODEX) with these code prompts significantly outperformed text-only LLMs on both abductive and counterfactual reasoning tasks, demonstrating that the explicit conditional structures in code are beneficial for understanding cause-and-effect.
Key insights
- Programming code's inherent conditional statements provide a natural expression of causal relationships that Code-LLMs can leverage for reasoning.
- The explicit conditional structure (e.g., 'if-else') in code prompts is crucial for enhancing causal reasoning, with its removal significantly degrading performance.
- Instruction tuning can inadvertently diminish certain causal reasoning abilities in LLMs, a phenomenon observed as an 'alignment tax'.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.