LLMs have demonstrated commendable performance across diverse domains. Nevertheless, formulating high-quality prompts to instruct LLMs proficiently poses a challenge for non-AI experts. Existing research in prompt engineering suggests somewhat scattered optimization principles and designs empirically dependent prompt optimizers. Unfortunately, these endeavors lack a structured design template, incurring high learning costs and resulting in low reusability. In addition, it is not conducive to the iterative updating of prompts. Inspired by structured reusable programming languages, we propose LangGPT, a dual-layer prompt design framework as the programming language for LLMs. LangGPT has an easy-to-learn normative structure and provides an extended structure for migration and reuse. Experiments illustrate that LangGPT significantly enhances the performance of LLMs. Moreover, the case study shows that LangGPT leads LLMs to generate higher-quality responses. Furthermore, we analyzed the ease of use and reusability of LangGPT through a user survey in our online community.
翻译:大语言模型已在多个领域展现出卓越性能。然而,为非人工智能专家设计高质量提示以有效指导大语言模型仍具挑战性。现有提示工程研究提出的优化原则较为分散,且设计的提示优化器多依赖经验性方法。这些工作缺乏结构化设计模板,导致学习成本高、可复用性低,同时不利于提示的迭代更新。受结构化可复用编程语言的启发,我们提出LangGPT——一种作为大语言模型“编程语言”的双层提示设计框架。LangGPT具备易于学习的规范结构,并提供支持迁移与复用的扩展结构。实验表明,LangGPT能显著提升大语言模型的性能。案例研究进一步证明,LangGPT可引导大语言模型生成更高质量的回复。此外,我们通过在线社区的用户调研分析了LangGPT的易用性与可复用性。