使用 LLM 起草架构设计决策:DRAFT 方法
DRAFT-ing Architectural Design Decisions using LLMs
AI总结:
本文提出 DRAFT 方法,融合检索增强、少样本与微调三种技术,在 4,911 条 ADR 数据集上验证其生成架构设计决策的有效性与效率,并兼顾隐私和资源约束。
摘要:
架构知识管理(AKM)对软件开发至关重要,但由于缺乏标准化且人工工作量高,仍然面临挑战。架构决策记录(ADR)提供了一种结构化的方式来捕获架构设计决策(ADD),但由于涉及的人工工作量和工具支持不足,其采用受到限制。我们之前的工作表明,大语言模型(LLM)可以辅助生成 ADD。然而,仅仅提示 LLM 并不能产生高质量的 ADD。此外,使用第三方 LLM 会引发隐私问题,而自行托管则带来资源挑战。为此,我们尝试了不同的方法,如少样本、检索增强生成(RAG)和微调,以增强 LLM 生成 ADD 的能力。我们的结果表明,这些技术都能提高有效性。在此基础上,我们提出了领域特定检索增强少样本微调方法 DRAFT,它结合了这三种方法的优势,以实现更有效的 ADD 生成。DRAFT 分两个阶段运行:离线阶段对 LLM 进行微调,使其在检索到的示例增强下生成 ADD;在线阶段利用检索到的 ADR 和微调后的模型生成 ADD。我们在包含 4,911 条 ADR 的数据集和各种 LLM 上对 DRAFT 与现有方法进行了评估,并使用自动化指标和人工评估进行分析。结果表明,DRAFT 在有效性上优于所有其他方法,同时保持了效率。我们的发现表明,DRAFT 可以帮助架构师起草 ADD,同时解决隐私和资源约束问题。
英文摘要:
Architectural Knowledge Management (AKM) is crucial for software development and Architectural Decision Records (ADR), an important artifact of AKM, provide a structured approach to capture Architectural Design Decisions (ADD). However, their adoption is limited due to the manual effort involved and insufficient tool support. Prior work shows that LLMs can support ADD generation, though basic prompting yields suboptimal results. This paper explores how LLMs can support architects in two complementary tasks: generating ADDs from Decision Contexts, and generating complete ADRs from titles. We propose Domain-specific Retrieval Augmented Few-shot Tuning (DRAFT), a novel approach that integrates Retrieval Augmented Few-shot Generation with Fine-tuning to generate. DRAFT operates in two phases: an offline phase that fine-tunes a model using retrieval-augmented prompts derived from historical ADRs, and an online phase that generates decisions or complete ADRs by combining retrieved examples with the fine-tuned model. Evaluated on 4344 ADRs across multiple LLMs using standard NLP metrics, DRAFT consistently produces outputs better aligned with real-world ADRs. A human evaluation with the authors and external architects, however, shows no uniformly preferred approach. DRAFT also maintains practical efficiency, reduces dependence- dence on proprietary models, and addresses organizational concerns around privacy, resource constraints, and inference costs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。