Auto-Formalizing Neuro-Symbolic Predictors
Organizations: University of Trento, Italy · University of Illinois Urbana-Champaign, USA · University of Edinburgh, UK
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/.
Figures & tables
| Dataset | Model | F1 ( ) | Precision ( ) | Recall ( ) | Syntax ER ( ) |
|---|---|---|---|---|---|
| auto-nesy-bench | qwen3-8b | ||||
| mistral-nemo | |||||
| phi4-reasoning-plus | |||||
| gpt-oss-20b | |||||
| gemma3-27b | |||||
| gemma4-31b |
| Dataset | Variant | Config. | F1 ( ) | Precision ( ) | Recall ( ) | Syntax ER ( ) |
|---|---|---|---|---|---|---|
| auto-nesy-bench | Description | Non-Detailed | ||||
| Detailed | ||||||
| Prompting | ZS | |||||
| ZS-CoT | ||||||
| dcpbench | Prompting | ZS | ||||
| ZS-CoT |
| Dataset | Format | F1 ( ) | Precision ( ) | Recall ( ) | Syntax ER ( ) |
|---|---|---|---|---|---|
| auto-nesy-bench | DIMACS | ||||
| NAT | |||||
| PySAT | |||||
| CPMpy | |||||
| SymPy | |||||
| dcpbench | DIMACS |
| G-T | gpt-oss-120b | olmo3-32b-think | qwen3-8b | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Task | F1 | Rec | F1 | Rec | Rel | MC-R | F1 | Rec | Rel | MC-R | F1 | Rec | Rel | MC-R |
| bdd-oia | ||||||||||||||
| bdd-oia-2 | ||||||||||||||
| cebab | ||||||||||||||
| chx | ||||||||||||||
| cifar10 | ||||||||||||||
Appendix figures & tables48 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Link | CUDA | vLLM | GPUs |
|---|---|---|---|---|
| qwen3-32b | Qwen/Qwen3-32B | 12.5.0 | 0.23.0 | 2 A100 80 GB |
| mistral-nemo | mistralai/Mistral-Nemo-Instruct-2407 | |||
| phi4-reasoning-plus | microsoft/Phi-4-reasoning-plus | |||
| gemma3-27b | google/gemma-3-27b-it | 12.6 | 0.23.0 | 1–2 RTX PRO 6000 Blackwell 96 GB (sm_120) |
| gemma4-31b | google/gemma-4-31B-it | |||
| olmo3-32b-think | allenai/Olmo-3-32B-Think | 12.6 | 0.23.0 | 4 A100 |
| Dataset | Problems | Variables | Clauses | NeSy-Ready | ||||
|---|---|---|---|---|---|---|---|---|
| Min | Max | Mean | Min | Max | Mean | |||
| satbench ( Wei et al., 2025 ) | ✗ | |||||||
| dcpbench ( Michailidis et al., 2025b ) | ✗ | |||||||
| auto-nesy-bench (ours) | ✓ | |||||||
| Natural-language constraint | CNF clause | DIMACS encoding |
|---|---|---|
| Ana signs up for watering duty. | 1 0 | |
| Either Ben does not sign up, or Ana does not sign up. | -2 -1 0 | |
| Either Ana does not sign up, or Emma signs up. | -1 5 0 | |
| Either Carla does not sign up, or Ben signs up. | -3 2 0 |
| Task | Variables | Clauses |
|---|---|---|
| chx ( Cohen et al., 2022 ) | 9 | 27 |
| fashion ( Xiao et al., 2017 ) | 10 | 46 |
| bdd-oia-2 ( Xu et al., 2020 ) | 11 | 17 |
| cle4evr ( Johnson et al., 2017 ) | 12 | 28 |
| cifar10 ( Krizhevsky et al., 2009 ) | 15 | 157 |
| mn-add-bin ( Manhaeve et al., 2018 ) | 13 | 512 |
| Dataset | Task(s) | License | Redistributed |
|---|---|---|---|
| MNIST ( LeCun, 1998 ) | mn-add(mul)(-bin) | Unrestricted (NIST-derived) | ✓ |
| Fashion-MNIST ( Xiao et al., 2017 ) | fashion | MIT | ✓ |
| CIFAR-based ( Krizhevsky et al., 2009 ) | cifar10(100) | No explicit license | ✗ |
| BDD-OIA ( Xu et al., 2020 ) | bdd-oia(-2) | See ( Bortolotti et al., 2024 ) | ✓ |
| ROAD-R ( Giunchiglia et al., 2023 ) | road-r | CC BY-NC-SA 4.0 | ✓ |
| SUSHI3 ( Kamishima, 2003 ) | sushi | Research use permitted; redistribution forbidden. | ✗ |
| Model | sample | rep. pen. | think | precision | |||
|---|---|---|---|---|---|---|---|
| qwen3-32b | ✓ | 0.6 | 0.95 | 20 | – | ✓ | bf16 |
| qwen3-8b | ✓ | 0.6 | 0.95 | 20 | – | ✓ | bf16 |
| qwen3-coder-next | ✓ | 1.0 | 0.95 | 40 | – | – | bf16 |
| mistral-nemo | – | – | – | – | – | – | bf16 |
| phi4-reasoning-plus | ✓ | 0.8 | 0.95 | 50 | – | ✓ | bf16 |
| gemma3-27b-it | ✓ | 0.7 | 0.95 | 64 | 1.3 | – | bf16 |
| Input | Layer Type | Parameter | Activation |
|---|---|---|---|
| Conv2d + BatchNorm2d | depth , kernel , stride , padding | ReLU | |
| MaxPool2d | kernel , stride | ||
| more identical blocks, depth | |||
| AdaptiveAvgPool2d | output | ||
| Flatten | dim | ||
| Linear | |||
| Input | Layer Type | Parameter | Activation |
|---|---|---|---|
| Conv2d + BatchNorm2d | depth , kernel , stride , padding | ReLU | |
| MaxPool2d | kernel , stride , padding | ||
| BasicBlock ( layer1 ) | depth , stride | ReLU | |
| BasicBlock ( layer2 ) | depth , stride (block 1) | ReLU | |
| BasicBlock ( layer3 ) | depth , stride (block 1) | ReLU | |
| BasicBlock ( layer4 ) | depth , stride (block 1) | ReLU |
| Input | Layer Type | Parameter | Activation |
|---|---|---|---|
| Linear | ReLU | ||
| Linear | ( ) | ReLU | |
| Linear |
| Input | Layer Type | Parameter | Activation |
|---|---|---|---|
| tokenized input ( input_ids , attention_mask ) | max length | ||
| BertModel ( bert-base-uncased , frozen) | Transformer encoder layers, | ||
| hidden , heads , | |||
| FFN | GELU (internal) | ||
| [CLS] pooled token | — | ||
| Linear | ReLU |
| Stage | Slow pathway | Fast pathway | Output (slow / fast ch.) |
|---|---|---|---|
| data | sample frames ( ) | all frames | / |
| conv1 | Conv3d , | Conv3d , | / |
| pool1 | MaxPool3d , | MaxPool3d , | / |
| res2 | bottleneck | bottleneck | / |
| res3 | bottleneck, stride | bottleneck, stride | / |
| res4 | bottleneck, stride | bottleneck, stride | / |
| Dataset | Model | Prompt | Format | F1 ( ) | Precision ( ) | Recall ( ) | Syn. ER ( ) |
|---|---|---|---|---|---|---|---|
| auto-nesy-bench | deepseek-r1-llama-70b | ZS | SymPy | ||||
| gemma3-27b | ZS-CoT | NAT | |||||
| gemma4-31b | ZS-CoT | CPMpy | |||||
| gpt-oss-120b | ZS-CoT | CPMpy | |||||
| gpt-oss-20b | ZS-CoT | SymPy | |||||
| mistral-nemo | ZS-CoT | CPMpy |
| Model | Prompt | Format | F1 ( ) | Precision ( ) | Recall ( ) | Syntax ER ( ) |
|---|---|---|---|---|---|---|
| deepseek-r1-llama-70b | ZS | CPMpy | ||||
| deepseek-r1-llama-70b | ZS | DIMACS | ||||
| deepseek-r1-llama-70b | ZS | NAT | ||||
| deepseek-r1-llama-70b | ZS | PySAT | ||||
| deepseek-r1-llama-70b | ZS | SymPy | ||||
| deepseek-r1-llama-70b | ZS-CoT | CPMpy |
| Model | Prompt | Format | F1 ( ) | Precision ( ) | Recall ( ) | Syntax ER ( ) |
|---|---|---|---|---|---|---|
| deepseek-r1-llama-70b | ZS | CPMpy | ||||
| deepseek-r1-llama-70b | ZS | DIMACS | ||||
| deepseek-r1-llama-70b | ZS | NAT | ||||
| deepseek-r1-llama-70b | ZS | PySAT | ||||
| deepseek-r1-llama-70b | ZS | SymPy | ||||
| deepseek-r1-llama-70b | ZS-CoT | CPMpy |
| Model | Prompt | Format | F1 ( ) | Precision ( ) | Recall ( ) | Syntax ER ( ) |
|---|---|---|---|---|---|---|
| gemma4-31b | ZS | CPMpy | ||||
| gemma4-31b | ZS | DIMACS | ||||
| gemma4-31b | ZS | NAT | ||||
| gemma4-31b | ZS | PySAT | ||||
| gemma4-31b | ZS | SymPy | ||||
| gemma4-31b | ZS-CoT | CPMpy |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia-2 | |||||||
| cebab | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion | |||||||
| kand-logic-2 |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia | |||||||
| bdd-oia-2 | |||||||
| cebab | |||||||
| chx | |||||||
| cifar10 | |||||||
| cifar100 |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia | |||||||
| bdd-oia-2 | |||||||
| cebab | |||||||
| chx | |||||||
| cifar10 | |||||||
| cifar100 |
| Model | Task | Category | Reason ( CPMpy + CoT ) |
| olmo3-32b-think | bdd-oia | formula degenerate | UNSAT (0 models) |
| olmo3-32b-think | kand-logic | no formula produced | no CNF generated |
| olmo3-32b-think | sudoku | no formula produced | no CNF generated |
| olmo3-32b-think | chx | run failure | CUDA device-side assert |
| olmo3-32b-think | road-r | run failure | process stalled |
| olmo3-32b-think | mn-add-bin | formula degenerate | 4 of 13 declared variables are missing |
| G-T | gpt-oss-120b | olmo3-32b-think | |||||||||||
| Task | F1 | Rec | Cons | F1 | Rec | Cons | Rel | MC-R | F1 | Rec | Cons | Rel | MC-R |
| bdd-oia | – | – | – | – | – | – | – | – | – | – | |||
| bdd-oia-2 | – | – | – | – | – | ||||||||
| cebab | – | – | – | – | – | – | – | – | – | – | |||
| chx | |||||||||||||
| cifar10 | |||||||||||||
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia-2 | |||||||
| chx | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| chx | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion | |||||||
| kand-logic-2 |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion | |||||||
| kand-logic | unknown | – | |||||
| kand-logic-2 |
| Model | Task | Category | Reason ( CPMpy + CoT , non-detailed prompt) |
|---|---|---|---|
| gpt-oss-120b | bdd-oia | formula degenerate | 5 of 25 task variables are missing |
| gpt-oss-120b | cebab | no formula produced | no CNF generated |
| olmo3-32b-think | bdd-oia | formula degenerate | 6 of 25 task variables are missing |
| olmo3-32b-think | bdd-oia-2 | formula degenerate | 1 of 11 task variables is missing |
| olmo3-32b-think | warcraft | formula degenerate | UNSAT (0 models) |
| olmo3-32b-think | cebab | no formula produced | no CNF generated |
| Unconstrained | G-T | gpt-oss-120b | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Task | F1 | Rec | Cons | F1 | Rec | Cons | Rel | MC-R | F1 | Rec | Cons | Rel | MC-R |
| bdd-oia | |||||||||||||
| bdd-oia-2 | |||||||||||||
| cebab | |||||||||||||
| chx | |||||||||||||
| cifar10 | |||||||||||||
| Task | Consistency | Accuracy | Precision | Recall | F1 |
|---|---|---|---|---|---|
| bdd-oia | |||||
| bdd-oia-2 | |||||
| cebab | |||||
| chx | |||||
| cifar10 | |||||
| cifar100 |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia | |||||||
| bdd-oia-2 | |||||||
| cebab | |||||||
| chx | |||||||
| cifar10 | |||||||
| cifar100 |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia | |||||||
| bdd-oia-2 | |||||||
| cebab | |||||||
| chx | |||||||
| cifar10 | |||||||
| cifar100 |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia-2 | |||||||
| cebab | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion | |||||||
| kand-logic-2 |
| Unconstrained | G-T | gpt-oss-120b | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Task | F1 | Rec | Cons | F1 | Rec | Cons | Rel | MC-R | F1 | Rec | Cons | Rel | MC-R |
| bdd-oia | – | – | – | – | – | ||||||||
| bdd-oia-2 | |||||||||||||
| cebab | – | – | – | – | – | ||||||||
| chx | |||||||||||||
| cifar10 | |||||||||||||
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| chx | – | – | |||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion | |||||||
| kand-logic | unknown | – |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| chx | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion | |||||||
| kand-logic-2 |
| Task | Consistency | Accuracy | Precision | Recall | F1 | Rel | MC-R |
|---|---|---|---|---|---|---|---|
| bdd-oia-simple | |||||||
| chx | |||||||
| cifar10 | |||||||
| cifar100 | |||||||
| cle4evr | |||||||
| fashion- |