arXiv:2610.25402cs.AIOct 2026

Manuscript Offprint

arXiv:2610.25402

When Form Changes but Logic Doesn't: Building Logic-invariant LLMs through Logical Structure

Xuyuan Liu, Xinshuai Dong, Elynn Chen, Yujun Yan

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

Abstract

Large language models (LLMs) have achieved strong performance across diverse reasoning tasks, yet it remains unclear whether this performance reflects an understanding of underlying logical structure or a reliance on shallow semantic cues. A key indicator of such understanding is whether models treat logically equivalent inputs consistently, producing the same predictions despite differences in expression. Through systematic evaluation on curated data, we show that even strong LLMs often fail this test: they do not consistently preserve predictions across logically equivalent inputs and generalize poorly to unseen logical forms. To address this limitation, we propose LoGical SStructure-guided reasoning (LoGIST), a framework that guides LLM reasoning with explicit logical structure. LoGIST maps each input instance to a decision diagram, a directed acyclic graph that captures the underlying logical structure, and encodes this graph into a logical embedding that conditions the LLM's reasoning process. Across multiple training settings, LoGIST reduces inconsistency under logical equivalence and improves generalization to unseen logical forms, suggesting that logical invariance is a useful target for building more robust and generalizable logical reasoning in LLMs. 1^{1}

1 Introduction

Large language models (LLMs) have demonstrated remarkable performance across a wide range of reasoning tasks, from mathematical problems to logical puzzles [56, 65, 55, 64, 58]. However, whether LLMs' reasoning capabilities reflect a genuine understanding of underlying logic or reliance on semantic cues remains unclear. Several recent studies suggest that, in some settings, LLMs may rely on surface-level patterns [28, 67, 63] and memorized world knowledge [61, 12, 3, 54, 25] rather than formal logical structures. A central test of logical understanding is whether models capture logical invariance: logically equivalent inputs should yield the same conclusions despite differences in expression. In this paper, we show that even state-of-the-art LLMs often fail this test. Using our curated dataset of logically equivalent input variants, we find that advanced LLMs exhibit substantial performance drops and frequent decision flips when the equivalent underlying logic is expressed in different forms. These failures reveal weak logical consistency and suggest that current LLMs remain overly sensitive to surface form rather than shared logical structure. We further show that addressing this invariance gap improves generalization to unseen logical forms.

Prior work on improving LLMs’ logical reasoning has largely emphasized task-level accuracy over learning reusable logical structure. Some methods couple LLMs with external symbolic tools, such as logic solvers or theorem provers [33, 62, 31, 37]; while effective, they rely on external systems for formal reasoning, leaving the LLM’s intrinsic structure-aware reasoning less examined. Other methods rely on data-driven training [39, 44, 29, 66], but do not explicitly model logical structure.

1^{1}Our code is available at https://github.com/GraphmindDartmouth/LoGIST.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

As a result, models may learn distribution-specific patterns rather than reusable logical principles, limiting generalization to unseen logical forms.

To address this gap, we propose LoGical STructure-guided reasoning (LoGIST). LoGIST maps each logical reasoning question to a decision diagram, a directed acyclic graph that captures the input's underlying logical structure independently of its surface form. Logically equivalent input variants are mapped to the same decision diagram. LoGIST then encodes these decision diagrams into structure-aware logical embeddings through contrastive learning and uses the embeddings to condition the LLM's reasoning. Across diverse training strategies, LoGIST improves both logical consistency across equivalent inputs and generalization to unseen logical forms, suggesting that logical invariance is a useful target for building more robust and generalizable logical reasoning in LLMs. Our further analysis shows that LoGIST learns to encode logical composition as a linear direction, thus explaining its generalizability.

In summary, our contributions are as follows:

  • New Insight: We identify a key limitation of current LLMs: even strong models often fail to reason consistently over logically equivalent inputs, revealing weak logical invariance and limited generalization to unseen logical forms.

  • New Method: We propose LoGIST, a framework that maps natural-language inputs to decision diagrams and encodes their logical structure into embeddings that condition LLM reasoning, enabling more consistent predictions across surface-form variants.

  • New Perspective: We show that logical invariance and generalization are closely connected: explicitly modeling logical structure helps LLMs reason more consistently over equivalent inputs and generalize better to unseen logical forms.

References (57)