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

Recent advances in mathematical problemsolving 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 codeintegration 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.Code, models and data are released on https://github.com/HaozheH3/AutoCode.

Authors

Publication Details

Published
2025-01-01
DOI
https://doi.org/10.18653/v1/2025.findings-acl.159
Primary Topic
Natural Language Processing Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

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

Wei Chu, Long Li, Fangzhen Lin, Chao Qu et al.
Natural Language Processing Techniques
article

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

Wei Chu, Long Li, Fangzhen Lin, Chao Qu, Weidi Xu, H. Wang, Fengming Zhu
article en

Abstract

Recent advances in mathematical problemsolving 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 codeintegration 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.Code, models and data are released on https://github.com/HaozheH3/AutoCode.

Quality Education
Openalex Percentile: Top 90%
Natural Language Processing Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.