Skip to main content
QUICK REVIEW

[论文解读] Assured LLM-Based Software Engineering

Nadia Alshahwan, Mark Harman|arXiv (Cornell University)|Feb 6, 2024
Business Process Modeling and AnalysisBusiness, Management and Accounting被引用 3
一句话总结

本文提出了一种基于大语言模型的软件工程保障框架(Assured LLMSE),该框架受遗传改进启发,采用语义过滤机制,确保大语言模型生成的代码在保持原始功能的同时,提升可度量的软件属性(如性能和正确性)。该方法通过在离线环境中强制实施可验证、可测试的保证,实现了完全自动化、仅需人工最终审查的代码增强,且无幻觉风险。

ABSTRACT

In this paper we address the following question: How can we use Large Language Models (LLMs) to improve code independently of a human, while ensuring that the improved code - does not regress the properties of the original code? - improves the original in a verifiable and measurable way? To address this question, we advocate Assured LLM-Based Software Engineering; a generate-and-test approach, inspired by Genetic Improvement. Assured LLMSE applies a series of semantic filters that discard code that fails to meet these twin guarantees. This overcomes the potential problem of LLM's propensity to hallucinate. It allows us to generate code using LLMs, independently of any human. The human plays the role only of final code reviewer, as they would do with code generated by other human engineers. This paper is an outline of the content of the keynote by Mark Harman at the International Workshop on Interpretability, Robustness, and Benchmarking in Neural Software Engineering, Monday 15th April 2024, Lisbon, Portugal.

研究动机与目标

  • 解决确保大语言模型生成的代码在提升可度量的软件属性的同时不退化原始功能的挑战。
  • 在无需人工干预(仅最终审查除外)的情况下,实现完全自动化的代码改进。
  • 开发一种可验证、可测试、可度量的大语言模型代码生成框架,支持离线保障。
  • 通过语义过滤与基于搜索的优化,弥合大语言模型代码生成与形式化软件工程实践之间的差距。
  • 探索可扩展的混合计算搜索策略,整合大语言模型与软件度量、遗传改进技术。

提出的方法

  • 采用生成与测试的流水线,其中大语言模型生成代码变体,随后通过自动化语义过滤验证功能和性能保证。
  • 应用一系列语义过滤器作为适应度函数,确保生成的代码保留原始行为,并在执行时间、内存使用量和测试覆盖率等指标上实现改进。
  • 利用离线处理支持耗时的验证步骤,如完整回归测试、静态分析和代码检查器强制执行。
  • 利用重提示(re-prompting)和链式提示(chained prompting)策略,基于SBSE原则迭代优化大语言模型输出。
  • 引入面向领域和代码的提示语言,专为计算搜索设计,使遗传算子能够演化出高效的提示策略。
  • 将大语言模型推理与并行计算搜索相结合,以扩展优化过程,利用大语言模型响应评估的天然并行性。
Figure 1. Top level comparison between Assured and Non-Assured Large Language Model Software Engineering. In the assured mode, there is a whole infrastructure phase for implementing ‘Assurance by Analysis and Manipulation’. This assurance phase pre-processes and post-processes the initial code produ
Figure 1. Top level comparison between Assured and Non-Assured Large Language Model Software Engineering. In the assured mode, there is a whole infrastructure phase for implementing ‘Assurance by Analysis and Manipulation’. This assurance phase pre-processes and post-processes the initial code produ

实验结果

研究问题

  • RQ1如何在不退化原始功能的前提下改进大语言模型生成的代码?
  • RQ2哪些机制可确保大语言模型生成的代码改进是可验证、可度量且形式化保证的?
  • RQ3如何系统性地将离线的 LLMSE 迁移至在线部署,同时保持保证的完整性?
  • RQ4在基于大语言模型的代码优化中,哪些高效近似度量可作为昂贵适应度函数的快速代理?
  • RQ5如何利用领域感知与代码感知的搜索策略,在大语言模型的条件概率分布中导航,以找到最优的代码改进?

主要发现

  • Assured LLMSE 框架通过语义过滤器强制实施可验证、可测试、可度量的保证,成功将代码生成与人工审查解耦。
  • 离线部署支持严格的保证检查(如完整回归测试和静态分析),这些在实时在线环境中难以实现。
  • 语义过滤器作为有效的适应度函数,可防止幻觉现象,确保仅保留语义正确且性能改进的代码变体。
  • 该方法实现了代码改进的完全自动化,人类工程师仅作为最终审查者,类似于人类开发者生成的代码。
  • 该框架证明了将 SBSE 与 GI 原理整合到大语言模型驱动的代码工程中,可实现系统化、可度量且可靠的改进。
  • 可扩展的混合策略(包括并行评估多个提示程序)在降低大规模 LLMSE 流水线计算成本方面展现出潜力。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。