TL;DR
ScaleFormer is a parameter-free, plug-and-play framework that enables off-the-shelf encoder-decoder Transformers to process long-context documents with linear complexity. By compressing text chunks into their boundary tokens and dynamically enriching them with cumulative global context, it explicitly informs the decoder of a document's narrative flow without requiring architectural modifications or expensive retraining.
What Problem Does This Paper Address?
Standard Transformer models suffer from a fundamental limitation: the self-attention mechanism scales quadratically ($O(N^2)$) with the input sequence length. This makes processing long-form text—such as books, scientific papers, or legal documents—prohibitively expensive.
While researchers have developed efficient Transformer variants using sparse attention patterns, these models typically require custom architectural changes and expensive pre-training from scratch. On the other hand, existing "plug-and-play" methods chunk the text but place the full burden of understanding the document's global structure on the decoder, which must sort through a flat sequence of concatenated chunk representations. ScaleFormer addresses this gap by explicitly encoding structural and narrative information into the input representations before they reach the decoder, all while keeping computational complexity linear ($O(N)$).
Methods
ScaleFormer operates as an elegant wrapper around existing pre-trained language models (PLMs) through a multi-step pipeline:
- Overlapping Segment Encoding: The long input document is partitioned into overlapping chunks of a fixed length that fits the model's standard context window. Each chunk is encoded independently and in parallel.
- Boundary Extraction: Instead of passing all encoded tokens from every segment to the decoder, ScaleFormer extracts only the "boundaries"—the hidden states of the first $k$ tokens (Left boundary, $L_i$) and the last $k$ tokens (Right boundary, $R_i$) of each chunk.
- Span Representation Cumulation: To inject structural awareness, the framework computes directional context vectors. The Left boundary of a chunk is fused with the average of all boundaries from preceding chunks (backward context). The Right boundary is fused with the average of all boundaries from succeeding chunks (forward context). A hyperparameter $\alpha$ controls the balance between local boundary information and global directional context.
- Middle Token Sampling: To ensure the unique local content of each chunk isn't lost during boundary compression, the model randomly samples $m$ "middle" tokens from the interior of each chunk.
- Final Decoder Input: The fused boundaries and sampled middle tokens from all chunks are concatenated and passed to the decoder.
Datasets
The authors evaluated ScaleFormer on three challenging long-document summarization benchmarks:
- SummScreen: A dataset of TV show transcripts and summaries, with an average input length of approximately 9,000 tokens.
- GovReport: A dataset consisting of lengthy government reports, truncated to 16,384 tokens for evaluation consistency.
- BookSum: An extremely challenging narrative summarization dataset featuring entire book chapters, with documents averaging over 140,000 tokens.
Key Insights and Ideas
- Boundaries as Structural Proxies: The core "aha moment" is that the edges of text spans carry strong signals about a document's narrative flow. Fusing these boundaries with cumulative past and future context provides the decoder with an explicit map of the document's structure.
- The Striking Balance of Local vs. Global: The ablation studies reveal that a purely local model ($\alpha = 1.0$) or a purely context-driven model ($\alpha = 0.0$) both perform poorly. Performance peaks precisely at $\alpha = 0.5$, proving that a 50/50 blend of segment-specific details and cumulative document context is optimal for long-text reasoning.
- Massive Compression, Better Performance: ScaleFormer drastically reduces the sequence length fed into the decoder from $C \times L$ (total chunks $\times$ chunk length) to $C \times (2k + m)$. Despite this heavy compression, it outperforms models that look at the entire uncompressed text sequence.
Key Results
ScaleFormer was evaluated using BART-base and T5-base backbones, consistently outperforming strong baselines like SLED, Memorizing Transformers, and the retrieval-based Unlimiformer:
- State-of-the-Art on BookSum: On the ultra-long BookSum test set,
ScaleFormer + Middleachieved a ROUGE-1 score of 39.2, decisively outperforming Unlimiformer (37.3) and setting a new state-of-the-art across all evaluated metrics. - GovReport Success: On GovReport, the full ScaleFormer model achieved a ROUGE-1 score of 57.0, compared to SLED's 54.7.
- Efficiency: The framework maintains strictly linear complexity $O(N)$ relative to the input length, making it highly scalable for massive documents.
Limitations and Future Work
The primary limitation acknowledged by the authors is their method for selecting interior chunk information: the middle tokens are currently selected via random sampling. While effective, random sampling can easily miss highly salient phrases. The authors note that integrating more sophisticated token-selection methods—such as prompt distillation or information-directed compression techniques (e.g., LLMLingua)—is a promising direction for future work.
Summary updated