Papers
Topics
Authors
Recent
Search
2000 character limit reached

UniRec40M: Unified Text & Formula Dataset

Updated 4 July 2026
  • UniRec40M is a large-scale, multi-source dataset that supports unified recognition of text, formulas, and mixed content across various granularities and languages.
  • It aggregates balanced samples from TeX sources, scene text, handwriting, and domain PDFs to enable multi-level supervision.
  • The dataset underpins the UniRec-0.1B model, leading to significant gains in formula recognition accuracy and layout-preserving transcription.

Searching arXiv for the primary UniRec paper and closely related OCR/formula-recognition context. UniRec40M is a large-scale training dataset introduced as the data foundation for unified recognition of text and formulas across multiple granularities, languages, and document conditions. It was established to support UniRec-0.1B, a unified recognition model with only 0.1B parameters, and is described as comprising 40 million text, formula and their mix samples (Du et al., 24 Dec 2025). More precisely, the dataset is reported as a collection of multi-level text-formula samples drawn from TeX-generated data, scene text data, handwritten data, and domain PDF data, with a tabulated raw total of 39.60M samples and a proportion-balanced sampling schedule of 12.63M samples per epoch (Du et al., 24 Dec 2025). Its role in the underlying work is not merely to enlarge OCR supervision, but to make lightweight unified recognition of plain text, mathematical formulas, and mixed text-formula content feasible at the levels of characters, words, lines, paragraphs, and document-like blocks (Du et al., 24 Dec 2025).

1. Definition and scope

UniRec40M is presented as a large-scale dataset built specifically for lightweight unified recognition of both text and formulas (Du et al., 24 Dec 2025). The dataset is motivated by a stated deficiency in existing OCR and document-parsing resources: text-recognition corpora and formula-recognition corpora are usually separate, and most available data are limited in scale, domain coverage, or hierarchical supervision (Du et al., 24 Dec 2025). In that formulation, UniRec40M is intended to fill the gap for a single compact model that must process plain text, isolated formulas, and interleaved text-formula sequences under a unified recognition objective (Du et al., 24 Dec 2025).

The corpus is explicitly characterized as multilingual and multi-level. The paper summarizes it as containing nearly 30M English samples and 10M Chinese samples, and across semantic categories it includes 19M plain text, 13M formula-only, and 8M text-formula mixed instances (Du et al., 24 Dec 2025). These counts indicate that the dataset is not restricted to scientific formula crops or standard line-level OCR. Rather, it is organized to expose a model to ordinary prose, formula syntax, and hybrid sequences in which both modalities co-occur. This suggests a training design aimed at representation sharing across modalities while preserving distinctions required for accurate decoding.

2. Composition and quantitative breakdown

The paper names four source families in the dataset composition: TeX-generated data, scene text data, handwritten data, and domain PDF data (Du et al., 24 Dec 2025). The detailed table reports the following raw counts, summing to 39.60M samples (Du et al., 24 Dec 2025).

Source family Subcategory Samples
TeX-generated English text 9.05M
TeX-generated English formula 12.85M
TeX-generated English mixed 7.91M
TeX-generated Chinese text 6.84M
TeX-generated Chinese formula 0.05M
TeX-generated Chinese mixed 0.24M
Scene text LSVT 1.05M
Scene text MTWI 0.26M
Scene text HierText 0.15M
Handwritten HWDB 0.32M
Handwritten TAL 0.38M
Handwritten Note 0.02M
Domain data IR Report 0.08M
Domain data Newspaper 0.35M
Domain data K-12 0.13M

The same table also gives per-epoch sampling counts under a proportion-balanced sampling strategy, totaling 12.63M samples per epoch (Du et al., 24 Dec 2025). The text states that data are either sub-sampled or re-sampled per training epoch so that the ratios among text, formula, and mixed samples remain stable (Du et al., 24 Dec 2025). This is significant because the raw source composition is visibly imbalanced across languages and content types, particularly between English and Chinese and between formula-rich TeX data and smaller handwritten or domain-specific subsets.

The designation “40 million” is therefore a rounded summary of the overall scale, whereas the paper’s table provides the more precise raw sample total of 39.60M (Du et al., 24 Dec 2025). A plausible implication is that the dataset name functions both as a scale indicator and as a label for the training regime associated with the UniRec-0.1B system.

