Are Large Language Models Robust in Understanding Code Against Semantics-Preserving Mutations?

要約

大規模な言語モデル(LLMS)の推論と堅牢性を理解することは、プログラミングタスクでの信頼できる使用にとって重要です。
最近の研究では、プログラムの出力を予測するLLMSの能力を評価していますが、ほとんどの場合、それらの背後にある理由を評価することなく、これらの予測の精度のみに焦点を当てています。
さらに、数学的な推論タスクでは、LLMSが欠陥のあるロジックを通じて正解に到達できることが観察されており、コード理解における同様の問題について懸念を提起しています。
この作業では、最大8Bパラメーターを持つ最先端のLLMがPythonプログラムについて推論できるか、単に推測しているかどうかを評価します。
変数の名前変更、比較式のミラーリング、IF-ELSEブランチの交換、ループのwhileに変換、ループの解消など、5つのセマンティクスを提供するコード変異を適用します。
これらの変異は、その構文を変更しながら、プログラムのセマンティクスを維持します。
6つのLLMSを評価し、LiveCodebenchを使用して人間の専門家分析を実行して、正しい予測が健全な推論に基づいているかどうかを評価しました。
また、LiveCodebenchおよび核兵器のさまざまなコード変異にわたる予測の安定性を評価しました。
私たちの調査結果は、llama3.2などの一部のLLMが、最大61%の症例の欠陥のある推論に基づいて正しい予測を生成することを示しています。
さらに、LLMはしばしばコード変異に応じて予測を変化させ、セマンティック理解における堅牢性が限られていることを示しています。

要約(オリジナル)

Understanding the reasoning and robustness of Large Language Models (LLMs) is critical for their reliable use in programming tasks. While recent studies have assessed LLMs’ ability to predict program outputs, most focus solely on the accuracy of those predictions, without evaluating the reasoning behind them. Moreover, it has been observed on mathematical reasoning tasks that LLMs can arrive at correct answers through flawed logic, raising concerns about similar issues in code understanding. In this work, we evaluate whether state-of-the-art LLMs with up to 8B parameters can reason about Python programs or are simply guessing. We apply five semantics-preserving code mutations: renaming variables, mirroring comparison expressions, swapping if-else branches, converting for loops to while, and loop unrolling. These mutations maintain program semantics while altering its syntax. We evaluated six LLMs and performed a human expert analysis using LiveCodeBench to assess whether the correct predictions are based on sound reasoning. We also evaluated prediction stability across different code mutations on LiveCodeBench and CruxEval. Our findings show that some LLMs, such as Llama3.2, produce correct predictions based on flawed reasoning in up to 61% of cases. Furthermore, LLMs often change predictions in response to our code mutations, indicating limited robustness in their semantic understanding.

arxiv情報

著者 Pedro Orvalho,Marta Kwiatkowska
発行日 2025-05-15 16:04:25+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.SE パーマリンク