Skip to main content
QUICK REVIEW

[論文レビュー] Automated Unit Test Improvement using Large Language Models at Meta

Nadia Alshahwan, Jubin Chheda|arXiv (Cornell University)|Feb 14, 2024
Software Testing and Debugging Techniques被引用数 5
ひとこと要約

MetaのTestGen-LLMは、LLMを用いて既存の人間が作成したKotlinのテストクラスの改善を自動化し、改善と回帰なしの保証を検証可能な形で提供し、InstagramとFacebookのテスト・アトンで展開されている。

ABSTRACT

This paper describes Meta's TestGen-LLM tool, which uses LLMs to automatically improve existing human-written tests. TestGen-LLM verifies that its generated test classes successfully clear a set of filters that assure measurable improvement over the original test suite, thereby eliminating problems due to LLM hallucination. We describe the deployment of TestGen-LLM at Meta test-a-thons for the Instagram and Facebook platforms. In an evaluation on Reels and Stories products for Instagram, 75% of TestGen-LLM's test cases built correctly, 57% passed reliably, and 25% increased coverage. During Meta's Instagram and Facebook test-a-thons, it improved 11.5% of all classes to which it was applied, with 73% of its recommendations being accepted for production deployment by Meta software engineers. We believe this is the first report on industrial scale deployment of LLM-generated code backed by such assurances of code improvement.

研究の動機と目的

  • 既存の挙動を保ちつつ、見逃しがちなエッジケースを網羅しテストカバレッジを向上させるため、ユニットテストの改善を自動化する動機付け。
  • 検証可能な改善を導くガイドフレームワークとして、Assured Offline LLM-Based Software Engineering (Assured LLMSE)を導入する。
  • TestGen-LLMのシステムアーキテクチャ、フィルタリングパイプライン、およびLLMとプロンプトを評価するテレメトリを説明する。
  • MetaにおけるTestGen-LLMの産業規模での展開経験を報告し、評価結果と得られた教訓を含む。

提案手法

  • 既存のKotlinテストクラスを追加テストで拡張するため、Meta開発の2つのLLMのアンサンブルを使用する。
  • 複数フィルタリングパイプラインを適用する: (i) 生成されたテストがコンパイルされることを保証するビルド可能性フィルター、(ii) テストが一貫して通過することを要求して回帰を防ぐ非回帰フィルター、(iii) 追加テストがカバレッジを改善することを保証するカバレッジフィルター。
  • CI統合を支えるため、テストケースごとの保証と改善を示す測定可能な差分を提供する。
  • 本格展開前にLLMプロンプト、温度設定、プロンプト戦略を検証するテレメトリと評価モードを組み込む。
  • 関連性を最大化しエンジニアの採用を促進するため、差分タイムデプロイメントを伴うMVPから本格展開への道筋を採用する。
  • プロンプティング戦略(extend_coverage、corner_cases、extend_test、statement_to_complete)およびLLMアンサンブル手法を用いて、固有のテスト追加を最大化する。
Figure 1. TestGen-LLM top level architecture (an instance of Assured Offline LLMSE (Alshahwan et al . , 2024 ) ).
Figure 1. TestGen-LLM top level architecture (an instance of Assured Offline LLMSE (Alshahwan et al . , 2024 ) ).

実験結果

リサーチクエスチョン

  • RQ1LLMは既存のテストスイートに対して、ビルドされ、安定して通過し、コードカバレッジを向上させる新しいユニットテストを生成できるか?
  • RQ2AI生成のテスト改善は、産業規模でエンジニアが推奨の多数を受け入れて本番環境に適用されるか?
  • RQ3信頼性の高いテスト生成改善のための効果的なプロンプト戦略と設定(LLMの選択、温度、プロンプト)とは何か?
  • RQ4大規模なコードベースにおけるテストケースごとの保証は、信頼と自動テスト改善の採用にどのように影響するか?
  • RQ5本番のテストワークフローにおけるAssured LLMSEの実用的な展開検討事項と得られた教訓は何か?

主な発見

  • Instagramの評価で、TestGen-LLMのテストケースの75%が正しくビルドされた。
  • テストクラスのうち57%が、少なくとも1つのテストケースが正しくビルドされ、安定して通過した。
  • テストクラスの25%が、少なくとも1つのテストケースが正しくビルドされ、安定して通過し、行カバレッジを向上させる。
  • Instagramのテスト・アトンでは、TestGen-LLMは適用されたすべてのクラスの11.5%を改善した。
  • TestGen-LLMのテスト改善の73%がMetaのエンジニアによって本番展開に受理された。
  • 3回のテスト・アトンを通じて、TestGen-LLMは適用された1,979クラス中196クラスを改善し、約10%となった。
  • FacebookとInstagramの展開で、280の差分のうち144が受理、64が却下、61が審査未了、11が撤回。
  • このアプローチは、回帰に対する検証可能な保証を伴う、スケーラブルで自動化されたテスト改善を実現した。
Figure 2. Sankey diagram showing the filtration process outcomes (as percentages of all test cases) from the Experimental Study on Instagram components for Reels and Stories products, using the four prompt strategies from Table 2 and the two language models, LLM1 and LLM2.
Figure 2. Sankey diagram showing the filtration process outcomes (as percentages of all test cases) from the Experimental Study on Instagram components for Reels and Stories products, using the four prompt strategies from Table 2 and the two language models, LLM1 and LLM2.

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。