Abstract
Traditional Semantic Entity Recognition (SER) in visually-rich documents often relies on sequence labeling with BIO tags, which can struggle with complex layouts and precise entity boundaries. This paper introduces Hypergraph Attention (HGA), a novel framework that reimagines SER as a hypergraph construction problem. By leveraging hypergraph attention to identify entity spans and categories simultaneously, and incorporating span position encoding via Rotary Position Embedding (RoPE), the proposed HGALayoutLM achieves state-of-the-art performance on major benchmarks like FUNSD and XFUND while maintaining significantly higher efficiency than massive Large Language Models (LLMs).
Introduction
In the field of Visually-rich Document Understanding (VRDU), the objective is to extract structured information from documents like forms, receipts, and invoices. Traditional Named Entity Recognition (NER) treats text as a one-dimensional string. However, documents are inherently two-dimensional and multimodal; text exists in discrete blocks or "nodes" with specific spatial relationships.
Current models often struggle with two primary challenges: precisely identifying entity boundaries and effectively utilizing structural context. Existing solutions usually append a simple linear layer to a pre-trained model (like LayoutLM) to predict BIO (Begin, Inside, Outside) tags. This approach often ignores the complex structural dependencies of document layouts and fails to "snap" to the start and end of an entity span correctly.
Methodology: From Sequences to Hypergraphs
The authors introduce the Hypergraph Attention (HGA) strategy to move beyond the limitations of sequence labeling. Instead of tagging individual tokens, the model treats token features as nodes in a graph. An "entity" is defined as a hyperedge—a connection that can encompass multiple nodes. Each attention head in the model is dedicated to a specific entity type (e.g., one head for "Header," another for "Question").
Key Technical Innovations
- Hypergraph Construction: By treating entities as hyperedges, the model naturally handles the "grouping" aspect of SER. It doesn't just classify tokens; it determines which tokens belong together in a specific category.
- Span Position Encoding: To help the model understand physical text boundaries, the researchers utilized Rotary Position Embedding (RoPE). They map all tokens within the same visual text node to the same "span position," forcing the model to respect the physical boundaries of the document's text blocks.
- Balanced Hyperedge Loss: Because most pairs of tokens in a document do not form an entity, the resulting connectivity matrix is extremely sparse. The authors introduced a balance factor ($b$) to the loss function to prevent the model from being overwhelmed by negative samples.
Experimental Results
The model was evaluated on four gold-standard VRDU benchmarks: FUNSD (noisy scanned forms), CORD (receipts with 30 entity types), SROIE (receipt extraction), and XFUND (multilingual forms). HGALayoutLM set new benchmarks across the board, achieving an F1 score of 95.31 on FUNSD and a near-perfect 99.61 on SROIE.
Ablation Study: The Importance of Span Position
A major driver of performance was the "Span Position Encoding." As illustrated in the ablation results, teaching the model about physical text blocks is vital for stability and accuracy.
Without span-level positional information, the F1 score on FUNSD dropped significantly, proving that spatial awareness at the block level is a prerequisite for high-precision entity extraction.
Discussion and Insights
- Efficiency over Scale: A specialized hypergraph head on a "Base" sized model can outperform "Large" models and even massive LayoutLLMs. HGALayoutLM (Large) uses ~307M parameters, whereas LayoutLLM uses ~6.9B, yet HGALayoutLM achieves comparable or better F1 scores with a fraction of the computational cost.
- The Sparsity Challenge: While hypergraphs are powerful, they face challenges when the number of entity types is very high (e.g., CORD's 30 categories). The "search space" for connections becomes extremely sparse, requiring careful balancing to remain effective.
Conclusion
HGALayoutLM demonstrates that reimagining SER as a hypergraph problem offers a more structurally sound and efficient path forward for document understanding. While the method currently faces scaling challenges with very high numbers of labels, it provides a robust framework for high-precision extraction in standard document tasks. Future work will focus on addressing matrix sparsity to scale the hypergraph approach to documents with hundreds of different entity types.
Summary updated