Manuscript Offprint

arXiv:2610.01519

Auto-Formalizing Neuro-Symbolic Predictors

Samuele Bortolotti, Weixin Chen, Han Zhao, Andrea Passerini, Stefano Teso, Antonio Vergari

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

ABSTRACT

Neuro-Symbolic (NeSy) predictors incorporate prior knowledge into the prediction process of neural networks, ensuring that outputs satisfy specified constraints, making them particularly suitable for high-stakes applications where compliance with domain knowledge is essential. A key bottleneck in this paradigm is the acquisition of symbolic constraints: encoding domain knowledge into logical formulas remains a manual and expert-intensive process. In this work, we investigate the extent to which auto-formalization via LLMs can systematically translate textual knowledge into symbolic knowledge that can be plugged into NeSy predictors. To this end, we introduce auto-nesy-bench, a new benchmark for evaluating constraint formalization and its impact on downstream accuracy of NeSy predictors. Through an extensive evaluation across several domains, we find that LLMs can formalize constraints to a meaningful extent, generating formulas that are often similar to those provided by human experts. Moreover, when the generated formulas are syntactically valid, they can lead to high-quality downstream predictions. The code and benchmark are available at https://unitn-sml.github.io/auto-nesy-bench/.

1 Introduction

Neuro-Symbolic (NeSy) AI combines the learning capabilities of neural networks with the reasoning capabilities of symbolic systems, making it a promising paradigm for building reliable AI models [De Raedt et al., 2021, Garcez et al., 2022]. A prominent and well-studied class of NeSy models is that of NeSy predictors [Manhaeve et al., 2018, Badreddine et al., 2022, Chen et al., 2026a], which incorporate prior knowledge into the prediction process to ensure that outputs comply with domain-specific constraints [Giunchiglia and Lukasiewicz, 2020, Giunchiglia et al., 2024, Chen et al., 2026b], making them suitable for high-stakes applications [Giunchiglia et al., 2022, 2025, Dash et al., 2022].

Such models typically assume that the constraints are provided beforehand, requiring a domain expert to identify the relevant knowledge and formalize it into a representation that can be incorporated into the predictor. This requirement persists even in recent frameworks such as DeepLog [Derkinderen et al., 2026] and ULLER [Van Krieken et al., 2024], which aim to make NeSy predictors more accessible to practitioners, as the formalization of logical constraints still falls on the end user. This raises a natural question: what if an end user wants to deploy a NeSy predictor but has no expert available to formalize the required knowledge? We address this gap by leveraging Large Language Models (LLMs) as domain experts to formalize natural language into symbolic constraints.

Corresponding author: samuele.bortolotti@unitn.it.

† Work started when Samuele Bortolotti was visiting the APRIL lab, University of Edinburgh.

Equal contribution.

Shared supervision.

A PREPRINT

Figure

Figure 1: Illustration of our auto-nesy-bench auto-formalization framework: given a natural language description of a constraint and the corresponding variables, an LLM generates DIMACS, PySAT, CPMpy, SymPy, or natural language (NAT) formalizations. Non-DIMACS outputs are converted to DIMACS and later compiled, via knowledge compilation, into circuits that can be used in NeSy predictors (SPL), thus ensuring that the output satisfies the specified constraints by design, following Eq. (1). The five boxes show equivalent encodings of (green ∧ clear) ⇒ forward.

Recent work has shown that LLMs can generate constraint programs directly from natural language descriptions [Tsouros et al., 2023, Michailidis et al., 2024]. Existing benchmarks target either Boolean satisfiability (SAT), such as satbench [Wei et al., 2025], or CP, such as dcpbench [Michailidis et al., 2025a], but do not evaluate how generated constraints affect learning and downstream NeSy performance. To address this gap, we introduce auto-nesy-bench, a challenging NeSy benchmark that extends the well-established rsbench [Bortolotti et al., 2024] with prompts, data instances, output annotations, and evaluation metrics in which the task is to formalize a logical constraint in conjunctive normal form (CNF) out of a textual description (see Fig. 1).

We therefore evaluate both the quality of constraints generated by modern and frontier LLMs on satbench, dcpbench, and auto-nesy-bench, as well as their downstream impact when integrated into state-of-the-art NeSy predictors, such as semantic probabilistic layers [Ahmed et al., 2022, SPL], or employed as soft constraints using semantic loss [Xu et al., 2018, SL] on auto-nesy-bench. To instantiate this evaluation, the LLM formalizes the constraints in propositional logic (PL) in one of several formalisms ranging from a textual representation of a CNF such as DIMACS [Johnson and Trick, 1996] or natural language (NAT) to Python programs using PySAT [Ignatiev et al., 2018], CPMpy [Guns, 2019] and SymPy [Meurer et al., 2017], each one coming with different challenges (see Section 3.1). Our results show that high-performing LLMs can formalize NeSy tasks, but performance depends on the level of detail in the constraint description. When the generated formulas are syntactically valid, formalization errors can have little impact on downstream predictions.

Our contributions: We introduce auto-nesy-bench, a benchmark for evaluating auto-formalization in NeSy tasks. We investigate the following research questions: (RQ1) Can LLMs formalize logical constraints from natural language descriptions? and (RQ2) How do NeSy models perform when provided with LLM-generated constraints? To address RQ1, we analyze the problem from multiple perspectives, examining which types of (a) LLMs, (b) input formats, and (c) output formats lead to the best results, as well as which configurations fail. For RQ2, we evaluate two representative state-of-the-art NeSy approaches, a layer and a loss, using LLM-generated constraints.

References (100)

Couldn't load all references. Reload the page to try again.