Kajal:利用大语言模型提取源代码语法
Kajal: Extracting Grammar of a Source Code Using Large Language Models
AI总结:
针对手动提取DSL语法耗时易错的问题,提出Kajal方法,通过提示工程、少样本学习和反馈迭代让LLM自动推断语法,实验显示少样本下准确率60%,为自动化语法提取提供了可行方案。
摘要:
理解并提取领域特定语言(DSL)的语法对各类软件工程任务至关重要,但手动构建这类语法耗时且易出错。本文提出Kajal——一种通过提示工程和少样本学习(few-shot learning)利用大语言模型(LLM)从DSL代码片段自动推断语法的新方法。Kajal会动态构建输入提示,利用上下文信息引导LLM生成对应语法,并通过反馈驱动的方法迭代优化这些语法。我们的实验表明,Kajal在使用少样本学习时准确率达60%,不使用时为45%,证明少样本学习对该工具的有效性有显著影响。该方法为自动化DSL语法提取提供了有前景的解决方案,未来工作将探索使用更小的开源LLM,并在更大数据集上测试以进一步验证Kajal的性能。
英文摘要:
Understanding and extracting the grammar of a domain-specific language (DSL) is crucial for various software engineering tasks; however, manually creating these grammars is time-intensive and error-prone. This paper presents Kajal, a novel approach that automatically infers grammar from DSL code snippets by leveraging Large Language Models (LLMs) through prompt engineering and few-shot learning. Kajal dynamically constructs input prompts, using contextual information to guide the LLM in generating the corresponding grammars, which are iteratively refined through a feedback-driven approach. Our experiments show that Kajal achieves 60% accuracy with few-shot learning and 45% without it, demonstrating the significant impact of few-shot learning on the tool's effectiveness. This approach offers a promising solution for automating DSL grammar extraction, and future work will explore using smaller, open-source LLMs and testing on larger datasets to further validate Kajal's performance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。