arXiv:2610.33267cs.AIOct 2026

Manuscript Offprint

arXiv:2610.33267

Scoped Semantic Invariance as a Foundation for LLM Reliability

Rosario Uceda-Sosa, Maria Chang, Karthikeyan Natesan Ramamurthy, Moninder Singh

Abstract

LLMs often answer semantically equivalent queries inconsistently, even when the underlying facts are known. We formalize consistency as semantic invariance over equivalence classes of queries and show that invariance under arbitrary meaning-preserving transformations is undecidable in general. This motivates scoped semantic invariance, where model behavior is evaluated relative to bounded semantic domains.

We operationalize this framework using knowledge graphs (KGs), which act as explicit semantic control structures defining local semantics and grounding contexts. Across the MITRE D3FEND ontology and eight Wikidata-derived domains, we show that inconsistencies are structured rather than random, concentrating in localized hotspot subgraphs organized around recurring TREE, STAR, and CYCLE patterns that remain stable across models and domains.

We further show that selective graph grounding improves consistency with the KG specification and cross-model agreement, while indiscriminate grounding introduces regressions. A layered grounding strategy achieves the strongest monotonicity profile, preserving KG-consistent knowledge while reducing inconsistency. Finally, we show that hotspot structures discovered from simple consistency probes transfer to more realistic compositional reasoning tasks, positioning them as a practical reliability layer for predicting and targeting failures rather than a canonical decomposition.

1 Introduction

Large language models (LLMs) achieve strong performance on many benchmarks, yet provide no guarantees of consistency across paraphrases or simple reasoning variations. Prior work shows that models often answer queries about knowledge graph (KG) relations in a manner consistent with it, yet fail on semantically equivalent formulations (Elazar et al., 2021). Thus, even when models know the underlying facts, their behavior may remain semantically unstable.

This instability reflects a broader limitation of current LLM interaction paradigms. Prompt engineering mixes instructions, data, and control flow within unstructured natural language, making behavior brittle, difficult to reproduce and monitor across domains and models (Hind et al., 2026). Our goal is not to eliminate prompting, but to make it more disciplined by grounding interactions in explicit semantic structure. We view KGs as a step toward such a semantic interface: a structured substrate against which model behavior can be evaluated, monitored, and selectively constrained. Our aim throughout is not to maximize aggregate accuracy, but to make failures predictable and localized enough that they can be selectively identified and repaired — a shift in emphasis from average-case performance to targeted reliability interventions.

A natural reliability requirement in this setting is semantic invariance: meaning-preserving queries should yield identical outputs (de Zarzà et al., 2026). Recent work similarly identifies consistency and robustness as central dimensions of LLM reliability (Rabanser et al., 2026). However, semantic invariance cannot be guaranteed in general: for unconstrained tasks, consistency under semantic transformations is undecidable (Sipser, 2013; Abiteboul et al., 1995). This motivates a shift from global guarantees to scoped semantic invariance, where model behavior is evaluated relative to bounded semantic domains.

We operationalize scoped invariance using KGs. A KG encodes explicit semantic structure through relations such as hierarchy, transitivity, and property inheritance, inducing equivalence classes of semantically related queries, which we refer to as query clusters. This makes consistency measurable relative to a well-defined semantic context while exposing the local constraints governing reasoning consistent with the KG specification.

Within this setting, we find that consistency failures are highly structured. Rather than being uniformly distributed, they concentrate in localized hotspot subgraphs that recur across models and domains. These hotspots decompose into a small set of recurring structural patterns—TREE, STAR, and CYCLE—which predict where models are likely to behave inconsistently. This suggests that semantic instability is shaped primarily by KG topology rather than incidental prompt variation.

Building on this structure, we study selective graph grounding through KG augmentation. We show that indiscriminate augmentation can improve aggregate performance while simultaneously introducing local regressions. This motivates monotonicity as a reliability criterion: interventions should reduce inconsistency while also preserving KG-aligned knowledge. We therefore use a layered strategy that applies stronger structural grounding only where simpler grounding fails.

Our primary goal is not unrestricted repair, but principled semantic evaluation and control over bounded domains. In practical deployments, KGs provide an explicit semantic reference against which LLM behavior can be audited, benchmarked, and selectively constrained, particularly in industrial or mission-critical settings where instability over a small set of concepts may have disproportionate operational impact.

We evaluate these ideas on a real-world cybersecurity dataset, SI-CYBER, derived from the MITRE D3FEND ontology (MITRE Corporation, 2025), together with multiple Wikidata-derived domains (Uceda-Sosa et al., 2024).

As preliminary evidence that these patterns generalize beyond controlled equivalence-cluster probes, we further observe, on a small set (N=25) of human-authored compositional reasoning queries (Section D.3), that selective graph grounding from simple queries improves consistency and cross-model agreement; we treat this as a targeted confirmatory signal rather than a large-scale validation of the taxonomy.

Contributions. (1) We formalize consistency as invariance over KG-derived equivalence classes and establish fundamental limits on semantic invariance. (2) We introduce SI-CYBER, a cybersecurity benchmark for scoped semantic invariance 1^{1}. (3) We show empirically that consistency failures are structured and predictive, concentrating in recurring hotspot patterns across models and domains. (4) We show that every hotspot edge receives a CYCLE, STAR, or TREE type under a deterministic classification procedure, with TREE as the default case. (5) We show that KG augmentation improves aggregate performance but may introduce local regressions, motivating monotonicity and layered grounding as practical reliability constraints.