Predicting Code Coverage without Execution

要約

コード カバレッジは、ステートメントや分岐などのプログラム要素がテスト中に実行される範囲を定量化するために広く使用されている指標です。
コード カバレッジの計算はリソースを大量に消費するため、コードの構築と実行が必要となり、インストルメンテーションに追加のオーバーヘッドがかかります。
さらに、コードの断片のカバレッジを計算するには、プログラム コンテキスト全体が必要です。
機械学習を使用してこの高価なプロセスを償却すると、ソース コードのコンテキストのみが必要となり、コード カバレッジのコストを削減できます。また、コード カバレッジの予測タスクは、モデルのコードを理解する能力を判断するための新しいベンチマークになる可能性があります。
私たちは、大規模言語モデル (LLM) のコード カバレッジ予測と呼ばれる新しいベンチマーク タスクを提案します。
このタスクを形式化し、特定のテスト ケースと入力によってメソッドのどの行が実行されるかを決定することによって、コード実行を理解する際の LLM の能力を評価します。
HumanEval データセットからテストとコードを実行し、コード カバレッジ情報を収集することで、COVERAGEEVAL と呼ばれるデータセットを厳選してリリースします。
コード関連タスクに使用される 4 つの最先端の LLM (OpenAI の GPT-4 および GPT-3.5-Turbo、Google の BARD、Anthropic の Claude など) のコード カバレッジ予測タスクにおけるパフォーマンスを報告します。
最後に、メトリクスとしてのコード カバレッジと事前トレーニング データ ソースは、ソフトウェア エンジニアリング タスクにおける LLM の全体的なパフォーマンスにとって貴重であると主張します。

要約(オリジナル)

Code coverage is a widely used metric for quantifying the extent to which program elements, such as statements or branches, are executed during testing. Calculating code coverage is resource-intensive, requiring code building and execution with additional overhead for the instrumentation. Furthermore, computing coverage of any snippet of code requires the whole program context. Using Machine Learning to amortize this expensive process could lower the cost of code coverage by requiring only the source code context, and the task of code coverage prediction can be a novel benchmark for judging the ability of models to understand code. We propose a novel benchmark task called Code Coverage Prediction for Large Language Models (LLMs). We formalize this task to evaluate the capability of LLMs in understanding code execution by determining which lines of a method are executed by a given test case and inputs. We curate and release a dataset we call COVERAGEEVAL by executing tests and code from the HumanEval dataset and collecting code coverage information. We report the performance of four state-of-the-art LLMs used for code-related tasks, including OpenAI’s GPT-4 and GPT-3.5-Turbo, Google’s BARD, and Anthropic’s Claude, on the Code Coverage Prediction task. Finally, we argue that code coverage as a metric and pre-training data source are valuable for overall LLM performance on software engineering tasks.

arxiv情報

著者 Michele Tufano,Shubham Chandel,Anisha Agarwal,Neel Sundaresan,Colin Clement
発行日 2023-07-25 10:07:02+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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