NuExtract3

提供商numind
分类image-to-text
许可证apache-2.0
下载量14.5K
星标2

简介

NuExtract3 是一款由 numind 推出的专业信息提取模型,专注于将非结构化文本或图像内容精准转化为结构化数据。与通用大模型不同,它更像是一个高效的“数据清洗专家”,能够严格按照用户定义的 Schema 提取关键字段,极大地降低了由于模型“幻觉”导致的格式错误。对于需要处理大量票据、表单或文档数字化、且对输出格式要求严苛的开发者来说,它是构建自动化数据 pipeline 的理想选择,上手难度低,可直接替代复杂的正则匹配或昂贵的通用 API 提取流程。

核心亮点

  • 精准结构化提取,严格遵循用户定义的 Schema
  • 支持图文多模态输入,高效处理文档数字化
  • Apache-2.0 协议,企业级部署无压力
  • 低幻觉率,显著提升数据清洗的自动化程度

使用方法

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

model = AutoModel.from_pretrained("numind/NuExtract3")
tokenizer = AutoTokenizer.from_pretrained("numind/NuExtract3")

Hugging Face 下载

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

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

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download numind/NuExtract3

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

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

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

SDK 下载

SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('numind/NuExtract3')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://huggingface.co/numind/NuExtract3

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

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/numind/NuExtract3

模型文件托管在 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/NuExtract3')
tokenizer = AutoTokenizer.from_pretrained('numind/NuExtract3')

模型下载

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

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

操作指引
pip install modelscope

命令行下载

下载完整模型库

下载完整模型库
modelscope download --model numind/NuExtract3

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

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

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

SDK 下载

SDK 下载
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('numind/NuExtract3')

Git 下载

请确保 lfs 已经被正确安装

Git 下载
git lfs install
git clone https://www.modelscope.cn/numind/NuExtract3.git

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

跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/numind/NuExtract3.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/NuExtract3')

完整文档

来源: HuggingFace

---
license: apache-2.0
license_link: https://huggingface.co/numind/NuExtract3/blob/main/LICENSE
library_name: transformers
pipeline_tag: image-to-text
tags:

  • image-text-to-text

  • transformers

  • safetensors

  • qwen3_5

  • vision-language

  • vlm

  • document-understanding

  • structured-extraction

  • information-extraction

  • ocr

  • document-to-markdown

  • markdown

  • rag

  • reasoning

  • multilingual

  • conversational

base_model:
  • Qwen/Qwen3.5-4B

model_name: NuExtract3
---

<p align="center">
<a href="https://nuextract.ai/">
<img src="header.svg" width="900px"/>
</a>
</p>

<p align="center">
🖥️ <a href="https://nuextract.ai/">API / Platform</a>&nbsp;&nbsp; | &nbsp;&nbsp;
📑 <a href="https://numind.ai/blog">Blog</a>&nbsp;&nbsp; | &nbsp;&nbsp;
🗣️ <a href="https://discord.gg/3tsEtJNCDe">Discord</a>&nbsp;&nbsp; | &nbsp;&nbsp;
🛠️ <a href="https://github.com/numindai/nuextract">GitHub</a>
</p>

NuExtract3 is a unified 4B vision-language reasoning model for document understanding.

It combines strong structured information extraction with high-quality image-to-Markdown conversion, making it suitable for extraction pipelines, OCR, and RAG preprocessing for all types of documents such as scans, receipts, forms, invoices, contracts or tables.

Try it out in the 🤗 space!

Overview

  • Structured extraction: input (text/images) + JSON template + instructions --> JSON output
  • Markdown conversion: input (text/images) --> Markdown
  • Multimodal inputs: text, images, or text + images.
  • Multilingual documents.
  • Reasoning and non-reasoning inference modes.
  • Template generation for structured extraction from natural language or input document.

Benchmark results

Structured Extraction

We benchmarked NuExtract on NuMind's internal structured benchmark, measuring model's performances on ~600 documents of diverse types including invoices, movie posters or floor plans. These documents and their ground-truth cover diverse use-cases testing model visual understanding, OCR, reasoning and ability to handle long input and output contexts.
We plan to open-source this benchmark in the coming weeks, along with a extensive leaderboard including most popular open-weight and closed-sourced APIs and a Python library allowing to easily measure model performances on structured extraction.

<img src="st.svg" width="1000"/>

