This paper introduces the retrieval-augmented large language model with Definite Finite Automaton (DFA-RAG), a novel framework designed to enhance the capabilities of conversational agents using large language models (LLMs). Traditional LLMs face challenges in generating regulated and compliant responses in special scenarios with predetermined response guidelines, like emotional support and customer service. Our framework addresses these challenges by embedding a Definite Finite Automaton (DFA), learned from training dialogues, within the LLM. This structured approach acts as a semantic router which enables the LLM to adhere to a deterministic response pathway. The routing is achieved by the retrieval-augmentation generation (RAG) strategy, which carefully selects dialogue examples aligned with the current conversational context. The advantages of DFA-RAG include an interpretable structure through human-readable DFA, context-aware retrieval for responses in conversations, and plug-and-play compatibility with existing LLMs. Extensive benchmarks validate DFA-RAG's effectiveness, indicating its potential as a valuable contribution to the conversational agent.
翻译:本文提出了基于确定性有限自动机的检索增强大语言模型(DFA-RAG),这是一种旨在增强基于大语言模型的对话代理能力的新型框架。传统大语言模型在情感支持、客户服务等具有预设响应准则的特殊场景中,难以生成规范且合规的响应。我们的框架通过将确定性有限自动机嵌入大语言模型来解决这一挑战,该自动机从训练对话中学习得到。这种结构化方法充当语义路由器,使大语言模型能够遵循确定性响应路径。路由通过检索增强生成策略实现,该策略能精准筛选与当前对话语境相匹配的对话示例。DFA-RAG的优势包括:通过人类可读的确定性有限自动机实现可解释结构、支持对话响应的上下文感知检索,以及与现有大语言模型的即插即用兼容性。大量基准测试验证了DFA-RAG的有效性,表明其有望为对话代理领域作出重要贡献。