NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Overcoming Spatial Serialization Loss in Document AI

16 concepts11 papers1 proposal

When humans read a document—whether it is an invoice, a multi-column financial report, or a medical form—we do not just read from left to right, top to bottom. We interpret meaning through geometry. A bold header governs the text beneath it; a number in a table cell derives its meaning entirely from the column header above it and the row label to its left; a checkbox belongs to the text immediately adjacent to it.

Standard natural language processing models, however, are fundamentally blind to this geometry. They require inputs to be formatted as a one-dimensional sequence of tokens. To process a document, we typically use Optical Character Recognition (OCR) to serialize the two-dimensional page into a linear string of text.

This serialization process introduces a fundamental failure mode: spatial serialization loss. By flattening a 2D layout into a 1D stream, we destroy the spatial relationships that give semi-structured documents their meaning.

The Geometry of Serialization Artifacts

Why exactly does serialization break document understanding? The core issue is that spatial proximity does not map cleanly to sequential proximity.

As Dimosthenis Karatzas et al. demonstrate in their work on DocVQA: A Dataset for VQA on Document Images and Document Collection Visual Question Answering, flattening a document forces visually adjacent elements to become textually distant. Imagine a two-column invoice:

+------------------------+------------------------+
| Item Description       | Amount                 |
+------------------------+------------------------+
| Cloud Hosting Service  | $1,200.00              |
| Database Storage       | $450.00                |
+------------------------+------------------------+

A standard top-to-bottom, left-to-right serialization might read this as: "Item Description Amount Cloud Hosting Service $1,200.00 Database Storage $450.00". But if the serialization engine reads column-by-column instead, it becomes: "Item Description Cloud Hosting Service Database Storage Amount $1,200.00 $450.00".

In the latter case, the label "Database Storage" and its corresponding value "$450.00" are separated by multiple tokens. As Chen-Yu Lee et al. observe in FormNet: Structural Encoding beyond Sequential Modeling in Form Document Information Extraction, standard sequence models struggle because semantically related items end up separated by hundreds of tokens. This introduces "serialization artifacts" that disrupt the model's ability to associate keys with their values.

Furthermore, Kyosuke Nishida et al. point out in their research on customer-contact automation that treating documents as linear strings forces models to infer structural relationships purely from linguistic context, completely ignoring the explicit organizational cues provided by headers, sidebars, and tables. Minghong Yao et al. echo this in Learning Label Dependencies for Visual Information Extraction, noting that disrupting spatial proximity makes it incredibly difficult for a network to recognize the inherent structural grammar of form fields and labels.

To solve this, researchers have developed three main paradigms: encoding geometry directly into the input tokens, redesigning attention mechanisms to be layout-aware, and bypassing text serialization altogether via end-to-end vision-language architectures.

Paradigm 1: Injecting Geometry into Input Space

The most direct way to counteract serialization loss is to modify the input representation so that the model can reconstruct the 2D layout from the 1D stream.

An early, elegant formulation of this was proposed by Anoop R. Katti et al. in Chargrid: Towards Understanding 2D Documents. Instead of a 1D sequence of text, the authors preserve the exact 2D topology of the document by mapping characters onto a two-dimensional pixel grid (a "chargrid"). Each pixel in this grid contains a one-hot encoded character token. This allows the model to use standard 2D convolutional networks to preserve spatial relationships naturally, treating document understanding as a semantic segmentation task.

Standard NLP:  "Total: $150" ---> [Total:] [$150] (1D Sequence)

Chargrid:      [ . . . . . . . ]
               [ . T o t a l . ]  ---> (Preserves exact 2D coordinates
               [ . $ 1 5 0 . . ]        of every character on the page)

Modern Large Language Models (LLMs) cannot easily process raw character grids, so researchers have adapted this intuition into text-based coordinate systems. In LMDX: Language Model-based Document Information Extraction and Localization, Vinçent Pérot et al. demonstrate that LLMs can be made layout-aware by interleaving text tokens with explicit spatial coordinate tokens. By training the model to read and output bounding box coordinates alongside text, the architecture grounds its semantic representations in physical space, allowing it to extract and localize information without needing complex, heavy vision-language pipelines.

