Uni-MuMER: Unified Multi-Task Fine-Tuning of Vision-Language Model for Handwritten Mathematical Expression Recognition

Yu Li, Jin Jiang, Jianhua Zhu, Shuai Peng, Baole Wei, Yuxuan Zhou, Liangcai Gao

TL;DR

Uni-MuMER shifts the paradigm of Handwritten Mathematical Expression Recognition (HMER) from specialized, rigid architectures to a unified, data-driven fine-tuning of generalist Vision-Language Models (VLMs). By integrating structured spatial reasoning, error correction, and symbol counting into a single training framework, it achieves a new state-of-the-art, outperforming specialized models by over 16% and top-tier closed-source VLMs like Gemini 2.5 Flash by 24%.

What Problem Does This Paper Address?

Recognizing handwritten math is significantly harder than standard Optical Character Recognition (OCR). While normal text is linear, math is inherently two-dimensional and hierarchical—featuring superscripts, subscripts, fractions, and nested square roots.

Historically, researchers tackled this by building "specialized" models with custom architectural modules (like tree-structured decoders) to handle these 2D relationships. However, these models are often brittle, hard to scale, and struggle with the messy variability of human handwriting. Conversely, while modern general-purpose VLMs (like GPT-4o or Qwen) are powerful, they lack the domain-specific "spatial logic" required to perfectly parse complex LaTeX formulas from an image. Uni-MuMER bridges this gap by injecting math-specific reasoning into a generalist VLM through clever data engineering rather than architectural changes.

Methods: Injecting Math Logic into VLMs

The authors use Qwen2.5-VL-3B as their base and fully fine-tune it on a multi-task objective. Instead of just asking the model to "output LaTeX," they train it on four integrated tasks:

Overview of the Uni-MuMER multi-task training framework
  1. Vanilla HMER: The standard image-to-LaTeX mapping.
  2. Tree-Aware Chain-of-Thought (Tree-CoT): This acts as the "spatial reasoning" engine. The model is trained to first generate an Abstract Syntax Tree (AST)—a structured representation of the formula's hierarchy—before producing the final LaTeX. This forces the model to explicitly "think" about the 2D layout.
  3. Error-Driven Learning (EDL): The researchers used a "learning from mistakes" approach. They identified common errors the model made during training (like confusing '2' and 'z') and created a specific sub-task where the model must detect and then correct these errors in a "Marked Expression."
  4. Symbol Counting (SC): To prevent the model from skipping symbols or hallucinating extras in long formulas, they added a task where the model must identify and count every distinct symbol in the image before transcribing it.

Datasets

The model was trained and evaluated on a massive scale (roughly 1.6 million samples) using:

  • CROHME (2014-2023): The industry standard benchmark for HMER.
  • HME100K: A large-scale, real-world dataset with diverse writing styles.
  • MathWriting: A massive corpus from Google Research (230K human-written, 400K synthetic).
  • Im2LaTeXv2: A dataset of printed expressions used to improve the model's understanding of LaTeX syntax and out-of-domain generalization.

Key Insights and Ideas

  • Data > Architecture: The paper demonstrates that a generalist VLM with the right "instructions" (tasks) can far outperform models specifically built for math. You don't need a custom decoder if you can teach the model to reason through the structure via Tree-CoT.
  • Spatial Reasoning via Serialization: By serializing an AST into a text format with tab-based indentation, the authors successfully converted a 2D structural problem into a sequence-to-sequence problem that VLMs are already experts at solving.
  • The "Counting" Fix: One of the most common failure modes in HMER is "omission" (skipping a character in a long string). Explicitly forcing the model to count symbols acts as a global consistency check, significantly stabilizing performance on long, complex expressions.
  • Visual Confusion Mitigation: EDL specifically targets "fine-grained" visual errors. By training on an "error corpus" generated by the model itself, Uni-MuMER learns to distinguish between visually similar characters that often trip up standard OCR.

Key Results

Performance comparison of Uni-MuMER against baselines on CROHME datasets
  • New SOTA: On the CROHME benchmark, Uni-MuMER achieved an average Expression Recognition Rate (ExpRate) of 79.74%, a massive jump over the previous specialized SOTA, SSAN (63.43%).
  • VLM Dominance: It outperformed Gemini 2.5 Flash by 24.42% and GPT-4o by nearly 31% in zero-shot settings.
  • Efficiency: Despite being a 3B parameter model, Uni-MuMER achieves an inference speed of 43.40 FPS using vLLM, which is roughly 8-10x faster than previous specialized transformer-based models like CoMER or TAMER.

Limitations and Future Work

  • Data Utilization: Due to compute constraints, the authors were unable to use the full 400K synthetic subset of the MathWriting dataset, suggesting there is still "performance left on the table."
  • Task Balancing: The paper notes that they haven't yet explored the optimal "mixture ratio" between the four tasks (HMER, Tree-CoT, EDL, SC). Finding the perfect balance could further boost accuracy.
  • Self-Correction: The authors suggest that future iterations could move toward "R1-like" spontaneous self-correction, where the model uses colloquial reasoning (e.g., "Wait, I missed a parenthesis...") to fix its own outputs during inference.

Summary updated

BibTeX
@inproceedings{li2025uni,
  author = {Yu Li and Jin Jiang and Jianhua Zhu and Shuai Peng and Baole Wei and Yuxuan Zhou and Liangcai Gao},
  title = {{Uni-MuMER: Unified Multi-Task Fine-Tuning of Vision-Language Model for Handwritten Mathematical Expression Recognition}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=oHbVboLXz6},
}
Figure