Quasi-symbolic Semantic Geometry over Transformer-based Variational AutoEncoder

Yingji Zhang, Danilo S. Carvalho, Ian Pratt‐Hartmann

Abstract

Formal and symbolic semantics provide canonical, rigid controllability and interpretability to sentence representations through their localization and composition properties. This work explores how to deliver these properties to distributional sentence representations to better control and interpret language model (LM) generation. We theoretically frame sentence semantics as a composition of semantic role - word content features and propose a "formal semantic geometry." By deploying a Transformer-based Variational AutoEncoder (VAE) with a supervision approach, we inject this geometry into GPT-2, allowing sentence generation to be manipulated and explained over a low-dimensional latent Gaussian space. Furthermore, we introduce a new probing algorithm to guide the movement of sentence vectors within this geometry. Our results indicate that formal semantic geometry can significantly enhance the control and interpretation of sentence generation.

Introduction: The Challenge of Polysemanticity

Current Large Language Models (LLMs) are often "polysemantic," where individual neurons or dimensions in their internal representations contribute to multiple, often unrelated concepts. This entanglement makes them difficult to interpret and control precisely. For instance, modifying a specific semantic component of a sentence (e.g., changing the action while preserving the subject) typically lacks a direct "knob" in the model's latent space.

In contrast, formal semantics—the logic-based study of meaning—is inherently modular. In a logical framework, variables can be swapped without disrupting the overall structure. This paper bridges the gap between the rigid controllability of symbolic logic and the flexible, continuous nature of neural distributional representations.

The Formal Semantic Geometry Framework

The proposed framework treats sentence semantics as a composition of semantic role - word content pairs, such as "Agent: Animals" or "Verb: Require."

SRL-Conditional VAE

To implement this, the authors adapt the "Optimus" architecture, which utilizes a BERT encoder and a GPT-2 decoder. Training is supervised using Semantic Role Labeling (SRL) to ensure the latent space—the bottleneck between encoding and decoding—organizes information according to these formal roles.

Overview of the Formal Semantic Geometry Framework, illustrating the flow from BERT to the geometric latent space and finally to GPT-2 generation.

The Convex Cone Hypothesis

Theoretically, semantic features are framed as convex cones within the latent Gaussian space. In this view, a sentence's meaning is defined by the intersection of several cones, each representing a different semantic role. Moving a vector out of one cone while remaining within others allows for precise, "quasi-symbolic" editing of the generated text.

Geometrical Probing and Guided Traversal

To navigate this latent geometry, the authors developed a probing algorithm based on decision trees. By training a classifier on latent vectors, they can identify the specific dimensions that govern transitions between semantic states.

A decision tree-based probing algorithm used to identify critical latent dimensions for guided traversal.

This "Guided Latent Traversal" allows for a "shortest path" approach to semantic editing. For example, a seed sentence like "fire causes chemical change" can be transitioned to "fire means chemical change" by modifying only the latent dimensions identified by the decision tree as critical for the predicate change.

Experimental Results

The study utilized datasets of explanatory sentences, specifically WorldTree (elementary science explanations) and EntailmentBank (multi-hop reasoning), due to their granular and rigid knowledge representations.

Key findings include:

  • High Separability: The model achieved high accuracy in isolating semantic features, with scores of 0.87 for predicates and 0.95 for arguments (ARG1).
  • Semantic Preservation: Latent arithmetic tests (e.g., $z_{sent1} + z_{sent2}$) demonstrated that adding vectors with shared semantic roles consistently produced new sentences preserving those roles.
  • Qualitative Control: Guided traversal successfully demonstrated the ability to steer sentence generation through specific intermediate semantic states.

Conclusion and Future Work

While currently focused on structured explanatory text, this work provides a foundation for more interpretable and controllable LLMs. Future research will explore the scalability of this geometric framework to larger models and its application to more diverse, creative text domains. The authors also suggest investigating "in-context learning" of compositional semantics within this geometric paradigm.

Summary updated

Abstract

Formal/symbolic semantics can provide canonical, rigid controllability and interpretability to sentence representations due to their \textit{localisation} or \textit{composition} property. How can we deliver such property to the current distributional sentence representations to control and interpret the generation of language models (LMs)? In this work, we theoretically frame the sentence semantics as the composition of \textit{semantic role - word content} features and propose the formal semantic geometry. To inject such geometry into Transformer-based LMs (i.e. GPT2), we deploy Transformer-based Variational AutoEncoder with a supervision approach, where the sentence generation can be manipulated and explained over low-dimensional latent Gaussian space. In addition, we propose a new probing algorithm to guide the movement of sentence vectors over such geometry. Experimental results reveal that the formal semantic geometry can potentially deliver better control and interpretation to sentence generation.
BibTeX
@misc{zhang2022quasi,
  author = {Yingji Zhang and Danilo S. Carvalho and Ian Pratt‐Hartmann},
  title = {{Quasi-symbolic Semantic Geometry over Transformer-based Variational AutoEncoder}},
  year = {2022},
  eprint = {2210.06230},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.06230},
}
Figure