NuMarkdown 8B Thinking

提供商numind
分类image-to-text
许可证mit
下载量287
星标0

简介

NuMarkdown 8B Thinking 是一款专注于将图像高效转化为 Markdown 格式的轻量化视觉模型。它在 OCR 识别的基础上引入了“思考”机制,能更精准地解析复杂的文档布局、表格和数学公式,避免了传统 OCR 常见的乱码或格式错位问题。对于开发者而言,它非常适合用于构建自动化文档数字化管线,或作为 RAG 系统的预处理组件,将扫描件、截图快速转换为可编辑、可检索的结构化文本。由于参数量适中,其部署成本低且响应迅速,是替代昂贵闭源视觉模型的高性价比方案。

核心亮点

  • 支持复杂文档布局的高精度 Markdown 还原
  • 内置思考链提升表格与公式的识别准确率
  • 轻量化 8B 参数,兼顾推理速度与部署成本
  • 理想的 RAG 知识库文档数字化预处理工具

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("numind/NuMarkdown-8B-Thinking")
tokenizer = AutoTokenizer.from_pretrained("numind/NuMarkdown-8B-Thinking")

Hugging Face 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download numind/NuMarkdown-8B-Thinking

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download numind/NuMarkdown-8B-Thinking config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('numind/NuMarkdown-8B-Thinking')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/numind/NuMarkdown-8B-Thinking

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/numind/NuMarkdown-8B-Thinking

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('numind/NuMarkdown-8B-Thinking')
tokenizer = AutoTokenizer.from_pretrained('numind/NuMarkdown-8B-Thinking')

模型下载

我们推荐使用命令行或者 ModelScope SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 ModelScope:

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model numind/NuMarkdown-8B-Thinking

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)

下载单个文件到指定本地文件夹(以下载 README.md 到当前路径下 dir 目录为例)
modelscope download --model numind/NuMarkdown-8B-Thinking README.md --local_dir ./dir

更多更丰富的命令行下载选项,可参见具体文档

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('numind/NuMarkdown-8B-Thinking')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/numind/NuMarkdown-8B-Thinking.git

如果您希望跳过 lfs 大文件下载,可以使用如下命令

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/numind/NuMarkdown-8B-Thinking.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook 快速开发

下载并安装 ModelScope library

下载并安装 ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

模型加载和推理

模型加载和推理
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'numind/NuMarkdown-8B-Thinking')

完整文档

来源: HuggingFace

---
license: mit
base_model: Qwen/Qwen2.5-VL-7B-Instruct
new_version: numind/NuExtract3
tags:

  • OCR

  • vision-language

  • VLM

  • Reasoning

  • document-to-markdown

  • qwen2.5

  • markdown

  • extraction

  • RAG

model_name: NuMarkdown-8B-Thinking
library_name: transformers
pipeline_tag: image-to-text
---

<p align="center">
<a href="https://nuextract.ai/">
<img src="numind.svg" width="400" height="400"/>
</a>
</p>
<p align="center">
🖥️ <a href="https://nuextract.ai/">API / Platform</a>&nbsp&nbsp | &nbsp&nbsp🗣️ <a href="https://discord.gg/3tsEtJNCDe">Discord</a>&nbsp&nbsp | &nbsp&nbsp🔗 <a href="https://github.com/numindai/NuMarkdown">GitHub</a>&nbsp&nbsp | &nbsp&nbsp🤗 <a href="https://huggingface.co/spaces/numind/NuMarkdown-8b-Thinking">Demo</a>
</p>

---

Reasoning comes to OCR 🧠✨📄🤘

NuMarkdown-8B-Thinking is the first reasoning OCR VLM. It is specifically trained to convert documents into clean Markdown files, well suited for RAG applications. It generates thinking tokens to figure out the layout of the document before generating the Markdown file.
It is particularly good at understanding documents with weird layouts and complex tables. The number of thinking tokens can vary from 20% to 500% of the final answer, depending on the task difficulty.

NuMarkdown-8B-Thinking is a fine-tune of Qwen 2.5-VL-7B on synthetic Doc &rarr; Reasoning &rarr; Markdown examples, followed by an RL phase (GRPO) with a layout-centric reward.

Try it out in the 🤗 space!

Results

NuMarkdown-8B-Thinking is outperforming generic non-reasoning models like GPT-4o and specialized OCR models like OCRFlux.
It is competitive against large reasoning closed-source models like Gemini 2.5.

Arena ranking against popular alternatives (using trueskill-2 ranking system, with around 500 model-anonymized votes):

<p align="center"> | Rank | Model | μ | σ | μ − 3σ | | ---- | --------------------------------------- | ----- | ---- | ------ | | 🥇 1 | gemini-flash-reasoning | 26.75 | 0.80 | 24.35 | | 🥈 2 | NuMarkdown-reasoning | 26.10 | 0.79 | 23.72 | | 🥉 3 | NuMarkdown-reasoning-w/o\_grpo | 25.32 | 0.80 | 22.93 | | 4 | OCRFlux-3B | 24.63 | 0.80 | 22.22 | | 5 | gpt-4o | 24.48 | 0.80 | 22.08 | | 6 | gemini-flash-w/o\_reasoning | 24.11 | 0.79 | 21.74 | | 7 | RolmoOCR | 23.53 | 0.82 | 21.07 |

</p>

