先草图后生成:通过面向语言的代码草图提供增量用户反馈并引导大语言模型代码生成
Sketch Then Generate: Providing Incremental User Feedback and Guiding LLM Code Generation through Language-Oriented Code Sketches
AI总结:
针对大语言模型代码生成中提示词编写缺乏即时反馈的问题,提出面向语言的代码草图方法,通过NLP技术将提示词转为代码草图,实现即时增量反馈并引导生成,提升人机交互效果。
摘要:
使用大语言模型(LLM)编写有效的代码生成或编辑提示词并非易事。尤其是提示词编写过程中缺乏即时、稳定的反馈,阻碍了有效交互,因为用户只能在代码生成前在脑中设想可能的结果。针对这一问题,我们提出了面向语言的代码草图绘制方法,这是一种在提示词编写过程中以代码草图(即不完整的代码大纲)形式提供即时增量反馈的交互式方法。该方法利用提示词内部的固有语言结构,并应用经典自然语言处理技术,将提示词转换为代码草图。草图随后作为中间占位符,不仅可以预览预期的代码结构,还能引导LLM生成所需代码,从而增强人与LLM的交互。最后我们讨论了该方法的适用性和未来计划。
英文摘要:
Crafting effective prompts for code generation or editing with Large Language Models (LLMs) is not an easy task. Particularly, the absence of immediate, stable feedback during prompt crafting hinders effective interaction, as users are left to mentally imagine possible outcomes until the code is generated. In response, we introduce Language-Oriented Code Sketching, an interactive approach that provides instant, incremental feedback in the form of code sketches (i.e., incomplete code outlines) during prompt crafting. This approach converts a prompt into a code sketch by leveraging the inherent linguistic structures within the prompt and applying classic natural language processing techniques. The sketch then serves as an intermediate placeholder that not only previews the intended code structure but also guides the LLM towards the desired code, thereby enhancing human-LLM interaction. We conclude by discussing the approach's applicability and future plans.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。