LaTr
A T5-based transformer that answers questions about text in images from OCR tokens, layout embeddings and ViT features.
Multimodal · 1,691 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Multimodal
- Parameters
- 314M
- Operations
- 1,691
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR (arXiv 2021)
- Cited by
- 95 (as of 27 October 2026)
- Authors
- Ali Furkan Biten, Ron Litman, Yusheng Xie and others
- Source
- GitHub: uakarsh/latr
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m17844
- Graph hash
- 862862fee916d93697dd23d63ff164b383bfdc1f44f78290c614f5ea938646f4
- Skeleton hash
- b777578383058ee407f9548065da877a3d19513a7ccf96e05a586896d5b3f505
- Architecture hash
- 31b9ce94ae2ec7ad5cab4893ffe8e94ba514fc542ca2ff982fd98a3155d14d8e
- Diagram SHA-256
- 56bab29d77261851657d8d809aa157fe6964abfc574f3f31a593eea977ec6319
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
LaTr, the Layout-Aware Transformer, is a multimodal architecture for Scene Text Visual Question Answering (STVQA), a task that requires models to reason over different modalities. It has three building blocks: a language model pre-trained on text only, spatial embeddings for the bounding boxes of OCR tokens together with layout-aware pre-training on documents, and a ViT for visual features.
The language model is the encoder-decoder transformer of T5. Because T5 was trained on text alone, the authors pre-train further to align the layout information, in the form of a 2-D spatial embedding, with the semantic representations. That pre-training uses scanned documents instead of natural images, because they are easy to procure, text-dense and varied in layout. A vision transformer supplies the visual features, which removes the need for an external object detector. Decoding is vocabulary-free, and the paper shows it generalizing beyond the training vocabulary.
The paper reports absolute accuracy gains over earlier STVQA methods of +7.6% on TextVQA, +10.8% on ST-VQA and +4.0% on OCR-VQA. The official implementation was not released by the authors, so the code behind this model is a PyTorch implementation written from the paper. Its author provides no pre-trained weights and reports a validation accuracy of 27.42 percent with a t5-base configuration, against the 44.03 percent the paper's authors achieved.
Key idea. LaTr adds 2-D layout embeddings for OCR tokens to a T5 encoder-decoder and pre-trains it on scanned documents with a single objective needing only text and spatial cues.
- latr
- layout-aware transformer
- scene text vqa
- stvqa
- textvqa
- st-vqa
- visual question answering
- layout-aware pre-training
- ocr-vqa
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{biten2021latrlayoutawaretransformerscenetext,
title={LaTr: Layout-Aware Transformer for Scene-Text VQA},
author={Ali Furkan Biten and Ron Litman and Yusheng Xie and Srikar Appalaraju and R. Manmatha},
year={2021},
eprint={2112.12494},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2112.12494},
}