Formal Semantic Control over Language Models

Yingji Zhang

Abstract

Modern language models (LMs) represent meaning through high-dimensional vectors, yet these representations often lack the interpretability and precision required for formal reasoning. This research advances semantic representation learning by shaping the latent space geometry of Variational AutoEncoders (VAEs). By aligning distributional semantics with formal linguistic structures, we enable localized, quasi-symbolic control over sentence generation and logical inference. This work introduces novel methodologies for disentangling semantic features and isolating inference behaviors, moving toward models whose internal representations can be systematically interpreted and reliably directed.

Introduction: Beyond the Black Box

The "black box" nature of Transformer-based language models presents a significant barrier to their deployment in high-stakes domains. While these models excel at capturing statistical patterns, their internal representations—distributional semantics—are typically "entangled." A single vector may encode syntax, sentiment, and factual content simultaneously, making it impossible to manipulate one attribute without inadvertently altering others.

This research addresses this limitation by bridging the gap between distributional semantics and formal semantics. The goal is to develop language representations that are not only geometrically interpretable but also systematically controllable through deliberate structural constraints.

Methodology: Structuring the Latent Space

The core of this work utilizes the Variational AutoEncoder (VAE) framework to compress natural language into a regularized latent space. Several novel techniques are introduced to impose formal structure on this space:

1. Formal Semantic Geometry

Rather than treating meaning as a single point in a high-dimensional space, this thesis proposes representing semantic features as convex cones. In this geometric framework, the meaning of a complex expression is defined by the intersection of the cones representing its constituent parts. This approach provides a rigorous geometric basis for compositionality—where adding vectors remains within the cone (preserving semantic integrity), while subtraction facilitates controlled semantic shifts.

2. Disentanglement via Invertible Neural Networks (INNs)

To separate entangled features without the need for massive retraining, Invertible Neural Networks are employed as "plug-in" components. These INNs bijectively map entangled representations into a separable Gaussian space, allowing for the isolation of specific semantic roles (e.g., "subject-animal") with high precision.

3. Dual-Encoder Architectures

To prevent the model from conflating "how" a sentence is structured with "what" it says, a dual-encoder system was developed. By pairing a graph-based encoder (capturing syntax trees) with a sequential encoder (capturing lexical meaning), the model explicitly disentangles syntactic patterns from semantic content.

4. Neural Tangent Kernel (NTK) Theory for Reasoning

To control logical inference, the research applies NTK theory to identify how specific inference rules—such as argument substitution—are encoded within a model's parameters. This allows for the isolation of "functional subspaces" within the Feed-Forward Network (FFN) layers, which were found to be more effective than attention layers at maintaining the separation of reasoning rules.

Experimental Framework and Datasets

The methodologies were evaluated using datasets characterized by structural regularity and conceptual density:

  • WorldTree: A corpus of scientific explanations involving taxonomic and causal relations.
  • EntailmentBank: A dataset of multi-step reasoning trees.
  • Mathematical Expressions: Used to evaluate the model's adherence to rigid symbolic rules like differentiation and integration.

Additionally, a new benchmark was established by manually annotating 10 symbolic inference types (e.g., Frame-conjunction, ARG-substitution) across 5,000 premise-conclusion pairs in EntailmentBank.

Key Findings and Results

The experiments yielded several significant insights into the nature of neural representations:

  • Enhanced Smoothness: The proposed T5-VQVAE model achieved a 43% improvement in "Interpolation Smoothness" over existing state-of-the-art models like Optimus. This indicates a more continuous and logically coherent transition between points in the latent space.
  • High-Precision Disentanglement: Using supervised INNs, the model achieved F1 scores of up to 0.98 in separating semantic roles, vastly outperforming standard VAE baselines.
  • Quasi-Symbolic Control: By manually manipulating "token embeddings" within the structured latent space (e.g., swapping the embedding for "animal" with "bird"), the model consistently generated the correct logical conclusions, demonstrating that the latent space had successfully captured the underlying rules of substitution.
  • Syntax as a Distractor: A notable finding was that explicitly separating syntax from semantics improved reconstruction accuracy. Standard models often prioritize common syntactic templates at the expense of specific lexical details; disentanglement mitigates this "distraction."

Conclusion and Future Directions

While this thesis demonstrates that latent spaces can be precisely structured for control, a persistent challenge remains: the tension between memorization and generalization. Transformer decoders still exhibit a tendency to rely on training patterns rather than pure compositional logic.

Future research will explore diffusion-based language models to provide more flexible decoding mechanisms for integrating structured constraints. Additionally, extending these geometric frameworks from "shallow" semantic roles to complex clausal constructions and non-compositional idioms remains a primary objective for the next generation of interpretable AI.

Summary updated

BibTeX
@misc{zhang2026formal,
  author = {Yingji Zhang},
  title = {{Formal Semantic Control over Language Models}},
  year = {2026},
  eprint = {2602.00638},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.00638},
}
Figure