CogLTX: Applying BERT to Long Texts

Ming Ding, Chang Zhou, Hongxia Yang, Jie Tang

Introduction

CogLTX (Cognize Long TeXts) is a framework designed to enable BERT to process documents that far exceed its standard 512-token limit. By mimicking human working memory, CogLTX uses a "judge" model to identify key sentences and concatenates them for a "reasoner" model. This approach achieves state-of-the-art performance on long-text tasks with constant memory overhead, regardless of the document's length.

The Challenge of Long Texts

Standard Transformer models like BERT are inherently "short-sighted." Because the self-attention mechanism has a quadratic $O(L^2)$ time and space complexity, these models are typically capped at a 512-token input limit.

While "sliding window" approaches exist—where the model processes overlapping chunks of text—they often fail when the information needed to solve a task is spread across distant parts of a document. For example, in multi-hop question answering, the two clues required to find an answer might be separated by thousands of tokens. Because they never appear in the same BERT window, they can never "attend" to each other.

Multi-hop reasoning often requires connecting clues separated by more than 512 tokens.

The CogLTX Approach

The authors draw inspiration from Baddeley’s cognitive theory of working memory, which suggests humans only hold 5–9 "chunks" of information at once. CogLTX implements this concept through a process called MemRecall, utilizing two distinct BERT models:

  1. The Judge and the Reasoner: The Judge scores the relevance of individual text blocks within the long document. The Reasoner then performs the actual downstream task (e.g., answering a question or classifying the text) using only the "key" blocks selected by the Judge.
  2. MemRecall Algorithm: To handle multi-step reasoning, MemRecall uses rehearsal (keeping important blocks in "memory" for the next step) and decay (removing blocks that prove irrelevant after more information is gathered).
  3. Intervention-based Training: A major challenge in training such a system is the lack of labels indicating which sentences are "key." The authors propose an unsupervised intervention strategy: they temporarily remove a block and observe if the Reasoner's loss increases. If the loss spikes, that block is deemed "essential" and is used to provide supervision for training the Judge.
CogLTX applies MemRecall to extract key sentences for sequence-level tasks like text classification.

Key Insights and Performance

The "bottleneck" of BERT is remarkably similar to the capacity of human working memory. Instead of trying to build a model with longer sequence lengths, CogLTX builds a better retrieval system to fill that limited capacity with the most relevant data. The paper demonstrates that for most NLP tasks, a few key sentences are sufficient. By identifying these and "zipping" them together into a single 512-token string, standard BERT can perform complex reasoning without massive computational resources.

Results

The model was evaluated on four diverse long-text benchmarks, including NewsQA, HotpotQA, 20NewsGroups, and an Alibaba proprietary dataset.

  • State-of-the-Art Accuracy: On NewsQA, CogLTX-base achieved 55.2 EM and 70.1 F1, outperforming the previous SOTA (DECAPROP) and a RoBERTa-large sliding window baseline. On HotpotQA, it outperformed all seven BERT sliding-window variants on the leaderboard, proving that selective memory is superior to exhaustive chunking.
  • Efficiency and Speed: CogLTX maintains constant memory consumption regardless of text length. While vanilla BERT's memory usage explodes as text grows, CogLTX stays flat. For texts longer than 2,048 tokens, CogLTX becomes faster than vanilla BERT, approaching the speed of simple sliding windows while maintaining much higher accuracy.

Limitations and Future Work

While highly effective, the authors identify a few areas for future improvement:

  • The "Key Sentence" Assumption: Some extremely dense tasks might require every single word in a long sequence, violating CogLTX’s core assumption that a few sentences are "sufficient and necessary."
  • Missing Antecedents: If a key block contains a pronoun (like "he" or "it") but the original entity name was in a discarded block, the model might get confused. Currently, this is alleviated by prepending entity names, but coreference resolution or position-aware retrieval could offer more robust solutions.
  • Variational Methods: The authors suggest that more advanced latent variable models could eventually replace their point-estimation approach for identifying key blocks.

Summary updated

BibTeX
@inproceedings{ding2020cogltx,
  author = {Ming Ding and Chang Zhou and Hongxia Yang and Jie Tang},
  title = {{CogLTX: Applying BERT to Long Texts}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
}
Figure