atlas

Research map / Large language models / Agents, code and math

Grammars of Formal Uncertainty: When to Trust LLMs in Automated Reasoning Tasks

NeurIPS 2025 · Large language models › Agents, code and math · approach: Mathematical and structural reasoning benchmarks · 1 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Models LLM-generated SMT-LIB programs as samples from a PCFG fitted to the SMT-LIB grammar, derives 25 grammar-based uncertainty metrics, and fuses them for selective verification of LLM autoformalization errors.

Problem

LLM-generated formal artifacts (SMT-LIB programs) are probabilistic and error-prone, yet standard token-level uncertainty methods fail to flag autoformalization errors before passing them to a solver.

Approach

Fits a PCFG over parse trees of ensembles of LLM-sampled SMT-LIB programs (using the SMT-LIB grammar as structure) and derives grammar-level uncertainty metrics (entropy, spectral radius, rule-distribution statistics) plus self-consistency signals, then fuses them with a lightweight ensemble for selective verification.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Generate SMT-LIB and solve with Z3 instead of direct text reasoningo3-mini · StrategyQAaccuracy: 0.7828 -> 0.7980Helped
Generate SMT-LIB and solve with Z3 instead of direct text reasoningLLMs · StrategyQAaccuracy: 0.8292 -> 0.6720; 0.8580 -> 0.7760; 0.7188 -> 0.5360; 0.6760 -> 0.4500Mixed
Generate SMT-LIB and solve with Z3 instead of direct text reasoningLLMs · ProntoQAaccuracy: 1.0000 -> 0.9980; 1.0000 -> 0.4501; 0.9939 -> 0.7440; 0.9820 -> 0.9000Hurt
Generate SMT-LIB and solve with Z3 instead of direct text reasoningLLMs · ProofWriteraccuracy: 0.8893 -> 0.9418; 0.8057 -> 0.5800; 0.9423 -> 0.4935; 0.4900 -> 0.6660; 0.4060 -> 0.7540Mixed
Generate SMT-LIB and solve with Z3 instead of direct text reasoningLLMs · FOLIOaccuracy: 0.9450 -> 0.5000; 0.9333 -> 0.5961; 0.9252 -> 0.5200; 0.9010 -> 0.5625; 0.9017 -> 0.7321Hurt
Combine uncertainty metrics with a learned Ensemble ML predictorPCFG-based error detection · StrategyQA (o3-mini)AUROC: 0.7448 -> 0.7850Helped
Use grammar entropy to predict SMT correctnesso3-mini · ProofWriterAUROC: 0.9301Helped
Increase sampling temperature (ablation)LLM SMT-LIB generation and induced PCFG · Temperature-varied SMT generationgrammar entropyHelped
Increase sampling temperature (ablation)LLM SMT-LIB generation and induced PCFG · Temperature-varied SMT generationspectral radiusMixed
Increase sampling temperature (ablation)LLM SMT-LIB generation and induced PCFG · Temperature-varied SMT generationNSUINo clear effect
Increase sampling temperature (ablation)LLM SMT-LIB generation and induced PCFG · Temperature-varied SMT generationaverage rules per non-terminalHelped
Increase sampling temperature (ablation)LLM SMT-LIB generation and induced PCFG · Temperature-varied SMT generationkurtosisHurt

Surprising findings

Limitations

Experimental setup

Datasets: StrategyQA ProntoQA ProofWriter FOLIO

Benchmarks: StrategyQA ProntoQA ProofWriter FOLIO

Metrics: accuracy AUROC AURC ECE Brier score

Baselines: token entropy perplexity self-consistency text Ensemble Average

Builds on: probabilistic context-free grammars self-consistency SAT-LM

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy