CodeSteer: Symbolic-Augmented Language Models via Code/Text Guidance

Yongchao Chen, Yilun Hao, Yueying Liu, Yang Zhang, Chuchu Fan

Abstract

Large Language Models (LLMs) often struggle with tasks requiring precise symbolic reasoning and algorithmic computation. We present CodeSteer, a framework that employs a specialized assistant model (Llama-3-8B) to navigate larger models (e.g., GPT-4o) through complex problem-solving trajectories. By dynamically steering between textual reasoning and code execution, CodeSteer achieves a state-of-the-art score of 86.4 on the SymBench suite, outperforming reasoning-heavy models like OpenAI’s o1 and DeepSeek R1.

Introduction

While LLMs excel at semantic understanding, they frequently fail at "hard" logic tasks such as exact mathematical computation or complex planning. A common failure mode is "overconfidence," where a model attempts to solve a symbolic problem using text when code would be more reliable, or generates "lazy" code that hard-codes a guessed answer. The fundamental challenge lies in steering: the ability to decide when to switch modalities and how to iterate when an initial approach fails.

Methodology: The CodeSteer Framework

CodeSteer introduces a dedicated navigator, the CodeSteerLLM, to guide a primary TaskLLM through a multi-turn problem-solving process.

1. The Assistant Model

The CodeSteerLLM is a fine-tuned Llama-3-8B model trained to review previous attempts and provide specific guidance. This guidance can include suggesting a more sophisticated search algorithm or pivoting from code back to textual reasoning when algorithmic attempts fail.

2. Training via SFT and DPO

The assistant is trained on 12,000 multi-turn trajectories generated via GPT-4o. It is further refined using Direct Preference Optimization (DPO) with a tree-based scoring system that prioritizes reaching the correct answer in the minimum number of turns.

3. Symbolic and Self-Answer Checkers

To combat "lazy code," the framework includes a Symbolic Checker that analyzes code for algorithmic depth (e.g., loops, recursion). Additionally, a Self-answer Checker prompts the TaskLLM to write verification scripts, providing a closed-loop feedback signal to the assistant.

Figure 6: CodeSteer guiding a TaskLLM through the BoxLift task, demonstrating dynamic adaptation from failed code attempts to successful textual reasoning.

Key Insights

  • Small Guides Large: A relatively small 8B parameter model can effectively manage the performance of much larger models like GPT-4o or Claude 3.5 Sonnet.
  • Dynamic Adaptation: CodeSteer allows models to pivot. As shown in the BoxLift example above, if a code-based approach hits an infinite loop or timeout, the assistant steers the model back to textual reasoning to gain new insights.
  • Generalizability: Guidance learned from GPT-4o trajectories generalizes well, providing significant performance boosts (+41.8 points on average) to other models like Mistral and Claude.

Experimental Results

The framework was evaluated on SymBench, a new benchmark of 37 symbolic tasks covering execution, planning, and reasoning.

Figure 1: Performance comparison on SymBench. GPT-4o with CodeSteer outperforms o1 and DeepSeek R1 on both seen and unseen tasks.

As shown in Figure 1, GPT-4o augmented with CodeSteer reached a score of 86.4, significantly higher than OpenAI o1 (82.7) and DeepSeek R1 (76.8). Notably, CodeSteer-guided models maintain high accuracy as task complexity scales, whereas standard models often see performance collapse on tasks like "Game 24" or large-scale multiplication.

Conclusion

CodeSteer demonstrates that external guidance from a specialized, smaller model can unlock the latent symbolic capabilities of large LLMs. By moving beyond static prompting to dynamic, multi-turn steering, the framework provides a more efficient and robust path to solving complex logical problems than internal reasoning chains alone.

Summary updated

BibTeX
@inproceedings{chen2025codesteer,
  author = {Yongchao Chen and Yilun Hao and Yueying Liu and Yang Zhang and Chuchu Fan},
  title = {{CodeSteer: Symbolic-Augmented Language Models via Code/Text Guidance}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=ezna4V4zHs},
}
Figure