LLMs have demonstrated commendable performance across diverse domains. Nevertheless, formulating high-quality prompts to effectively instruct LLMs poses a challenge for non-AI experts. Existing research in prompt engineering suggests somewhat fragmented 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. 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 capacity of LLMs to produce responses of superior quality compared to baselines. Moreover, LangGPT has proven effective in guiding LLMs to generate high-quality prompts. We have built a community on LangGPT to facilitate the tuition and sharing of prompt design. We also analyzed the ease of use and reusability of LangGPT through a community user survey.
翻译:大型语言模型(LLMs)在多个领域展现了卓越的性能。然而,为有效指导LLMs而制定高质量提示对非AI专家而言是一项挑战。现有提示工程研究多采用碎片化的优化原则,并设计依赖经验的提示优化器。遗憾的是,这些努力缺乏结构化设计模板,导致学习成本高、可复用性低。受结构化可复用编程语言的启发,我们提出LangGPT——一种作为LLMs编程语言的双层提示设计框架。LangGPT具有易于学习的规范结构,并提供用于迁移和复用的扩展结构。实验表明,与基线相比,LangGPT显著增强了LLMs生成更高质量响应的能力。此外,LangGPT在引导LLMs生成高质量提示方面已被证明有效。我们基于LangGPT构建了一个社区,以促进提示设计的教学与共享。我们还通过社区用户调查分析了LangGPT的易用性和可复用性。