Abstract
Program-of-Thought (PoT) reasoning decouples logical reasoning from numerical computation by generating executable code, offering a potential solution to the "multilingual math gap" in Large Language Models (LLMs). This study explores PoT's effectiveness in cross-lingual and multilingual settings through a two-stage framework: Q-R alignment (fine-tuning) and R-A association (quality analysis). We introduce "Soft Self-Consistency," a voting mechanism weighted by code quality (ICE-Score), which significantly boosts multilingual mathematical accuracy, nearly doubling performance in specific cross-lingual configurations.
Introduction
Large Language Models (LLMs) often exhibit a performance gap between English and other languages in mathematical reasoning tasks. While Chain-of-Thought (CoT) prompting—where models generate natural language reasoning steps—is a common approach, it suffers from "entanglement," requiring the model to manage linguistic nuances and arithmetic simultaneously. This often leads to "calculation drift" in non-English contexts.
Program-of-Thought (PoT) addresses this by prompting the model to generate a Python script ($Q \to R$), delegating the execution ($R \to A$) to an external interpreter. This paper investigates the largely unexplored potential of PoT in multilingual and cross-lingual environments.
Methodology
The researchers propose a two-stage framework to decouple the reasoning process from the final answer generation.
1. Q-R Alignment (Fine-tuning)
This stage focuses on the model's ability to map a multilingual question ($Q$) to a reasoning program ($R$). The study examines how different fine-tuning strategies, particularly the use of inline code comments, influence this alignment.
2. R-A Association and Soft Self-Consistency
To measure the functional correctness of the generated code, the authors utilize the ICE-Score (Intermediate Code Evaluation). Building on this, they developed Soft Self-Consistency (Soft-SC). Unlike standard majority voting (Hard-SC), Soft-SC generates multiple code candidates and weights the final answers based on their ICE-Scores, prioritizing programs with higher logical quality.
Data Synthesis
To create high-quality training data, an "Oracle" model (Llama 3.1-405B) was used to synthesize accurate Python solutions (GSM8KPoT and MGSM8KPoT) guided by existing natural language CoT data.
Experimental Setup
The framework was evaluated using:
- GSM8K: The standard English grade-school math dataset.
- MGSM (Multilingual GSM8K): A benchmark of GSM8K problems translated into 10 diverse languages.
- Models: Llama 2-7B and CodeLlama-7B were used to compare the impact of model size versus code-specific pre-training.
Key Insights and Results
The study revealed several critical findings regarding multilingual reasoning:
- The Role of Comments: In cross-lingual (zero-shot) settings, English comments can distract the model. However, in multilingual settings (where target languages are seen during training), translated comments serve as "semantic anchors," improving reasoning alignment.
- Correlation Between Quality and Truth: A high correlation (Spearman's $\rho$ up to 0.91) exists between generated code quality and answer correctness.
- Performance Gains: PoT fine-tuning consistently outperformed CoT. The Soft-SC method provided the most significant improvements; for instance, a Llama 2-7B model's accuracy in a cross-lingual setup increased from 31.6% to 56.6%.
- Pre-training Advantage: CodeLlama-7B outperformed the larger Llama 2-7B, highlighting that exposure to structured code is more vital for multilingual reasoning than raw parameter count.
Conclusion
This research demonstrates that decoupling reasoning from computation via PoT, combined with code-quality-aware decoding, significantly enhances the multilingual capabilities of LLMs. While the study is currently limited to grade-school math (GSM8K), it provides a robust foundation for future work in more complex symbolic and scientific reasoning tasks. Future efforts should focus on reducing the dependency on large Oracle models for quality evaluation and exploring broader alignment techniques.
Summary updated