Length-Aware Multi-Kernel Transformer for Long Document Classification
Guangzeng Han, Jack Tsao, Xiaolei Huang
TL;DR
This paper tackles the challenge of long-document classification under transformer input limits, where context fragmentation and length-robustness are major issues. It introduces Length-Aware Multi-Kernel Transformer (LAMKIT), which combines multi-kernel encoding (diverse chunked contexts) with length-aware vectorization (segment-position and length features) and hierarchical integration to produce length-aware document representations. Across five health/legal benchmarks, LAMKIT outperforms strong baselines by up to 10.9 percentage points and demonstrates robustness across varying document lengths, as shown by ablations that confirm the contributions of MK and LaV. The work also includes a case study with ChatGPT indicating current LLM prompting has gaps in long-document classification, underscoring the practical value of discriminative long-document models like LAMKIT for domain-specific tasks.
Abstract
Lengthy documents pose a unique challenge to neural language models due to substantial memory consumption. While existing state-of-the-art (SOTA) models segment long texts into equal-length snippets (e.g., 128 tokens per snippet) or deploy sparse attention networks, these methods have new challenges of context fragmentation and generalizability due to sentence boundaries and varying text lengths. For example, our empirical analysis has shown that SOTA models consistently overfit one set of lengthy documents (e.g., 2000 tokens) while performing worse on texts with other lengths (e.g., 1000 or 4000). In this study, we propose a Length-Aware Multi-Kernel Transformer (LAMKIT) to address the new challenges for the long document classification. LAMKIT encodes lengthy documents by diverse transformer-based kernels for bridging context boundaries and vectorizes text length by the kernels to promote model robustness over varying document lengths. Experiments on five standard benchmarks from health and law domains show LAMKIT outperforms SOTA models up to an absolute 10.9% improvement. We conduct extensive ablation analyses to examine model robustness and effectiveness over varying document lengths.
