Forethought: Verifiable Reasoning from Neurosymbolic Primitive Programming

arXiv cs.AI Papers

Summary

Forethought is a neurosymbolic reasoning system that treats reasoning as an explicit, verifiable program composed from symbolic and neural primitives. It improves base-model accuracy by about 30% relative and enables small models to match frontier models while being model-agnostic and auditable.

arXiv:2607.04096v1 Announce Type: new Abstract: Current agentic workflows usually involve decomposing user requests into sequences of tool calls with correctly resolved parameters, the results of which are processed through reasoning traces in the language model's context window. The prevailing route to improve such reasoning is test-time scaling, which trains models to search over long chains of thought; but the resulting capability is entangled in model weights, is not verifiable step-by-step, and is costly at inference. We present Forethought, a neurosymbolic reasoning system that instead treats reasoning as an explicit, verifiable program, that builds from a library of symbolic and neural primitives which are composed through a domain-specific language. The result are reasoning programs, which are concrete representations of the model's work, and as such can be inspected and modified before deployment. Instantiated as a tool-calling execution kernel and evaluated across five benchmarks, Forethought improves base-model accuracy by about 30% relative and outperforms vanilla prompting, reinforcement learning scaffolds, and prompt-evolution methods, enabling small models to match or exceed frontier models capabilities. In a direct comparison, a non-reasoning model augmented with Forethought competes with a dedicated reasoning model while requiring roughly three orders of magnitude less post-training investment, and remains model-agnostic and auditable.
Original Article
View Cached Full Text

Cached at: 07/07/26, 04:35 AM

# Forethought: Verifiable Reasoning from Neurosymbolic Primitive Programming
Source: [https://arxiv.org/html/2607.04096](https://arxiv.org/html/2607.04096)
###### Abstract

Current agentic workflows usually involve decomposing user requests into sequences of tool calls with correctly resolved parameters, the results of which are processed through reasoning traces in the language model’s context window\. The prevailing route to improve such reasoning is test\-time scaling, which trains models to search over long chains of thought; but the resulting capability is entangled in model weights, is not verifiable step\-by\-step, and is costly at inference\. We presentForethought, a neurosymbolic reasoning system that instead treats reasoning as an explicit, verifiable program, that builds from a library of symbolic and neural primitives which are composed through a domain\-specific language\. The result arereasoning programs, which are concrete representations of the model’s work, and as such can be inspected and modified before deployment\. Instantiated as a tool\-calling execution kernel and evaluated across five benchmarks,Forethoughtimproves base\-model accuracy by about 30% relative and outperforms vanilla prompting, reinforcement\-learning scaffolds, and prompt\-evolution methods, enabling small models to match or exceed frontier models capabilities\. In a direct comparison, a non\-reasoning model augmented withForethoughtcompetes with a dedicated reasoning model while requiring roughly three orders of magnitude less post\-training investment, and remains model\-agnostic and auditable\.

## Introduction

Large language models are increasingly deployed as agents that must reason over multiple steps and invoke external tools to accomplish tasks\. This shift—from single\-turn text generation to multi\-turn, tool\-using agents—has made*reasoning reliability*a central concern\. An agent that must select the correct function, resolve its parameters from context, respect dependencies between steps, and maintain state across turns has many opportunities to fail, and a single incorrect step can invalidate an entire trajectory\(Patilet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib6); Yaoet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib7)\)\. As these systems move to production, and into regulated domains, accuracy alone is no longer sufficient: their reasoning must also be efficient, cost\-effective, and auditable\.

