论文提出 13 种语言模型与规则引擎耦合模式及选型指南
Hybrid AI Patterns: Thirteen Ways to Couple Language Models with Rules, and How to Choose Among Them
把 LLM 加规则引擎的混搭方式系统梳理成 13 种模式,还带了选型决策指南和失败案例,做 agent 或风控系统的人可以直接查表用。
一篇 arXiv 论文将语言模型与可执行规则语言的组合方式整理为 13 种设计模式,采用面向对象设计模式的目录格式描述,涵盖意图、动机、适用性、实现与已知用例等条目。13 种模式分为四组:4 种涉及模型与规则边界间传递的内容、5 种涉及谁控制谁、3 种涉及模型参与推理的方式、1 种涉及知识的长期保存。论文给出 5 条对所有组合都成立的不变量,并总结 5 种破坏不变量的失败模式。作者基于自身测量构建决策指南,包括单独模型表现不逊于甚至优于混合方案的案例,并报告各设计的成本。
Hybrid AI Patterns: Thirteen Ways to Couple Language Models with Rules, and How to Choose Among Them
Language models handle text well, and rule engines give conclusions with proofs. Systems that combine the two are usually described by example, and the same coupling turns up under different names in agent frameworks, guardrail toolkits and neuro-symbolic research. This document defines thirteen patterns for coupling a language model with an executable rule language, in the catalogue form introduced for object-oriented design: intent, motivation, applicability, participants, collaborations, consequences, implementation, known uses and related patterns. Four patterns concern what crosses the boundary between model and rules, five who controls whom, three how the model takes part in the reasoning, and one how knowledge is kept over time. Five invariants hold for every combination, and five failure patterns name the couplings that break them. We relate the catalogue to published pattern catalogues and taxonomies of hybrid and neuro-symbolic systems and show where they overlap with it. A decision guide leads from a problem to a pattern. It rests on our measurements, including the cases in which a model alone did as well as the hybrid or better, and it reports what each design cost.