LogicVault: Persistent Symbolic Belief States for Cross-Query Logical Consistency in LLMs
Abstract
Large Language Models (LLMs) answer each query in isolation with no persistent logical state. This causes contradictions across related questions. We introduce LogicVault, a framework that maintains a symbolic belief vault alongside any LLM and enforces cross-query consistency through an external SMT solver. For each response, LogicVault formalizes the output into first-order logic, checks it against all prior beliefs via Z3, and repairs contradictions by feeding the minimal unsatisfiable core back to the LLM. A belief revision module based on AGM theory handles genuine world-model updates. We release LogicBench-Cross, the first benchmark for crossquery logical consistency, containing 500 multi-query scenarios across five domains. Across six LLMs, LogicVault reduces cross-query contradictions by 78% and improves single-query accuracy on FOLIO, ProofWriter, and LogiQA 2.0. The framework requires no training and works with any LLM at inference time. Code is available at: https://github.com/Sarimsaljook/LogicVault.