LLMにおけるコード誘導型推論について
On Code-Induced Reasoning in LLMs
September 25, 2025
著者: Abdul Waheed, Zhen Wu, Carolyn Rosé, Daphne Ippolito
cs.AI
要旨
コードデータが大規模言語モデル(LLM)の推論能力を向上させることが示されていますが、コードのどの側面が最も影響を与えているかは不明です。本研究では、この疑問を体系的でデータ中心のフレームワークを用いて調査します。10のプログラミング言語で並列の指示データセットを構築し、コードの構造的または意味的特性を選択的に破壊する制御された摂動を適用します。その後、5つのモデルファミリーと8つのスケールのLLMを各バリアントでファインチューニングし、自然言語、数学、コードタスクにおける性能を評価します。3,331の実験を通じて、LLMが特に数学とコードタスクにおいて、意味的摂動よりも構造的摂動に対して脆弱であることが明らかになりました。擬似コードやフローチャートなどの適切な抽象化は、コードと同様に効果的であり、同じ情報をより少ないトークンでエンコードし、元の構文に従わない場合でも性能を維持または向上させることが多いです。注目すべきは、誤った信号を含む破損したコードでも、表層的な規則性が維持されている場合には競争力を保つことです。最後に、構文スタイルもタスク固有の利得を形成し、Pythonは自然言語推論に有利であり、JavaやRustなどの低レベル言語は数学に有利です。本体系的なフレームワークを通じて、コードの異なる特性が推論にどのように影響するかを明らかにし、LLMの推論能力を向上させるためのトレーニングデータの設計に役立つ知見を提供することを目指します。
English
Code data has been shown to enhance the reasoning capabilities of large
language models (LLMs), but it remains unclear which aspects of code are most
responsible. We investigate this question with a systematic, data-centric
framework. We construct parallel instruction datasets in ten programming
languages and apply controlled perturbations that selectively disrupt
structural or semantic properties of code. We then finetune LLMs from five
model families and eight scales on each variant and evaluate their performance
on natural language, math, and code tasks. Across 3,331 experiments, our
results show that LLMs are more vulnerable to structural perturbations than
semantic ones, particularly on math and code tasks. Appropriate abstractions
like pseudocode and flowcharts can be as effective as code, while encoding the
same information with fewer tokens without adhering to original syntax can
often retain or even improve performance. Remarkably, even corrupted code with
misleading signals remains competitive when surface-level regularities persist.
Finally, syntactic styles also shape task-specific gains with Python favoring
natural language reasoning and lower-level languages such as Java and Rust
favoring math. Through our systematic framework, we aim to provide insight into
how different properties of code influence reasoning and inform the design of
training data for enhancing LLM reasoning capabilities.