The current dominant approach to improving reasoning is to scale inference\-time computation\. Reasoning language models such as DeepSeek\-R1\(Guoet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib1)\)are trained through reinforcement learning to produce extended chain\-of\-thought traces, and a growing body of work organizes these test\-time scaling methods into structured search over reasoning chains, trees, and graphs\(Zhanget al\.[2026](https://arxiv.org/html/2607.04096#bib.bib2)\)\. This paradigm has produced impressive results, but it carries three significant drawbacks\. First, the reasoning capability is entangled in the model’s weights: it is the product of expensive, model\-specific training and does not transfer to other base models\. Second, the reasoning process is stochastic and unverifiable—a reasoning model produces a plausible natural\-language chain, but there is no formal guarantee that any given step is correct, and errors are detected only by the model’s own unreliable self\-monitoring\. Third, extended reasoning chains are expensive at inference, in cases consuming many times more tokens than the underlying task requires\.

An alternative line of work treats reasoning as an explicit program over language\-model modules\. Declarative frameworks such as DSPy\(Khattabet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib4)\)and reflective prompt optimizers such as GEPA\(Agrawalet al\.[2026](https://arxiv.org/html/2607.04096#bib.bib3)\)compose and optimize multi\-step pipelines, while neurosymbolic methods such as Logic\-LM\(Panet al\.[2023](https://arxiv.org/html/2607.04096#bib.bib8)\)and neurosymbolic program synthesis\(Ganguly and others[2024](https://arxiv.org/html/2607.04096#bib.bib9)\)offload verification to symbolic components\. These approaches introduce valuable structure, but existing systems either optimize only textual components \(prompts, demonstrations\) without verifying intermediate outputs, or target formal domains such as logic and mathematics that admit clean symbolic specifications\. Neither line fully addresses agentic tool\-calling, where reasoning must be reliable and verifiable but the domain lacks the clean formal semantics of a theorem prover\.

In this work we presentForethought, a neurosymbolic reasoning system for agentic tool\-calling that makes reasoning explicit, verifiable, and model\-agnostic\. Our central idea is to decompose reasoning into a library of*primitives*—narrow reasoning operations implemented either symbolically or as fine\-tuned small language models \(SLMs\)—each carrying a typed*output contract*that specifies the properties its output must satisfy\. Primitives are composed into structured reasoning programs through a Python\-embedded domain\-specific language \(DSL\), and executed by an engine that verifies each primitive’s output against its contract and produces a per\-step verified trace\. Because a reasoning program is represented as an analyzable data structure rather than an opaque chain, it can be inspected and audited at*design time*: a developer establishes the correctness of the program before deployment by reasoning about local contracts and their composition, rather than discovering errors at runtime\. We identify this design\-time verification as the primary source of our accuracy gains\.

This architecture directly addresses the three costs of test\-time scaling\. The reasoning structure is explicit and model\-agnostic—the same program runs on any base model capable of executing its primitives—so it transfers without retraining\. Each step is verifiable, providing the auditability that regulated deployments require\. And because reasoning is carried by small specialized models composed through a constrained program rather than by extended stochastic search, it is far more compute\- and data\-efficient\. Our approach leverages the key observation that formal contracts on model outputs both guarantee correctness and prune the space of candidate programs; we develop this insight into a composable primitive library with a design\-time verification workflow and demonstrate it at scale on agentic benchmarks\.

We evaluate our system on five tool\-calling benchmarks spanning multiple domains, comparing against vanilla LLM prompting, reinforcement learning\-based scaffolds, and reflective prompt evolution\. We empirically demonstrate thatForethoughtconsistently achieves performance improvements when augmenting a wide range of base models, as well as relative to alternative harness engineering approaches\.

Concretely, we lay our contributions as follows:

- •We introduceForethought, a neurosymbolic reasoning architecture for tool\-calling built on verifiable primitives—deterministic and SLM\-based—composed through an embedded DSL with typed contracts and per\-step verification\.
- •We formalize the tool\-calling execution kernel as five composable sub\-processes with explicit contracts and cross\-process invariants, and describe a design\-time verification workflow in which reasoning programs are validated before deployment\.
- •We show that our approach improves base\-model performance by 30–60% relative on reasoning\-intensive tasks, outperforms vanilla prompting, reinforcement learning scaffolds, and reflective prompt optimization across five benchmarks, and enables small models to match or exceed frontier models under vanilla prompting at a fraction of the inference cost\.
- •We demonstrate that a non\-reasoning base model augmented with our neurosymbolic programs competes with a dedicated reasoning model trained through a costly multi\-stage pipeline, while requiring roughly three orders of magnitude less post\-training investment, and we analyze why structured verification succeeds where stochastic scaling has structural limits\.

## Related Work

#### Reasoning Enhancement and Test\-Time Scaling

Reasoning Language Models such as DeepSeek\-R1\(Guoet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib1)\)are trained to produce extended chain\-of\-thought traces, developing behaviors such as self\-verification and reflection through large\-scale stochastic search rather than explicit supervision\.\(Zhanget al\.[2026](https://arxiv.org/html/2607.04096#bib.bib2)\)survey this space and propose a modular blueprint organizing reasoning language models into reasoning structures \(chains, trees, graphs\), search strategies \(Monte Carlo Tree Search, beam search\), and supervision schemes, showing that many prior methods are special cases of a common design space\. From this perspective, such approaches share three drawbacks that our work addresses: the reasoning capability is entangled in model weights and does not transfer across base models; the reasoning process is not verifiable step\-by\-step; and the improvement comes at substantial compute and data cost\. Our approach instead constructs reasoning as an explicit, verifiable, model\-agnostic program\.

#### Neurosymbolic Reasoning

Neurosymbolic methods combine neural language models with symbolic structure to improve reliability and interpretability\. Early work in the LLM era translated natural\-language reasoning into formal representations offloaded to external solvers: Logic\-LM\(Panet al\.[2023](https://arxiv.org/html/2607.04096#bib.bib8)\)couples LLMs with symbolic solvers for faithful logical reasoning, andGanguly and others \([2024](https://arxiv.org/html/2607.04096#bib.bib9)\)use neurosymbolic program synthesis to produce robust and interpretable reasoning by generating programs verified against a theorem prover\. More recent work extends neurosymbolic proceduralization to embodied and efficiency\-constrained settings\(Choiet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib10)\)\. These methods demonstrate that offloading verification to symbolic components improves reliability, but they typically target logical or mathematical domains with clean formal semantics\. Our contribution differs in two respects: we target agentic tool\-calling rather than formal logic, and our symbolic structure is a composable library of verifiable primitives rather than a translation to an external solver\.

#### Declarative LM Programming and Prompt Optimization

A parallel line of work treats reasoning as a program over language\-model modules and optimizes that program automatically\. DSPy\(Khattabet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib4)\)introduced declarative language\-model programs that compile into self\-improving pipelines by optimizing prompts and demonstrations\. GEPA\(Agrawalet al\.[2026](https://arxiv.org/html/2607.04096#bib.bib3)\)evolves task\-specific prompts through reflective, genetic\-Pareto search, using natural\-language feedback to propose improved prompts in few rollouts, and reports gains over reinforcement learning baselines at substantially lower sample cost\. These frameworks share our view that reasoning benefits from explicit program structure, but they optimize*textual*components \(prompts, demonstrations\) of an otherwise unstructured pipeline, without typed contracts or per\-step output verification\. As a result, the composed program cannot be verified at design time, and errors surface only at inference\.

Most closely related to our approach is SEVerA\(Banerjeeet al\.[2026](https://arxiv.org/html/2607.04096#bib.bib5)\), which synthesizes self\-evolving agents with verifiable guarantees by enforcing formal input\-output contracts on model calls\. SEVerA and our work share the central insight that formal contracts on model outputs both guarantee correctness and prune the space of candidate programs, steering synthesis toward higher\-quality agents\. Our approaches differ in emphasis: SEVerA focuses on deductive program synthesis with first\-order\-logic contracts and constraint satisfaction, whereas we focus on a composable primitive library with a design\-time verification workflow and demonstrate the approach at scale across five tool\-calling benchmarks\. The two lines of work are complementary evidence that verifiable, contract\-guarded composition is a promising direction for reliable agents\.

## Methodology

We now present the architecture ofForethoughtin detail\. The system consists of three core components: \(1\) a library of reasoning primitives with verifiable output contracts, \(2\) a Python\-embedded domain\-specific language \(DSL\) for composing primitives into structured reasoning programs, and \(3\) a separate execution engine that interprets, verifies, and optimizes composed programs\. We describe each component and their interactions below\.

### Reasoning Primitive Library

At the foundation of our system lies a library of reasoningprimitives, each one in charge of implementing a narrow, well\-defined reasoning operation\. These primitives can be classified in two groups depending on their implementation style:

#### Symbolic Primitives\.

The semantics of these operations can be expressed as a formal, symbolic program, which by construction entails guaranteed correctness\. Examples are type checking, format validation, constraint propagation, pattern matching, and structural transformations\. Their outputs are deterministic given their inputs, and correctness can be verified trivially by re\-executing the operation\.

#### SLM\-Based Primitives\.

These are implemented as fine\-tuned small language models \(SLMs\), each trained on a narrow task with natural language input\-output semantics, such as entity extraction, relation classification, argument decomposition, or logical entailment checking\. By restricting the scope of each SLM to a single reasoning operation we exploit a fundamental property:*LLM reliability is inversely related to task scope*\(Patilet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib6); Yaoet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib7)\)\. Each SLM\-based primitive is trained on curated data specific to its operation and evaluated against a held\-out test set that covers the expected input distribution\.

Every symbolic or language processing primitive, is associated with an*output contract*: a formal specification of the properties its output must satisfy\. Contracts may include type constraints \(e\.g\., the output must be a valid JSON object conforming to a schema\), value constraints \(e\.g\., extracted entities must appear in the source text\), and semantic constraints \(e\.g\., a decomposition must collectively cover the original query\)\. Contracts are checked automatically at execution time, and contract violations trigger structured error reporting that identifies the failing primitive, its inputs, and the specific constraint that was violated\.

#### Primitive Design Principles\.

We design primitives according to the following criteria:

- •Narrow scope:Each primitive performs a single, well\-defined reasoning operation\. This enables reliable fine\-tuning with limited training data and meaningful output verification\.
- •Composability:Primitive inputs and outputs are typed, enabling static validation of compositions before execution\.
- •Independence:Primitives are stateless and side\-effect\-free, allowing parallel execution of independent operations and deterministic replay for debugging\.
- •Verifiability:Every primitive’s output can be checked against its contract without requiring access to ground\-truth labels, enabling runtime verification in production\.

### Embedded Domain\-Specific Language

We provide a Python\-embedded DSL for composing primitives into structured reasoning programs\. Unlike general\-purpose Python code, programs written in our DSL have formal properties that enable analysis, verification, and optimization before execution\.

#### Composition Operators\.

The DSL provides first\-class composition operators that express common reasoning patterns:

- •Sequence:Execute primitives in order, passing outputs forward\.
- •Parallel:Execute independent primitives concurrently\.
- •Conditional:Branch execution based on intermediate results or contract outcomes\.
- •Iterate:Repeat a subprogram until a termination condition is met\.
- •Fallback:Attempt alternatives upon primitive failure or contract violation\.

These operators are themselves typed, enabling the DSL to validate that composed programs are well\-formed before execution\. For example, the system can statically verify that the output type of a decomposition primitive is compatible with the input type of the subsequent verification primitive\.

#### Formal Properties\.

Using an embedded DSL enables several analyses that are impossible with unstructured Python code:

- •Type\-checked composition:Mismatched primitive interfaces are caught at program construction time, not at runtime\.
- •Cost and latency estimation:The execution engine can traverse the program tree to estimate the number of SLM calls, expected latency, and inference cost before any computation occurs\.
- •Correctness reasoning:If primitiveAAsatisfies contractCAC\_\{A\}and primitiveBBsatisfies contractCBC\_\{B\}, and their composition respects type compatibility, the composed program’s correctness properties can be derived from the individual contracts\.
- •Program optimization:Redundant primitive calls can be eliminated, independent branches can be parallelized, and frequently co\-occurring patterns can be cached—all by transforming the AST before execution\.

#### Distinction from General\-Purpose Libraries\.

The DSL framing is justified by properties that distinguish our system from a standard Python package\. A general\-purpose library provides functions with unconstrained inputs and outputs; our DSL provides primitives with typed, contracted interfaces\. A general\-purpose library’s compositions exist only as imperative code; our DSL’s compositions exist as analyzable data structures\. A general\-purpose library cannot reason about program correctness before execution; our DSL can, by leveraging the formal contracts and typed composition\. These properties are what enable per\-step verification, program optimization, and—as discussed in SectionLABEL:sec:synthesis—automated program synthesis, building on a tradition of neurosymbolic program synthesis for interpretable and faithful reasoning\(Ganguly and others[2024](https://arxiv.org/html/2607.04096#bib.bib9); Panet al\.[2023](https://arxiv.org/html/2607.04096#bib.bib8)\)\.

Algorithm 1Tool\-Calling Execution Kernel\.\[SLM\]marks SLM\-based primitives; all others are deterministic\. Invariant tags reference Section[Tool\-Calling Execution Kernel](https://arxiv.org/html/2607.04096#Sx3.SSx3)\.0:input

ι\\iota, config

γ\\gamma, registry

Ω\\Omega, turn context

τ\\tau
1:// SP1: Decompose

2:

𝑡𝑢𝑟𝑛𝑠←Turns​\(ι\)\\mathit\{turns\}\\leftarrow\\textsc\{Turns\}\(\\iota\)\[SLM\]

3:

𝑐𝑜𝑛𝑓𝑖𝑔←Extract​\(γ\)\\mathit\{config\}\\leftarrow\\textsc\{Extract\}\(\\gamma\);

𝑡𝑜𝑜𝑙𝑠←Register​\(Ω\)\\mathit\{tools\}\\leftarrow\\textsc\{Register\}\(\\Omega\)
4:// SP2: Init\-Scratchpad

5:

S←∅S\\leftarrow\\emptyset;for

\(k,v\)∈𝑐𝑜𝑛𝑓𝑖𝑔\(k,v\)\\in\\mathit\{config\}:

S←S∪\{k↦v\}S\\leftarrow S\\cup\\\{k\\mapsto v\\\}\{INV\-S\}

6:// SP3: Get\-Order

7:

G←BuildDepGraph​\(𝑡𝑢𝑟𝑛𝑠\)G\\leftarrow\\textsc\{BuildDepGraph\}\(\\mathit\{turns\}\)\[SLM\]

8:if

CycleDetect​\(G\)\\textsc\{CycleDetect\}\(G\)thenhalt

9:

T←TopoSort​\(G\)T\\leftarrow\\textsc\{TopoSort\}\(G\)\{leaves first, root last\}

10:for all

t∈Tt\\in Tdo

11:// SP4: Check\-Prerequisites\(t,S\)\(t,S\)

12:for all

p∈GetPrereqs​\(t\)p\\in\\textsc\{GetPrereqs\}\(t\)do

13:

r←Check​\(p,S\)r\\leftarrow\\textsc\{Check\}\(p,S\)\{

𝑀𝑒𝑡\\mathit\{Met\}/

¬𝑀𝑒𝑡\\neg\\mathit\{Met\}/

𝐴𝑏𝑠𝑒𝑛𝑡\\mathit\{Absent\}\}

14:if

r=𝑀𝑒𝑡r=\\mathit\{Met\}then

15:continue

16:elseif

r=¬𝑀𝑒𝑡r=\\neg\\mathit\{Met\}then

17:

t′←TaskToMeet​\(p\)t^\{\\prime\}\\leftarrow\\textsc\{TaskToMeet\}\(p\)\[SLM\]

18:return

⟨𝐵𝑙𝑜𝑐𝑘𝑒𝑑​\(t′\),S⟩\\langle\\mathit\{Blocked\}\(t^\{\\prime\}\),S\\rangle\{

SSunchanged; retry

tt\(INV\-3\)\}

19:else

20:

v←Execute​\(TaskToCheck​\(p\)\)v\\leftarrow\\textsc\{Execute\}\(\\textsc\{TaskToCheck\}\(p\)\)\[SLM\]

21:

S←S∪\{p↦v\}S\\leftarrow S\\cup\\\{p\\mapsto v\\\}\{fires once per

pp\(INV\-2\)\}

22:endif

23:endfor

24:// SP5: Match\-Funcs\-and\-Params\(t,S,τ,Ω\)\(t,S,\\tau,\\Omega\)

25:

f←MatchFunc​\(t,Ω\)f\\leftarrow\\textsc\{MatchFunc\}\(t,\\Omega\)\[SLM\]

26:if

f=⊥f=\\botthen

27:reportMissingFunction;continue\{abandon

tt\(INV\-R\)\}

28:endif

29:

M←Params​\(f\)M\\leftarrow\\textsc\{Params\}\(f\);

B←∅B\\leftarrow\\emptyset
30:for all

m∈Mm\\in Mdo

31:

v←Lookup​\(m,τ,S\)v\\leftarrow\\textsc\{Lookup\}\(m,\\tau,S\)\{

τ​\(m\)\\tau\(m\), else

S​\(m\)S\(m\), else

⊥\\bot\(INV\-3\)\}

32:if

v=⊥v=\\botthen

33:

v←Execute​\(TaskToGet​\(m\)\)v\\leftarrow\\textsc\{Execute\}\(\\textsc\{TaskToGet\}\(m\)\)\[SLM\]

34:

S←S∪\{m↦v\}S\\leftarrow S\\cup\\\{m\\mapsto v\\\}\{write even if

⊥\\bot\(INV\-2\)\}

35:if

v=⊥v=\\botthen reportMissingParam\(

mm\);break

36:endif

37:

B←B∪\{m↦v\}B\\leftarrow B\\cup\\\{m\\mapsto v\\\}
38:endfor

39:if

dom​\(B\)=M\\mathrm\{dom\}\(B\)=Mthen

Execute​\(f,B\)\\textsc\{Execute\}\(f,B\)\{execution guard \(INV\-E\)\}

40:endfor

### Tool\-Calling Execution Kernel

We instantiate the general DSL framework described above as a tool\-calling execution kernel, targeting the agentic tool\-use setting where a language model must decompose user requests into sequences of API calls with correctly resolved parameters\. This instantiation concretizes the primitive library, composition operators, and verification contracts for a specific reasoning domain while preserving the general architectural properties\.

#### Formal Domain\.

The execution kernel operates over the following base sets:𝕍\\mathbb\{V\}\(universe of values\),𝕂\\mathbb\{K\}\(key names, unified namespace for configuration, prerequisites, and parameters\),𝕋\\mathbb\{T\}\(unit task descriptors\),𝔽\\mathbb\{F\}\(callable function identifiers\),𝕄⊆𝕂\\mathbb\{M\}\\subseteq\\mathbb\{K\}\(parameter names\), and𝑆𝑖𝑔\\mathit\{Sig\}\(function signatures mapping names to parameter lists and return types\)\. The kernel receives three inputs:ι∈𝕀\\iota\\in\\mathbb\{I\}\(raw multi\-turn input\),γ∈ℂ\\gamma\\in\\mathbb\{C\}\(initial configuration\), andΩ∈𝕆\\Omega\\in\\mathbb\{O\}\(tool and function registry\)\.

#### Sub\-Process Architecture\.

The kernel comprises five composable sub\-processes, each corresponding to a primitive or composition of primitives in the DSL\. Critically, each sub\-process is implemented using either deterministic primitives, SLM\-based primitives, or a defined combination of both\. This classification determines the verification strategy applied at each stage and makes explicit where neural inference is required versus where symbolic computation suffices\.

1. 1\.Decompose\(ι,γ,Ω\)\(\\iota,\\gamma,\\Omega\): Receives raw inputs and separates them into typed structures—an ordered list of unit tasks𝑡𝑢𝑟𝑛𝑠\\mathit\{turns\}, a key\-value configuration𝑐𝑜𝑛𝑓𝑖𝑔:𝕂⇀𝕍\\mathit\{config\}:\\mathbb\{K\}\\rightharpoonup\\mathbb\{V\}, and a tool registry𝑡𝑜𝑜𝑙𝑠:𝔽⇀𝑆𝑖𝑔\\mathit\{tools\}:\\mathbb\{F\}\\rightharpoonup\\mathit\{Sig\}\. Primitive type: hybrid\.The extraction of configuration \(𝐸𝑥𝑡𝑟𝑎𝑐𝑡​\(γ\)\\mathit\{Extract\}\(\\gamma\)\) and tool registration \(𝑅𝑒𝑔𝑖𝑠𝑡𝑒𝑟​\(Ω\)\\mathit\{Register\}\(\\Omega\)\) aredeterministicprimitives—they parse structured inputs according to fixed schemas, and their outputs are verifiable by checking conformance to the expected types\. The derivation of unit tasks \(𝑇𝑢𝑟𝑛𝑠​\(ι\)\\mathit\{Turns\}\(\\iota\)\) is anSLM\-basedprimitive: it requires natural language understanding to decompose a user request into discrete actionable tasks\. The SLM for this operation is fine\-tuned on task decomposition examples and its output contract requires that every derived task maps to at least one function inΩ\\Omegaand that the union of derived tasks covers the user’s stated intent\.
2. 2\.Init\-Scratchpad\(𝑐𝑜𝑛𝑓𝑖𝑔\)\(\\mathit\{config\}\): Establishes a mutable key\-value storeS:𝕂⇀𝕍S:\\mathbb\{K\}\\rightharpoonup\\mathbb\{V\}, seeded from the configuration output ofDecompose\.SSpersists for the lifetime of the engine run and grows monotonically: keys are never deleted, though values may be overwritten\. Primitive type: deterministic\.Scratchpad initialization is a pure data\-structure operation—iterating over key\-value pairs and writing them into a map\. No neural inference is involved\. Correctness is verified trivially:dom​\(S\)=dom​\(𝑐𝑜𝑛𝑓𝑖𝑔\)\\mathrm\{dom\}\(S\)=\\mathrm\{dom\}\(\\mathit\{config\}\)and∀k:S​\(k\)=𝑐𝑜𝑛𝑓𝑖𝑔​\(k\)\\forall k:S\(k\)=\\mathit\{config\}\(k\)\.
3. 3\.Get\-Order\(𝑡𝑢𝑟𝑛𝑠\)\(\\mathit\{turns\}\): Constructs a dependency graphG=\(V,E\)G=\(V,E\)over unit tasks, detects cycles, and produces a topological orderingTTwhere leaf tasks \(no dependencies\) execute first and the root task executes last\. The ordering satisfies:∀\(ti,tj\)∈E:𝑝𝑜𝑠​\(tj,T\)<𝑝𝑜𝑠​\(ti,T\)\\forall\(t\_\{i\},t\_\{j\}\)\\in E:\\mathit\{pos\}\(t\_\{j\},T\)<\\mathit\{pos\}\(t\_\{i\},T\)\. Primitive type: hybrid\.The dependency graph construction \(𝐵𝑢𝑖𝑙𝑑​\-​𝐷𝑒𝑝​\-​𝐺𝑟𝑎𝑝ℎ\\mathit\{Build\\text\{\-\}Dep\\text\{\-\}Graph\}\) is anSLM\-basedprimitive: determining whether tasktjt\_\{j\}must execute before tasktit\_\{i\}requires semantic understanding of the tasks and their data dependencies\. The SLM is fine\-tuned on dependency classification and its output contract requires that declared dependencies correspond to actual data\-flow relationships \(a task is marked as dependent only if it consumes a value produced by the prerequisite task\)\. Cycle detection and topological sorting aredeterministicprimitives operating on the constructed graph using standard algorithms\. Their correctness is guaranteed by the algorithms themselves\.
4. 4\.Check\-Prerequisites\(t,S\)\(t,S\): For each prerequisiteppof tasktt, evaluates a three\-valued check function: Check​\(p,S\)=\{𝑀𝑒𝑡p∈dom​\(S\)∧𝑆𝑎𝑡​\(p,S​\(p\)\)¬𝑀𝑒𝑡p∈dom​\(S\)∧¬𝑆𝑎𝑡​\(p,S​\(p\)\)𝐴𝑏𝑠𝑒𝑛𝑡p∉dom​\(S\)\\text\{Check\}\(p,S\)\\\!=\\\!\\begin\{cases\}\\mathit\{Met\}&p\\\!\\in\\\!\\text\{dom\}\(S\)\\,\\wedge\\,\\mathit\{Sat\}\(p,S\(p\)\)\\\\ \\neg\\mathit\{Met\}&p\\\!\\in\\\!\\text\{dom\}\(S\)\\,\\wedge\\,\\neg\\mathit\{Sat\}\(p,S\(p\)\)\\\\ \\mathit\{Absent\}&p\\\!\\notin\\\!\\text\{dom\}\(S\)\\end\{cases\}\(1\)The𝐴𝑏𝑠𝑒𝑛𝑡\\mathit\{Absent\}branch triggers inline retrieval, writes the result toSS, and re\-enters the check loop\. The¬𝑀𝑒𝑡\\neg\\mathit\{Met\}branch returns a blocking remediation task\. This guarantees that each prerequisite key fires the𝐴𝑏𝑠𝑒𝑛𝑡\\mathit\{Absent\}branch at most once\. Primitive type: predominantly deterministic\.The domain membership check \(p∈dom​\(S\)p\\in\\mathrm\{dom\}\(S\)\) and the𝐴𝑏𝑠𝑒𝑛𝑡\\mathit\{Absent\}/𝑀𝑒𝑡\\mathit\{Met\}/¬𝑀𝑒𝑡\\neg\\mathit\{Met\}branching logic aredeterministic\. The𝑆𝑎𝑡𝑖𝑠𝑓𝑖𝑒𝑑​\(p,S​\(p\)\)\\mathit\{Satisfied\}\(p,S\(p\)\)predicate may be either deterministic \(e\.g\., checking that a value is non\-null or conforms to a type\) orSLM\-based\(e\.g\., evaluating whether a retrieved value semantically satisfies a domain\-specific condition\)\. When SLM\-based, the predicate’s output contract requires a binary decision with a confidence score, and values below a threshold trigger the¬𝑀𝑒𝑡\\neg\\mathit\{Met\}branch rather than proceeding with uncertain inputs\. The remediation task generation \(Task\-To\-Meet\) and retrieval task generation \(Task\-To\-Check\) areSLM\-basedprimitives that construct well\-formed task descriptors; their contracts require that the generated task, when executed, will produce a value in the domain of the prerequisite key\.
5. 5\.Match\-Functions\-and\-Parameters\(t,S,τ,Ω\)\(t,S,\\tau,\\Omega\): Identifies the best matching functionfffor tasktt, resolves all required parametersMMvia a prioritized lookup \(turn contextτ\\taufirst, scratchpadSSsecond\), and executesffonly when all parameters are fully bound:dom​\(B\)=M\\mathrm\{dom\}\(B\)=M\. Primitive type: hybrid\.Function matching \(Match\-Func\) is anSLM\-basedprimitive: it requires semantic similarity assessment between the task description and the function signatures inΩ\\Omega\. The SLM is fine\-tuned on function\-matching examples and its output contract requires that the matched function’s signature is compatible with the task’s expected input\-output types\. The prioritized lookup function \(Lookup\) isdeterministic: it checksτ\\tauthenSSin fixed order and returns the first defined value, with no neural inference involved\. The execution guard \(dom​\(B\)=M\\mathrm\{dom\}\(B\)=M\) is adeterministiccontract check that prevents partial execution unconditionally\. Parameter retrieval for missing values \(Task\-To\-Get\) follows the same SLM\-based pattern as the retrieval tasks inCheck\-Prerequisites\.

#### Verification Implications of the Classification\.

The explicit classification of each operation as deterministic or SLM\-based has direct consequences for how the system is verified at design time\. Deterministic primitives can be verified exhaustively: their behavior is fully determined by their inputs and can be checked by re\-execution or formal analysis\. SLM\-based primitives are verified probabilistically: their reliability is measured empirically against held\-out test sets, and their output contracts provide runtime checks that catch failures even when the model produces an incorrect output\. The hybrid sub\-processes are verified compositionally: the deterministic components are verified exhaustively, the SLM\-based components are verified probabilistically, and the contracts at the boundaries between them ensure that errors in the SLM\-based components are caught before they propagate into the deterministic components\. This compositional verification strategy is what enables the design\-time validation workflow described in Section[Design\-Time Verification](https://arxiv.org/html/2607.04096#Sx3.SSx6)\.

#### Verifiable Contracts in the Tool\-Calling Instantiation\.

Each sub\-process enforces explicit post\-conditions that serve as output contracts:

- •Decompose:dom​\(𝑐𝑜𝑛𝑓𝑖𝑔\)⊆𝕂\\mathrm\{dom\}\(\\mathit\{config\}\)\\subseteq\\mathbb\{K\};dom​\(𝑡𝑜𝑜𝑙𝑠\)⊆𝔽\\mathrm\{dom\}\(\\mathit\{tools\}\)\\subseteq\\mathbb\{F\}\.
- •Init\-Scratchpad:dom​\(S\)=dom​\(𝑐𝑜𝑛𝑓𝑖𝑔\)\\mathrm\{dom\}\(S\)=\\mathrm\{dom\}\(\\mathit\{config\}\)and∀k:S​\(k\)=𝑐𝑜𝑛𝑓𝑖𝑔​\(k\)\\forall k:S\(k\)=\\mathit\{config\}\(k\)\.
- •Get\-Order: Completeness \(∀t∈𝑡𝑢𝑟𝑛𝑠:t∈T\\forall t\\in\\mathit\{turns\}:t\\in T\), no duplication \(\|T\|=\|𝑡𝑢𝑟𝑛𝑠\|\|T\|=\|\\mathit\{turns\}\|\), dependency respect, and acyclicity\.
- •Check\-Prerequisites: Scratchpad monotonicity \(S′⊇SS^\{\\prime\}\\supseteq S\); at most one𝐵𝑙𝑜𝑐𝑘𝑒𝑑\\mathit\{Blocked\}return per invocation\.
- •Match\-Functions\-and\-Parameters: Execution guard \(Execute​\(f,B\)\\textsc\{Execute\}\(f,B\)is called iffdom​\(B\)=𝑃𝑎𝑟𝑎𝑚𝑠​\(f\)\\mathrm\{dom\}\(B\)=\\mathit\{Params\}\(f\)\); lookup priority \(τ\\taualways consulted beforeSS\)\.

#### Cross\-Process Invariants\.

The following invariants hold globally across all sub\-processes:

- •*Scratchpad monotonicity:*∀\\forallstatesSi,SjS\_\{i\},S\_\{j\}at stepsi<ji<j:dom​\(Si\)⊆dom​\(Sj\)\\mathrm\{dom\}\(S\_\{i\}\)\\subseteq\\mathrm\{dom\}\(S\_\{j\}\)\.
- •*Task queue well\-foundedness:*The engine terminates iff the set of reachable tasks is finite and all dependency graphs are acyclic\.
- •*Execution precondition:*Execute​\(f,B\)\\textsc\{Execute\}\(f,B\)is called iffdom​\(B\)=𝑃𝑎𝑟𝑎𝑚𝑠​\(f\)\\mathrm\{dom\}\(B\)=\\mathit\{Params\}\(f\)\. No partial execution is ever attempted\.
- •*Non\-fatal errors:*Failures abandon only the current tasktt; execution continues with the next task inTT\.

These invariants are not aspirational properties; they are structural consequences of the DSL’s typed composition and contract enforcement\. A program that violates any invariant is rejected at construction time or caught at the first violating step during execution\.

### Execution Engine

The execution engine is responsible for interpreting reasoning programs, managing primitive invocations, enforcing output contracts, and producing structured execution traces\.

#### Interpretation\.

The engine traverses the program AST and evaluates each primitive according to its type\. Deterministic primitives are executed directly\. SLM\-based primitives are dispatched to the appropriate fine\-tuned model, with input formatting, output parsing, and retry logic handled by the engine rather than by the user\.

#### Per\-Step Verification\.

After each primitive produces an output, the engine checks the output against the primitive’s contract\. If the contract is satisfied, execution proceeds\. If the contract is violated, the engine invokes the program’s error\-handling strategy: this may involve retrying the primitive with modified inputs, invoking a fallback primitive, or halting execution with a structured error report\.

#### Symbolic Trace Generation\.

The engine produces a structured trace for every execution\. The trace records, for each primitive invocation: the primitive identity, input values, output values, contract check results, execution time, and model identity \(for SLM\-based primitives\)\. This trace serves multiple purposes:

- •Debugging:When a program produces incorrect results, the trace identifies exactly which primitive failed and why\.
- •Auditability:In regulated industries, the trace provides a complete, inspectable record of the reasoning process that satisfies audit requirements\.
- •Improvement:Traces from production executions identify primitives with high failure rates, guiding targeted retraining or redesign\.
- •Metric collection:Per\-primitive reliability, latency, and cost metrics are derived automatically from traces without user instrumentation\.

#### Optimization\.

Before execution, the engine may apply optimizations to the program AST:

- •Parallelization:Independent primitive calls identified from the AST are dispatched concurrently\.
- •Caching:Results of previously executed primitives with identical inputs are reused\.
- •Batching:Multiple SLM\-based primitive calls targeting the same model are batched for throughput\.
- •Pruning:Branches that are unreachable given earlier contract results are eliminated\.

### Model\-Agnostic Integration

The system is designed to operate independently of any specific foundation model provider\. SLM\-based primitives are fine\-tuned from open\-source base models such as Gemma\(Teamet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib14)\)and DeepSeek\-V3\(DeepSeek\-AIet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib13)\), and the execution engine interfaces with models through an abstraction layer that supports any model serving infrastructure\. This design provides three advantages:

1. 1\.Cost efficiency:Fine\-tuned SLMs at 1–7B parameters are substantially cheaper to run than frontier models at inference time, enabling high\-volume production deployment at a fraction of frontier inference cost\.
2. 2\.Deployment flexibility:Customers can deploy the system on\-premises or in private cloud environments without depending on external API providers, satisfying data sovereignty and security requirements\.
3. 3\.Compounding improvement:As open\-source base models improve, existing primitives can be re\-fine\-tuned on stronger bases, and the reasoning layer’s relative improvement compounds on top of the stronger foundation\.

### Design\-Time Verification

A distinguishing property of our architecture is that reasoning programs can be manually verified for correctness*before deployment*, rather than evaluated only at runtime against test inputs\. This design\-time verification workflow is a primary source of the accuracy improvements we report, and it fundamentally differentiates our approach from systems that rely on post\-hoc output checking or end\-to\-end evaluation\.

#### Verification Workflow\.

The construction of a reasoning program proceeds through explicit verification stages:

1. 1\.Program construction:The developer composes primitives using the DSL, producing an AST that represents the intended reasoning process\.
2. 2\.Static analysis:The system validates type compatibility across all primitive interfaces, checks that every composition is well\-formed, and estimates cost and latency\. Programs with type mismatches or malformed compositions are rejected before any model is invoked\.
3. 3\.Contract review:The developer inspects the output contract of each primitive in the program and verifies that the contracts collectively guarantee the desired end\-to\-end behavior\. Because each primitive has a narrow, well\-defined contract, this review is tractable even for complex programs—the developer reasons about local correctness at each step rather than global correctness of the entire system\.
4. 4\.Edge case analysis:The developer identifies inputs that are likely to stress the program’s assumptions and traces execution through the AST manually, checking whether the contracts and error\-handling strategies cover the anticipated failure modes\.
5. 5\.Controlled execution:The program is executed on a curated set of representative inputs with full trace logging\. The developer inspects the trace to verify that each primitive behaves as expected on real data, and that contract violations are caught and handled appropriately\.
6. 6\.Deployment:Only after passing the above stages is the program deployed to production, where runtime verification continues to enforce contracts on every execution\.

This workflow is analogous to the design\-review and testing practices of traditional software engineering, applied to AI reasoning programs, and reflects a growing line of work that advocates verifying AI systems at design time rather than through runtime safeguards alone\(Haynes[2026](https://arxiv.org/html/2607.04096#bib.bib11); Flandreet al\.[2026](https://arxiv.org/html/2607.04096#bib.bib12)\)\. The key enabler is the decomposition of reasoning into primitives with verifiable contracts: because each step is independently checkable, the developer can establish confidence in the whole program by verifying its parts, rather than treating the system as an opaque end\-to\-end pipeline\.

#### Concrete Validation: BFCL Tool\-Calling\.

We illustrate the design\-time verification methodology through our development of the tool\-calling execution kernel \(Section[Tool\-Calling Execution Kernel](https://arxiv.org/html/2607.04096#Sx3.SSx3)\)\. Prior to deployment, we constructed a synthetic validation dataset of 300 entries modeled on the Berkeley Function\-Calling Leaderboard \(BFCL\)\(Patilet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib6)\)multi\-turn benchmark\. For each entry, we manually worked through the complete DSL execution—decomposition, scratchpad initialization, task ordering, prerequisite checking, and function/parameter matching—producing a fully annotated solution trace that records every sub\-process decision and its justification\.

As a representative example, consider a multi\-turn scenario where Turn 1 creates a directory and moves a file, and Turn 2 requests a search within the moved file\. Figure[1](https://arxiv.org/html/2607.04096#Sx3.F1)shows the complete DSL trace for Turn 2, illustrating how cross\-turn state is managed through the scratchpad formalism\. The resulting tool\-call sequence produces an exact match with the BFCL ground truth\.

Scenario:multi\_turn\_base\_0, Turn 2User input \(ι\\iota\):“Search the moved report for any mention ofrevenue\.”Scratchpad state inherited from Turn 1:S=\{archive↦𝑐𝑟𝑒𝑎𝑡𝑒𝑑,report\.txt↦𝑚𝑜𝑣𝑒𝑑​\_​𝑡𝑜​\_​𝑎𝑟𝑐ℎ𝑖𝑣𝑒\}S=\\\{\\texttt\{archive\}\\mapsto\\mathit\{created\},\\;\\texttt\{report\.txt\}\\mapsto\\mathit\{moved\\\_to\\\_archive\}\\\}1\.Decompose\(ι,γ,Ω\\iota,\\gamma,\\Omega\):t1t\_\{1\}: Navigate toarchivet2t\_\{2\}: Searchreport\.txtfor pattern2\.Get\-Order\(turns\):t1≺t2t\_\{1\}\\prec t\_\{2\}\(must enter directory before searching\)3\.Check\-Prerequisites\(t1,St\_\{1\},S\):P=\{archive\_exists\}P=\\\{\\texttt\{archive\\\_exists\}\\\}Check\(archive\_exists,SS\)=𝑀𝑒𝑡=\\mathit\{Met\}\(from Turn 1 state\)⇒⟨𝑅𝑒𝑎𝑑𝑦,S⟩\\Rightarrow\\langle\\mathit\{Ready\},S\\rangle4\.Match\-Funcs\-and\-Params\(t1,S,τ,Ωt\_\{1\},S,\\tau,\\Omega\):f=cdf=\\texttt\{cd\},M=\{folder\}M=\\\{\\texttt\{folder\}\\\}Lookup\(folder,τ\\tau,SS\):S​\(archive\)→S\(\\texttt\{archive\}\)\\rightarrow’archive’B=\{folder↦’archive’\}B=\\\{\\texttt\{folder\}\\mapsto\\texttt\{'archive'\}\\\},dom​\(B\)=M\\mathrm\{dom\}\(B\)=M✓\\checkmark5\.Match\-Funcs\-and\-Params\(t2,S,τ,Ωt\_\{2\},S,\\tau,\\Omega\):f=grepf=\\texttt\{grep\},M=\{file\_name,pattern\}M=\\\{\\texttt\{file\\\_name\},\\texttt\{pattern\}\\\}Lookup\(file\_name,τ\\tau,SS\):S→S\\rightarrow’report\.txt’Lookup\(pattern,τ\\tau,SS\):τ→\\tau\\rightarrow’revenue’\(from user input\)B=\{file\_name↦’report\.txt’,pattern↦’revenue’\}B=\\\{\\texttt\{file\\\_name\}\\mapsto\\texttt\{'report\.txt'\},\\;\\texttt\{pattern\}\\mapsto\\texttt\{'revenue'\}\\\}✓\\checkmarkDSL output:cd\(folder=’archive’\);grep\(file\_name=’report\.txt’, pattern=’revenue’\)Ground truth:cd\(folder=’archive’\);grep\(file\_name=’report\.txt’, pattern=’revenue’\)Result:✓\\checkmarkExact match \| Functional correctness:✓\\checkmark\| DSL compliance:✓\\checkmark

Figure 1:Cross\-turn state management in the tool\-calling DSL\. Turn 2 resolves the directory and file location from scratchpad state established by Turn 1, while the search pattern is resolved from the current turn’s user input \(τ\\tau\)\. The scratchpad formalism makes cross\-turn dependencies explicit and verifiable, whereas unstructured approaches rely on implicit context\-window management\.A more complex example, shown in Figure[2](https://arxiv.org/html/2607.04096#Sx3.F2), involves cross\-task parameter resolution within a single turn\. When a user requests a passenger name correction on a reservation, the DSL decomposes this into two ordered tasks: retrieve reservation details \(to obtain the existing passenger’s date of birth\), then update the passenger record with the corrected name while preserving the unchanged DOB\. The parameter resolution for the update task demonstrates the lookup priority: the new name comes from the turn contextτ\\tau\(user\-provided\), while the DOB comes from the scratchpadSS\(retrieved by the prior task\)\. This cross\-task state management is made explicit and verifiable by the scratchpad formalism, whereas in unstructured approaches it would be implicit in the model’s context window\.

Scenario:Passenger name correctionUser input \(ι\\iota\):“Correct passenger name on reservationG2LTC4to James Nguyen”Known context:Existing passenger Ethan Nguyen, user idethan\_nguyen\_73601\.Decompose\(ι,γ,Ω\\iota,\\gamma,\\Omega\):t1t\_\{1\}: Retrieve reservation detailst2t\_\{2\}: Update passenger namet2t\_\{2\}depends ont1t\_\{1\}\(need existing DOB\)⇒\\RightarrowT=\[t1,t2\]T=\[t\_\{1\},t\_\{2\}\]2\. Executet1t\_\{1\}— Retrieve reservation:Check\-Prerequisites\(t1,St\_\{1\},S\):P=∅⇒⟨𝑅𝑒𝑎𝑑𝑦,S⟩P=\\emptyset\\Rightarrow\\langle\\mathit\{Ready\},S\\ranglef=get\_reservation\_detailsf=\\texttt\{get\\\_reservation\\\_details\},M=\{reservation\_id\}M=\\\{\\texttt\{reservation\\\_id\}\\\}Lookup:τ​\(reservation\_id\)=’G2LTC4’\\tau\(\\texttt\{reservation\\\_id\}\)=\\texttt\{'G2LTC4'\}Execute→\\rightarrowupdatesSS:S←S∪\{current\_passengers↦\[\{dob:’1998\-08\-02’,…\}\]\}S\\leftarrow S\\cup\\\{\\texttt\{current\\\_passengers\}\\mapsto\[\\\{\\texttt\{dob\}:\\texttt\{'1998\-08\-02'\},\\ldots\\\}\]\\\}3\. Executet2t\_\{2\}— Update passenger name:Check\-Prerequisites\(t2,St\_\{2\},S\):P=\{reservation\_loaded,passenger\_dob\_known\}P=\\\{\\texttt\{reservation\\\_loaded\},\\texttt\{passenger\\\_dob\\\_known\}\\\}Both𝑀𝑒𝑡\\mathit\{Met\}fromSSaftert1t\_\{1\}⇒⟨𝑅𝑒𝑎𝑑𝑦,S⟩\\Rightarrow\\langle\\mathit\{Ready\},S\\ranglef=update\_reservation\_passengersf=\\texttt\{update\\\_reservation\\\_passengers\},M=\{reservation\_id,passengers\}M=\\\{\\texttt\{reservation\\\_id\},\\texttt\{passengers\}\\\}Parameter resolution \(lookup priority\):reservation\_id:τ→\\tau\\rightarrow’G2LTC4’\(from user input\)first\_name:τ→\\tau\\rightarrow’James’\(user\-requested change\)last\_name:τ→\\tau\\rightarrow’Nguyen’\(user\-requested\)dob:S→S\\rightarrow’1998\-08\-02’\(preserved fromt1t\_\{1\}; name correction≠\\neqDOB change\)DSL output:1\.get\_reservation\_details\(reservation\_id=’G2LTC4’\)2\.update\_reservation\_passengers\(reservation\_id=’G2LTC4’,passengers=\[\{first\_name:’James’, last\_name:’Nguyen’, dob:’1998\-08\-02’\}\]\)Result:✓\\checkmarkCorrect \| DOB preserved viaS​\(t1\)S\(t\_\{1\}\)\| DSL compliance:✓\\checkmark

Figure 2:Cross\-task parameter resolution with lookup priority\. The new name is resolved from the turn contextτ\\tau\(user\-provided\), while the date of birth is resolved from the scratchpadSS\(populated byt1t\_\{1\}\)\. The DSL’s explicit lookup ordering \(τ\\taubeforeSS\) ensures that user\-provided values override stale scratchpad entries, while values not mentioned by the user are correctly preserved from prior task outputs\. An unstructured approach would require the model to implicitly decide which fields to change and which to preserve—a common source of errors in tool\-calling systems\.
#### Iterative DSL Refinement\.

The 300 manually worked solutions served not only as validation but as the primary mechanism for refining the DSL itself\. Each solution that revealed friction, ambiguity, or failure in the sub\-process specifications led to a concrete revision:

- •Cases where prerequisite checking produced false negatives identified missing scratchpad propagation rules, leading to the𝐴𝑏𝑠𝑒𝑛𝑡\\mathit\{Absent\}branch with inline retrieval\.
- •Cases where parameter resolution failed identified the need for the prioritized lookup function with explicit turn\-context\-over\-scratchpad ordering\.
- •Cases where task ordering was ambiguous led to the explicit dependency graph construction with cycle detection\.
- •Cases where the scratchpad accumulated stale values motivated the monotonicity invariant: keys are never deleted, preventing accidental loss of cross\-turn state\.

The final DSL specification that emerged from this iterative process—the specification presented in this paper—achieved state\-of\-the\-art results on the BFCL benchmark\. Critically, the design\-time verification process is what produced this outcome: the DSL was validated against hundreds of manually worked examples*before*any model was trained or any benchmark was attempted\. The accuracy gains are attributable to the rigor of this process, not to post\-hoc tuning against benchmark results\.

#### Source of Accuracy Gains\.

The accuracy improvements reported in Experiments section arise primarily from the structural properties of this verification workflow rather than from improvements to the underlying language models themselves\. The system does not make base models more capable; rather, it eliminates errors that unstructured reasoning approaches introduce through ambiguous intermediate steps, unchecked error propagation, and compositions that are never validated for correctness\.

We decompose the sources of improvement through ablation in the Experiments section, separating the contributions of three factors:

1. 1\.Specialized primitives:Gains attributable to using fine\-tuned SLMs for narrow operations rather than general\-purpose models for all reasoning steps\.
2. 2\.Structured composition:Gains attributable to the DSL’s typed composition and program structure, compared to unstructured chaining of the same primitives\.
3. 3\.Verification and error correction:Gains attributable to contract enforcement, design\-time validation, and runtime error handling\.

Understanding this decomposition is important for evaluating the durability of our approach\. Gains from verification and structured composition are architectural and persist regardless of how capable the underlying models become: better models produce fewer errors per step, but verification still catches the errors they do produce, and structured composition still ensures the overall program is well\-formed\. Gains from specialized primitives are more contingent on the relative advantage of fine\-tuned SLMs over general\-purpose models, which may narrow as foundation models improve\. We report the relative contribution of each factor in Section[Experiments](https://arxiv.org/html/2607.04096#Sx4)\.

#### Neurosymbolic Programs\.

We refer to the composed, verified reasoning programs produced by our DSL as*neurosymbolic programs*\. A neurosymbolic program is a typed AST of primitives—both deterministic and SLM\-based—that has been validated through design\-time verification and whose execution produces per\-step verified traces\. The term distinguishes these artifacts from pure neural reasoning chains such as those produced by reasoning language models\(Guoet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib1); Zhanget al\.[2026](https://arxiv.org/html/2607.04096#bib.bib2)\)\(which lack formal structure and per\-step verification\) and from pure symbolic programs \(which lack the flexibility of learned components\)\. Neurosymbolic programs are model\-agnostic: once validated, the same program can be executed with any base model capable of running the constituent primitives, because correctness is a property of the program structure rather than of the model weights\.

### Compositional Reliability Analysis

A key advantage of our architecture is the ability to reason about system\-level reliability from primitive\-level measurements\. Letrir\_\{i\}denote the empirically measured reliability of primitiveii\(the probability that its output satisfies its contract on a randomly drawn input from the expected distribution\)\. For a sequential composition ofnnprimitives, the naive reliability bound is∏i=1nri\\prod\_\{i=1\}^\{n\}r\_\{i\}, which degrades rapidly with composition length\.

Our system mitigates this degradation through several mechanisms:

- •Contract\-based early termination:Failed primitives are detected immediately, preventing error propagation through the remaining program\.
- •Retry and fallback strategies:The DSL’s error\-handling operators allow failed primitives to be retried or replaced with alternatives, improving effective per\-step reliability\.
- •Independent verification:Verification primitives inserted at key points in the program independently check intermediate results, catching errors that passed earlier contract checks\.
- •Targeted improvement:Production traces identify the lowest\-reliability primitives, enabling focused retraining that improves the weakest links in the composition\.

We report per\-primitive reliability measurements and overall system reliability in Appendix C\.

## Experiments

We evaluate our neurosymbolic reasoning system across five tool\-calling benchmarks spanning multiple domains, comparing against strong baselines including both agentic reasoning frameworks and vanilla LLM prompting\. We describe the fine\-tuning procedure for our SLM\-based primitives, report main results, and present ablation studies isolating the contribution of each architectural component\.

### Benchmarks

We evaluate on the following benchmarks, chosen to cover both breadth of tool\-calling domains and depth of multi\-turn reasoning complexity\.

#### Tau2\.

A multi\-domain tool\-calling benchmark\(Yaoet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib7)\)spanning three industry verticals: Airline, Telecom, and Retail\. Each domain presents distinct function registries, prerequisite structures, and parameter resolution patterns, testing whether our DSL generalizes across domain\-specific tool configurations without per\-domain modification\.

#### BFCL v4 — Multi\-Turn\-Base\.

The multi\-turn subset of the Berkeley Function\-Calling Leaderboard v4\(Patilet al\.[2024](https://arxiv.org/html/2607.04096#bib.bib6)\)\. This benchmark evaluates multi\-step tool\-calling where later turns depend on state established by earlier turns, directly testing our scratchpad\-based cross\-turn state management\.

#### LiveMCPBench\.

A benchmark\(Moet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib15)\)evaluating tool\-calling in the Model Context Protocol \(MCP\) setting, where models must interact with live tool servers\. This tests our system’s ability to handle dynamic tool registries and real\-world API interaction patterns\.

#### MCP\-Atlas\.

A comprehensive MCP evaluation benchmark\(Bandiet al\.[2026](https://arxiv.org/html/2607.04096#bib.bib16)\)testing tool discovery, parameter resolution, and multi\-step execution across diverse server configurations\.

#### BFCL v4 with Human Review \(Optional\)\.

During our evaluation, we identified scoring inaccuracies in the standard BFCL v4 evaluation pipeline\. We conducted a human review of a subset of cases where our system’s output diverged from the ground truth, identifying instances where the ground truth itself contained errors or where functionally equivalent outputs were scored as incorrect\. We report results both with the standard scoring and with human\-corrected scoring to provide a more accurate assessment\. Details of the identified inaccuracies are provided in Appendix B\.

### Baselines

We compare against three baseline approaches, each representing a distinct paradigm for tool\-calling\.

#### Vanilla LLM Prompting\.

Direct prompting of large language models with the tool\-calling task, function signatures, and conversation history\. We evaluate across a broad set of models to establish the frontier of what unstructured prompting achieves: DeepSeek V3\(DeepSeek\-AIet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib13)\), Kimi K2\.6\(Moonshot AI[2026](https://arxiv.org/html/2607.04096#bib.bib19)\), MiniMax M3\(MiniMax Team[2026](https://arxiv.org/html/2607.04096#bib.bib18)\), GPT\-OSS\-120B\(OpenAI[2025](https://arxiv.org/html/2607.04096#bib.bib20)\), Mistral 3\.5\(Mistral AI[2026](https://arxiv.org/html/2607.04096#bib.bib21)\), Claude Haiku 4\.5\(Anthropic[2025a](https://arxiv.org/html/2607.04096#bib.bib24)\), Claude Sonnet 4\.6\(Anthropic[2025b](https://arxiv.org/html/2607.04096#bib.bib23)\), Claude Opus 4\.7\(Anthropic[2026](https://arxiv.org/html/2607.04096#bib.bib22)\), and GLM 5\(Zhipu AI[2026](https://arxiv.org/html/2607.04096#bib.bib25)\)\. For each model, we use the recommended prompting strategy from the respective provider and report the best result\.

#### RLM\.

A reinforcement learning\-based reasoning framework that runs with fine\-tuned frozen code and configurable iteration budgets \(𝑚𝑎𝑥​\_​𝑖𝑡𝑒𝑟=15\\mathit\{max\\\_iter\}=15–2020,𝑚𝑎𝑥​\_​𝑙𝑙𝑚​\_​𝑐𝑎𝑙𝑙𝑠=40\\mathit\{max\\\_llm\\\_calls\}=40–5050\)\. We evaluate with Kimi K2\.6 and GPT\-OSS\-120B as inference models\. RLM reports pass% / reward% on potentially reduced denominators: runs that produce errors are excluded from the denominator, yielding an effective sample sizeNNthat may be smaller than the full benchmark\. We report the error rate alongside scores to enable fair comparison\. Table[1](https://arxiv.org/html/2607.04096#Sx4.T1)shows the full sweep; we use the best\-performing configuration per benchmark in our main comparison\.

A notable observation is RLM’s high error rate with GPT\-OSS\-120B \(18–34%\), indicating that the framework’s reliability is sensitive to the choice of inference model\. On reduced denominators, pass rates appear competitive, but when errors are counted as failures against the full benchmark size, effective accuracy drops substantially\. We discuss the implications of denominator reduction for benchmark comparability in the Analysis section\.

Table 1:RLM sweep\. ft = fine\-tuned frozen code\.NN= effective sample size after excluding errors\. Best pass% per benchmark inbold\.Bench\.ParamsInf\.Pass / RwdErrBFCLbaselinekimi56\.0/ 59\.2–i20, c50 ftkimi50\.5 / ––Airlinebaselinekimi81\.6 / 982%i20, c50 ftkimi86\.6/ 9010%i15, c40 ftkimi86\.4 / 8812%i20, c50 ftgpt21\.2 / 6634%Retailbaselinekimi73\.7 / ––i20, c50 ftkimi80\.6/ 94\.75%i15, c40 ftkimi70\.6 / 89\.511%i20, c50gpt34\.6 / 7129%Telecombaselinekimi81\.6 / ––i20, c50 ftkimi79\.6/ 95\.64%i20, c50 ftgpt54\.8 / 8218%
#### GEPA\.

A genetic evolution\-based prompt optimization framework for structured tool\-calling\. GEPA evolves a task\-specific prompt via a task model and a reflection model within a metric\-call budget \(𝑚𝑎𝑥​\_​𝑚𝑒𝑡𝑟𝑖𝑐​\_​𝑐𝑎𝑙𝑙𝑠=150\\mathit\{max\\\_metric\\\_calls\}=150–250250\)\. We tuned GEPA on Tau2, as it is representative of the target task distribution but separate from our primary evaluation set\. Prompts are compiled per dataset; we observed that scores are sensitive to the compilation recipe \(choice of task model, reflection model, and budget\)\. We evaluate compiled prompts with DeepSeek V3, Kimi K2\.6, MiniMax M3, and GLM 4\.7 as inference models\. Table[2](https://arxiv.org/html/2607.04096#Sx4.T2)reports the full sweep; we use the best\-performing configuration per benchmark in our main comparison\. As with RLM, we report*best*scores after hyperparameter optimization, ensuring that our comparisons reflect the strongest possible performance of each baseline rather than default configurations\.

Table 2:GEPA sweep\. Recipe = task / reflection model\. Best per benchmark inbold\. “–” = not evaluated\.Bench\.RecipeInf\.Pass / RwdBFCLds\-v3 / kimids\-v343\.5 / 47\.1ds\-v3 / kimikimi62\.5 / 66\.1kimi / kimikimi71\.5 / 77\.0kimi / kimimm\-m379\.0 / 83\.3Airlineds\-v3 / kimikimi76\.0glm / mm, 150cglm82\.0Retailkimi / kimikimi–glm / mm, 250cglm82\.6glm / mm, 250ckimi78\.1glm / mm, 250cmm\-m381\.6For both RLM and GEPA, we emphasize that we report*best*scores after hyperparameter optimization, ensuring that our comparisons reflect the strongest possible performance of each baseline rather than default configurations\.

### SLM Fine\-Tuning

Each SLM\-based primitive in our DSL is implemented as a separately fine\-tuned model\. We use Gemma 12B\(Teamet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib14)\)as the base model for all primitives, chosen for its strong instruction\-following capability at a parameter count that enables cost\-efficient inference in production\.

#### Training Data\.

Training data for each primitive was constructed through the design\-time verification process described in Section[Design\-Time Verification](https://arxiv.org/html/2607.04096#Sx3.SSx6)\. From our corpus of 300 manually worked DSL solutions, we derived per\-primitive training examples by extracting the input\-output pairs for each sub\-process invocation\. These were augmented with additional synthetic examples generated by systematic variation of the core scenarios\. Table[3](https://arxiv.org/html/2607.04096#Sx4.T3)summarizes the dataset composition\.

Table 3:Fine\-tuning dataset for SLM\-based primitives\. All primitives use Gemma 12B as the base model with a 90/10 train/validation split\.The variation in dataset size across primitives reflects the complexity of each operation\.Decomposerequires the most examples because input decomposition spans the widest variety of user request patterns\.Check\-Prerequisitesrequires substantial data because prerequisite satisfaction involves diverse domain\-specific conditions\.Match\-Fill, which handles parameter value extraction, requires fewer examples because the operation is more constrained once the function signature is known\.

#### Training Procedure\.

All primitives are fine\-tuned for 4 epochs with a learning rate of1×10−51\\times 10^\{\-5\}\. During training, we optimize token\-level cross\-entropy loss\. During validation, we evaluate using*exact match*: the predicted output must be identical to the ground truth at the structured output level \(correct function names, correct parameter names, and correct parameter values\)\. This strict evaluation metric aligns with the production requirement that tool calls must be precisely correct—approximate matches result in API failures\.

#### Per\-Primitive Validation\.

Each fine\-tuned primitive is validated independently against its output contract before integration into the full system\. ForDecompose, validation checks that every derived task maps to at least one function in the registry\. ForGet\-Order, validation checks that the produced ordering respects all declared dependencies\. ForCheck\-Prerequisites, validation checks that the three\-valued classification \(Met/¬\\negMet/Absent\) is correct\. ForMatch\-Func, validation checks that the matched function’s signature is compatible with the task\. ForMatch\-Fill, validation checks that all parameter bindings conform to the expected types\. Primitives that fail to meet reliability thresholds on validation are retrained with additional data before deployment\.

Table[4](https://arxiv.org/html/2607.04096#Sx4.T4)reports per\-primitive exact\-match accuracy on the held\-out synthetic test split\. We treat these as a diagnostic of whether each primitive learned its operation and where the weakest stage lies, not as a measure of system reliability—which the benchmark results \(Section[Results](https://arxiv.org/html/2607.04096#Sx4.SSx4)\) establish\. Fine\-tuning improves every stage, with the largest gains on the hardest primitives,Decompose\(\+23\.1\) andCheck\-Prerequisites\(\+14\.5\)\.

As these scores are in\-distribution, they are best read as upper bounds on primitive accuracy\. Tuning\-set construction and examples are in the Appendix \(see section Finetuning examples\)\.

Table 4:Per\-primitive exact\-match accuracy on the held\-out synthetic test split, before and after fine\-tuning Gemma 12B\.Averageis the end\-to\-end score over the full pipeline\. Fine\-tuning improves every primitive, with the largest gains on the semantically hardest stages \(Decompose,Check\-Prerequisites\)\.

### Results

Table[5](https://arxiv.org/html/2607.04096#Sx4.T5)presents our main results across all benchmarks\. We report scores for our neurosymbolic reasoning engine \(NRE\) with multiple inference models, vanilla LLM prompting baselines, and the best configurations of RLM and GEPA from the sweeps reported in Tables[1](https://arxiv.org/html/2607.04096#Sx4.T1)and[2](https://arxiv.org/html/2607.04096#Sx4.T2)\.

Table 5:Main results across benchmarks \(MCP\-Atlas deferred to a later version\)\. Tau2 domains \(Airline/Retail/Telecom\), BFCL v4 and v3 multi\-turn\-base, LiveMCPBench, and BFCL v4 with human review \(v4\+H\)\. Avg1excludes v4\+H; Avg2uses v4\+H in place of v4\. Best per column inbold\. DeepSeek\-V3 under RLM errored out on two Tau2 domains\.∗All runs errored out on this benchmark under RLM\.

Several observations emerge from these results\.

#### NRE consistently improves base model performance\.

Across all models where both NRE and vanilla results are available, NRE produces higher scores\. The improvement is most dramatic for weaker models: haiku\-4\.5 improves from 52\.0 to 82\.0 on Tau2 Airline \(\+57\.7% relative\), from 75\.4 to 92\.1 on Tau2 Retail \(\+22\.1%\), and from 53\.5 to 98\.0 on Tau2 Telecom \(\+83\.2%\)\. Stronger models also improve but by smaller margins, consistent with our expectation that the verification and composition framework captures errors that are more frequent in weaker models\.

#### NRE outperforms all baselines across benchmarks\.

On every benchmark where results are available for all methods, NRE achieves the highest score\. Against vanilla prompting, NRE produces improvements of 30–60% relative on weaker models and meaningful gains even on the strongest frontier models\. Against RLM, NRE achieves comparable or higher pass rates without the error\-rate penalty that reduces RLM’s effective accuracy on full denominators\. Against GEPA, NRE outperforms the best\-tuned compilation recipes while requiring no per\-benchmark prompt optimization\. The consistency of NRE’s advantage across diverse benchmarks \(multi\-domain Tau2, multi\-turn BFCL, live MCP interaction\) and across diverse inference models indicates that the gains are architectural rather than benchmark\-specific or model\-specific\.

#### NRE with small models matches or exceeds frontier vanilla prompting\.

Our system running on kimi\-k2\.6 \(93\.0 on Tau2 Retail\) and minimax\-m3 \(78\.0 on BFCL v4\) achieves scores competitive with or exceeding vanilla Opus 4\.7 \(87\.7 and 77\.0 respectively\), despite using substantially smaller and cheaper inference models\. This validates the Pareto frontier positioning: comparable accuracy at a fraction of the cost\.

#### RLM and GEPA show sensitivity to configuration\.

RLM’s best scores \(86\.6 on Airline with kimi\-k2\.6\) are competitive on individual benchmarks but accompanied by significant error rates \(10–34%\) that reduce effective accuracy\. GEPA’s scores vary widely with compilation recipe \(43\.5–79\.0 on BFCL v4\)\. Neither baseline achieves consistent performance across all benchmarks, whereas NRE maintains stable performance across models and benchmarks\.

#### Human\-reviewed scoring narrows the gap with ground truth\.

On BFCL v4 with human review, NRE scores improve by 10–20 points across models \(e\.g\., minimax\-m3 from 78\.0 to 92\.0\), suggesting that a substantial fraction of “errors” under standard scoring are functionally correct outputs penalized by overly rigid evaluation criteria\. We detail the specific scoring issues identified in Appendix B\.

### Neurosymbolic Programs vs\. Test\-Time Scaling

A central question for the field is whether reasoning improvements should come from scaling inference compute \(test\-time scaling\) or from structured reasoning programs\. Test\-time scaling approaches—exemplified by DeepSeek\-R1, OpenAI’s o\-series, and similar reasoning models—invest additional compute at inference to search over reasoning chains, producing longer and more deliberate outputs\. These approaches have demonstrated strong results but at significant cost: reasoning models consume 5–50×\\timesmore tokens per query than their non\-reasoning counterparts, and the reasoning capability is baked into a specific model through specialized training rather than being transferable across models\.

We test this directly by comparing three configurations built on the same base model family:

1. 1\.DeepSeek\-R1\(reasoning model\): The test\-time scaling variant of DeepSeek, trained with reinforcement learning to produce extended reasoning chains\.
2. 2\.DeepSeek\-V3 \+ Neurosymbolic Programs: The non\-reasoning base model enhanced with our neurosymbolic reasoning engine\.
3. 3\.DeepSeek\-V3 \+ RLM / GEPA: The non\-reasoning base model enhanced with alternative reasoning frameworks\.

This comparison isolates the reasoning enhancement method from the base model capability\. DeepSeek\-V3 and R1 share the same base architecture; R1 adds test\-time scaling through reinforcement learning\-trained reasoning chains\. If V3 \+ neurosymbolic programs matches or exceeds R1, it demonstrates that structured neurosymbolic reasoning can substitute for—and improve upon—the expensive test\-time scaling approach\.

Table 6:Neurosymbolic programs vs\. test\-time scaling, controlling for the base model\. DeepSeek V3 \(non\-reasoning\) with our system vs\. DeepSeek R1 \(a reasoning model on the same base\), vanilla prompting, and the strongest prompt\-orchestration baseline \(GEPA\), all on the same V3 base\. Tau2 is averaged over its three domains; Avg1excludes BFCL v4\+H, Avg2uses the human\-reviewed score\. Best per column inbold\.#### Resource contrast\.

The resource asymmetry between test\-time scaling and neurosymbolic programs at the*post\-training*stage is stark\. DeepSeek\-R1’s reasoning capability was developed through a four\-stage post\-training pipeline on top of the DeepSeek\-V3 base model\(Guoet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib1)\): \(1\) cold\-start SFT on curated chain\-of\-thought examples, \(2\) reasoning\-focused RL using GRPO with rule\-based rewards, sampling 16 outputs per question at up to 32,768 tokens each, \(3\) rejection sampling producing∼\\sim600K reasoning samples plus∼\\sim200K general samples for a second SFT stage \(∼\\sim800K examples total\), and \(4\) a second RL phase for all\-scenario alignment\. The RL stages alone used 512 NVIDIA H800 GPUs at a reported cost of $294K for the first stage\(Guoet al\.[2025](https://arxiv.org/html/2607.04096#bib.bib1)\); the full four\-stage post\-training pipeline likely exceeds $500K–$1M when accounting for both RL stages and the SFT computation on 800K examples\.

By contrast, our post\-training consists of a single SFT stage: fine\-tuning five SLM\-based primitives on a 12B\-parameter base model \(Gemma 12B\) using 16,502 total training examples \(Table[3](https://arxiv.org/html/2607.04096#Sx4.T3)\)\. The entire process runs on a single GPU in hours, at a cost under $500\. Table[7](https://arxiv.org/html/2607.04096#Sx4.T7)summarizes the post\-training contrast\.

Table 7:Post\-training resource comparison: test\-time scaling \(DeepSeek\-R1\) vs\. neurosymbolic programs \(ours\)\.
#### Why stochastic scaling has structural limits\.

Test\-time scaling approaches are fundamentally stochastic: the model searches over possible reasoning chains by sampling, evaluating, and extending candidates\. This search is unstructured in the sense that the model has no formal guarantees about which reasoning steps are correct, no typed composition ensuring that intermediate results are compatible, and no contracts verifying outputs at each step\. The search finds good reasoning chains through brute\-force exploration of a vast space, relying on the model’s implicit knowledge to guide the search toward correct answers\.

This approach has three structural limitations that neurosymbolic reasoning addresses:

Compute inefficiency\.Stochastic search explores many incorrect paths before finding correct ones\. Each explored path consumes inference compute\. Neurosymbolic programs eliminates this waste by constraining the reasoning to verified primitives composed through a typed DSL: the space of valid reasoning programs is orders of magnitude smaller than the space of possible token sequences, and contract checking prunes invalid candidates without executing them\.

Unreliable error correction\.When a stochastic reasoning chain makes an error at stepkk, the model may or may not detect it at stepk\+1k\+1\. Error detection depends on the model’s implicit ability to recognize mistakes, which is itself unreliable\. Neurosymbolic programs detect errors at each step through explicit contract verification: if primitivekkproduces an output that violates its contract, the error is caught immediately and handled through retry or fallback logic before it propagates\.

Model specificity\.Test\-time scaling requires model\-specific training\. DeepSeek\-R1’s reasoning capability is the product of reinforcement learning applied specifically to the DeepSeek architecture and weights\. This capability does not transfer to other models: using R1’s reasoning approach with a different base model requires retraining from scratch\. Our neurosymbolic programs are model\-agnostic: the same primitive library, DSL, and verification framework can be applied to any base model without retraining\. A reasoning program validated on one model works on any other model that can execute the individual primitives, because correctness is a property of the program structure rather than of the model weights\.

#### Practical implications\.

The comparison between V3 \+ Neurosymbolic Programs and R1 has direct practical implications for enterprise deployment:

- •Cost:R1 consumes substantially more tokens per query than V3 \+ Neurosymbolic Programs, because extended reasoning chains are longer than structured primitive invocations\. At production scale, this cost difference is significant\.
- •Latency:Extended reasoning chains increase end\-to\-end latency proportionally to chain length\. Structured primitive invocations have predictable latency determined by the program structure rather than by stochastic search depth\.
- •Portability:When a new base model is released, neurosymbolic programs can be applied immediately without retraining\. Test\-time scaling requires a new reasoning\-specific training run for each model, which may take months and significant compute\.
- •Auditability:neurosymbolic programs produce structured traces with per\-step verification\. Reasoning models produce natural language chains that are not formally verifiable and may contain plausible\-sounding but incorrect reasoning steps\.
- •Data efficiency:Our SLM\-based primitives are fine\-tuned on 16,502 total examples \(Table[3](https://arxiv.org/html/2607.04096#Sx4.T3)\) at a cost under $500\. DeepSeek\-R1’s post\-training pipeline consumed∼\\sim800K SFT examples plus two large\-scale RL stages using 512 H800 GPUs, at a total post\-training cost exceeding $500K—approximately three orders of magnitude greater than ours \(Table[7](https://arxiv.org/html/2607.04096#Sx4.T7)\)\.

These advantages are not marginal improvements over test\-time scaling; they are structural consequences of the neurosymbolic approach that persist regardless of how much compute is invested in stochastic scaling\. A reasoning model that searches10×10\\timeslonger still cannot provide per\-step verification, still cannot transfer its capability to a different base model, and still cannot guarantee that its reasoning chain is well\-typed\. These are architectural limitations, not resource limitations, and they motivate the neurosymbolic alternative we present\.

## Discussion

#### Verifiability Drives Accuracy

The verifiable contracts at the core of our system serve both as tools for interpretability as well as a primary driver of accuracy; a developer can establish the correctness of a reasoning program before deployment, and errors can be corrected during construction rather than surfacing unpredictably at inference\. This contrasts with unstructured reasoning scaffolds such as RLMs, where the reasoning process is determined by the model’s stochastic search rather than by an inspectable program\.

#### Toward Thinner Reasoning Layers

A natural direction for future work is increasing the modularity of the primitive library\. A sufficiently rich and modular primitive library shifts reasoning out of the model weights and into the explicit program structure, reducing the need for the base LLM to perform sophisticated reasoning internally\. This points toward a regime in which the neurosymbolic layer is thin and cheap—small specialized models orchestrated by a verified program—rather than depending on large, reasoning\-capable base models\. From the synthesis perspective, although the final reasoning program might only depend on cheap SLM primitives, it iself might only be only within reach of a capable enought LLM\. This illustrates a possible workflow for using frontier models: use them only to write the definition of an efficient reasoning program inForethought\.

#### Significance for Deployment

The properties that distinguish neurosymbolic programs are precisely those that matter most for high\-stakes deployment\. In regulated domains—finance, healthcare, legal, defense—accuracy alone is insufficient; systems must be auditable, and their reasoning must be inspectable after the fact\. Our per\-step verified traces provide exactly this: a complete, inspectable record of the reasoning process in which each step’s correctness was checked against an explicit contract\. The combination of competitive accuracy, low cost, model\-agnostic deployment, and auditability positions neurosymbolic programs for exactly the settings where current approaches fall short\.

#### Limitations

An evident limitation is that constructing, reviewing and maintaining reasoning programs requires expert effort to define primitives and contracts, and work through validation\. In particular, obtaining each of the SLM\-based primitives requires a full language model fine\-tuning loop\. We believe that neurosymbolic program synthesis techniques could help in these fronts, both by helping with the authoring of reasoning programs, as well as with the creation of post\-training loops to obtain SLMs for new primitive operations\.

Additionally, our approach assumes that the target reasoning task decomposes into narrow primitive operations composed through well\-defined patterns\. Tool\-calling satisfies this assumption well: it has clear sub\-operations \(decomposition, ordering, prerequisite checking, parameter resolution\) with checkable outputs\. However, not all reasoning is so cleanly decomposable\. Open\-ended reasoning, tasks requiring holistic judgment, and problems without well\-defined intermediate contracts are less amenable to our approach\.

## Conclusion

We introduceForethought, a neurosymbolic reasoning system that significantly boosts the accuracy of base language models on tool‑calling tasks while staying cost‑ and data‑efficient, model‑agnostic and fully auditable\. By decomposing reasoning into a library of typed, neural and symbolic primitives and composing them via an embedded DSL, we obtain structured programs that can be verified at design time\. Evaluated on five diverse benchmarks, our approach outperforms vanilla prompting, reinforcement‑learning scaffolds, and prompt‑evolution methods by 30–60% relative, and matches or exceeds frontier models using far cheaper inference\. Compared to a test‑time scaling baseline, augmenting a non‑reasoning model with our programs rivals a dedicated reasoning model trained through a four‑stage pipeline, yet requires roughly three orders of magnitude less post‑training effort\. We argue that verifiability drives accuracy by enabling error detection before deployment, positioning explicit program construction as far more data‑efficient than implicit scaling\. Future work includes automated DSL program synthesis, expanding the primitive library to further thin the reasoning layer, and extending neurosymbolic decomposition beyond tool‑calling to broader reasoning domains, affirming structured, verifiable reasoning as a durable alternative to pure scaling for applications demanding accuracy, cost‑effectiveness, and auditability\.

## References

- L\. A\. Agrawal, S\. Tan, D\. Soylu, N\. Ziems, R\. Khare, K\. Opsahl\-Ong, A\. Singhvi, H\. Shandilya, M\. J\. Ryan, M\. Jiang, C\. Potts, K\. Sen, A\. G\. Dimakis, I\. Stoica, D\. Klein, M\. Zaharia, and O\. Khattab \(2026\)GEPA: reflective prompt evolution can outperform reinforcement learning\.External Links:2507\.19457,[Link](https://arxiv.org/abs/2507.19457)Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p3.1),[Declarative LM Programming and Prompt Optimization](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px3.p1.1)\.
- Anthropic \(2025a\)Claude Haiku 4\.5\.External Links:[Link](https://www.anthropic.com/news/claude-haiku-4-5)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- Anthropic \(2025b\)Claude Sonnet 4\.6\.External Links:[Link](https://www.anthropic.com/news/claude-sonnet-4-6)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- Anthropic \(2026\)Claude Opus 4\.7\.External Links:[Link](https://www.anthropic.com/news/claude-opus-4-7)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- C\. Bandi, R\. Dumitru, B\. Hertzberg, D\. Agarwal, G\. Boo, T\. Polakam, S\. Hassaan, J\. Da, H\. Kim, V\. Gupta, M\. Sharma, A\. Park, M\. Dimakis, E\. G\. H\. Montoya, D\. Rambado, I\. Salazar, R\. Cruz, M\. Rezaei, C\. Rane, B\. Levin, D\. Y\. Zhang, B\. Kenstler, and B\. Liu \(2026\)MCP\-atlas: a large\-scale benchmark for tool\-use competency with real mcp servers\.External Links:2602\.00933,[Link](https://arxiv.org/abs/2602.00933)Cited by:[MCP\-Atlas\.](https://arxiv.org/html/2607.04096#Sx4.SSx1.SSS0.Px4.p1.1)\.
- D\. Banerjee, C\. Xu, E\. Ie, M\. Zhang, D\. Peng, C\. Lin, and G\. Singh \(2026\)SEVerA: verified synthesis of self\-evolving agents\.External Links:2603\.25111,[Link](https://arxiv.org/abs/2603.25111)Cited by:[Declarative LM Programming and Prompt Optimization](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px3.p2.1)\.
- W\. Choi, J\. Kim, and H\. Woo \(2025\)NeSyPr: neurosymbolic proceduralization for efficient embodied reasoning\.External Links:2510\.19429,[Link](https://arxiv.org/abs/2510.19429)Cited by:[Neurosymbolic Reasoning](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px2.p1.1)\.
- DeepSeek\-AI, A\. Liu, B\. Feng, B\. Xue, B\. Wang, B\. Wu, C\. Lu, C\. Zhao, C\. Deng, C\. Zhang, C\. Ruan, D\. Dai, D\. Guo, D\. Yang, D\. Chen, D\. Ji, E\. Li, F\. Lin, F\. Dai, F\. Luo, G\. Hao, G\. Chen, G\. Li, H\. Zhang, H\. Bao, H\. Xu, H\. Wang, H\. Zhang, H\. Ding, H\. Xin, H\. Gao, H\. Li, H\. Qu, J\. L\. Cai, J\. Liang, J\. Guo, J\. Ni, J\. Li, J\. Wang, J\. Chen, J\. Chen, J\. Yuan, J\. Qiu, J\. Li, J\. Song, K\. Dong, K\. Hu, K\. Gao, K\. Guan, K\. Huang, K\. Yu, L\. Wang, L\. Zhang, L\. Xu, L\. Xia, L\. Zhao, L\. Wang, L\. Zhang, M\. Li, M\. Wang, M\. Zhang, M\. Zhang, M\. Tang, M\. Li, N\. Tian, P\. Huang, P\. Wang, P\. Zhang, Q\. Wang, Q\. Zhu, Q\. Chen, Q\. Du, R\. J\. Chen, R\. L\. Jin, R\. Ge, R\. Zhang, R\. Pan, R\. Wang, R\. Xu, R\. Zhang, R\. Chen, S\. S\. Li, S\. Lu, S\. Zhou, S\. Chen, S\. Wu, S\. Ye, S\. Ye, S\. Ma, S\. Wang, S\. Zhou, S\. Yu, S\. Zhou, S\. Pan, T\. Wang, T\. Yun, T\. Pei, T\. Sun, W\. L\. Xiao, W\. Zeng, W\. Zhao, W\. An, W\. Liu, W\. Liang, W\. Gao, W\. Yu, W\. Zhang, X\. Q\. Li, X\. Jin, X\. Wang, X\. Bi, X\. Liu, X\. Wang, X\. Shen, X\. Chen, X\. Zhang, X\. Chen, X\. Nie, X\. Sun, X\. Wang, X\. Cheng, X\. Liu, X\. Xie, X\. Liu, X\. Yu, X\. Song, X\. Shan, X\. Zhou, X\. Yang, X\. Li, X\. Su, X\. Lin, Y\. K\. Li, Y\. Q\. Wang, Y\. X\. Wei, Y\. X\. Zhu, Y\. Zhang, Y\. Xu, Y\. Xu, Y\. Huang, Y\. Li, Y\. Zhao, Y\. Sun, Y\. Li, Y\. Wang, Y\. Yu, Y\. Zheng, Y\. Zhang, Y\. Shi, Y\. Xiong, Y\. He, Y\. Tang, Y\. Piao, Y\. Wang, Y\. Tan, Y\. Ma, Y\. Liu, Y\. Guo, Y\. Wu, Y\. Ou, Y\. Zhu, Y\. Wang, Y\. Gong, Y\. Zou, Y\. He, Y\. Zha, Y\. Xiong, Y\. Ma, Y\. Yan, Y\. Luo, Y\. You, Y\. Liu, Y\. Zhou, Z\. F\. Wu, Z\. Z\. Ren, Z\. Ren, Z\. Sha, Z\. Fu, Z\. Xu, Z\. Huang, Z\. Zhang, Z\. Xie, Z\. Zhang, Z\. Hao, Z\. Gou, Z\. Ma, Z\. Yan, Z\. Shao, Z\. Xu, Z\. Wu, Z\. Zhang, Z\. Li, Z\. Gu, Z\. Zhu, Z\. Liu, Z\. Li, Z\. Xie, Z\. Song, Z\. Gao, and Z\. Pan \(2025\)DeepSeek\-v3 technical report\.External Links:2412\.19437,[Link](https://arxiv.org/abs/2412.19437)Cited by:[Model\-Agnostic Integration](https://arxiv.org/html/2607.04096#Sx3.SSx5.p1.1),[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- N\. Y\. Flandre, A\. C\. Nwala, and P\. J\. Giabbanelli \(2026\)Composing verifiable conceptual models via building blocks: towards design\-time verification of agentic AI workflows\.arXiv preprint arXiv:2606\.21565\.Cited by:[Verification Workflow\.](https://arxiv.org/html/2607.04096#Sx3.SSx6.SSS0.Px1.p2.1)\.
- D\. Gangulyet al\.\(2024\)Proof of thought: neurosymbolic program synthesis allows robust and interpretable reasoning\.arXiv preprint arXiv:2409\.17270\.Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p3.1),[Neurosymbolic Reasoning](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px2.p1.1),[Distinction from General\-Purpose Libraries\.](https://arxiv.org/html/2607.04096#Sx3.SSx2.SSS0.Px3.p1.1)\.
- D\. Guo, D\. Yang, H\. Zhang, J\. Song, P\. Wang, Q\. Zhu, R\. Xu, R\. Zhang, S\. Ma, X\. Bi, X\. Zhang, X\. Yu, Y\. Wu, Z\. F\. Wu, Z\. Gou, Z\. Shao, Z\. Li, Z\. Gao, A\. Liu, B\. Xue, B\. Wang, B\. Wu, B\. Feng, C\. Lu, C\. Zhao, C\. Deng, C\. Ruan, D\. Dai, D\. Chen, D\. Ji, E\. Li, F\. Lin, F\. Dai, F\. Luo, G\. Hao, G\. Chen, G\. Li, H\. Zhang, H\. Xu, H\. Ding, H\. Gao, H\. Qu, H\. Li, J\. Guo, J\. Li, J\. Chen, J\. Yuan, J\. Tu, J\. Qiu, J\. Li, J\. L\. Cai, J\. Ni, J\. Liang, J\. Chen, K\. Dong, K\. Hu, K\. You, K\. Gao, K\. Guan, K\. Huang, K\. Yu, L\. Wang, L\. Zhang, L\. Zhao, L\. Wang, L\. Zhang, L\. Xu, L\. Xia, M\. Zhang, M\. Zhang, M\. Tang, M\. Zhou, M\. Li, M\. Wang, M\. Li, N\. Tian, P\. Huang, P\. Zhang, Q\. Wang, Q\. Chen, Q\. Du, R\. Ge, R\. Zhang, R\. Pan, R\. Wang, R\. J\. Chen, R\. L\. Jin, R\. Chen, S\. Lu, S\. Zhou, S\. Chen, S\. Ye, S\. Wang, S\. Yu, S\. Zhou, S\. Pan, S\. S\. Li, S\. Zhou, S\. Wu, T\. Yun, T\. Pei, T\. Sun, T\. Wang, W\. Zeng, W\. Liu, W\. Liang, W\. Gao, W\. Yu, W\. Zhang, W\. L\. Xiao, W\. An, X\. Liu, X\. Wang, X\. Chen, X\. Nie, X\. Cheng, X\. Liu, X\. Xie, X\. Liu, X\. Yang, X\. Li, X\. Su, X\. Lin, X\. Q\. Li, X\. Jin, X\. Shen, X\. Chen, X\. Sun, X\. Wang, X\. Song, X\. Zhou, X\. Wang, X\. Shan, Y\. K\. Li, Y\. Q\. Wang, Y\. X\. Wei, Y\. Zhang, Y\. Xu, Y\. Li, Y\. Zhao, Y\. Sun, Y\. Wang, Y\. Yu, Y\. Zhang, Y\. Shi, Y\. Xiong, Y\. He, Y\. Piao, Y\. Wang, Y\. Tan, Y\. Ma, Y\. Liu, Y\. Guo, Y\. Ou, Y\. Wang, Y\. Gong, Y\. Zou, Y\. He, Y\. Xiong, Y\. Luo, Y\. You, Y\. Liu, Y\. Zhou, Y\. X\. Zhu, Y\. Huang, Y\. Li, Y\. Zheng, Y\. Zhu, Y\. Ma, Y\. Tang, Y\. Zha, Y\. Yan, Z\. Z\. Ren, Z\. Ren, Z\. Sha, Z\. Fu, Z\. Xu, Z\. Xie, Z\. Zhang, Z\. Hao, Z\. Ma, Z\. Yan, Z\. Wu, Z\. Gu, Z\. Zhu, Z\. Liu, Z\. Li, Z\. Xie, Z\. Song, Z\. Pan, Z\. Huang, Z\. Xu, Z\. Zhang, and Z\. Zhang \(2025\)DeepSeek\-r1 incentivizes reasoning in llms through reinforcement learning\.Nature645\(8081\),pp\. 633–638\.External Links:ISSN 1476\-4687,[Link](http://dx.doi.org/10.1038/s41586-025-09422-z),[Document](https://dx.doi.org/10.1038/s41586-025-09422-z)Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p2.1),[Reasoning Enhancement and Test\-Time Scaling](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px1.p1.1),[Neurosymbolic Programs\.](https://arxiv.org/html/2607.04096#Sx3.SSx6.SSS0.Px5.p1.1),[Resource contrast\.](https://arxiv.org/html/2607.04096#Sx4.SSx5.SSS0.Px1.p1.3)\.
- H\. Haynes \(2026\)Decidable by construction: design\-time verification for trustworthy AI\.arXiv preprint arXiv:2603\.25414\.Cited by:[Verification Workflow\.](https://arxiv.org/html/2607.04096#Sx3.SSx6.SSS0.Px1.p2.1)\.
- O\. Khattab, A\. Singhvi, P\. Maheshwari, Z\. Zhang, K\. Santhanam, S\. Vardhamanan, S\. Haq, A\. Sharma, T\. T\. Joshi, H\. Moazam, H\. Miller, M\. Zaharia, and C\. Potts \(2024\)DSPy: compiling declarative language model calls into self\-improving pipelines\.InInternational Conference on Learning Representations \(ICLR\),Note:arXiv:2310\.03714Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p3.1),[Declarative LM Programming and Prompt Optimization](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px3.p1.1)\.
- MiniMax Team \(2026\)MiniMax\-M3: frontier coding, 1m context, native multimodality — all in one model\.External Links:[Link](https://www.minimax.io/blog/minimax-m3)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- Mistral AI \(2026\)Mistral technical report\.External Links:[Link](https://docs.mistral.ai/models/model-cards/mistral-medium-3-5-26-04)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- G\. Mo, W\. Zhong, J\. Chen, X\. Chen, Y\. Lu, H\. Lin, B\. He, X\. Han, and L\. Sun \(2025\)LiveMCPBench: can agents navigate an ocean of MCP tools?\.arXiv preprint arXiv:2508\.01780\.Cited by:[LiveMCPBench\.](https://arxiv.org/html/2607.04096#Sx4.SSx1.SSS0.Px3.p1.1)\.
- Moonshot AI \(2026\)Kimi K2\.6: technical report\.External Links:[Link](https://www.kimi.com/blog/kimi-k2-6)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- OpenAI \(2025\)GPT\-OSS\-120B\.External Links:[Link](https://openai.com/index/introducing-gpt-oss/)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.
- L\. Pan, A\. Albalak, X\. Wang, and W\. Y\. Wang \(2023\)Logic\-LM: empowering large language models with symbolic solvers for faithful logical reasoning\.arXiv preprint arXiv:2305\.12295\.Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p3.1),[Neurosymbolic Reasoning](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px2.p1.1),[Distinction from General\-Purpose Libraries\.](https://arxiv.org/html/2607.04096#Sx3.SSx2.SSS0.Px3.p1.1)\.
- S\. G\. Patil, H\. Mao, C\. C\. Ji, F\. Yan, V\. Suresh, I\. Stoica, and J\. E\. Gonzalez \(2024\)The berkeley function calling leaderboard \(BFCL\): from tool use to agentic evaluation of large language models\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p1.1),[SLM\-Based Primitives\.](https://arxiv.org/html/2607.04096#Sx3.SSx1.SSS0.Px2.p1.1),[Concrete Validation: BFCL Tool\-Calling\.](https://arxiv.org/html/2607.04096#Sx3.SSx6.SSS0.Px2.p1.1),[BFCL v4 — Multi\-Turn\-Base\.](https://arxiv.org/html/2607.04096#Sx4.SSx1.SSS0.Px2.p1.1)\.
- G\. Team, A\. Kamath, J\. Ferret, S\. Pathak, N\. Vieillard, R\. Merhej, S\. Perrin, T\. Matejovicova, A\. Ramé, M\. Rivière, L\. Rouillard, T\. Mesnard, G\. Cideron, J\. Grill, S\. Ramos, E\. Yvinec, M\. Casbon, E\. Pot, I\. Penchev, G\. Liu, F\. Visin, K\. Kenealy, L\. Beyer, X\. Zhai, A\. Tsitsulin, R\. Busa\-Fekete, A\. Feng, N\. Sachdeva, B\. Coleman, Y\. Gao, B\. Mustafa, I\. Barr, E\. Parisotto, D\. Tian, M\. Eyal, C\. Cherry, J\. Peter, D\. Sinopalnikov, S\. Bhupatiraju, R\. Agarwal, M\. Kazemi, D\. Malkin, R\. Kumar, D\. Vilar, I\. Brusilovsky, J\. Luo, A\. Steiner, A\. Friesen, A\. Sharma, A\. Sharma, A\. M\. Gilady, A\. Goedeckemeyer, A\. Saade, A\. Feng, A\. Kolesnikov, A\. Bendebury, A\. Abdagic, A\. Vadi, A\. György, A\. S\. Pinto, A\. Das, A\. Bapna, A\. Miech, A\. Yang, A\. Paterson, A\. Shenoy, A\. Chakrabarti, B\. Piot, B\. Wu, B\. Shahriari, B\. Petrini, C\. Chen, C\. L\. Lan, C\. A\. Choquette\-Choo, C\. Carey, C\. Brick, D\. Deutsch, D\. Eisenbud, D\. Cattle, D\. Cheng, D\. Paparas, D\. S\. Sreepathihalli, D\. Reid, D\. Tran, D\. Zelle, E\. Noland, E\. Huizenga, E\. Kharitonov, F\. Liu, G\. Amirkhanyan, G\. Cameron, H\. Hashemi, H\. Klimczak\-Plucińska, H\. Singh, H\. Mehta, H\. T\. Lehri, H\. Hazimeh, I\. Ballantyne, I\. Szpektor, I\. Nardini, J\. Pouget\-Abadie, J\. Chan, J\. Stanton, J\. Wieting, J\. Lai, J\. Orbay, J\. Fernandez, J\. Newlan, J\. Ji, J\. Singh, K\. Black, K\. Yu, K\. Hui, K\. Vodrahalli, K\. Greff, L\. Qiu, M\. Valentine, M\. Coelho, M\. Ritter, M\. Hoffman, M\. Watson, M\. Chaturvedi, M\. Moynihan, M\. Ma, N\. Babar, N\. Noy, N\. Byrd, N\. Roy, N\. Momchev, N\. Chauhan, N\. Sachdeva, O\. Bunyan, P\. Botarda, P\. Caron, P\. K\. Rubenstein, P\. Culliton, P\. Schmid, P\. G\. Sessa, P\. Xu, P\. Stanczyk, P\. Tafti, R\. Shivanna, R\. Wu, R\. Pan, R\. Rokni, R\. Willoughby, R\. Vallu, R\. Mullins, S\. Jerome, S\. Smoot, S\. Girgin, S\. Iqbal, S\. Reddy, S\. Sheth, S\. Põder, S\. Bhatnagar, S\. R\. Panyam, S\. Eiger, S\. Zhang, T\. Liu, T\. Yacovone, T\. Liechty, U\. Kalra, U\. Evci, V\. Misra, V\. Roseberry, V\. Feinberg, V\. Kolesnikov, W\. Han, W\. Kwon, X\. Chen, Y\. Chow, Y\. Zhu, Z\. Wei, Z\. Egyed, V\. Cotruta, M\. Giang, P\. Kirk, A\. Rao, K\. Black, N\. Babar, J\. Lo, E\. Moreira, L\. G\. Martins, O\. Sanseviero, L\. Gonzalez, Z\. Gleicher, T\. Warkentin, V\. Mirrokni, E\. Senter, E\. Collins, J\. Barral, Z\. Ghahramani, R\. Hadsell, Y\. Matias, D\. Sculley, S\. Petrov, N\. Fiedel, N\. Shazeer, O\. Vinyals, J\. Dean, D\. Hassabis, K\. Kavukcuoglu, C\. Farabet, E\. Buchatskaya, J\. Alayrac, R\. Anil, Dmitry, Lepikhin, S\. Borgeaud, O\. Bachem, A\. Joulin, A\. Andreev, C\. Hardin, R\. Dadashi, and L\. Hussenot \(2025\)Gemma 3 technical report\.External Links:2503\.19786,[Link](https://arxiv.org/abs/2503.19786)Cited by:[Model\-Agnostic Integration](https://arxiv.org/html/2607.04096#Sx3.SSx5.p1.1),[SLM Fine\-Tuning](https://arxiv.org/html/2607.04096#Sx4.SSx3.p1.1)\.
- S\. Yao, N\. Shinn, P\. Razavi, and K\. Narasimhan \(2024\)τ\\tau\-Bench: a benchmark for tool\-agent\-user interaction in real\-world domains\.arXiv preprint arXiv:2406\.12045\.Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p1.1),[SLM\-Based Primitives\.](https://arxiv.org/html/2607.04096#Sx3.SSx1.SSS0.Px2.p1.1),[Tau2\.](https://arxiv.org/html/2607.04096#Sx4.SSx1.SSS0.Px1.p1.1)\.
- A\. L\. Zhang, T\. Kraska, and O\. Khattab \(2026\)Recursive language models\.External Links:2512\.24601,[Link](https://arxiv.org/abs/2512.24601)Cited by:[Introduction](https://arxiv.org/html/2607.04096#Sx1.p2.1),[Reasoning Enhancement and Test\-Time Scaling](https://arxiv.org/html/2607.04096#Sx2.SS0.SSS0.Px1.p1.1),[Neurosymbolic Programs\.](https://arxiv.org/html/2607.04096#Sx3.SSx6.SSS0.Px5.p1.1)\.
- Zhipu AI \(2026\)GLM\-5: From Vibecoding to Agentic Engineering\.External Links:[Link](https://z.ai/blog/glm-5)Cited by:[Vanilla LLM Prompting\.](https://arxiv.org/html/2607.04096#Sx4.SSx2.SSS0.Px1.p1.1)\.

## Appendix AWorked Design\-Time Verification Solutions

This appendix presents representative worked solutions from the corpus of 300 manually verified DSL executions used for design\-time verification \(see Methodology section\)\. We organize them by the DSL capability each exercises rather than by scenario, so that each example illustrates a distinct aspect of the execution kernel\. Each solution traces the five sub\-processes and compares the resulting tool\-call sequence against the benchmark ground truth\.

### Cross\-Turn State Management

Turn 2 ofmulti\_turn\_base\_0requires searching a file that a prior turn moved into a new directory\. The directory and file location are resolved from scratchpad state established in Turn 1, while the search pattern is taken from the current turn’s user input\. This exercises the scratchpad monotonicity invariant \(INV\-S\) and the turn\-context\-over\-scratchpad lookup priority\. \(Presented in full as Figure[1](https://arxiv.org/html/2607.04096#Sx3.F1)\.\)

### Multi\-Step Dependency Chains

Turn 3 ofmulti\_turn\_base\_13decomposes a single request—“copyrelease\_notes\.txtintohandoffand rename the copy”—into three ordered unit tasks whose execution order follows the dependency chain\.

1Scenario:multi\_turn\_base\_13,Turn3

2Input:"Copyrelease\_notes\.txtintohandoffandrenamethe

3copytoclient\_release\_notes\.txt\."

4

5SP1Decompose\-\>unittasks:

6t1:Copyrelease\_notes\.txttohandoff

7t2:Navigatetohandoff

8t3:Renamerelease\_notes\.txt\-\>client\_release\_notes\.txt

9

10SP3Get\-Order\-\>T=\[t1,t2,t3\]\(dependencychain\)

11

12SP4/SP5\(pertask\):

131\.cp\(source=’release\_notes\.txt’,destination=’handoff’\)

142\.cd\(folder=’handoff’\)

153\.mv\(source=’release\_notes\.txt’,

16destination=’client\_release\_notes\.txt’\)

17

18Groundtruth:identical\(3/3calls\)Result:EXACTMATCH

### Prerequisite Checking Against Persistent State

A single\-task turn \(“Find the nearest airport to Miami”\) illustrates prerequisite evaluation\. The task carries a prerequisiteuser\_authenticated, which the three\-valuedCheckfunction resolves toMetdirectly from persistent scratchpad state \(theauthenticatedflag set in a prior turn\), so no remediation is needed\.

1Scenario:TravelAPImulti\-turn,Turn1

2Input:"FindthenearestairporttoMiami\."

3Scratchpad\(carried\):authenticated=true,\.\.\.

4

5SP4Check\-Prerequisites\(t1,S\):

6P=\{user\_authenticated\}

7Check\(user\_authenticated,S\):

8S\(authenticated\)=true\-\>Satisfied\-\>Met

9=\><Ready,S\>

10

11SP5Match\-Funcs\-and\-Params\(t1,S,tau,Omega\):

12f=get\_nearest\_airport\_by\_city\[SLMmatch\]

13M=\{city\}

14Lookup\(city,tau,S\):tau\(city\)="Miami"

15B=\{city\-\>"Miami"\},dom\(B\)=M\[guardsatisfied\]

16=\>Execute\(get\_nearest\_airport\_by\_city,\{city:"Miami"\}\)

17

18Result:SUCCESS\(returnsMIA,MiamiInternationalAirport\)

### Cross\-Task Parameter Resolution

A passenger name correction decomposes into a retrieval task followed by an update task\. The update draws the corrected name from the turn contextτ\\tauwhile preserving the date of birth from the scratchpadSSpopulated by the retrieval task—a value the user did not mention and must not alter\. This is the sharpest illustration of the lookup priority \(τ\\taubeforeSS\) combined with preservation of unmentioned fields\. \(Presented in full as Figure[2](https://arxiv.org/html/2607.04096#Sx3.F2); an additional variant, reservationNZK0WL, follows the identical pattern\.\)

## Appendix BBFCL v4 Scoring Corrections

During evaluation we observed that the standard BFCL v4 multi\-turn scoring pipeline penalizes a recurring class of outputs that are functionally correct\. To quantify this, we performed a human review of failing cases for*each model and technique on each benchmark*; the human\-reviewed scores reported in Section[Results](https://arxiv.org/html/2607.04096#Sx4.SSx4)are the result of applying this review uniformly across all evaluated systems\. Rather than enumerate per\-system correction counts, we illustrate here the*kinds*of scoring issues the review identified, with representative examples\. In every case we hold a deliberately conservative standard, described below, and we retain genuine model errors as failures\.

We treat an output as a*scoring artifact*only when it reaches the same scored state by a valid alternative path, is penalized only on surface formatting, or performs setup the reference omits\. An output that performs an unrequested action with genuine side effects on API state is treated as a real error, even when the final user\-visible result appears similar, and is not reclassified as an artifact\. This is consistent with the paper’s thesis that correct intermediate state, not only final output, is what matters\.

### Category A: Reference Omits Required Setup Calls

Here the reference hard\-codes values or assumes state that the task in fact requires the agent to establish\. Our system performs the necessary call—resolving a city to an airport code, or authenticating before a booking—and is penalized for output that is, if anything, more complete than the reference\.

#### multi\_turn\_base\_4\.

*Request:*plan a business\-class flight from “Los Angeles” to “New York” on 2026\-04\-15, then book it with the given card and access token\. *Reference:*get\_flight\_cost \(with travel\_from=LAX, travel\_to=JFK\), then book\_flight\. *Our output:*two get\_nearest\_airport\_by\_city calls resolving “Los Angeles” and “New York” to LAX and JFK, then get\_flight\_cost, authenticate\_travel, and book\_flight\. *Why this is an artifact:*the user supplies city names, not airport codes\. Resolving them via get\_nearest\_airport\_by\_city is a required and correct step; the reference silently hard\-codes the codes and omits the authentication the booking API requires\. Our output is penalized for performing setup the task genuinely demands\.

#### multi\_turn\_base\_159\.

*Request:*book a first\-class flight from “San Francisco” to “Los Angeles” on 2026\-10\-15 with the given travel card\. *Reference:*get\_flight\_cost \(with travel\_from=SFO, travel\_to=LAX\), then book\_flight\. *Our output:*two get\_nearest\_airport\_by\_city calls resolving “San Francisco” and “Los Angeles” to codes, then authenticate\_travel, get\_flight\_cost, and book\_flight\. *Why this is an artifact:*identical to the above—city\-to\-airport resolution and authentication are necessary and correct, but the reference omits them and scores their presence as divergence\.

### Category B: Decomposed Calls Reaching Equivalent State

The output performs the same effective action as the reference but reaches it through additional or split calls that do not alter the scored end state\.

#### multi\_turn\_base\_15\.

*Request:*draft a tweet naming the two files, comma\-separated, with the hashtag \#fileshowcase\. *Reference:*post\_tweet with content “file1\.txt, file2\.txt” and tag \#fileshowcase\. *Our output:*a read\-only posting\_get\_login\_status call, then post\_tweet with the same file names and hashtag\. *Why this is an artifact:*the posted tweet conveys the same file names and hashtag as the reference; the additional call is a read\-only status check that does not mutate tweet state, and the decomposition into multiple calls reaches an equivalent end state\. The exact\-match scorer nonetheless flags the trace as divergent\.

### Category C: Valid Alternative Path to Equivalent State

The output obtains the same information or reaches the same state as the reference through a different but valid call sequence, and is penalized by exact execution\-state matching rather than by any functional difference\.

#### multi\_turn\_base\_66\.

*Request:*explore ResearchDocs for files or subdirectories containing the keyword “draft”\. *Reference:*find with path=ResearchDocs and name=draft\. *Our output:*ls, then cd into ResearchDocs, then find with path=\. and name=draft\. *Why this is an artifact:*navigating into ResearchDocs and searching the current directory covers exactly the same search space as searching ResearchDocs directly; the two produce the same matches\.

#### multi\_turn\_base\_110\.

*Request:*track down a recently lodged support ticket\. *Reference:*get\_ticket with ticket\_id=1\. *Our output:*get\_user\_tickets\. *Why this is an artifact:*both retrieve the target ticket; get\_user\_tickets returns the user’s tickets \(including the one requested\), obtaining equivalent information through a valid alternative accessor with no difference in resulting state\.

#### Summary\.

The categories above recur across models and techniques: because the standard pipeline scores exact call sequences and intermediate state, it systematically penalizes correct outputs that resolve underspecified inputs, differ only in formatting, or reach the target state by a valid alternative route\. Applying the human review uniformly across all evaluated systems yields the corrected scores in Section[Results](https://arxiv.org/html/2607.04096#Sx4.SSx4), and the correction affects every system’s absolute numbers without changing their relative ordering\.

## Appendix CFine\-Tuning Examples

Each SLM\-based primitive is fine\-tuned on examples that pair a task\-specific system prompt with a structured JSON target\. We show one representative example per primitive below\. System prompts are abbreviated to their operative constraints, and the model’s output is shown as the structured object it must produce; the exact\-match validation criterion \(Section[SLM Fine\-Tuning](https://arxiv.org/html/2607.04096#Sx4.SSx3)\) requires this object to match the target\. These examples are drawn from our synthetic corpus and are illustrative of the input–output contract each primitive learns\.

### Decompose

*System \(abbrev\.\):*break the request into atomic unit tasks, each calling exactly one registry tool; identify dependencies; ground every parameter in the user request, environment config, or prior conversation\. *Input:*“Play Marvin Gaye for 15 minutes, and after that finishes, play Stevie Wonder for 12 minutes\.” *Target:*

> \{"tasks": \[\{"id":"t1", "tool\_name":"spotify\.play", "depends\_on":\[\], "parameters":\{"artist":"Marvin Gaye", "duration":15\}\}, \{"id":"t2", "tool\_name":"spotify\.play", "depends\_on":\["t1"\], "parameters":\{"artist":"Stevie Wonder", "duration":12\}\}\], "config\_keys":\{\}\}

The second task is marked dependent on the first, capturing the “after that finishes” ordering constraint\.

### Get\-Order

*System \(abbrev\.\):*given a batch of mutually independent tasks, output a total ordering that best fits the user’s workflow; output exactly the given ids, inventing no dependencies\. *Input:*three ready tasks —s5enable roaming,s6add 3 GB data,s7toggle airplane mode\. *Target:*\{"ordered\_task\_ids": \["s5", "s6", "s7"\]\}

### Check\-Prerequisites

*System \(abbrev\.\):*for a prerequisite key that is*absent*\(missing from scratchpad\) or*not\_met*\(present but predicate false\), propose at most one unit task that would advance the check toward*Met*\. *Input:*keydestination\_set, outcomeabsent; main task “Navigate to New York after the prerequisite is resolved\.” *Target:*

> \{"task": \{"tool\_name":"set\_navigation", "parameters":\{"destination":"New York"\}\}\}

The absent key triggers a single setup task that will populate it\.

### Match\-Func

*System \(abbrev\.\):*given one unit task and a tool registry, choose at most one tool whose name matches the registry exactly; return null if none applies\. *Input:*task “Add 3GB of mobile data to my line L\-555”, registry \{enable\_roaming,get\_customer\_by\_phone,refuel\_data,run\_speed\_test\}\. *Target:*\{"tool\_name": "refuel\_data"\}

### Match\-Fill

*System \(abbrev\.\):*propose values only for missing required parameters, grounded in the task text, turn context, or scratchpad; if a value must come from state, read it from the scratchpad rather than inventing it\. *Input:*missing parameteritem\_idsforexchange\_delivered\_order\_items; turn context suppliesnew\_item\_ids= \[I\-100, I\-101\]; scratchpadSholdsitem\_ids= \[I\-200, I\-201\]\. *Target:*\{"values": \{"item\_ids": \["I\-200", "I\-201"\]\}\}

This last example illustrates the lookup discipline directly: the requireditem\_idsis resolved from the scratchpad rather than conflated with the similarly namednew\_item\_idspresent in the turn context, matching the priority rule enforced by the execution kernel\.

Similar Articles

PACE: A Neuro-Symbolic Framework for Plausible and Actionable Counterfactual Explanations

arXiv cs.AI

This paper introduces PACE, a modular neuro-symbolic framework that combines a neural predictive model with symbolic reasoning to generate counterfactual explanations that respect domain-specific feasibility constraints. A case study on the Adult Income dataset demonstrates that incorporating symbolic rules yields more plausible and actionable explanations.

Structured Thoughts For Improved Reasoning And Context Pruning

arXiv cs.CL

This paper introduces Structured Thoughts, a framework that organizes LLM reasoning into alternating <try> and <outcome> blocks, enabling context pruning and improving performance on reasoning benchmarks by up to 8.08% with 85% memory savings.

Detecting misbehavior in frontier reasoning models

OpenAI Blog

OpenAI researchers demonstrate that chain-of-thought monitoring can detect misbehavior in frontier reasoning models like o3-mini, but warn that directly optimizing CoT to prevent bad thoughts causes models to hide their intent rather than eliminate the behavior.