Towards Reading Comprehension for Long Documents

Yuanxing Zhang, Yangbin Zhang, Kaigui Bian, Xiaoming Li

Abstract

Machine Reading Comprehension (MRC) has seen significant progress on short-context datasets like SQuAD. However, standard models struggle when applied to long documents where the answer is buried within thousands of tokens. This paper introduces the Match-based Hierarchical Attention Model (MH-LSTM), a framework that decouples the MRC task into two distinct stages: identifying the most relevant paragraph and then extracting the specific answer. By leveraging Recurrent Highway Networks (RHN) and a hierarchical attention mechanism, MH-LSTM effectively mitigates issues like attention dilution and vanishing gradients. Experimental results on a modified long-document version of SQuAD show that the MH-LSTM pipeline significantly outperforms flat baseline models, achieving a 67.15% F1 score and demonstrating superior scalability to documents exceeding 17,000 tokens.

Introduction: The Challenge of Long-Form Context

Most state-of-the-art MRC models are optimized for contexts of a few hundred words. In these constrained settings, the relevant information is highly concentrated. However, real-world applications—such as analyzing technical manuals, legal contracts, or full Wikipedia articles—require processing tens of thousands of tokens.

When standard models, such as BiDAF or vanilla LSTM-based pointer networks, are applied to these long documents, they encounter two primary obstacles:

  1. Attention Dilution: As the context length increases, the attention mechanism's ability to distinguish relevant "needles" from the "haystack" of noise diminishes. The probability mass is spread too thin across irrelevant tokens.
  2. Vanishing Gradients: Recurrent neural networks (RNNs) struggle to maintain long-range dependencies over thousands of steps, leading to a loss of contextual information from the beginning of the document by the time the end is reached.

The authors propose bridging this gap by treating long-document reading as a hierarchical navigation task rather than a single-pass extraction problem.

Methodology: The MH-LSTM Architecture

The core of the proposed solution is the Match-based Hierarchical Attention Model (MH-LSTM). This architecture is designed to distill a long document into its most relevant components before attempting fine-grained extraction.

The hierarchical architecture of the MH-LSTM model, showing the flow from token embeddings to paragraph selection.

The model consists of several specialized layers:

  • Token Embedding Layer: Combines pre-trained GloVe word embeddings with Character-level CNNs. This dual approach ensures robust representations and handles out-of-vocabulary (OOV) words effectively.
  • Recurrent Highway Network (RHN): To process the initial document context, the authors employ a two-layer RHN. Unlike standard LSTMs, RHNs utilize highway gates that allow information to flow through many layers without attenuation, making them better suited for sequences spanning thousands of tokens.
  • Hierarchical Mask Layer: Special <par> tokens are inserted at paragraph boundaries. This layer masks all non-boundary tokens, effectively transforming the word-level sequence into a condensed sequence of paragraph-level representations.
  • Match-LSTM Layer: Drawing inspiration from Natural Language Inference (NLI), this layer calculates the textual entailment between the query (premise) and each paragraph (hypothesis). This allows the model to rank paragraphs based on how likely they are to contain the answer.

The Two-Step Pipeline

The system operates as a pipeline. First, the MH-LSTM identifies the top-ranked paragraphs. These selected segments are then passed to a standard MRC model (e.g., BiDAF) for the final answer extraction. This "divide and conquer" strategy ensures the extraction model only operates on high-signal text.

Experimental Setup and Datasets

To evaluate the model, the researchers modified the SQuAD v1.1 dataset. While the original SQuAD provides models with a single relevant paragraph, the authors merged all paragraphs from the original Wikipedia articles back into a single context. This increased the average context length from ~800 words to documents reaching up to 17,174 tokens and 150 paragraphs, creating a much more challenging retrieval environment.

Key Results and Discussion

The MH-LSTM + BiDAF pipeline demonstrates a substantial performance leap over "flat" models. The hierarchical approach achieved an Exact Match (EM) of 58.83% and an F1 score of 67.15%, representing a ~9-10% improvement over using BiDAF alone on the full document.

F1 performance comparison between MH-LSTM and the BiDAF baseline across different document lengths.

A critical insight from the results is the effectiveness of the "Top-K" strategy. The authors found that reserving the top 2-3 paragraphs for the extraction stage, rather than just the single best-ranked one, significantly improved the final performance. This suggests that while the paragraph selector is highly accurate (80.91% CP), providing a small buffer helps capture cases where the answer might be split or the selection is ambiguous.

Furthermore, the choice of RHNs proved vital. Comparisons showed that standard LSTMs lost significant accuracy as document length increased, whereas the RHN-based MH-LSTM maintained relatively stable performance even at the extreme end of the token count spectrum.

Conclusion

The MH-LSTM framework successfully addresses the "needle in a haystack" problem in long-document MRC by introducing a hierarchical, two-stage processing pipeline. By treating paragraph selection as a textual entailment problem, the model effectively filters noise and focuses computational resources on relevant text. Future work may involve extending this architecture to handle multi-hop reasoning and optimizing the pipeline to reduce the latency inherent in two-stage models.

Summary updated

BibTeX
@inproceedings{zhang2018towards,
  author = {Yuanxing Zhang and Yangbin Zhang and Kaigui Bian and Xiaoming Li},
  title = {{Towards Reading Comprehension for Long Documents}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.24963/ijcai.2018/638},
}
Figure