All models

SAN

Encoder-decoder recognizer that turns handwritten math images into LaTeX by following grammar rules.

Documents and OCR · 1,255 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (937 KB)

Open in a new tab

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

Family
SAN
Parameters
8M
Operations
1,255
Framework
PyTorch
Recurrent
Yes
Published
CVPR 2022
Cited by
87 (as of 30 October 2026)
Authors
Ye Yuan, Xiao Liu, Wondimu Dikubab and others
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m19950
Graph hash
7fa742d3e65e3def7e7ee74662fe5463ae46ce4999b403537f00fada78b98ea1
Skeleton hash
ed1ad066c8b12ce7ca5776ae03f2db35920ff18d8deedadae242a1b3fdef30d6
Architecture hash
e80dfe600c2e27f5c5e83e81c5081c9799279bfc4754ebf7ddb840eda694629d
Diagram SHA-256
bb78dfa5ff54d2e225e5a46622ee1cd3f5cee2ad9278b08506bbbf2a9140988d
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

SAN, the syntax-aware network, is an encoder-decoder model for handwritten mathematical expression recognition that builds grammar constraints into the network. The paper observes that earlier encoder-decoder recognizers predict one character after another, which produces errors on complicated structures and hard-to-read handwriting.

SAN instead uses a set of grammar rules to convert each expression's LaTeX markup into a parse tree, and treats recognition as a traversal of that tree. At each step the decoder scores the production rules of the grammar and selects the most probable one. The image encoder is a densely connected convolutional network (DenseNet). The decoder consists mainly of two GRU cells and a syntax-aware attention module.

The paper also introduces HME100K, a dataset of 100k handwritten expression images from ten thousand writers. On CROHME 2014, 2016 and 2019 it reports expression recognition rates above MAN by 3.1%, BTTR by 1.3% and BTTR by 0.5%, respectively. On an HME100K test set it measures SAN as 3.5 times faster than the tree decoder DWAP-TD.

Key idea. The paper builds grammar rules into an encoder-decoder recognizer so that LaTeX markup is predicted by traversing a parse tree instead of character by character.

  • SAN
  • Syntax-Aware Network
  • handwritten mathematical expression recognition
  • HMER
  • LaTeX recognition
  • grammar rules
  • parse tree
  • HME100K
  • CROHME

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{yuan2022syntaxawarenetworkhandwrittenmathematical,
      title={Syntax-Aware Network for Handwritten Mathematical Expression Recognition}, 
      author={Ye Yuan and Xiao Liu and Wondimu Dikubab and Hui Liu and Zhilong Ji and Zhongqin Wu and Xiang Bai},
      year={2022},
      eprint={2203.01601},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2203.01601}, 
}