Standard language model pre-training focuses on the "local" relationship between words—predicting a missing token based on its immediate neighbors. However, documents possess a higher-level architecture: sentences follow a logical flow, paragraphs group related ideas, and visual layouts signal semantic importance.
A growing body of research suggests that this inherent document structure provides a powerful, "free" signal for learning deep semantic representations. By training models to recognize whether two text spans belong to the same document or if a sequence of sentences has been shuffled, researchers are building models that understand discourse, coherence, and intent without requiring a single human label.
Proximity as a Proxy for Meaning
The foundational intuition behind this direction is a scaling of the distributional hypothesis: just as words appearing in similar contexts have similar meanings, text segments appearing in the same document likely share a semantic bond.
In the DeCLUTR framework, John M. Giorgi and colleagues demonstrate that simply sampling spans from the same document and treating them as "positive pairs" in a contrastive learning objective produces high-quality sentence embeddings. By forcing a Transformer to pull representations of co-occurring spans together while pushing apart spans from different documents, the model learns to map semantically related concepts into a continuous vector space. Johannes Schneider extends this to topic modeling, showing that the physical proximity of sentences acts as a reliable signal for topic discovery, outperforming traditional word-based models.
Learning the Logic of Discourse
Beyond simple proximity, the order and cohesion of a document provide clues about its logical structure. A coherent essay follows a specific argumentative flow; if you shuffle the paragraphs, the "logic" breaks even if the individual words remain the same.
Farjana Sultana Mim and Kentaro Inui leveraged this by training models to distinguish between original, coherent documents and versions where the internal structure was intentionally corrupted. This binary classification task forces the model to internalize patterns of discourse and organizational quality. Similarly, Tu Vu and Mohit Iyyer found that encouraging paragraph embeddings to "remember" their constituent sentences—by identifying if a specific sentence belongs to a paragraph—dramatically improves data efficiency and classification accuracy.
Bridging the Gap with Spatial Layouts
In real-world scenarios, document structure isn't just a linear sequence of text; it is often two-dimensional. Tables, headers, and multi-column layouts provide visual cues that are lost in plain-text processing.
The ReLayout framework, introduced by Yuta Nakashima and his team, addresses this by using spatial-semantic contrastive clustering. By bringing representations of text fragments closer together if they share both spatial proximity and semantic similarity, the model learns to group fragmented OCR outputs (like the lines of a multi-line address) into coherent units. Laura Nguyen showed that even simple attention mechanisms, when trained solely on spatial coordinates, naturally learn to cluster tokens into semantic units like abstracts or tables, proving that layout is a sufficient signal for unsupervised segmentation.
The Sentence-Level Bottleneck
One of the most effective ways to force a model to learn global semantics is to create a "bottleneck" where it must predict one part of a document using only the compressed representation of another.
Daniel Cer proposed Conditional Masked Language Modeling (CMLM), which requires a model to predict masked tokens in a sentence conditioned on the encoded vector of an adjacent sentence. Because the model cannot see the original tokens of the target sentence, it must rely entirely on the semantic information captured in the neighboring sentence's embedding. This objective incentivizes the encoder to capture broad, document-level context rather than just local word patterns, often outperforming models trained on massive supervised datasets.
Why It Works: The Structural Heuristic
This research direction works because it exploits the "structural heuristic": humans organize information non-randomly. The fact that a sentence appears in a specific paragraph, follows a specific heading, or sits at a specific (x, y) coordinate on a page is a strong indicator of its role and meaning. By treating these structural properties as labels, we can train models that are "discourse-aware" and "layout-enhanced" using the vast, untapped oceans of unlabeled digital documents.