Large Language Models (LLMs) increasingly exhibit strong reasoning abilities, often attributed to their capacity to generate chain-of-thought-style intermediate reasoning. Recent work suggests that exposure to code can further enhance these skills, but existing studies largely treat code as a generic training signal, leaving open the question of which properties of code actually contribute to improved reasoning. To address this gap, we study the structural complexity of code, which captures control flow and compositional structure that may shape how models internalise multi-step reasoning during fine-tuning. We examine two complementary settings: solution-driven complexity, where complexity varies across multiple solutions to the same problem, and problem-driven complexity, where complexity reflects variation in the underlying tasks. Using cyclomatic complexity and logical lines of code to construct controlled fine-tuning datasets, we evaluate a range of open-weight LLMs on diverse reasoning benchmarks. Our findings show that although code can improve reasoning, structural properties strongly determine its usefulness. In 83% of experiments, restricting fine-tuning data to a specific structural complexity range outperforms training on structurally diverse code, pointing to a data-centric path for improving reasoning beyond scaling.


翻译:大型语言模型(LLMs)日益展现出强大的推理能力,这通常归因于其生成思维链式中间推理的能力。近期研究表明,接触代码可以进一步提升这些技能,但现有研究大多将代码视为通用训练信号,尚未解答代码的哪些特性实际有助于提升推理能力。为填补这一空白,我们研究了代码的结构复杂度——这种复杂度捕捉了控制流和组合结构,可能影响模型在微调过程中内化多步推理的方式。我们考察了两种互补场景:解决方案驱动的复杂度(同一问题的不同解决方案呈现复杂度差异)和问题驱动的复杂度(复杂度反映底层任务的变化)。通过采用圈复杂度和逻辑代码行数构建受控微调数据集,我们在多样化推理基准上评估了一系列开源权重的大型语言模型。研究结果表明,虽然代码能提升推理能力,但其结构特性强烈决定了代码的有效性。在83%的实验中,将微调数据限制在特定结构复杂度范围内的表现优于使用结构多样化代码的训练,这为超越规模扩展、通过数据中心化方法提升推理能力指明了路径。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
面向大型语言模型推理的可信研究综述
专知会员服务
22+阅读 · 2025年9月6日
大型语言模型推理引擎的综述:优化与效率的视角
专知会员服务
21+阅读 · 2025年5月13日
迈向大型推理模型:基于大型语言模型的强化推理综述
专知会员服务
49+阅读 · 2025年1月17日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
【大模型对齐】利用对齐使大型语言模型更好地推理
专知会员服务
48+阅读 · 2023年9月8日
「大型语言模型推理」综述
专知会员服务
95+阅读 · 2022年12月24日
机器学习必备的数学基础有哪些?
人工智能头条
12+阅读 · 2019年10月18日
深度学习文本分类方法综述(代码)
中国人工智能学会
28+阅读 · 2018年6月16日
关系推理:基于表示学习和语义要素
计算机研究与发展
19+阅读 · 2017年8月22日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
VIP会员
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员