*We plan to realease a markdown arena, similar to llmArena, for complex document-to-markdown tasks to provide a tool to evaluate different solutions.*

Win/Draw/Lose-rate against others models (image-only):

<p align="center"> <img src="bar plot.png" width="700"/> </p>

Training

1. SFT: Single epoch supervised fine-tuning on synthetic reasoning traces generated from public PDFs.
2. RL (GRPO): RL phase using a layout-centric reward with difficult image examples.

Example:

<p align="center">
<img src="ex1.png" width="500"/>
</p>

``
<think>
1. Analyze the overall structure: The document consists of two main sections, each containing a header, a set of bullet points, a title, a table, and a footer. The layout is consistent within each section but different between the two.

2. Handle the first section header and bullet points:
- The top left corner has "Generalitat de Catalunya Departament d'Educació Institut Gal·lecs". This is a consistent header and should be transcribed as a level 3 heading.
- The top right corner has "Curs 2021-22". This is a distinct header and should be transcribed as a level 3 heading.
- Below the header, there are four bullet points. These are standard list items. I will use Markdown's unordered list syntax (
- `).

3. Process the first section's main content - Table 1:
- Identify table structure: This is a complex table with a clear header row: "MATERIAL", "TÍTOL", "AUTOR", "EDITORIAL", "ISBN".
- Determine columns: There are 5 columns.
- Handle merged cells:
- "Llengua Catalana" spans two rows.
- "Llengua Castellana" spans three rows.
- "Anglès" spans two rows.
- Populate table data: Transcribe all text, including multi-line content within cells (e.g., "Babulinka Books\nEditorialCol·lecció: Pettes\nJoies per a Grans Lectors.\n2013").
- Markdown table creation: Use standard Markdown table syntax, ensuring correct alignment and handling of multi-line content within cells.

4. Handle the first section's footer:
- The footer contains "Codí: 04mp02", "Responsable: Coordinador Qualitat", "Versió: 5", "Full d'Informació a l'alumnat i famílies", "Aquest document pot quedar obsolet una vegada imprès", and "Pàgina 1 de 2". This is a simple text block at the bottom. I will transcribe it as a separate paragraph or list, maintaining the original layout if possible, but a simple paragraph is sufficient for a footer.

5. Handle the second section header and bullet points:
- The top left corner has "Generalitat de Catalunya Departament d'Educació Institut Gal·lecs". This is a consistent header and should be transcribed as a level 3 heading.
- The top right corner has "Curs 2021-22". This is a distinct header and should be transcribed as a level 3 heading.
- Below the header, there are no bullet points, but there is a table.

6. Process the second section's main content - Table 2:
- Identify table structure: This is a simpler table with a clear header row: "MATERIAL", "TÍTOL", "AUTOR", "EDITORIAL", "ISBN".
- Determine columns: There are 5 columns.
- Populate table data: Transcribe all text, including multi-line content within cells (e.g., "Projecte MOTIMATS-ONMAT (llicència digital) Tekman Books\nES GESTIONA A TRAVÉS DE L'AMPA AL SETEMBRE").
- Markdown table creation: Use standard Markdown table syntax.

7. Handle the second section's footer:
- The footer contains "Codí: 04mp02", "Responsable: Coordinador Qualitat", "Versió: 5", "Full d'Informació a l'alumnat i famílies", "Aquest document pot quedar obsolet una vegada imprès", and "Pàgina 2 de 2". This is a simple text block at the bottom. I will transcribe it as a separate paragraph or list, maintaining the original layout if possible, but a simple paragraph is sufficient for a footer.

8. Final review: Check for any missed text, incorrect formatting, or issues with table alignment. Ensure all original content is present and accurately represented in GitHub-Flavored Markdown. The image placeholders are not needed as there are no images in the document.
</think>
<answer>

Generalitat de Catalunya


Departament d'Educació


Institut Gal·lecs

Curs 2021-22

  • Els llibres de color blau indiquen que es manté respecte al curs anterior.
  • Els llibres de color groc indiquen que es tracta d'un canvi per a aquest curs.
  • Els llibres de color vermell indiquen que no s'han de comprar perquè van a càrrec del centre.
  • Matèries sense llibre: Dossiers, llicències i el Kit de tecnologia s'hauran de pagar i de recollir a través de l'AMPA a partir de setembre.

1 ESO

| MATERIAL | TÍTOL | AUTOR | EDITORIAL | ISBN |
|---|---|---|---|---|
| Llengua Catalana | Punt Volat | | Castellnou (Didacta +) | 9788417803124 |
| | Duna, Diari d'un estiu. | Muriel Villanueva | Babulinka Books<br>EditorialCol·lecció: Pettes<br>Joies per a Grans Lectors.<br>2013 | 9788494159077 |
| | El nen que xatejava amb Jack Sparrow. | Francesc Puigpelat | Bromera<br>Col·lecció: L'Elefant. 2015 | 9788490264072 |
| Llengua Castellana | Proyecto Asterisco | | Castellnou (Didacta +) | 9788417803186 |
| | Manzanas rojas | Luis Matilla | Ed. Anaya | 978846673989 |
| | Fàbulas de Esopo | Jerry Pinkney | Vicens Vives | 978843671648 |
| Anglès | Think Ahead ESO 1. Student's book.<br>Think Ahead ESO 1. Workbook (cat).