3. Data sources and construction pipeline

The first and most substantial source is an online TeX source pipeline. The authors collect arXiv TeX source files and Wikipedia HTML pages converted into TeX format, giving about 2 million TeX files (Du et al., 24 Dec 2025). For each TeX source file, every valid text or formula token is assigned a unique color by inserting LaTeX color commands, after which the files are rendered to PDF (Du et al., 24 Dec 2025). Because each token has a distinct color in the rendered output, the pipeline performs color-based alignment between the TeX source and the PDF rendering to recover labels (Du et al., 24 Dec 2025). This enables automatic generation of supervision at word level, line level, and paragraph level, obtained by parsing LaTeX grammar (Du et al., 24 Dec 2025).

A second source consists of digital-born PDF documents, especially industry research reports and newspapers (Du et al., 24 Dec 2025). Using PyMuPDF, the authors extract text blocks and corresponding image regions from these PDFs (Du et al., 24 Dec 2025). The function of this source is to add multi-level, multi-domain text recognition data beyond TeX-like scientific layouts. The dataset description does not provide a more elaborate annotation mechanism for this portion, but the extraction process is explicitly identified.

A third source incorporates public datasets and handwriting resources. The integrated corpora include LSVT and MTWI for Chinese scene text, HierText for English scene text, CASIA-HWDB and TAL for handwriting, K-12 as an examination-style dataset, and handwritten notes labeled by Qwen3VL-235B-A30B and then manually refined (Du et al., 24 Dec 2025). The handwritten notes are described as a high-quality supplement (Du et al., 24 Dec 2025). In aggregate, these sources broaden the visual and domain distribution of the dataset from rendered scientific documents to scene text, offline handwriting, examination material, and document blocks.

4. Recognition hierarchy and annotation semantics

A central feature of UniRec40M is its support for hierarchical recognition. The associated model is intended to recognize text and formulas at the character, word, line, paragraph, and multi-paragraph / document-like level (Du et al., 24 Dec 2025). The dataset supports these levels through heterogeneous supervision paths: TeX-generated data provide word-, line-, and paragraph-level supervision; scene text primarily contributes character/word/line recognition; handwritten datasets strengthen character-level and line-level robustness; and domain PDFs provide paragraph-like and block-like samples from realistic layouts (Du et al., 24 Dec 2025).

The paper does not state that every sample is annotated for every level (Du et al., 24 Dec 2025). Instead, the dataset is described as a multi-level corpus feeding a model trained for multi-level output. This distinction matters technically: UniRec40M is not presented as a uniformly annotated benchmark in the strict sense, but as a composite training resource whose supervisory granularity depends on source type.

The content taxonomy is also explicit. UniRec40M includes plain text, formula-only, mixed text-formula, scene text, handwritten text, and domain-specific document text (Du et al., 24 Dec 2025). The mixed samples are especially important because they require the recognizer to distinguish ordinary words from formula tokens within a single sequence (Du et al., 24 Dec 2025). This suggests that the dataset is structured not only around visual diversity but also around intra-sequence semantic switching.

5. Coupling with tokenization and hierarchical supervision

UniRec40M is tightly coupled to two training mechanisms introduced alongside UniRec-0.1B: the Semantic-Decoupled Tokenizer (SDT) and Hierarchical Supervision Training (HST) (Du et al., 24 Dec 2025). The dataset is valuable in part because it provides the content diversity needed for these mechanisms to operate meaningfully.

For SDT, the paper states that two independent tokenizers are trained: one on plain text and one on mathematical formulas (Du et al., 24 Dec 2025). Formula tokens are then merged into the text tokenizer as special tokens, except for tokens already present in the text vocabulary (Du et al., 24 Dec 2025). The motivation is to avoid shared embeddings for semantically different uses of the same strings, with problematic examples explicitly identified as sum, infty, left, frac, and right (Du et al., 24 Dec 2025). Since UniRec40M contains plain text, formulas, and mixed sequences at scale, it provides the empirical basis on which such semantic decoupling is expected to matter.

For HST, the paper states that hierarchical tokens are inserted into labels during dataset construction and training: <|ln|> for line breaks within a paragraph and <|pn|> for paragraph boundaries (Du et al., 24 Dec 2025). During inference, <|ln|> tokens are removed and <|pn|> tokens are converted into two newline characters (Du et al., 24 Dec 2025). UniRec40M is therefore not merely a collection of image-text pairs; it is a corpus with structure-aware label design that supports training for layout-preserving transcription.

