arXiv:2505.19949cs.LG2025-05NeurIPS被引 5

用影响函数分析数据如何提升数学与代码推理能力

Which Data Attributes Stimulate Math and Code Reasoning? An Investigation via Influence Functions

  • 通过影响函数追踪训练数据对模型推理的贡献,定位关键样本
  • 难数学题能同时提升数学和代码能力,低难度代码题最有效
  • 重加权数据后,模型准确率翻倍,适合想优化训练数据的研究者

大语言模型在数学与代码推理方面表现优异,通常依赖更强模型生成的思维链(CoTs)进行后训练。然而现有数据筛选多依赖启发式方法,缺乏普适性且难以捕捉数据深层特征。本文利用影响函数,系统地将模型在数学与代码任务中的推理能力归因于单个训练样本、序列及词元,揭示了跨任务的非平凡效应:高难度数学题可同时提升数学与代码推理能力,而低难度代码任务对代码推理提升最为显著。基于此,提出一种简单有效的数据重加权策略——反转任务难度,使Qwen2.5-7B-Instruct在AIME24上的准确率从10%提升至20%,在LiveCodeBench上从33.8%提升至35.3%。细粒度分析还发现,序列级探索行为有助于两类推理,而词元级影响模式在数学中偏好自然语言逻辑连接词,在代码中则强调结构语法。

原文摘要 · Abstract (English)

Large language models (LLMs) have demonstrated remarkable reasoning capabilities in math and coding, often bolstered by post-training on the chain-of-thoughts (CoTs) generated by stronger models. However, existing strategies for curating such training data predominantly rely on heuristics, limiting generalizability and failing to capture subtleties underlying in data. To address these limitations, we leverage influence functions to systematically attribute LLMs' reasoning ability on math and coding to individual training examples, sequences, and tokens, enabling deeper insights into effective data characteristics. Our Influence-based Reasoning Attribution (Infra) uncovers nontrivial cross-domain effects across math and coding tasks: high-difficulty math examples improve both math and code reasoning, while low-difficulty code tasks most effectively benefit code reasoning. Based on these findings, we introduce a simple yet effective dataset reweighting strategy by flipping task difficulty, which doubles AIME24 accuracy from 10\% to 20\% and boosts LiveCodeBench accuracy from 33.8\% to 35.3\% for Qwen2.5-7B-Instruct. Moreover, our fine-grained attribution reveals that the sequence-level exploratory behaviors enhance reasoning performance in both math and code, and the token-level influence patterns are distinct for math and code reasoning: the former prefers natural language logic connectors and the latter emphasizes structural syntax.

大模型推理能力数据重加权影响函数

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。