u/Brilliant_Rich3746

▲ 30 r/Rag

Structured doc parsing pipeline for RAG - 0.3B OCR, layout detection, reading-order Markdown output

Background: Work at PatSnap and process patent documents at scale. We built these two tools internally and just open-sourced them, sharing here to get feedback from people working on different document types.

Hiro-Smart-Doc is a self-hosted FastAPI pipeline for document parsing. Layout detection first (RT-DETR, 25 region categories), then OCR per region in correct reading order including multi-column pages. Tables as HTML, formulas as LaTeX, text as Markdown. Works on PDFs, Office files, images. Apache-2.0.

GitHub: https://github.com/patsnap/Hiro-Smart-Doc

The OCR layer is powered by Hiro-MOSS-OCR, a 0.3B model trained from scratch on 50M+ technical documents. Scores 93.63 on OmniDocBench v1.5. Runs at 58 QPS on a single RTX 4090 via vLLM. Apache-2.0.

GitHub: https://github.com/patsnap/Hiro-MOSS-OCR
HuggingFace: https://huggingface.co/PatSnap/Hiro-MOSS-OCR-0.3B

Would love to hear how it holds up on document types beyond patents. Happy to answer questions or dig into any part of the setup.

u/Brilliant_Rich3746 — 5 days ago

0.3B OCR model for structured document extraction: tables to HTML, formulas to LaTeX, outperforms 1.2B models on patent docs

Patent documents are one of the harder OCR problems out there. A single page can contain merged tables, chemical diagrams, formula blocks, and mixed English/Chinese/Japanese all at once. We've been working on this problem specifically, and after getting to a point where we're happy with the results, we decided to open-source what we built and see what the community thinks.

Here are two tools we use internally.

Hiro-MOSS-OCR is a 0.3B model that outputs structured markup: tables to HTML, formulas to LaTeX, text to Markdown. Trained on 50M+ samples. Ranks #1 on our patent-domain benchmark against all 1.2B models we tested. ~59 QPS on a single RTX 4090 via vLLM.

Hiro-Smart-Doc wraps layout detection (RT-DETR, 25 region categories) and MOSS-OCR into a streaming FastAPI service with an OpenAI-compatible endpoint. Feed it a PDF, image, or Office doc, get back reading-ordered structured content or Markdown.

Both Apache 2.0. Would love feedback from anyone dealing with complex document types where standard OCR falls short.

Thanks!

u/Brilliant_Rich3746 — 13 days ago