PPTSER: A Plug-and-Play Tag-guided Method for Few-shot Semantic Entity Recognition on Visually-rich Documents

Wenhui Liao, Jiapeng Wang, Zening Lin, Longfei Xiong, Lianwen Jin

Abstract

Extracting structured information from visually-rich documents (VRDs) is a critical task in document intelligence, yet standard Semantic Entity Recognition (SER) models often require thousands of labeled examples to perform effectively. We introduce PPTSER (Plug-and-Play Tag-guided SER), a novel method designed specifically for few-shot scenarios. By utilizing label names as semantic prompts and repurposing internal transformer attention weights as a classifier, PPTSER achieves significant performance gains in low-data regimes. On the FUNSD benchmark, PPTSER improves LayoutLMv3 performance by over 15% with just a single training example, while remaining more parameter-efficient than traditional fine-tuning approaches.

Introduction

Semantic Entity Recognition (SER) involves identifying and categorizing entities within documents like invoices, forms, and receipts, where both textual content and spatial layout are vital. While multi-modal pre-trained models (e.g., LayoutLM, LiLT) have set new benchmarks, their reliance on large-scale human-annotated data presents a barrier in domains where data is scarce or sensitive, such as legal or insurance sectors.

PPTSER addresses this "few-shot" challenge by reimagining how pre-trained models are adapted to downstream tasks. Instead of the standard practice of adding a task-specific classifier head and fine-tuning the entire network, PPTSER leverages the inherent semantic knowledge and attention mechanisms already present in pre-trained transformers.

Methodology

The PPTSER architecture is built upon three innovative pillars that depart from traditional sequence-labeling paradigms:

1. Tag-guided Prompting

Rather than treating entity categories as abstract numerical indices, PPTSER incorporates the actual semantic names of the tags (e.g., "question," "header," "answer") as text prompts. These prompts are concatenated with the document tokens, allowing the model to utilize its pre-trained understanding of these words to guide its focus.

2. Task Decoupling

Standard SER often conflates entity identification and classification. PPTSER decouples the task into two simultaneous objectives: Entity Typing (identifying the category) and Span Detection (determining the boundaries of an entity). These are handled through distinct attention heads, providing a more granular learning signal.

3. Attention as a Classifier

In a significant departure from standard fine-tuning, PPTSER discards the final feed-forward classifier layer. Instead, it treats the attention weights in the final transformer layer as classification probabilities. The attention score between a "Tag Prompt" and a "Document Token" directly indicates the likelihood of that token belonging to the corresponding category.

Comparison between traditional fine-tuning (a) and the proposed PPTSER architecture (b), highlighting the use of tag prompts and the removal of the classifier layer.

Training and Inference Pipeline

During training, the model optimizes the attention matrices to align document tokens with their correct semantic prompts. This process is governed by two loss functions: $L^{ent}$ for entity typing and $L^{det}$ for span detection. Because the model uses existing attention mechanisms rather than adding new layers, it is highly parameter-efficient, reducing the total parameter count by approximately 5-6 million for a LayoutLMv3-base backbone. This reduction is crucial for preventing overfitting in few-shot settings.

The PPTSER pipeline showing the transition from attention weights $(W^t)'_{att}$ to training losses and the final inference of entity spans.

At inference time, the model extracts entity spans by analyzing the decoupled attention outputs. The typing head identifies the most likely category for each token, while the detection head identifies "Begin" (B) and "Inside" (I) markers to reconstruct full entity strings.

Experimental Results

The researchers evaluated PPTSER across three major benchmarks: FUNSD (complex forms), CORD (receipts), and XFUND-zh (multilingual forms). The method was tested in 1, 3, 5, and 7-shot scenarios against various backbones, including BROS, LiLT, and LayoutLMv2/v3.

  • Superior Few-shot Performance: On FUNSD, LayoutLMv3 equipped with PPTSER achieved a 15.61% F1 score improvement in the 1-shot setting compared to standard fine-tuning.
  • Robustness Across Backbones: The "plug-and-play" nature of the method allowed it to consistently outperform baselines regardless of whether the underlying model used image features or purely text-layout features.
  • Scalability: While designed for few-shot learning, PPTSER remained competitive or superior even when trained on full datasets, suggesting it is a robust architectural improvement rather than a niche optimization.

Conclusion

PPTSER demonstrates that the internal representations of multi-modal pre-trained models are powerful enough to act as classifiers when guided by semantic prompts. By treating "labels as data" and "attention as classification," the method provides a parameter-efficient and highly effective solution for document intelligence in data-constrained environments. Future research will explore extending this tag-guided logic to zero-shot scenarios and more complex document tasks like entity linking.

Summary updated

BibTeX
@inproceedings{liao2024pptser,
  author = {Wenhui Liao and Jiapeng Wang and Zening Lin and Longfei Xiong and Lianwen Jin},
  title = {{PPTSER: A Plug-and-Play Tag-guided Method for Few-shot Semantic Entity Recognition on Visually-rich Documents}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.626},
}
Figure