让大模型像插件一样可靠组合,实现可维护的智能软件开发
Oracular Programming: A Modular Foundation for Building LLM-Enabled Software
- 将任务分解为可动态调用的大模型决策点,实现模块化编程
- 通过真实示例训练模型选择正确路径,提升复杂任务可靠性
- 适合构建需要长期维护的智能应用系统,如自动化流程引擎
大语言模型(LLMs)仅凭自然语言指令和少量示例即可解决以往难以处理的任务,但在精确控制和大规模可靠软件构建方面仍存在不足,尤其缺乏可验证的模块化计算组合能力。当前多数系统依赖领域知识将任务拆解,并通过验证与搜索提升可靠性,但这类流水线的编写、调优和维护复杂度高,限制了其发展。本文提出‘预言式编程’(Oracular Programming):一种将传统显式计算与归纳型预言者(如LLMs)融合的基础范式。该范式基于两个核心原则:核心逻辑与搜索逻辑完全分离(允许后者独立演化而不破坏前者),以及将少样本示例视为可演化的程序组件。程序员以包含未决选择点的非确定性程序表达高层策略,这些选择点在运行时由LLM通过用户提供的正确与错误决策示例进行泛化求解。一个预言式程序由三部分组成:策略(含可实例化的搜索树)、策略(指导如何利用LLM预言者导航树结构)和示范集(涵盖多种问题实例的成功与失败导航场景)。每个组件使用专用编程语言表达。本文解决了预言式程序模块化组合及组件间一致性保障的关键语言设计挑战。
原文摘要 · Abstract (English)
Large Language Models (LLMs) can solve previously intractable tasks given only natural-language instructions and a few examples, but they remain difficult to steer precisely and lack a key capability for building reliable software at scale: the modular composition of computations under enforceable contracts. As a result, they are often embedded in larger software pipelines that use domain-specific knowledge to decompose tasks and improve reliability through validation and search. Yet the complexity of writing, tuning, and maintaining such pipelines has so far limited their sophistication. We propose oracular programming: a foundational paradigm for integrating traditional, explicit computations with inductive oracles such as LLMs. It rests on two directing principles: the full separation of core and search logic (allowing the latter to freely evolve without breaking the former), and the treatment of few-shot examples as grounded and evolvable program components. Within this paradigm, programmers express high-level problem-solving strategies as programs with unresolved choice points. These choice points are resolved at runtime by LLMs, which generalize from user-provided examples of correct and incorrect decisions. An oracular program is composed of three orthogonal components: a strategy that consists of a nondeterministic program with choice points that can be reified into a search tree, a policy that specifies how to navigate this tree with the help of LLM oracles, and a set of demonstrations that describe successful and unsuccessful tree navigation scenarios across diverse problem instances. Each component is expressed in a dedicated programming language. We address the key programming language design challenges of modularly composing oracular programs and enforcing consistency between their components as they evolve.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。