atlas

Research map / Large language models / Agents, code and math

Steering Large Language Models between Code Execution and Textual Reasoning

ICLR 2025 · Large language models › Agents, code and math · approach: Mathematical and structural reasoning benchmarks · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Evaluates when LLMs choose code execution versus textual reasoning across 14 tasks and 6 LLMs, finds no single steering method is optimal, and proposes three methods (Code Interpreter+, Code+Text+Sum., Self-estimate Score) plus multi-turn refinement that improve performance.

Problem

LLMs do not reliably decide when to answer with code versus textual reasoning; existing steering methods (prompting, Code Interpreter, AutoGen) are inconsistent across tasks and models, and textual reasoning fails on math, logic, and planning tasks that code can solve.

Approach

Systematically benchmarks seven existing code/text steering methods across 14 code-solvable tasks and six LLMs, then proposes steering methods that combine a code-based answer and a text-based answer and have the same LLM summarize them, or let the model self-estimate its code and text confidence before choosing a mode, plus multi-turn code-execution refinement.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Combine answers from text and code agents with a summarizerLLMs across 14 tasks · 14 tasks, 6-model averageAverage Normalized Score (%): 79.5 vs. 77.2 (All Code)Helped
Use Code Interpreter+ to encourage code generationGPT-4o · 14 tasksAverage Normalized Score (%): 83.5 -> 85.7Helped
Use Code Interpreter+ to encourage code generationGPT-4o-mini · 14 tasksAverage Normalized Score (%): 80.8 -> 79.0Hurt
Use Code Interpreter+ to encourage code generationGPT-3.5 · 14 tasksAverage Normalized Score (%): 64.5 -> 58.5Hurt
Add a second generation/refinement turn (ablation)All Code · 14 tasks, 6-model averageAverage Normalized Score (%): 77.2 -> 78.6Helped
Add a second generation/refinement turn (ablation)Only Question · 14 tasks, 6-model averageAverage Normalized Score (%): 72.8 -> 65.6Hurt
Add a second generation/refinement turn (ablation)All Text · 14 tasks, 6-model averageAverage Normalized Score (%): 73.9 -> 70.1Hurt
Append `python` to the final question prompt (ablation)All Code · 14 tasks, 6-model averageAverage Normalized Score (%): 77.2 -> 75.9Hurt
Change the system prompt to start the answer with `python` (ablation)All Code · 14 tasks, 6-model averageAverage Normalized Score (%): 77.2 -> 75.5Hurt
Replace original AutoGen prompt with CAMEL prompt (ablation)AutoGen Conca. · 14 tasks, 6-model averageAverage Normalized Score (%): 74.8 -> 72.3Hurt
Replace original AutoGen prompt with paraphrased AutoGen prompt (ablation)AutoGen Conca. · 14 tasks, 6-model averageAverage Normalized Score (%): 74.8 -> 74.4No clear effect
Require code answers rather than text answersLLMs across tasks · 14 taskssuccess rateMixed

Surprising findings

Limitations

Experimental setup

Datasets: Number Multiplying Game 24 GSM-Hard MATH-Geometry MATH-Count&Probability Date Understanding Web of Lies Logical Deduction Navigate BoxNet Path Plan Letters

Benchmarks: Number Multiplying Game 24 GSM-Hard MATH-Geometry MATH-Count&Probability Date Understanding Web of Lies Logical Deduction Navigate BoxNet Path Plan Letters

Metrics: success rate average normalized score token length runtime

Baselines: Only Question All Text All Code All Code + CoT AutoGen Conca. AutoGen System Code Interpreter

Builds on: AutoGen Chain-of-Thought Tree-of-Thought BIG-Bench-Hard

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy