To Code or not to Code? Adaptive Tool Integration for Math Language Models via Expectation-Maximization

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Wang, Haozhe, Li, Long, Qu, Chao, Zhu, Fengming, Xu, Weidi, Chu, Wei, Lin, Fangzhen
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866908455167590400
author Wang, Haozhe
Li, Long
Qu, Chao
Zhu, Fengming
Xu, Weidi
Chu, Wei
Lin, Fangzhen
author_facet Wang, Haozhe
Li, Long
Qu, Chao
Zhu, Fengming
Xu, Weidi
Chu, Wei
Lin, Fangzhen
contents Recent advances in mathematical problem-solving with language models (LMs) integrate chain-of-thought (CoT) reasoning and code execution to harness their complementary strengths. However, existing hybrid frameworks exhibit a critical limitation: they depend on externally dictated instructions or rigid code-integration templates, lacking metacognitive awareness -- the capacity to dynamically evaluate intrinsic capabilities and autonomously determine when and how to integrate tools. This rigidity motivates our study of autonomous code integration, enabling models to adapt tool-usage strategies as their reasoning abilities evolve during training. While reinforcement learning (RL) shows promise for boosting LLM reasoning at scale (e.g., DeepSeek-R1), we demonstrate its inefficiency in learning autonomous code integration due to inadequate exploration of the vast combinatorial space of CoT-code interleaving patterns. To address this challenge, we propose a novel Expectation-Maximization (EM) framework that synergizes structured exploration (E-step) with off-policy RL optimization (M-step), creating a self-reinforcing cycle between metacognitive tool-use decisions and evolving capabilities. Experiments reveal our method achieves superior results through improved exploration. Notably, our 7B model improves over 11% on MATH500 and 9.4% on AIME without o1-like CoT.
format Preprint
id arxiv_https___arxiv_org_abs_2502_00691
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle To Code or not to Code? Adaptive Tool Integration for Math Language Models via Expectation-Maximization
Wang, Haozhe
Li, Long
Qu, Chao
Zhu, Fengming
Xu, Weidi
Chu, Wei
Lin, Fangzhen
Artificial Intelligence
Computation and Language
Machine Learning
Recent advances in mathematical problem-solving with language models (LMs) integrate chain-of-thought (CoT) reasoning and code execution to harness their complementary strengths. However, existing hybrid frameworks exhibit a critical limitation: they depend on externally dictated instructions or rigid code-integration templates, lacking metacognitive awareness -- the capacity to dynamically evaluate intrinsic capabilities and autonomously determine when and how to integrate tools. This rigidity motivates our study of autonomous code integration, enabling models to adapt tool-usage strategies as their reasoning abilities evolve during training. While reinforcement learning (RL) shows promise for boosting LLM reasoning at scale (e.g., DeepSeek-R1), we demonstrate its inefficiency in learning autonomous code integration due to inadequate exploration of the vast combinatorial space of CoT-code interleaving patterns. To address this challenge, we propose a novel Expectation-Maximization (EM) framework that synergizes structured exploration (E-step) with off-policy RL optimization (M-step), creating a self-reinforcing cycle between metacognitive tool-use decisions and evolving capabilities. Experiments reveal our method achieves superior results through improved exploration. Notably, our 7B model improves over 11% on MATH500 and 9.4% on AIME without o1-like CoT.
title To Code or not to Code? Adaptive Tool Integration for Math Language Models via Expectation-Maximization
topic Artificial Intelligence
Computation and Language
Machine Learning
url https://arxiv.org/abs/2502.00691