mlsanityData to 14 Oct 2026

N-gram Injection into Transformers for Dynamic Language Model Adaptation in Handwritten Text Recognition

arXiv 2603.03930 ↗First posted 4 Mar 2026cs.CVcited by 0

Not on the map. Why?

Abstract (arXiv)

Transformer-based encoder-decoder networks have recently achieved impressive results in handwritten text recognition, partly thanks to their auto-regressive decoder which implicitly learns a language model. However, such networks suffer from a large performance drop when evaluated on a target corpus whose language distribution is shifted from the source text seen during training. To retain recognition accuracy despite this language shift, we propose an external n-gram injection (NGI) for dynamic adaptation of the network's language modeling at inference time. Our method allows switching to an n-gram language model estimated on a corpus close to the target distribution, therefore mitigating bias without any extra training on target image-text pairs. We opt for an early injection of the n-gram into the transformer decoder so that the network learns to fully leverage text-only data at the low additional cost of n-gram inference. Experiments on three handwritten datasets demonstrate that the proposed NGI significantly reduces the performance gap between source and target corpora.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 29 of its 45 references that are in the map. First posted on arXiv 4 Mar 2026.

Builds on

29 of 45 references.

References · 29

  1. 2017Attention Is All You Needcited by 60,361
  2. 2014Adam: A Method for Stochastic Optimizationcited by 37,240
  3. 2016Layer Normalizationcited by 5,669
  4. 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
  5. 2022Fast Inference from Transformers via Speculative Decodingcited by 1,653
  6. 2021TrOCR: Transformer-based Optical Character Recognition with Pre-trained Modelscited by 279
  7. 2017Improved Texture Networks: Maximizing Quality and Diversity in Feed-forward Stylization and Texture Synthesiscited by 215
  8. 2024Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokenscited by 153
  9. 2015On Using Monolingual Corpora in Neural Machine Translationcited by 150
  10. 2017Cold Fusion: Training Seq2Seq Models Together with Language Modelscited by 88
  11. 2022DAN: a Segmentation-free Document Attention Network for Handwritten Document Recognitioncited by 62
  12. 2019Evaluating Sequence-to-Sequence Models for Handwritten Text Recognitioncited by 58
17 more
  1. 2020On Vocabulary Reliance in Scene Text Recognitioncited by 39
  2. 2019ZEN: Pre-training Chinese Text Encoder Enhanced by N-gram Representationscited by 35
  3. 2020Recurrence-free unconstrained handwritten text recognition using gated fully convolutional networkcited by 23
  4. 2020ERNIE-Gram: Pre-Training with Explicitly N-Gram Masked Language Modeling for Natural Language Understandingcited by 17
  5. 2022N-Grammer: Augmenting Transformers with latent n-gramscited by 14
  6. 2024The N-Grammys: Accelerating Autoregressive Inference with Learning-Free Batched Speculationcited by 14
  7. 2023How to Choose Pretrained Handwriting Recognition Models for Single Writer Fine-Tuningcited by 13
  8. 2019Candidate Fusion: Integrating Language Modelling into a Sequence-to-Sequence Handwritten Word Recognition Architecturecited by 12
  9. 2020Enhancing Handwritten Text Recognition with N-gram sequence decomposition and Multitask Learningcited by 11
  10. 2024On the Generalization of Handwritten Text Recognition Modelscited by 10
  11. 2023MRN: Multiplexed Routing Network for Incremental Multilingual Text Recognitioncited by 7
  12. 2023N-Gram Unsupervised Compoundation and Feature Injection for Better Symbolic Music Understandingcited by 5
  13. 2023Improving Scene Text Recognition for Character-Level Long-Tailed Distributioncited by 3
  14. 2025Meta-DAN: towards an efficient prediction strategy for page-level handwritten text recognitioncited by 3
  15. 2022Vision-Language Adaptive Mutual Decoder for OOV-STRcited by 2
  16. 2024Revisiting N-Gram Models: Their Impact in Modern Neural Networks for Handwritten Text Recognitioncited by 2
  17. 2025Relaxed syntax modeling in Transformers for future-proof license plate recognitioncited by 1

Built on by

Not cited yet.