用检索增强让大模型更准地写代码,减少错误导入。
RAILS: Retrieval-Augmented Intelligence for Learning Software Development
- 从精选Java资源中检索语义相关代码,补全模型提示。
- 通过编译器反馈迭代修正,正确导入率提升显著。
- 适合需要精准代码生成的开发者和教育场景。
大型语言模型(如GPT-3.5-Turbo)在辅助软件开发中日益普及,但常因无法访问外部或项目特定文档而产生不完整代码或错误导入。我们提出RAILS(Retrieval-Augmented Intelligence for Learning Software Development),通过FAISS与OpenAI嵌入技术,从精心整理的Java资源中检索语义相关上下文,增强LLM提示。RAILS引入基于编译器反馈的迭代验证循环,持续优化建议。我们在78个真实世界Java导入错误案例上评估,涵盖标准库、GUI API、外部工具及自定义工具。尽管使用相同LLM,RAILS在保留意图、避免幻觉、正确识别缺失依赖方面显著优于基线提示。未来工作将结合PostgreSQL实现符号过滤,并拓展支持其他语言与IDE。
原文摘要 · Abstract (English)
Large Language Models (LLMs) like GPT-3.5-Turbo are increasingly used to assist software development, yet they often produce incomplete code or incorrect imports, especially when lacking access to external or project-specific documentation. We introduce RAILS (Retrieval-Augmented Intelligence for Learning Software Development), a framework that augments LLM prompts with semantically retrieved context from curated Java resources using FAISS and OpenAI embeddings. RAILS incorporates an iterative validation loop guided by compiler feedback to refine suggestions. We evaluated RAILS on 78 real-world Java import error cases spanning standard libraries, GUI APIs, external tools, and custom utilities. Despite using the same LLM, RAILS outperforms baseline prompting by preserving intent, avoiding hallucinations, and surfacing correct imports even when libraries are unavailable locally. Future work will integrate symbolic filtering via PostgreSQL and extend support to other languages and IDEs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。