Skim-Aware Contrastive Learning for Efficient Document Representation
Waheed Ahmed Abro, Zied Bouraoui
TL;DR
This work tackles the challenge of producing high-quality long-document embeddings in domains like law and medicine, where standard transformer encoders struggle with length and context. It introduces Chunk Prediction Encoders (CPE), a self-supervised, contrastive-learning framework that samples text chunks and uses an NLI-inspired objective to align related chunks while separating unrelated ones, enabling richer document representations with improved efficiency. By applying CPE to hierarchical transformers and Longformer, and evaluating on legal and biomedical datasets, the authors demonstrate consistent gains in macro- and micro-F1 scores, particularly when using domain-specific pretrained models (e.g., LegalBERT, ClinicalBioBERT). The results suggest that modeling intra- and inter-document chunk relationships, combined with selective chunking, yields practical improvements for long-document classification and can reduce training time relative to some contrastive baselines, with potential for broader cross-domain and multilingual applicability.
Abstract
Although transformer-based models have shown strong performance in word- and sentence-level tasks, effectively representing long documents, especially in fields like law and medicine, remains difficult. Sparse attention mechanisms can handle longer inputs, but are resource-intensive and often fail to capture full-document context. Hierarchical transformer models offer better efficiency but do not clearly explain how they relate different sections of a document. In contrast, humans often skim texts, focusing on important sections to understand the overall message. Drawing from this human strategy, we introduce a new self-supervised contrastive learning framework that enhances long document representation. Our method randomly masks a section of the document and uses a natural language inference (NLI)-based contrastive objective to align it with relevant parts while distancing it from unrelated ones. This mimics how humans synthesize information, resulting in representations that are both richer and more computationally efficient. Experiments on legal and biomedical texts confirm significant gains in both accuracy and efficiency.
