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.
翻译:大语言模型(LLM)仅凭自然语言指令和少量示例即可解决以往难以处理的任务,但其精确控制仍具挑战性,且缺乏大规模构建可靠软件所需的关键能力:基于可执行契约的模块化计算组合。因此,LLM常被嵌入更庞大的软件管道中,这些管道利用领域知识分解任务,并通过验证与搜索提升可靠性。然而,编写、调优和维护此类管道的复杂性至今限制了其精妙程度。我们提出神谕式编程:一种将传统显式计算与归纳性神谕(如LLM)相结合的基础范式。该范式基于两项核心原则:核心逻辑与搜索逻辑的完全分离(允许后者自由演化而不破坏前者),以及将少样本示例视为可落地且可演化的程序组件。在此范式内,程序员将高层次问题求解策略表达为包含未解析选择点的程序。这些选择点由LLM在运行时解析,LLM通过用户提供的正确/错误决策示例进行泛化。神谕式程序由三个正交组件构成:包含可具化为搜索树的选择点的非确定性策略程序;依托LLM神谕指定搜索树导航策略的政策;描述跨不同问题实例的成功/失败树导航场景的演示集合。每个组件均采用专用编程语言表达。我们重点解决了模块化组合神谕式程序及其组件演化时一致性强制要求的关键编程语言设计挑战。