A Multi-Task Approach for Disentangling Syntax and Semantics in Sentence Representations

Mingda Chen, Qingming Tang, Sam Wiseman, Kevin Gimpel

Abstract

This paper introduces the vMF-Gaussian Variational Autoencoder (VGVAE), a generative model designed to explicitly separate a sentence's semantic meaning from its syntactic structure. By employing two distinct latent variables—a von Mises-Fisher (vMF) distribution for semantics and a Gaussian distribution for syntax—and utilizing multi-task learning objectives such as paraphrase reconstruction and word-order prediction, the authors achieve state-of-the-art disentanglement. Evaluation on semantic textual similarity and novel syntactic tasks demonstrates that the proposed approach significantly improves the precision of similarity calculations by effectively isolating "what" is being said from "how" it is structured.

Introduction

In natural language processing, standard sentence representations (e.g., GloVe or BERT) often conflate meaning and structure. This entanglement limits the effectiveness of tasks requiring the isolation of one component, such as finding paraphrases with diverse grammatical structures or identifying sentences with similar syntax but different topics. While previous research has explored disentangling attributes like sentiment or style, this work addresses the fundamental challenge of separating syntax (the structural "how") from semantics (the conceptual "what") to enhance downstream similarity tasks.

Methodology

The authors propose the VGVAE, which models a sentence using two independent latent variables:

  1. Semantic Variable ($y$): Modeled using a von Mises-Fisher (vMF) distribution. The vMF distribution is particularly suited for semantics as it resides on a hypersphere, where the vector's direction represents meaning, aligning with the common use of cosine similarity.
  2. Syntactic Variable ($z$): Modeled using a standard Gaussian distribution.

To ensure these variables capture distinct information, three specialized multi-task losses are employed:

  • Paraphrase Reconstruction Loss (PRL): The model swaps semantic variables between paraphrase pairs while retaining original syntactic variables to reconstruct the sentences. This forces $y$ to capture meaning invariant across paraphrases and $z$ to capture structural differences.
  • Discriminative Paraphrase Loss (DPL): A triplet-style loss that minimizes the distance between semantic representations of paraphrases while maximizing the distance for non-paraphrases.
  • Word Position Loss (WPL): This objective requires the syntactic variable $z$ to predict the original positions of words, guiding it to capture structural information deeply tied to word order.
The VGVAE architecture utilizes separate encoders for semantic ($y$) and syntactic ($z$) information, integrated into an LSTM-based decoder for reconstruction.

Experimental Setup

The model was trained on a subsampled set of 500,000 paraphrase pairs from ParaNMT-50M. Evaluation spanned two domains:

  • Semantic Evaluation: Performance was measured on standard SemEval Semantic Textual Similarity (STS) tasks (2012–2016) and the STS benchmark.
  • Syntactic Evaluation: The authors introduced novel tasks using the Penn Treebank and ParaNMT subsets, evaluating syntax by identifying a sentence's nearest neighbor in the latent space and checking for shared parse trees or Part-of-Speech (POS) tags.

Results and Analysis

The study found that disentanglement is most successful when the semantic variable performs exceptionally well on semantic tasks while performing poorly on syntactic ones, and vice versa. This "performance gap" served as a key metric for success.

Key Findings

  • Word Order and Syntax: The Word Position Loss (WPL) proved highly effective, allowing the model to learn structural patterns without explicit gold-standard parse trees.
  • Distribution Synergy: The choice of vMF for semantics and Gaussian for syntax was critical; the vMF's focus on directionality complements semantic goals, while the Gaussian distribution captures the structural nuances required for syntax.
  • Model Complexity: While Bag-of-Words (BOW) models are competent at capturing semantics, LSTMs are significantly better at encoding syntactic nuances, particularly as sentence length increases.
Quantitative results demonstrate that the VGVAE model, especially with LSTM components, achieves superior semantic similarity scores while minimizing syntactic information in the semantic variable.

Quantitative Performance

  • Semantic Similarity: The "ALL + LSTM" model achieved a Pearson correlation of 72.9% on the STS benchmark, significantly outperforming baselines like InferSent (67.8%) and raw BERT (4.5%).
  • Syntactic Specialization: On the $k$-NN constituent parsing task, the syntactic variable achieved an F1 score of 38.8, compared to 25.3 for the semantic variable, confirming successful variable specialization.
  • Qualitative Analysis: Lexical analysis showed the syntactic variable grouped words like starting with getting (grammatically similar), whereas the semantic variable grouped starting with begin (meaning similar).

Conclusion

While the VGVAE achieves impressive disentanglement, some limitations remain. Using a shared word embedding space for both encoders proved difficult, necessitating separate spaces for clear separation. Additionally, syntactic performance declines for sentences longer than 15 words due to data sparsity in the candidate pool. Future research could explore achieving these results with less specialized data, reducing the reliance on large-scale paraphrase corpora like ParaNMT.

Summary updated

BibTeX
@inproceedings{chen2019multi,
  author = {Mingda Chen and Qingming Tang and Sam Wiseman and Kevin Gimpel},
  title = {{A Multi-Task Approach for Disentangling Syntax and Semantics in Sentence Representations}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/n19-1254},
}
Figure