Abstract
Modern neural language models often struggle with long-range syntactic dependencies, frequently prioritizing local context over global structure. We present Dependency-based Mixture Language Models (DMLM), a flexible, architecture-agnostic framework that integrates syntactic structure into neural language models. DMLM trains models to predict future dependent tokens and utilizes a mixture mechanism weighted by self-attention to refine next-token probabilities. Experimental results on LSTMs, Transformers, and GPT-2 demonstrate that DMLM consistently improves grammaticality and logical coherence in generated text.
Introduction
While models like GPT-2 are highly capable, they often fail to maintain syntactic consistency over long distances. For instance, in the sentence "The figures on the screen indicate...", a model might incorrectly predict a singular verb like "indicates" due to the proximity of the singular noun "screen", failing to link back to the plural subject "figures".
Previous attempts to address this involved specialized, "syntax-aware" architectures that are often difficult to integrate into modern Transformer-based workflows. DMLM addresses this by providing a "syntactic map" that is both computationally efficient and compatible with existing neural architectures.
Methodology: The DMLM Framework
The DMLM approach consists of three primary components designed to bake syntactic expectations into the prediction process:
- Dependency Modeling Objective: During training, the model is tasked with predicting future dependent tokens—words that appear later in the sequence but share a parent-child relationship with the current word in a dependency parse tree.
- The Mixture Mechanism: Instead of relying solely on the current hidden state for next-token prediction, the model aggregates the syntactic "expectations" of all previous tokens.
- Self-Attention Weighting: The model uses its internal self-attention mechanism to dynamically weight which previous tokens' syntactic predictions are most relevant to the current timestep.
This design allows DMLM to be applied to LSTMs, vanilla Transformers, or pre-trained models like GPT-2 by simply adding the dependency objective and a mixture layer.
Experimental Evaluation
The researchers evaluated DMLM across three tasks: conditional text generation (ROCStories), unconditional text generation (WMT News), and language modeling (Penn Treebank). Ground truth dependency trees were generated using an off-the-shelf HPSG Parser.
Key Results
DMLM variants consistently outperformed baseline models across both human and automated metrics. In human evaluations, DM-GPT-2 and DM-Transformer were rated significantly higher for logical coherence and grammaticality.
On the ROCStories task, DM-GPT-2 achieved a UNION score of 85.31 compared to 84.41 for the base model. Perplexity gains were also notable; DM-Transformer improved its base model's perplexity by over 20 points on the Penn Treebank dataset, suggesting that syntactic bias is particularly beneficial in data-scarce scenarios.
Discussion and Insights
The core innovation of DMLM is the concept of a Syntactic "Look-Back". By forcing the model to explicitly predict future dependents, it learns to fulfill the "promises" made by words earlier in the sentence, making it more resilient to local noise.
Furthermore, DMLM offers Simplicity over Complexity. Unlike previous "Parsing-Reading-Predict" networks that required multiple separate neural networks, DMLM achieves superior results by modifying the training objective and the output probability calculation without adding significant architectural overhead.
Limitations
Despite its strengths, DMLM has some limitations. For RNNs, the mixture mechanism increases computational complexity to $O(T^2)$, though this is less impactful for Transformers which are already quadratic. Additionally, the current model does not distinguish between dependency types (e.g., subject vs. modifier) and is reliant on the accuracy of the external parser used during training.
Conclusion
Dependency-based Mixture Language Models provide a robust way to infuse syntactic structure into modern language models. By being architecture-agnostic and improving both quantitative and qualitative performance, DMLM represents a significant step toward more coherent and syntactically sound natural language generation.
Summary updated