LLM-based agents have recently emerged as promising tools for solving challenging problems without the need for task-specific finetuned models that can be expensive to procure. Currently, the design and implementation of such agents is ad hoc, as the wide variety of tasks that LLM-based agents may be applied to naturally means there can be no one-size-fits-all approach to agent design. In this work we aim to alleviate the difficulty of designing and implementing new agents by proposing a minimalistic, high-level generation framework that simplifies the process of building agents. The framework we introduce allows the user to specify desired agent behaviors in Linear Temporal Logic (LTL). The declarative LTL specification is then used to construct a constrained decoder that guarantees the LLM will produce an output exhibiting the desired behavior. By designing our framework in this way, we obtain several benefits, including the ability to enforce complex agent behavior, the ability to formally validate prompt examples, and the ability to seamlessly incorporate content-focused logical constraints into generation. In particular, our declarative approach, in which the desired behavior is simply described without concern for how it should be implemented or enforced, enables rapid design, implementation and experimentation with different LLM-based agents. We demonstrate how the proposed framework can be used to implement recent LLM-based agents, and show how the guardrails our approach provides can lead to improvements in agent performance. In addition, we release our code for general use.
翻译:基于大语言模型(LLM)的智能体近来成为解决复杂问题的有前景工具,无需为特定任务预先训练昂贵的微调模型。目前这类智能体的设计与实现缺乏系统性规范,因为LLM智能体可应用的广泛任务自然意味着不存在放之四海而皆准的设计方法。本研究旨在通过提出一个简约的高层次生成框架来简化智能体构建过程,从而缓解新型智能体设计与实现的困难。我们提出的框架允许用户在线性时序逻辑(LTL)中指定期望的智能体行为。随后利用声明式LTL规范构建约束解码器,确保LLM生成的输出表现出期望行为。通过这种框架设计方式,我们获得了多重优势,包括:强化复杂智能体行为的能力、形式化验证提示示例的能力,以及将内容导向的逻辑约束无缝融入生成过程的能力。特别是,我们采用的声明式方法仅需描述期望行为而无需关心其实现或强制方式,这实现了基于LLM的不同智能体的快速设计、实现和实验验证。我们展示了该框架如何用于实现最新的基于LLM的智能体,并论证了所提供防护栏如何提升智能体性能。此外,我们将开源相关代码供广泛使用。