Syntax-Informed Question Answering with Heterogeneous Graph Transformer

Fangyi Zhu, Lok You Tan, See-Kiong Ng, Stéphane Bressan

Introduction

While Large Language Models (LLMs) like BERT have fundamentally shifted the landscape of Natural Language Processing (NLP), their reliance on statistical patterns often overlooks the explicit structural rules of language. Researchers from the National University of Singapore have introduced SyHGT, a framework designed to bridge this gap by injecting explicit syntactic structures—such as dependency and constituency trees—directly into pre-trained language models. By utilizing a Heterogeneous Graph Transformer (HGT), SyHGT provides the structural "scaffolding" necessary for more precise Question Answering (QA), particularly in complex linguistic scenarios.

The Challenge: Structural Dilution in Neural Models

Standard transformer-based models capture linguistic structure implicitly during pre-training. However, research suggests this information often becomes "diluted" in the model's deeper layers, where embeddings prioritize semantic associations over rigid syntax. This dilution manifests as failures in extractive QA tasks, where a model might struggle to identify answer boundaries in nested sentences or fail to distinguish between items in a list. SyHGT addresses this by re-introducing symbolic linguistic knowledge as an explicit guide for the neural architecture.

The SyHGT Framework

The Syntax-informed neural network with Heterogeneous Graph Transformer (SyHGT) operates through a two-stage process:

1. Graph Creation and the "Virtual Vertex" Trick

The framework first processes text through a standard encoder (e.g., BERT) to generate initial token embeddings. Simultaneously, an external parser generates syntactic graphs. A significant technical challenge arises here: BERT utilizes sub-word tokenization (WordPiece), whereas syntactic parsers operate on whole words (lexemes). To reconcile these different granularities, the authors introduce "virtual lexeme vertices." These nodes act as aggregators for sub-word embeddings, allowing the syntactic graph to be mapped accurately onto the neural token sequence.

2. Heterogeneous Graph Processing

The resulting graph—comprising tokens, lexemes, and constituents—is processed by a Heterogeneous Graph Transformer (HGT). Unlike standard Graph Neural Networks, the HGT is specifically designed to handle diverse node types and edge relations (e.g., dependency relations or morphological links). By aggregating information across these heterogeneous structures, the model produces "syntax-aware" embeddings. These refined embeddings are then passed to linear layers to predict the precise start and end positions of the answer span.

Experimental Evaluation

The researchers evaluated SyHGT on the SQuAD 2.0 (Stanford Question Answering Dataset), a rigorous benchmark containing over 130,000 examples, including unanswerable questions to test model robustness.

The results demonstrated clear advantages over the BERT-base-cased baseline:

  • SyHGT-D (Dependency-based): This variant achieved the highest performance, yielding an improvement of 1.22 points in Exact Match (EM) and 0.97 points in F1 score.
  • SyHGT-C (Constituency-based): This variant also outperformed the baseline, with gains of 0.77 EM and 0.46 F1.

Insights and Qualitative Analysis

Beyond quantitative metrics, the study revealed several key insights into how syntax aids machine comprehension:

  • Parsimony through Syntax: The syntax-informed model demonstrated a tendency toward "parsimony," selecting shorter and more grammatically coherent spans. For instance, it might correctly identify a single adjective modifier rather than including unnecessary surrounding context.
  • Structural Disambiguation: In sentences featuring complex lists or multiple prepositional phrases, the constituency tree helps the model maintain the boundaries between distinct ideas, preventing the confusion often seen in purely sequential models.
  • Qualitative Success: In cases where BERT provided redundant answers or failed to locate a span, SyHGT successfully identified the correct answer by following syntactic links, such as connecting a specific entity to its grammatical role as a conjunct.

Limitations and Future Directions

While SyHGT shows significant promise, it remains dependent on the quality of the external syntactic parser. Errors in the initial graph structure can propagate through the HGT. Furthermore, the addition of a graph transformer layer introduces some computational overhead during inference.

Looking forward, the authors propose a "blueprint" for extending this architecture. Potential iterations include SemHGT, which would incorporate semantic entity-relationship graphs, and PragHGT, which would integrate pragmatic context. Preliminary tests on datasets like Wiki80 and FewRel suggest that these additions could further enhance a model's ability to understand complex social roles and specific relationships.

Conclusion

SyHGT demonstrates that "old-fashioned" symbolic linguistics still has a vital role to play in the era of LLMs. By providing a seamless way to integrate syntactic graphs with neural embeddings, the framework enhances the precision and structural awareness of QA systems without requiring the massive computational cost of retraining base models from scratch.

Summary updated

BibTeX
@inproceedings{zhu2022syntax,
  author = {Fangyi Zhu and Lok You Tan and See-Kiong Ng and Stéphane Bressan},
  title = {{Syntax-Informed Question Answering with Heterogeneous Graph Transformer}},
  booktitle = {DEXA},
  year = {2022},
  url = {https://openreview.net/forum?id=Rk1BsYj-K-g},
}
Figure