Various Articles

From PDFs to Clean Markdown: Inside Baseer, the New Standard for Arabic OCR

Admin
4 Minutes of reading
From PDF files to editable files

If you are a developer or researcher working with document parsing, you know the drill: extracting text and tables from English PDFs has become almost trivial thanks to modern AI. But the moment you feed an Arabic document into a state-of-the-art vision-language model, things tend to fall apart.

Arabic Optical Character Recognition (OCR) remains a notoriously difficult task. The language’s cursive script, complex ligatures, diverse fonts, right-to-left orientation, and critical use of diacritics make it a nightmare for standard models. While modern Multimodal Large Language Models (MLLMs) perform brilliantly on high-resource languages, their performance on Arabic documents is severely limited.

Enter Baseer (meaning “*one who sees clearly*” in Arabic) — a specialized vision-language model designed specifically to solve the Arabic document-to-markdown pipeline. Here is a look at how this new model is setting a new state-of-the-art, outperforming commercial giants like GPT-4 and Azure AI.

You can try Baseer for free on this **Link**

The Problem with “Generalist” AI

Recent advancements in AI have given us massive multimodal models capable of analyzing images and text simultaneously. However, these general-purpose giants are rarely optimized for the niche, precision-critical demands of Arabic OCR.

When developers use off-the-shelf models for Arabic documents, they often encounter frustrating artifacts: text randomly flipping from left-to-right, broken diacritics, and complete structural collapse when tables are involved. This leaves industries, academics, and developers without robust tools for digitizing the massive volume of real-world Arabic documents.

How Baseer Sees Clearly

To bridge this gap, researchers developed Baseer by fine-tuning an existing foundation model. Rather than training a model from scratch, we chose to build above strong baseline, as we don’t need to reinvent the wheel again. We fine-tuned the model with the following details.

  • Decoder-Only Fine-Tuning: The team froze the model’s “eyes” (the vision tower) and only updated its “brain” (the language decoder). This allowed Baseer to preserve its generalized visual capabilities while heavily adapting its language and reasoning skills to Arabic document structures. Tests proved this method significantly outperformed full-model training.
  • Built for Developers (Markdown & HTML): To make the output instantly usable, Baseer was trained to format standard text into clean Markdown. Because Markdown struggles with complex tabular data, Baseer is trained to output tables in HTML, preserving exact structural layouts.
  • A Massive, Tailored Dataset: The model was trained on a massive dataset of approximately 769,000 image-text pairs. This hybrid dataset combined synthetically generated documents with real-world books, magazines, and financial tables.
  • No Hallucinations Allowed: To prevent the AI from “inventing” text, the researchers deliberately included about 1,500 non-text images (like blank pages and natural scenes) in the training data, teaching the model to output nothing when there is no text to read.
  • Long Context for Dense Data: To ensure Baseer could read massive, data-dense tables without truncating the output, it was trained using a sequence length of 8192 tokens.

You Can’t Improve What You Can’t Measure: The Misraj-DocOCR Benchmark

During development, the team hit a roadblock: existing Arabic OCR benchmarks were deeply flawed. When analyzing the popular KITAB-bench dataset, researchers found severe ground-truth errors. The benchmark contained hallucinated text, missed page numbers, and frequently ignored small-font text at the bottom of pages.

To fix this, the team did two things:

  1. Corrected the Old: They painstakingly reviewed and corrected the *KITAB-bench* dataset, releasing a revised version for the community.
  2. Built the New: They introduced *Misraj-DocOCR*, an entirely new, open-source benchmark. It features 400 highly diverse, expert-verified document images designed to rigorously test Arabic OCR systems without the flawed annotations of the past.

The Results: Beating the Industry Heavyweights

So, how does Baseer stack up? In comprehensive evaluations across both text accuracy (Word Error Rate, Character Error Rate) and structural layout fidelity (TEDS, MARS), Baseer achieved state-of-the-art results.

In the *Misraj-DocOCR* benchmark, Baseer took the top spot, beating out major commercial systems. It outperformed Gemini-2.5-pro (which ranked second), and left larger models like GPT-4o-mini, Azure AI Document Intelligence, and various open-source models trailing behind.

Despite being a much smaller model than its competitors, Baseer’s domain-specific adaptation proved that tailored data and efficient training strategies are far more important than sheer parameter size when tackling morphologically rich languages. The following table shows the result of Baseer on different metrics.

For detailed technical information, you can read the paper

What This Means for You

For developers building document parsing pipelines, Baseer offers a powerful, specialized tool that outputs reliable Markdown and HTML out-of-the-box. For researchers, the Misraj-DocOCR benchmark provides a much-needed, reliable standard for evaluating future models.

Baseer isn’t just an academic win; it establishes a strong, practical baseline for digitizing Arabic cultural heritage, automating commercial data entry, and making Arabic texts accessible to end-users worldwide.

Reference

  1. *Baseer: A Vision-Language Model for Arabic Document-to-Markdown OCR* (https://arxiv.org/abs/2509.18174)
  1. *8 Top Open-Source OCR Models Compared: A Complete Guide* (https://modal.com/blog/8-top-open-source-ocr-models-compared)