Python is Not Always the Best Choice: Embracing Multilingual Program of Thoughts

Xianzhen Luo, Qingfu Zhu, Zhiming Zhang, Libo Qin, Xuanyu Zhang, Qing Yang, Dongliang Xu, Wanxiang Che


Abstract
Program of Thoughts (PoT) is an approach characterized by its executable intermediate steps, which ensure the accuracy of the logical calculations in the reasoning process. Currently, PoT primarily uses Python. However, relying solely on a single language may result in suboptimal solutions and overlook the potential benefits of other programming languages. In this paper, we conduct comprehensive experiments on the programming languages used in PoT and find that no single language consistently delivers optimal performance across all tasks and models. The effectiveness of each language varies depending on the specific scenarios. Inspired by this, we propose a task and model agnostic approach called MultiPoT, which harnesses strength and diversity from various languages. Experimental results reveal that it significantly outperforms Python Self-Consistency. Furthermore, it achieves comparable or superior performance compared to the best monolingual PoT in almost all tasks across all models. In particular, MultiPoT achieves more than 4.6% improvement on average on ChatGPT (gpt-3.5-turbo-0701).
Anthology ID:
2024.emnlp-main.408
Volume:
Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing
Month:
November
Year:
2024
Address:
Miami, Florida, USA
Editors:
Yaser Al-Onaizan, Mohit Bansal, Yun-Nung Chen
Venue:
EMNLP
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
7185–7212
Language:
URL:
https://aclanthology.org/2024.emnlp-main.408
DOI:
10.18653/v1/2024.emnlp-main.408
Bibkey:
Cite (ACL):
Xianzhen Luo, Qingfu Zhu, Zhiming Zhang, Libo Qin, Xuanyu Zhang, Qing Yang, Dongliang Xu, and Wanxiang Che. 2024. Python is Not Always the Best Choice: Embracing Multilingual Program of Thoughts. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 7185–7212, Miami, Florida, USA. Association for Computational Linguistics.
Cite (Informal):
Python is Not Always the Best Choice: Embracing Multilingual Program of Thoughts (Luo et al., EMNLP 2024)
Copy Citation:
PDF:
https://aclanthology.org/2024.emnlp-main.408.pdf
Software:
 2024.emnlp-main.408.software.zip
Data:
 2024.emnlp-main.408.data.zip