Skip to main content
Back

Xiaohongshu's dots.mocr Turns Charts and Diagrams Into Editable SVG Code

A 3B model from Xiaohongshu treats charts, diagrams, and icons as first-class parsing targets by converting them into renderable SVG code.

Pro

  • Xiaohongshu and HUST release dots.mocr, a 3B model that parses text and graphics into unified structured outputs.
  • Charts, diagrams, and icons are converted to renderable SVG code instead of discarded as pixel crops.
  • Sets a new state of the art of 83.9 on olmOCR-Bench, ranking second only to Gemini 3 Pro.
  • Beats Gemini 3 Pro on every image-to-SVG benchmark tested including ChartMimic, Design2Code, and ChemDraw.
  • Vision encoder trained entirely from scratch (1.2B) paired with a Qwen2.5-1.5B decoder for structured generation.
  • MIT-licensed code and both checkpoints available on Hugging Face with vLLM support.

Document parsing has quietly become one of the most important preprocessing steps in modern AI, since it decides how much reliable structured data can be pulled out of the PDFs, scans, and screenshots that hold most of the world's written knowledge. But almost every OCR pipeline stops at text. Charts, diagrams, icons, and schematics get detected, cropped, and thrown away as pixels, which wastes a huge amount of the visual information a page actually contains.

A new paper from Huazhong University of Science and Technology and Xiaohongshu's hi lab proposes a fix. Multimodal OCR (MOCR), implemented as a 3B model called dots.mocr, treats graphics as first-class parsing targets and reconstructs them as renderable SVG code alongside the text. Designed for comprehensive parsing, dots.mocr seamlessly recognizes both diverse human scripts and structured graphical content. Its core capabilities encompass grounding, recognition, semantic understanding, and interactive dialogue.

Comparison between text-only OCR and multimodal OCR paradigms

The lossy problem with today's OCR

Conventional OCR pipelines are text-centric by design. They detect layout regions, recognize characters, and then leave anything non-textual as a bounding box wrapped around raw pixels. That means a bar chart showing quarterly revenue, a flowchart explaining an algorithm, or a molecular diagram in a chemistry paper all get discarded as opaque images that downstream models can only stare at, not manipulate.

The MOCR paper argues this is a scalability problem, not just a fidelity one. Every chart parsed into SVG becomes a faithful image, code, and text triple, meaning documents can supply not just textual tokens but controllable, editable structural supervision for multimodal pretraining, at a scale bounded only by how many documents you have.

Turning charts and icons into SVG

The task definition is straightforward. Given an input page, the model outputs an ordered sequence of parsed elements, where each element has a bounding box, a semantic category, and a payload. For text blocks the payload is Markdown, for tables it is HTML, for formulas it is LaTeX. For visual elements that admit a concise programmatic description, such as UI components, icons, and charts, the payload is renderable SVG code.

Complex natural photographs, which do not have a compact program representation, are still kept as raster content. This is a pragmatic call: SVG works well for geometric, symbolic imagery, and less well for a photo of a cat.

Architecturally, dots.mocr is a fairly standard VLM stack with one important detail. The vision encoder is a 1.2B backbone trained entirely from scratch rather than initialized from a general-purpose CLIP-style model. The team argues this gives features natively tuned for document parsing, and it supports native inputs up to roughly 11 million pixels so small fonts and fine chart strokes survive. The decoder is Qwen2.5-1.5B, chosen as a capacity-versus-cost sweet spot for generating long structured sequences like full SVG programs.

The data engine is the actual contribution

The bigger challenge is training data. Real documents almost never come with aligned program representations for their visual elements, and the same rendered image can correspond to many different SVG programs, so straightforward supervised training is unstable. The team built a four-source corpus:

  • PDFs auto-labeled by their previous dots.ocr model, with stratified sampling across language, domain, and layout complexity.
  • Rendered webpages, using aligned HTML and DOM signals to reduce label noise and pulling in native SVG icons and charts along the way.
  • Native SVG assets, cleaned with svgo, normalized for numeric precision, and deduplicated using perceptual hashing on the rendered images.
  • General-purpose vision data like grounding and counting to keep broader capabilities intact.

Training runs in three staged pretraining phases followed by supervised fine-tuning, gradually shifting the mixture from general vision to MOCR-specific targets while increasing input resolution. Two checkpoints are released with the same pretraining backbone: the base dots.mocr, and dots.mocr-svg, which up-weights harder SVG programs during SFT for stronger image-to-code performance.

Benchmarks: second only to Gemini 3 Pro

Evaluation uses a paired-comparison Elo protocol called OCR Arena, where a high-capacity vision-language model, such as Gemini 3 Flash, evaluates pairs of model outputs given the original document image and their generated Markdown transcriptions, judging which result better preserves fidelity, structure, and formatting or declaring a tie. Every comparison runs in both directions to filter out position bias.

Bar charts comparing dots.mocr against other systems on image and document parsing benchmarks

On document parsing, dots.mocr ranks second only to Gemini 3 Pro across olmOCR-Bench, OmniDocBench 1.5, and XDocParse, beating every open-source system tested including its own predecessor dots.ocr, PaddleOCR-VL-1.5, GLM-OCR, and HunyuanOCR. On olmOCR-Bench specifically, it sets a new state of the art at 83.9, edging out olmOCR v0.4.0 and Infinity-Parser 7B while leading on ArXiv, old-scan math, tables, and multi-column pages.

The structured graphics results are where things get more interesting. Across six image-to-code benchmarks (UniSVG, ChartMimic, Design2Code, GenExam, SciGen, ChemDraw), the dots.mocr-svg variant beats Gemini 3 Pro on every single one, with particularly large gains on structure-sensitive tasks like ChartMimic (0.905 vs. 0.788) and UniSVG overall (0.902 vs. 0.735). That is a compact 3B open model outperforming a frontier closed model on faithful visual reconstruction.

What it is actually good for

The obvious applications are the ones that stall today when charts and diagrams appear:

  • Building RAG or pretraining corpora from technical PDFs where figures carry real information.
  • Converting existing UI screenshots or design mockups into editable vector code.
  • Parsing scientific papers with equations, tables, and figures into a single machine-readable representation.
  • Bulk conversion of chemistry, engineering, or exam-style diagrams into reusable structured formats.

The team is honest about limits. Complex tables and formulas remain difficult given the small parameter budget, and the SVG output for pictures is not yet fully robust. There are also occasional parsing failures. And the current release is task-conditioned, meaning full-page text parsing and region-level image-to-SVG decoding still run as two separate passes rather than one unified output.

Getting it running

Both checkpoints are on Hugging Face under the rednote-hilab org, with MIT-licensed code on GitHub. Since vLLM version 0.11.0, dots OCR has been officially integrated into vLLM with verified performance, so the fastest path to trying it is a one-line vLLM serve:

vllm serve rednote-hilab/dots.mocr \
  --tensor-parallel-size 1 \
  --gpu-memory-utilization 0.9 \
  --chat-template-content-format string \
  --trust-remote-code

Swap in rednote-hilab/dots.mocr-svg for the SVG-tuned variant, or use the provided Hugging Face inference script for a Transformers-only path. A live demo is available for anyone who wants to poke at pages before installing anything.

The bigger idea behind this release is worth sitting with. If graphics can be systematically parsed into code, then every existing document corpus becomes a potential source of image-to-code supervision for the next generation of multimodal models, without needing to hand-annotate anything. That reframing, more than the leaderboard numbers, is what makes MOCR interesting.