When a scanned form or receipt is run through text recognition, its words are flattened into a single line of text in some reading order, usually top-to-bottom and left-to-right. A label like "Total:" and its value "$24.50" can end up far apart in that line, and words from neighboring columns can end up interleaved. Document models that read this line therefore produce word representations that depend partly on which reading order the flattening step happened to use. This proposal argues that this dependence matters most in the few-shot setting, where a new field type must be learned from one to ten example documents, and that it can be measured and reduced directly. The approach uses prototype classification, meaning each field type is represented by the average embedding of its labeled example words and new words are labeled by their nearest average. On top of that, we train a small low-rank adapter (LoRA: a trainable correction to a frozen network, factored as the product of two thin matrices) with one goal. Field prototypes computed under different reading orders of the same documents should coincide.
The core prediction is specific. In few-shot extraction, reading-order artifacts show up as spurious sub-clusters within a field type. The same "total price" field lands in different regions of embedding space depending on which words the reading order placed next to it. A prototype averaged from three examples then sits between those sub-clusters and labels badly. If the prediction holds, an adapter trained to make prototypes invariant to reading order should shrink these spurious sub-clusters. It should improve one-shot and five-shot accuracy, and sharply narrow the gap between the best-case and worst-case reading orders. Its behavior should differ measurably from simply shuffling the training order or deleting the model's reading-order inputs.
Core Claim
The claim has three parts. The first is that a frozen layout-aware encoder with a prototype head is a strong few-shot field extractor whose remaining errors are concentrated in reading-order sensitivity. The second is that a low-rank adapter, a few hundred thousand trainable parameters, has enough capacity to remove much of that sensitivity, provided it is trained against the right objective. The third is that the right objective constrains class prototypes, not individual words. A word-level invariance constraint would also flatten real variation within a field, such as a total written as a bare integer versus a currency string. A prototype-level constraint only demands that the field's center stop moving when the reading order changes.
Written out, for an episode with support documents, a serialization $\pi$ (one particular reading order), and the frozen encoder $f$ with adapter weights $\phi$, let $c_k^{(\pi)}$ be the mean embedding of support words of field $k$ read under $\pi$. The training loss is
$$ \mathcal{L} = \mathcal{L}_{\text{proto}}\big(\pi_1\big) + \lambda \sum_k \frac{\lVert c_k^{(\pi_1)} - c_k^{(\pi_2)} \rVert^2}{\bar{D}^2}, $$
Here $\mathcal{L}_{\text{proto}}(\pi_1)$ is the standard prototypical cross-entropy over query words read under order $\pi_1$, as in Prototypical Networks for Few-shot Learning. The orders $\pi_1, \pi_2$ are two reading orders sampled independently per episode. The normalizer $\bar{D}$ is the mean distance between distinct prototypes, so the penalty cannot be satisfied by shrinking the whole space. The weight $\lambda$ trades the two terms. At test time there is no training. A new field is registered by averaging embeddings of its labeled words in the support documents.
Relation to Prior Work
Three lines of work motivate the gap. FormNet shows that reading order separates keys from values in multi-column forms, and repairs this with a geometric word graph and coordinate-aware attention trained end to end. Learning Label Dependencies for Visual Information Extraction recovers broken label structure with an auxiliary label model and iterative inference. LMDX appends coordinate tokens to text for large language models. All three accept full training of large components, and none studies the regime of one to ten documents. Our proposal does not build a graph or extend the input. It keeps the encoder frozen and asks whether a low-rank correction can make its existing representations order-stable.
Two papers are the closest competitors. Generative Compositor for Few-Shot Visual Information Extraction targets exactly the few-shot regime. It reports robustness to shuffled word order, obtained through layout-centric pretraining objectives and a prompt-conditioned pointer network, with substantial trained components. It does not represent fields as class centers and does not use low-rank adaptation. Our method differs in both respects and adds an explicit diagnostic of order sensitivity. FS-DAG reaches strong receipt accuracy with a compact graph network but classifies with a fixed linear head, which cannot register new fields without retraining.
On the method side, Meta-Baseline supplies the observation that pretrained features plus nearest-centroid classification is already a strong few-shot baseline, and we reuse it as our naive reference. Xu and Kong et al. supply evidence that low-rank updates to a frozen backbone limit overfitting and preserve calibration, which is why we expect prototypes to stay stable when the adapter is trained on few documents. LE-ProtoPNet is the only file entry combining prototypes with LoRA. It uses prototype activations to route a mixture of LoRA experts for natural-image classification. It never touches word layouts or reading order, and its prototypes choose adapters rather than serving as the target of an invariance constraint.
One constraint cuts against us. The tension noted between low-rank capacity and the heavy machinery Yao et al. needed to restore layout structure suggests rank 8 may be too small. We treat adapter rank as an experimental variable rather than an assumption.
Research Program
The backbone is a pretrained layout-aware encoder, LayoutLMv3, kept frozen, with LoRA adapters on the attention query and value projections at ranks 4, 8, 16, and 32. Adapter training is episodic. Each episode samples a document type and a subset of its fields, draws a few support documents and query documents, and reads every document under two orders. The orders are drawn from a fixed family: default row-major OCR order, column-major order, recursive XY-cut order, segment-shuffled order (whole text lines permuted, words inside a line kept in order), and fully shuffled words. A learned "other" prototype handles background words, which make up most tokens on FUNSD and CORD.
The first stage is diagnostic and needs no new training. For the frozen encoder, we compute each field's support prototype under each reading order. We then measure how far the prototype moves relative to the spacing between prototypes, and fit a two-component mixture per field to test for order-induced sub-clusters. If prototype movement is small and nearest-centroid accuracy barely changes across orders, the central premise is wrong and we stop. The second stage trains the adapter with the loss above on base document types. The third stage evaluates on held-out fields and held-out document types, using one, five, and ten support documents, under every reading order at test time.
Baselines
The naive reference is the frozen LayoutLMv3 with a nearest-centroid head and no adapter, in the spirit of Meta-Baseline. It costs nothing to train. Any trained method that fails to beat it has learned nothing about the few-shot problem. It also gives us the pure order-sensitivity measurement of the pretrained model.
The conventional reference is LayoutLMv3 fully fine-tuned with a linear classification head on the support documents. Generative Compositor reports 38.95% entity F1 for this baseline at one shot on CORD. We will rerun it on our splits, giving it the same support documents and a matched hyperparameter search.
The strongest existing method on the central question is the Generative Compositor itself. It reports 62.16% F1 at one shot on CORD and 94.33% F1 on FUNSD with full data, and it claims robustness to shuffled order. We will use the reported CORD one-, five-, and ten-shot numbers directly, and rerun it under our reading-order perturbations if code permits. Beating it means matching or exceeding 62.16% one-shot CORD F1 with orders of magnitude fewer trained parameters. Even matching it with a smaller worst-case-order gap would count as a meaningful result.
For receipts at full data, FS-DAG reports 93.90% F1 on WildReceipt against 87.14% for LayoutLMv3. We include it as a full-data ceiling, not a few-shot competitor.
The ablations isolate the key ingredient. All share the adapter rank, training episodes, optimizer steps, and a fixed tuning budget of the same number of configurations per method. The first is LoRA with a linear head. The second is LoRA with a prototype head and no consistency term. The third is LoRA with a prototype head trained under random reading orders but without the consistency term, which is plain order augmentation. The fourth replaces the prototype-level penalty with a word-level penalty that forces each word's embedding to match across orders. The fifth deletes the encoder's 1D position inputs and lets LoRA adapt to their absence. The proposal is supported only if the full objective beats the augmentation-only and position-deletion variants on worst-case-order F1, and beats the word-level variant on fields with genuine within-class variation.
Why not just…?
Why not just prompt a multimodal large language model with a few example documents? The file's evidence is unfavorable for this route on layout-heavy extraction. On SVRD, QwenVL reaches 17.63% all-category F-score against 41.98% for grounded extraction, and it runs about twenty times slower, according to TG-VIE, which also documents invented field values. We will still include one prompted model as a reference on CORD few-shot splits, because it requires no training and sets a practical floor.
Why not just delete the reading-order position inputs, since that makes the model order-invariant by construction? This is the most serious threat, and we cannot rule it out from the literature. Two-dimensional boxes already carry most order information. Deleting the 1D positions might therefore cost little, and LoRA might absorb the shift cheaply. The position-deletion ablation tests this directly. The counterargument is that the pretrained encoder relies on those positions to read multi-word values such as addresses, so deleting them may hurt clean-order accuracy even as it removes the order gap. If position deletion matches our method on both clean-order and worst-case-order F1, we will report the cheap fix as the finding and drop the consistency objective.
Why not just train with shuffled reading orders as data augmentation? Augmentation teaches the classifier to tolerate order changes. It does not force the support prototypes, computed from only one to five documents, to land in the same place, and that is where few-shot error is predicted to come from. The augmentation-only ablation settles this. If it closes the order gap as well as the consistency term, the prototype penalty adds nothing, and we will say so.
Why not just fully fine-tune with a prototype head? Full fine-tuning on one to five documents is exactly where representation drift and collapse appear, as the 38.95% one-shot LayoutLMv3 result shows. We run it with the identical prototype head, so any gap is attributable to the adaptation method rather than the classifier.
Proposed Experiments
The benchmarks are FUNSD (149 training and 50 test forms), CORD with its 42 fine-grained fields, SROIE, and WildReceipt. Adapter meta-training uses base document types, and field splits are held out so that evaluation fields are never seen during adapter training. For example, the adapter is trained on FUNSD, SROIE, and WildReceipt and evaluated on CORD fields, and the arrangement is rotated. We also report the Generative Compositor protocol of one, five, and ten CORD support documents for direct comparison.
Metrics are standard entity-level F1 and worst-case F1 across the five reading orders. We also report the order gap, the best minus worst F1, and a prototype-movement ratio, the mean prototype displacement across orders divided by the mean distance between prototypes. Trainable parameter count and inference time per document are reported for every method. The rank sweep tests the capacity concern directly. If F1 under shuffled orders keeps rising up to rank 32, low rank is a binding limit on recovering broken layout structure.
The decisive checks are three. First, the frozen-encoder diagnostic must show substantial prototype movement and order-induced sub-clusters; without that, the premise fails. Second, the full objective must cut the prototype-movement ratio and the order gap well below the augmentation-only and position-deletion ablations, while matching them on default-order F1. Third, on fields with known genuine variants, such as CORD totals written in different formats, the prototype-level penalty must retain accuracy that the word-level penalty loses. That comparison is the evidence that constraining class centers, rather than individual words, is the right choice.
References
- Prototypical Networks for Few-shot Learning
- FormNet: Structural Encoding beyond Sequential Modeling in Form Document Information Extraction
- Learning Label Dependencies for Visual Information Extraction
- LMDX: Language Model-based Document Information Extraction and Localization
- Generative compositor for few-shot visual information extraction
- FS-DAG: Few Shot Domain Adapting Graph Networks for Visually Rich Document Understanding
- Meta-Baseline: Exploring Simple Meta-Learning for Few-Shot Learning
- On the Calibration of Large Language Models and Alignment
- Enhancing General Face Forgery Detection via Vision Transformer with Low-Rank Adaptation
- Interpretable Few-Shot Image Classification via Prototypical Concept-Guided Mixture of LoRA Experts
- Textual Grounding for Open-Vocabulary Visual Information Extraction in Layout-Diversified Documents