The formal model definitions given in the paper are relevant because they clarify the representational interface through which UniRec40M is consumed. The input image is defined as

IRH×W×3,\mathbf{I} \in \mathbb{R}^{H \times W \times 3},

the encoder output as

Fmap=Encoder(I)RH32×W32×D\mathbf{F}_{map} = \mathbf{Encoder}(\mathbf{I}) \in \mathbb{R}^{\frac{H}{32} \times \frac{W}{32} \times D}

with D=768D = 768, the flattened visual sequence as

F=Flatten(Fmap)RN×D,N=H32×W32,\mathbf{F} = \text{Flatten}(\mathbf{F}_{map}) \in \mathbb{R}^{N \times D}, \quad N = \frac{H}{32} \times \frac{W}{32},

the tokenized label sequence as

Y=SDT(Label)={<BOS>,y0,y1,,yl1,yl}\mathbf{Y} = \text{SDT}(Label) = \{<BOS>, y_0, y_1, \ldots, y_{l-1}, y_l\}

where yl=<EOS>y_l = <EOS>, and the training loss as

LCE=t=0llogP(yty0:t1,F).\mathcal{L}_{CE} = - \sum_{t=0}^{l} \log P(y_t \mid y_{0:t-1}, \mathbf{F}).

These definitions situate UniRec40M within a sequence-generation training framework rather than a conventional lexicon-constrained OCR pipeline (Du et al., 24 Dec 2025).

6. Empirical role, availability, and limitations

The paper does not provide a direct ablation that removes UniRec40M entirely, because the dataset is the training foundation of the reported model (Du et al., 24 Dec 2025). Its importance is instead argued indirectly through downstream performance and through ablations of HST and SDT. The dataset-related evidence emphasized in the text includes formula recognition gains and domain robustness: UniRec-0.1B outperforms Mathpix, Pix2Tex, and UniMERNet-B on formula recognition on UniRec-Bench; improves formula recognition by 23.1% against Dolphin-1.5; beats PaddleOCR-VL by 2.7% on the Exam Paper domain; and performs best on handwritten Note and noisy Newspaper domains (Du et al., 24 Dec 2025). The paper attributes these outcomes partly to the rich and diverse formula recognition data in UniRec40M, to SDT plus the high-quality mixed text/formula training data, and to the inclusion of exam-related, handwritten, and noisy domain samples in the dataset (Du et al., 24 Dec 2025).

The ablation results further indicate that the training corpus is sufficiently rich to support the proposed supervisory strategies. HST improves edit distance by 1.2% on text, 1.0% on formulas, and 1.5% on mixed content, and improves multi-level text recognition across five levels by 0.5%, 0.8%, 0.4%, 1.7%, and 1.2%, with especially strong gains at paragraph and multi-paragraph levels (Du et al., 24 Dec 2025). SDT gives 1.2% improvement on text, 11.1% on formulas, and 1.8% on mixed content (Du et al., 24 Dec 2025). These are model-level outcomes, but they depend on the dataset containing sufficient mixed and multi-level supervision.

The dataset’s availability is stated through the project repository at https://github.com/Topdu/OpenOCR, where the codebase and dataset are said to be available (Du et al., 24 Dec 2025). By contrast, the text shown does not provide a formal train/validation/test split for UniRec40M itself, nor does it state a dataset license (Du et al., 24 Dec 2025). One explicit limitation is also identified: some subscript/superscript cases are misrepresented because the PyMuPDF extraction collapses them into plain text, and the model may therefore predict these outside mathematical contexts as plain text (Du et al., 24 Dec 2025). This is not presented as a global defect of the dataset, but it is a concrete example of annotation-noise mismatch arising from one acquisition pipeline.

In summary, UniRec40M is best understood as a deliberately constructed multi-source, multi-level, multilingual training corpus for unified text-and-formula recognition. Its distinctive properties are the scale of its mixed supervision, the integration of TeX-derived scientific content with scene text, handwriting, and domain PDFs, and its direct alignment with structure-aware labeling and semantic-decoupled tokenization in UniRec-0.1B (Du et al., 24 Dec 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to UniRec40M.