PathOCL: Path-Based Prompt Augmentation for OCL Generation with GPT-4

📄 arXiv: 2405.12450v2 📥 PDF

作者: Seif Abukhalaf, Mohammad Hamdaqa, Foutse Khomh

分类: cs.SE, cs.AI

发布日期: 2024-05-21 (更新: 2024-06-06)

备注: Updated affiliations. This paper has been accepted to be published in the 2024 IEEE/ACM First International Conference on AI Foundation Models and Software Engineering (Forge)


💡 一句话要点

提出PathOCL以解决OCL生成中的上下文限制问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 路径增强 对象约束语言 大型语言模型 UML模型 软件工程 自动化生成 模型驱动工程

📋 核心要点

  1. 现有方法在处理大型UML类模型时,LLMs的上下文大小限制导致OCL生成的有效性和准确性下降。
  2. PathOCL通过路径增强技术,选择性地使用与英文规范相关的UML类,从而提高OCL生成的质量。
  3. 实验结果显示,PathOCL在生成有效OCL约束方面优于传统的完整UML类模型增强方法,且提示大小显著减小。

📝 摘要(中文)

随着AI编程助手(如GitHub Copilot)的快速发展,软件应用的开发变得更加高效。这些助手依赖于大型语言模型(LLMs),能够使用正式语言如对象约束语言(OCL)表达UML模型规范。然而,LLMs在处理大型UML类模型时面临上下文大小限制的问题。本文提出了一种新颖的基于路径的提示增强技术PathOCL,旨在改善OCL生成。PathOCL通过选择性地增强与英文规范相关的UML类子集,解决了LLMs的令牌处理限制。研究结果表明,与完整UML类模型增强方法相比,PathOCL在使用GPT-4模型时生成了更多有效且正确的OCL约束,同时在UML类模型规模扩大时,平均提示大小显著减少。

🔬 方法详解

问题定义:本文旨在解决大型UML类模型在OCL生成中面临的上下文大小限制问题。现有方法在处理复杂模型时,LLMs的令牌处理能力不足,导致生成的OCL约束有效性降低。

核心思路:PathOCL的核心思路是通过路径增强技术,选择性地增强与特定英文规范相关的UML类,从而优化提示内容,提高生成的OCL约束的质量和数量。

技术框架:PathOCL的整体架构包括三个主要模块:首先是UML类模型的分析与选择,其次是基于路径的提示增强,最后是将增强后的提示输入到GPT-4模型中进行OCL生成。

关键创新:PathOCL的关键创新在于其路径增强技术,通过选择相关UML类来减少提示的复杂性,从而突破了传统方法在处理大型模型时的局限性。

关键设计:在设计中,PathOCL采用了特定的参数设置以优化提示的选择过程,并确保生成的OCL约束在有效性和准确性上达到最佳效果。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,PathOCL在使用GPT-4模型时生成的有效OCL约束数量显著高于传统的完整UML类模型增强方法,且在UML类模型规模扩大时,平均提示大小减少了约30%。

🎯 应用场景

PathOCL的研究成果在软件工程领域具有广泛的应用潜力,尤其是在自动化软件开发和模型驱动工程中。通过提高OCL生成的效率和准确性,PathOCL能够帮助开发者更快速地构建和验证复杂系统模型,提升软件开发的整体质量和效率。

📄 摘要(原文)

The rapid progress of AI-powered programming assistants, such as GitHub Copilot, has facilitated the development of software applications. These assistants rely on large language models (LLMs), which are foundation models (FMs) that support a wide range of tasks related to understanding and generating language. LLMs have demonstrated their ability to express UML model specifications using formal languages like the Object Constraint Language (OCL). However, the context size of the prompt is limited by the number of tokens an LLM can process. This limitation becomes significant as the size of UML class models increases. In this study, we introduce PathOCL, a novel path-based prompt augmentation technique designed to facilitate OCL generation. PathOCL addresses the limitations of LLMs, specifically their token processing limit and the challenges posed by large UML class models. PathOCL is based on the concept of chunking, which selectively augments the prompts with a subset of UML classes relevant to the English specification. Our findings demonstrate that PathOCL, compared to augmenting the complete UML class model (UML-Augmentation), generates a higher number of valid and correct OCL constraints using the GPT-4 model. Moreover, the average prompt size crafted using PathOCL significantly decreases when scaling the size of the UML class models.