这篇论文分析了代码解释器推理的关键属性和认知行为,发现验证、回溯等能提升数学推理效率,适合关心LLM推理优化的人。
研究在多个大语言模型上分析了代码解释器推理的外在属性(关键token)和内在属性(代码认知行为)。发现较强模型的关键token和认知行为(验证、回溯、反向链)更突出。推理时添加关键token在数学、排序、优化任务上提升性能。训练时加入认知行为改进了三个模型中的两个的监督微调和强化学习效果。分析显示这些行为能减少错误回答的过度推理并提高token效率。
Exploring Extrinsic and Intrinsic Properties for Effective Reasoning with Code Interpreter
Reasoning with a Code Interpreter (CI) has emerged as an effective paradigm for enhancing the reasoning capabilities of large language models (LLMs) through executable computation and iterative verification. Despite its growing adoption, the behavioral properties underlying effective code reasoning remain largely underexplored. In this work, we investigate code reasoning from two distinct perspectives inspired by prior studies of natural language reasoning: extrinsic properties, represented by crucial tokens, and intrinsic properties, represented by code-specific cognitive behaviors. Across multiple LLMs, we find that stronger CI reasoning models consistently exhibit a higher prevalence of crucial tokens and cognitive behaviors, particularly verification, backtracking, and backward chaining. Building on these observations, we examine how these properties can be leveraged during both inference and training. At inference time, appending code-specific crucial tokens improves performance on several reasoning capabilities, including mathematical, ordering, and optimization, while yielding limited benefits elsewhere. At training time, augmenting a state-of-the-art framework with code-specific cognitive behaviors improves supervised fine-tuning and reinforcement learning performance in two of three evaluated models. Further analysis shows that these behaviors reduce overthinking in incorrect responses and improve token efficiency, while also revealing factors that limit gains in a certain model. Our findings provide the first systematic characterization of effective reasoning with CI and demonstrate both the potential and limitations of leveraging key properties to improve CI-based reasoning.