In the evolving landscape of software development, Large Language Models (LLMs) exhibit a unique phenomenon known as emergent abilities, demonstrating adeptness across numerous tasks, from text summarization to code generation. While these abilities open up novel avenues in software design and crafting, their incorporation presents substantial challenges. Developers grapple with decisions surrounding the direct embedding of LLMs within applications versus employing them for code generation. Moreover, effective prompt design becomes a critical concern, given the necessity of data extraction from natural language outputs. To address these intricacies, this paper introduces AskIt, a domain-specific language (DSL) specifically designed for LLMs. AskIt simplifies LLM integration, offering type-guided output control, template-based function definitions, and a unified interface that diminishes the distinction between LLM-based code generation and application integration. Furthermore, through Programming by Example (PBE), AskIt harnesses the power of few-shot learning at the programming language level. Our evaluations underscore AskIt's potency. Across 50 tasks, AskIt generated concise prompts for the given tasks, achieving a 16.14% reduction in prompt length relative to benchmarks. Additionally, by enabling the transition from direct LLM application usage to function generation, AskIt achieved significant speedups, as observed in our GSM8K benchmark experiments. Through these advancements, AskIt streamlines the integration of LLMs in software development, offering a more efficient, versatile approach for leveraging emergent abilities. The implementations of AskIt in TypeScript and Python are available at https://github.com/katsumiok/ts-askit and https://github.com/katsumiok/pyaskit, respectively.
翻译:在软件开发不断演变的背景下,大语言模型(LLMs)展现出一种称为“涌现能力”的独特现象,在从文本摘要到代码生成的众多任务中表现出色。尽管这些能力为软件设计与构建开辟了全新途径,但其整合过程仍面临重大挑战。开发者需在将LLM直接嵌入应用程序与将其用于代码生成之间做出权衡。此外,鉴于从自然语言输出中提取数据的必要性,有效的提示设计成为关键问题。为应对这些复杂性,本文提出了AskIt——一种专为LLM设计的领域特定语言(DSL)。AskIt简化了LLM的集成过程,提供类型引导的输出控制、基于模板的函数定义以及一个统一接口,从而模糊了基于LLM的代码生成与应用集成之间的界限。此外,通过示例编程(PBE),AskIt在编程语言层面充分利用了小样本学习能力。我们的评估凸显了AskIt的效能。在50项任务中,AskIt为目标任务生成了简洁的提示,相较于基准实现了16.14%的提示长度缩减。同时,通过支持从直接使用LLM应用到函数生成的转变,AskIt在GSM8K基准实验中取得了显著的加速效果。通过这些改进,AskIt简化了LLM在软件开发中的集成,为利用涌现能力提供了更高效、更通用的方法。AskIt在TypeScript和Python中的实现分别发布于https://github.com/katsumiok/ts-askit和https://github.com/katsumiok/pyaskit。