Paradigm 2: Modifying Attention for Spatial Awareness

Rather than changing the inputs, another approach alters how the model computes relationships between tokens. In a standard Transformer, the attention mechanism determines token relationships based on their positions in the 1D sequence. Spatial attention mechanisms replace or augment this with geometric distances.

In FormNet, Chen-Yu Lee et al. introduce "Rich Attention," which explicitly factors the 2D spatial distance between tokens into the attention score calculation. They pair this with "Super-Tokens"—constructed via graph convolutional networks—to capture local 2D context. This ensures that even if a label and a value are separated by hundreds of tokens in the linear sequence, their physical proximity on the page allows them to maintain a strong, direct attention link.

Similarly, Laura Nguyen et al. propose Skim-Attention: Learning to Focus via Document Layout, which mimics human reading behavior. When humans skim a document, our eyes jump to specific structural regions (like headers or bolded text) based on layout before we read the words. Skim-Attention operationalizes this by computing attention scores based directly on bounding box coordinates, allowing the model to focus on relevant document zones efficiently without wasting compute on the linear text stream.

Paradigm 3: Bypassing Serialization via Vision-Language Models

The most radical solution to spatial context loss is to stop turning documents into plain text strings altogether. Instead, models can ingest the document image directly, treating text and layout as a unified visual canvas.

For instance, Wonseok Hwang et al. developed WYVERN, an end-to-end generative model detailed in Cost-effective End-to-end Information Extraction for Semi-structured Document Images. Instead of relying on an independent OCR step that flattens the document, WYVERN reads the document image directly and generates structured Abstract Syntax Trees (ASTs) in a single sequence-to-sequence pass, avoiding serialization artifacts entirely.

To make this open-vocabulary and flexible, Mengjun Cheng et al. introduced the TG-VIE framework in Textual Grounding for Open-Vocabulary Visual Information Extraction in Layout-Diversified Documents. They pair frozen language model embeddings with a layout-aware visual encoder. By framing information extraction as a textual grounding task over the visual layout, the model can answer arbitrary queries about highly diversified document formats without losing track of which value belongs to which key.

[Document Image] ---> [Layout-Aware Visual Encoder] ---\
                                                        +---> [Spatial Alignment] ---> Structured Output
[Text Query]     ---> [Frozen Language Model] --------/

However, processing documents purely as images introduces what Aviad Aberdam et al. call a "resolution tax" in DocVLM: Make Your VLM an Efficient Reader. While a standard Vision-Language Model (VLM) can understand a natural scene with a low-resolution image, reading a dense insurance contract or a complex table requires high-resolution inputs. This explodes the number of visual tokens the model must process. The authors demonstrate that by carefully managing this resolution tax and preserving structural layout information without stripping it away via naive OCR, VLMs can achieve high-fidelity document reading without becoming computationally prohibitive.

Why Spatial Awareness Works

By moving away from strict 1D serialization, these diverse approaches restore a critical inductive bias to document processing: geometric continuity.

When a model is forced to process a document as a linear string, it must dedicate a significant portion of its parameter capacity simply to reconstructing "where" things are and "what" goes with "what." By providing the model with explicit 2D coordinates, grid-based representations, or direct visual inputs, we offload this structural reconstruction task. The model is freed to focus on the actual semantic task at hand—such as extracting an invoice total, validating a form field, or answering a complex question across an entire archive of documents.

Key Foundational Work

Chargrid: Towards Understanding 2D Documents (2018) — contributed 1 concept elements to this direction.
Knowledge and Language-processing Technology that Supports and Substitutes Customer-contact Work (2020) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_spatial_context_loss_spatial_context_ser_a3782cb9,
  title = {spatial context loss (spatial context serialization loss)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/spatial-context-loss-spatial-context-serialization-loss/rdr_a3782cb9b60e42879f3045eb52dba9ad},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-28},
}

This exact version (version 1, frozen text):

@misc{lacuna_spatial_context_loss_spatial_context_ser_a3782cb9_v1,
  title = {spatial context loss (spatial context serialization loss)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/spatial-context-loss-spatial-context-serialization-loss/rdr_a3782cb9b60e42879f3045eb52dba9ad/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-28},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake