mlsanityData to 14 Oct 2026

Which Programming Language and What Features at Pre-training Stage Affect Downstream Logical Inference Performance?

arXiv 2410.06735 ↗First posted 9 Oct 2024cs.CL cs.AIcited by 5

On the map: LLM reasoning → Reasoning benchmarks and evaluation

Abstract (arXiv)

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.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Placed in Reasoning benchmarks and evaluation, one of 17 directions in LLM reasoning. Builds on 12 of its 21 references that are in the map. First posted on arXiv 9 Oct 2024.

Builds on

12 of 21 references.

Closest ancestors · 3

Same direction, newest first

  1. 2023Code Llama: Open Foundation Models for Code24 Aug
  2. 2023Learning Deductive Reasoning from Synthetic Corpus based on Formal Logic11 Aug
  3. 2022Language Models of Code are Few-Shot Commonsense Learners13 Oct

Other references · 9

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2023GPT-4 Technical Reportcited by 18,396
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  4. 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,160
  5. 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 713
  6. 2015Towards AI-Complete Question Answering: A Set of Prerequisite Toy Taskscited by 314
  7. 2023SantaCoder: don't reach for the stars!cited by 170
  8. 2023To Repeat or Not To Repeat: Insights from Scaling LLM under Token-Crisiscited by 92
  9. 2023LM-CPPF: Paraphrasing-Guided Data Augmentation for Contrastive Prompt-Based Few-Shot Fine-Tuningcited by 16

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 1; 2025: 1; 2026: 3.

5 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Do Large Language Models Excel in Complex Logical Reasoning with Formal Language?
  2. 2025On Code-Induced Reasoning in LLMs
  3. 2024Do Large Language Models Understand Logic or Just Mimick Context?
  4. 2025Cross-Task Benchmarking and Evaluation of General-Purpose and Code-Specific Large Language Models ↗
  5. 2023At Which Training Stage Does Code Data Help LLMs Reasoning?
  6. 2022Impact of Pretraining Term Frequencies on Few-Shot Reasoning
  7. 2025Reasoning Capabilities and Invariability of Large Language Models
  8. 2025Do LLMs Overthink Basic Math Reasoning? Benchmarking the Accuracy-Efficiency Tradeoff in Language Models