Large language models improve reasoning by testing own explanations

From Observation to Intervention: Distilling Self-Generated In-Context Demonstrations via Executable Causal Intervention

Computation and Language

Summary

Large language models (LLMs) can write their own examples to learn from, often better than using examples made by people. The authors found that just checking if an example leads to the right answer isn’t enough because some explanations just look correct but aren’t truly helpful. They created a new way to test explanations by turning them into computer programs to see if they help solve similar problems too. This method keeps only truly useful examples and boosts the model’s reasoning, especially when facing new kinds of questions.

What this means in practice

  • For ai product engineers: Improve reasoning accuracy in AI systems by filtering few-shot examples through executable causal tests for more reliable outputs.$Commercial implications: Enables higher-performance AI assistants by reliably selecting examples that generalize well across tasks, improving product quality.
  • For software developers: Reduce the number of training examples needed for language models by using executable interventions to select only effective demonstrations.

Authors

Minming Ye, Min Liu, Haoang Chi, Ciheng Wu, Naiyang Guan

Abstract

Self-generated In-Context Learning (ICL) enables LLMs to synthesize their own few-shot demonstrations, often outperforming manual prompts. However, existing methods filter demonstrations by observation, assuming a rationale is high-quality if it leads to the correct output. We show such filtering suffers from \textit{observational equivalence}, whereby both faithful causal rationales and spurious post-hoc rationales can yield same outputs and are statistically indistinguishable from observation alone. Inspired by independent causal mechanisms, we argue that faithful rationales imply \textit{transfer invariance}, in which causal rationales should remain effective across logically similar samples. We instantiate this criterion as \textbf{E}xecutable \textbf{C}ausal \textbf{I}ntervention for \textbf{D}emonstrations \textbf{D}istillation (ECI2D), which abstracts language rationales into executable programs and applies the causal interventions ($do$-operator) on logically similar samples, retaining only those demonstrations that imply transfer invariance. Experiments on math, logical and commonsense reasoning benchmarks demonstrate that ECI2D consistently outperforms observation-based ICL while retaining far fewer demonstrations, with gains exceeding 7 points as the test distribution shifts.