Manuscript Offprint

arXiv:2610.31062

SCOPE: Compiling Natural-Language Policies into Neurosymbolic Predicate Programs

Arnon Mazza, Elad Levi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Policy enforcement for LLM agents has shifted from single-turn content moderation to compound, application-specific policies evaluated over multi-turn transcripts and tool-call trajectories. Fine-tuned guardrail models are efficient but degrade on compound policies, and while LLM-as-a-judge approaches achieve higher accuracy, they incur high inference cost and tend to produce unstable predictions. Neurosymbolic methods offer a natural alternative, decomposing the policy into narrow neural decisions composed under explicit logic. However, existing symbolic layers lack the required expressiveness and are optimized against fixed data rather than the policy itself. To address this, we introduce SCOPE, which compiles a policy into an executable program of neural predicates executed by small models, deterministic extractors, and code that composes their outputs. The program is optimized jointly with its training data, using adversarial generation of counterexamples that target where the program deviates from the policy. We evaluate SCOPE on a benchmark of real-world policy tasks against prompt optimization, task decomposition, and workflow generation methods, achieving the highest average accuracy across tasks and models. Programs optimized with the weakest executor transfer to other models without further optimization. This allows them to be deployed in production on inexpensive models, where they reach accuracy comparable to frontier reasoning models. Unlike these monolithic models, SCOPE produces substantially more stable predictions, and each verdict is interpretable through the predicate outputs that produced it. Additionally, we validate the key components of our method through an ablation study. SCOPE thus enables reliable, interpretable, and efficient policy enforcement at production scale.

1 Introduction

Large language models are increasingly deployed to enforce the policies of the organizations that run them, from content rules [37, 31, 98] and regulatory obligations [17] to application-specific constraints on permissible system behavior [89, 54]. As these applications advance from single-turn moderation to multi-turn assistants and tool-using agents, both the policies and the inputs they govern grow more complex. The unit of judgment becomes a long transcript [33, 94], a structured plan [35], or an agent trajectory [89, 12] rather than a single message, and a modern policy is rarely one flat category: it bundles conditions, exceptions, counts, and interactions that must be assessed together [33]. Adhering to such a policy is therefore both critical and hard [94], as the verdict turns on a compound, context-dependent specification rather than a single surface feature, where one overlooked clause produces a false violation or a missed obligation.

∗^{*}Equal contribution.

Figure

Figure 1: (1) Given a natural-language policy and a small pool of seed samples, (2) the optimizer compiles the policy into (3) a decomposition program: predicates answered by weak models, deterministic extractors, and Python code that composes their outputs into a verdict. (4) Adversarial generators extend the training pool with counterexamples where the program departs from the policy, at the level of a single predicate (local) or the composition as a whole (systemic). The loop repeats, optimizing the program and its training data jointly.

The most direct approach uses a language model as the policy classifier itself. Its principal advantage is generality: any policy that can be expressed in natural language can be enforced without a predefined taxonomy [33, 67, 62]. This approach takes two forms. The first trains a custom classifier on the task, typically a small fine-tuned guardrail model [37, 31, 98, 24]. Such models are fast and inexpensive, and on a single, well-scoped rule they match far larger models [54]. Their capacity is the ceiling, so accuracy falls as a policy compounds interacting conditions beyond what one model resolves in a single pass [20]. The second prompts a frontier model with the policy at runtime and reads its verdict, the paradigm known as LLM-as-a-judge [101, 51]. While it is more capable on the compound case, its predictions are unstable [30, 76, 7], with variance rising with the number of clauses in the input [57]. Further, even dedicated reasoning models collapse past a complexity threshold rather than scaling through it [79]. Finally, its inference cost and latency make it impractical at production scale, where high-throughput classification is required. The first form is thus reliable only on simple policies, while the second is neither stable nor scalable.

A neurosymbolic approach is the natural alternative. Such methods pair neural components that supply semantic judgment with a symbolic layer that composes their outputs under explicit logic [52, 49]. Because each sub-decision is narrowly scoped and the composition is explicit, the verdict is more stable than a monolithic judgment [46]. As narrow sub-decisions are simpler [41, 102, 70], they can also be answered by small models, which makes the system cheaper to run. The weakness of existing methods lies in the symbolic layer itself, along two axes. The first is expressiveness: checklists [46, 15], weighted rule sets [93, 58], and compiled Boolean or probabilistic rules [12, 38, 92] cannot express the conditional, iterative, and computational structure that complex real-world use cases carry. The second is bias: a learned or synthesized layer is fit to a proxy for the policy, not to the policy itself, whether a rule set tuned to its training samples [93], a program searched against a static benchmark [99, 34], or a function verified against self-generated tests and specifications [56].

In this paper, we introduce SCOPE (Symbolic Composition Over Predicates and Extractors), which compiles a natural-language policy into a neurosymbolic program: neural predicates resolved by weak models, cheap sub-frontier models served without extended reasoning, deterministic extractors for exact computation, and executable code that composes their outputs. Expressiveness is met by the composition being code: it expresses the structure of real-world policies naturally, which rule-based formalisms capture only at low fidelity. Bias is mitigated by how the training data is built. Rather than relying only on a static training set, the search draws on an adversary that repeatedly generates counterexamples targeting where the current program departs from the specification [81], and the program is revised against them. Counterexamples are produced by the adversary at two levels: local drift, where a predicate no longer tracks the clause it transcribes, and global drift, where the decomposition as a whole misses a predicate or misroutes an interaction between clauses. Each counterexample is labeled by a strong teacher applying the full policy, and the cost is paid once at compilation. The unit of optimization is thus not a single rule [54] but the compound policy: each round adds counterexamples and updates both the predicate formulations and the code that composes them. The converged program runs entirely on weak models, so it is cheap to serve. Each verdict is attributable to the predicate outputs behind it rather than a post-hoc rationale, and, being built from narrow classifications, is more stable than a monolithic judgment.

We release a benchmark of four policy-enforcement tasks, derived from public benchmarks or modeled on deployed agentic systems. The tasks span long agent traces, multi-turn counting, critic auditing, and dynamic multi-label outputs. SCOPE attains the best accuracy in most task-executor settings, outperforming prompt optimization, neurosymbolic methods, and workflow generation. Its advantage grows as the executor weakens. Once a policy is compiled into predicates a weak model can answer without reasoning, accuracy becomes largely insensitive to the choice of executor. Programs compiled with our weakest executor transfer directly to other models, matching frontier reasoning models at a fraction of the inference cost. They are also far more stable: where reasoning models flip a substantial share of their verdicts across repeated runs, SCOPE's predictions remain nearly fixed, and each verdict traces to the predicate outputs that produced it. Ablations confirm that adversarial generation is central to these gains. More broadly, SCOPE shows that natural-language policies can be compiled rather than interpreted, turning policy enforcement from an opaque judgment delegated to a frontier model into a program that can be optimized, inspected, and deployed at scale.

References (88)