To measure a pair of predicted and ground-truth JSONs, we represent both as trees which we align based on node names, compute metric scores for aligned leaves and report the average of these scores. string and verbatim-string leaves are evaluated with indel distance (i.e. Levenshtein without replacement), while all others are evaluated with exact-match.
Models were evaluated using vllm, with a temperature of 0.25 and a maximum of 65000 output token (for both thinking and answer), which largely exceeds 22000 which is the number of tokens of the largest ground truth output.

<figure>

|Model name |Average score|Num. failed⁽¹⁾|Avg. num tokens thinking|Avg. num tokens answer|
|--------------------|-------------|-----------|------------------------|----------------------|
|NuExtract3.4_4B-RL |0.651 ± 0.019|27 |2036 |1856 |
|gemma-4-E4B-it |0.538 ± 0.023|31 |3005 |1287 |
|Qwen3.5-9B |0.479 ± 0.030|170 |22409 |1257 |
|Qwen3.5-4B |0.417 ± 0.031|229 |27177 |1201 |
|GLM-4.6V-Flash |0.435 ± 0.026|153 |2989 |1357 |
|Nemotron-3-Nano-Omni|0.387 ± 0.028|204 |25827 |522 |
|Ministral-3-3B |0.240 ± 0.022|344 |27586 |362 |

<figcaption>
<small>
(1) number of model outputs that were not JSON deserializable, either directly or by removing leading and trailing backticks.<br>
95% confidence intervals computed using a nonparametric bootstrap over scores distributions.
</small>
</figcaption>
</figure>

The benchmark include samples containing multiple images resulting in large input context, and some with ground-truth containing large numbers of items to extract resulting in large outputs. We found that the reasoning of small models significantly negatively impact their performances. The reason is that many models ended up falling in repetition loops, hitting the output tokens limit and resulting in failed requests.

Document to Markdown

NuExtract can also convert document images into clean Markdown. Output will be Markdown for text (headers etc), HTML for tables, LaTeX for math and ``<figure data-type="image" data-id="img_n"><img src="/NM-dev/model_card-A/resolve/main/img_n.png" alt="Detail description of the images"/>

code
Modern, format-agnostic benchmarks for complex document understanding are limited, so we explored a new evaluation approach.
We selected 100 documents with challenging layouts and tables, asked each model to convert them into a structured representation, then used Gemini 3 Flash to compare model outputs against the source document and choose the most accurate result.
The rankings aligned with human votes, suggesting this is a promising method for evaluating document-to-Markdown capabilities. More details will be shared in an upcoming technical report.
Here are some results:

<img src="ocr_preferences.svg" width="1000"/>

Using "Markdown-to-structured"

To add other evaluate references, we used our structured extraction benchmark to evaluate models in a two-step fashion: convert the benchmark inputs to Markdown, then use Qwen3.6 27B to perform the structured extraction task on them. Intuitively, it allows to evaluate how models achieve to keep the input document content and layout: good models will allow the "structured extractor" model to perform better scores.

<img src="md2st.svg" width="1000"/>

Using NuExtract

Structured extraction

Structured extraction takes as inputs:

1. An input document, which can be text, image, or both;
2. A JSON template describing the information to extract;
3. (Optional) Instructions, allowing to specify expected output formats or values, to provide with the
instructions chat template kwarg;
4. (Optional) In-Context Learning (ICL) examples.

Input JSON template

NuExtract uses a input JSON template whose structure is identical to the output JSON. Its leaf values are specify the types of the output JSON leaves. For examples:

json
{
"invoice_number": "verbatim-string",
"invoice_date": "date",
"total_amount": "number",
"currency": "currency",
"line_items": [
{
"description": "verbatim-string",
"item_type": ["electronics", "clothing", "vehicle", "furniture", "other"],
"quantity": "integer",
"unit_price": "number",
"total": "number"
}
]
}
code
Supported template types include:

  • verbatim-string: extract text exactly as it appears in the document;
  • string: generic string field, allowing abstraction or light paraphrasing;
  • integer: whole number;
  • number: integer or decimal number;
  • date-time: ISO-8601 date, time or date-time;
  • Other specific types such as data, time, country, currency, email and so on.
For more details, read the complete types specifications and examples

Template constructors:

  • Arrays, for example ["string"];
  • Enums, for example ["yes", "no", "maybe"];
  • Multi-enums (multiple possible values), for example [["A", "B", "C"]].

If the model does not find relevant information for a field, it returns null or [].

Converting JSON schema / Pydantic models to NuExtract template

Our Python SDK (pip install numind`) offers a method to convert JSON schemas to NuExtract templates:

Python
from typing import Literal