Recent large language models (LLMs) have demonstrated remarkable generalization abilities in mathematics and logical reasoning tasks. Prior research indicates that LLMs pre-trained with programming language data exhibit high mathematical and reasoning abilities; however, this causal relationship has not been rigorously tested. Our research aims to verify which programming languages and features during pre-training affect logical inference performance. Specifically, we pre-trained decoder-based language models from scratch using datasets from ten programming languages (e.g., Python, C, Java) and three natural language datasets (Wikipedia, Fineweb, C4) under identical conditions. Thereafter, we evaluated the trained models in a few-shot in-context learning setting on logical reasoning tasks: FLD and bAbi, which do not require commonsense or world knowledge. The results demonstrate that nearly all models trained with programming languages consistently outperform those trained with natural languages, indicating that programming languages contain factors that elicit logic inference performance. In addition, we found that models trained with programming languages exhibit a better ability to follow instructions compared to those trained with natural languages. Further analysis reveals that the depth of Abstract Syntax Trees representing parsed results of programs also affects logical reasoning performance. These findings will offer insights into the essential elements of pre-training for acquiring the foundational abilities of LLMs.
Improved Logical Reasoning of Language Models via Differentiable Symbolic Programming
Carnegie Mellon University(卡内基梅隆大学);University of Pennsylvania(宾夕法尼亚大学);Mohamed Bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学);Petuum Inc.(Petuum公司)
Abstract Meaning Representation-Based Logic-Driven Data Augmentation for Logical Reasoning
Strong AI Lab, NAOInstitute, Waipapa Taumata Rau - The University of Auckland(强人工智能实验室、NAO研究所、怀帕帕·陶马陶·劳 - 奥克兰大学);Xtracta, New Zealand(新西兰Xtracta公司);University of Cambridge, UK(英国剑桥大学);Sun Yat-Sen University, China(中国中山大学);The University of Auckland, New Zealand(新西兰奥克兰大学)
DAGN: Discourse-Aware Graph Network for Logical Reasoning
Shenzhen Campus of Sun Yat-sen University(中山大学深圳校区);Tencent Robotics X(腾讯机器人实验室);School of Computer Science, The University of Sydney(悉尼大学计算机科学学院);The Chinese University of Hong Kong(香港中文大学)