numind/NuExtract3
Summary
NuExtract3 is a 4B vision-language reasoning model for document understanding, enabling structured extraction and image-to-Markdown conversion.
View Cached Full Text
Cached at: 05/22/26, 07:44 AM
numind/NuExtract3 · Hugging Face
Source: https://huggingface.co/numind/NuExtract3
🖥️API / Platform| 📑Blog| 🗣️Discord| 🛠️GitHub
NuExtract3is a unified4Bvision-language reasoning model for document understanding.
It combines strongstructured information extractionwith high-qualityimage-to-Markdownconversion, 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 inthe 🤗 space!
https://huggingface.co/numind/NuExtract3#overviewOverview
- Structured extraction: input (text/images) + JSON template + instructions --> JSON output
- Markdown conversion: input (text/images) --> Markdown
- Multimodal inputs: text, images, or text + images.
- Multilingualdocuments.
- Reasoningand non-reasoning inference modes.
- Template generationfor structured extraction from natural language or input document.
https://huggingface.co/numind/NuExtract3#benchmark-resultsBenchmark results
https://huggingface.co/numind/NuExtract3#structured-extractionStructured 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.
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.stringandverbatim\-stringleaves 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.
Model nameAverage scoreNum. failed⁽¹⁾Avg. num tokens thinkingAvg. num tokens answerNuExtract3.4_4B-RL0.651 ± 0.0192720361856gemma-4-E4B-it0.538 ± 0.0233130051287Qwen3.5-9B0.479 ± 0.030170224091257Qwen3.5-4B0.417 ± 0.031229271771201GLM-4.6V-Flash0.435 ± 0.02615329891357Nemotron-3-Nano-Omni0.387 ± 0.02820425827522Ministral-3-3B0.240 ± 0.02234427586362 (1) number of model outputs that were not JSON deserializable, either directly or by removing leading and trailing backticks. 95% confidence intervals computed using a nonparametric bootstrap over scores distributions.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.
https://huggingface.co/numind/NuExtract3#document-to-markdownDocument 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"/\>
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:
https://huggingface.co/numind/NuExtract3#using-markdown-to-structuredUsing “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.
https://huggingface.co/numind/NuExtract3#using-nuextractUsing NuExtract
https://huggingface.co/numind/NuExtract3#structured-extraction-1Structured extraction
Structured extraction takes as inputs:
- An input document, which can be text, image, or both;
- A JSON template describing the information to extract;
- (Optional) Instructions, allowing to specify expected output formats or values, to provide with the
instructionschat template kwarg; - (Optional) In-Context Learning (ICL) examples.
https://huggingface.co/numind/NuExtract3#input-json-templateInput JSON template
NuExtract uses a input JSON template whose structure is identical to the output JSON. Its leaf values are specify thetypesof the output JSON leaves. For examples:
{
"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"
}
]
}
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,emailand 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 returnsnullor\[\].
https://huggingface.co/numind/NuExtract3#converting-json-schema–pydantic-models-to-nuextract-templateConverting JSON schema / Pydantic models to NuExtract template
Our Python SDK (pip install numind) offers a method to convert JSON schemas to NuExtract templates:
from typing import Literal
from pydantic import Field, BaseModel
from numind.nuextract_utils import convert_json_schema_to_nuextract_template
class HotelBooking(BaseModel):
city: str
check_in_date: str = Field(description="date")
check_out_date: str = Field(description="date")
number_of_guests: int
room_type: Literal["single", "double", "suite"]
template, dropped_branches = convert_json_schema_to_nuextract_template(
HotelBooking.model_json_schema()
)
# {'check_in_date': 'date', 'check_out_date': 'date', 'city': 'string', 'number_of_guests': 'integer', 'room_type': ['single', 'double', 'suite']}
https://huggingface.co/numind/NuExtract3#document-to-markdown-1Document-to-Markdown
NuExtract can also convert document images into clean Markdown. Output will be markdown for text (headers etc), html for tables, latex for mat 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"/\>
Markdown example:
<figure data-type="image" data-id="img_1">
<img src="/numind/NuExtract3/resolve/main/img_1.png" alt="Logo of Mobilier 2000 with contact information: Tél.: (418) 275-4232, 1654, boul. Marcotte, Roberval (Qc) G8H 2P2"/>
</figure>
# COMMANDE
**NUMÉRO 72259**
1
**Vendu à**
TREMBLAY ERIC
ERIC TREMBLAY
348 BOUL. DE L'ANSE
ROBERVAL
G8H 1Y9
**Livré à**
TREMBLAY ERIC
ERIC TREMBLAY
348 BOUL. DE L'ANSE
ROBERVAL
G8H 1Y9
<table>
<thead>
<tr>
<th># CLIENT</th>
<th>EXPÉDITEUR</th>
<th>TERME DE CRÉDIT</th>
<th>DATE</th>
</tr>
</thead>
<tbody>
<tr>
<td>2753133</td>
<td>Notre camion</td>
<td>à la livraison</td>
<td>22/06/2023</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>NOM DU VENDEUR</th>
<th>VOTRE ÉCONOMIE !</th>
<th># COMMANDE</th>
</tr>
</thead>
<tbody>
<tr>
<td>Éric</td>
<td>0.00</td>
<td></td>
</tr>
</tbody>
</table>
https://huggingface.co/numind/NuExtract3#reasoning-and-non-reasoning-modesReasoning and non-reasoning modes
NuExtract supports both reasoning and non-reasoning inference.
https://huggingface.co/numind/NuExtract3#non-thinking-modeNon-thinking mode
Use this for fast and deterministic extraction or Markdown conversion.
enable_thinking = False
temperature = 0.2
https://huggingface.co/numind/NuExtract3#thinking-modeThinking mode
Use this for difficult documents, complex layouts, ambiguous fields, or cases where the document structure requires additional reasoning.
enable_thinking = True
temperature = 0.6
For production extraction workloads, we recommend starting withnon-reasoning modeand enabling reasoning only for difficult examples.
https://huggingface.co/numind/NuExtract3#vllm-deploymentvLLM deployment
NuExtract can be served with vLLM using an OpenAI-compatible API.
vllm serve numind/NuExtract3 \
--trust-remote-code \
--limit-mm-per-prompt '{"image": 99, "video": 0}' \
--chat-template-content-format openai \
--generation-config vllm \
--max-model-len 131072 \
--speculative-config '{"method": "qwen3_next_mtp", "num_speculative_tokens": 2}'
https://huggingface.co/numind/NuExtract3#multi-token-predictionMulti Token Prediction
The deployment commands above enable Multi Token Prediction (MTP) through vLLM speculative decoding:``` –speculative-config ‘{“method”: “qwen3_next_mtp”, “num_speculative_tokens”: 2}’
MTP can improve decoding throughput without changing the OpenAI\-compatible request payload\. You can tune`num\_speculative\_tokens`for your hardware and workload, or remove`\-\-speculative\-config`if your vLLM version or environment does not support this speculative decoding method\.
If you encounter memory issues, reduce the maximum model length and the maximum number of images:
vllm serve numind/NuExtract-3
–trust-remote-code
–limit-mm-per-prompt ‘{“image”: 6, “video”: 0}’
–chat-template-content-format openai
–generation-config vllm
–max-model-len 16384
–speculative-config ‘{“method”: “qwen3_next_mtp”, “num_speculative_tokens”: 2}’
## [https://huggingface.co/numind/NuExtract3#vllm-inference-structured-extraction-text](https://huggingface.co/numind/NuExtract3#vllm-inference-structured-extraction-text)vLLM inference: structured extraction: text
import json from openai import OpenAI
client = OpenAI( api_key=“EMPTY”, base_url=“http://localhost:8000/v1”, )
template = { “store”: “verbatim-string”, “date”: “date-time”, “total”: “number”, “currency”: [“USD”, “EUR”, “GBP”, “JPY”, “Other”], “items”: [ { “name”: “verbatim-string”, “price”: “number” } ] }
response = client.chat.completions.create(
model=“numind/NuExtract3”,
temperature=0.2,
messages=[
{
“role”: “user”,
“content”: [
{
“type”: “text”,
“text”: “Yesterday I bought apples and coffee at Trader Joe’s for a total of $12.40.”
}
],
}
],
extra_body={
“chat_template_kwargs”: {
“template”: json.dumps(template),
“instructions”: “Specify the time for the date entry only if it is present, otherwise only output the date component.”,
“enable_thinking”: False
}
}
)
print(response.choices[0].message.content)
Example output:
{ “store”: “Trader Joe’s”, “date”: null, “total”: 12.40, “currency”: “USD”, “items”: [ { “name”: “apples”, “price”: null }, { “name”: “coffee”, “price”: null } ] }
---
## [https://huggingface.co/numind/NuExtract3#vllm-inference-structured-extraction-image](https://huggingface.co/numind/NuExtract3#vllm-inference-structured-extraction-image)vLLM inference: structured extraction: image
import json import base64 from openai import OpenAI
client = OpenAI( api_key=“EMPTY”, base_url=“http://localhost:8000/v1”, )
def encode_image(image_path): with open(image_path, “rb”) as image_file: return base64.b64encode(image_file.read()).decode(“utf-8”)
image_base64 = encode_image(“receipt.png”) data_url = f“data:image/png;base64,{image_base64}“
template = { “store”: “verbatim-string”, “date”: “date-time”, “total”: “number”, “payment_method”: “verbatim-string” }
response = client.chat.completions.create( model=“numind/NuExtract3”, temperature=0.2, messages=[ { “role”: “user”, “content”: [ { “type”: “image_url”, “image_url”: {“url”: data_url} } ], } ], extra_body={ “chat_template_kwargs”: { “template”: json.dumps(template, indent=4), “enable_thinking”: False } } )
print(response.choices[0].message.content)
Example output:
{ “store”: “Trader Joe’s”, “date”: “2025-04-12”, “total”: 42.85, “payment_method”: “Visa” }
### [https://huggingface.co/numind/NuExtract3#multiple-page-pdf](https://huggingface.co/numind/NuExtract3#multiple-page-pdf)Multiple page PDF
You can render a PDF to one PNG image per page with PyMuPDF, then pass the images to vLLM in page order\.```
import base64
import json
import fitz # pip install pymupdf
from openai import OpenAI
client = OpenAI(
api_key="EMPTY",
base_url="http://localhost:8000/v1",
)
def pdf_to_png_data_urls(pdf_path, dpi=170):
data_urls = []
with fitz.open(pdf_path) as doc:
for page in doc:
pix = page.get_pixmap(dpi=dpi, alpha=False)
png_bytes = pix.tobytes("png")
png_base64 = base64.b64encode(png_bytes).decode("utf-8")
data_urls.append(f"data:image/png;base64,{png_base64}")
return data_urls
data_urls = pdf_to_png_data_urls("invoice.pdf", dpi=170)
template = {
"invoice_number": "verbatim-string",
"invoice_date": "date",
"total": "number",
"currency": "currency",
"line_items": [
{
"description": "verbatim-string",
"quantity": "number",
"unit_price": "number",
"total": "number"
}
]
}
response = client.chat.completions.create(
model="numind/NuExtract3",
temperature=0.2,
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {"url": data_url}
}
for data_url in data_urls
],
}
],
extra_body={
"chat_template_kwargs": {
"template": json.dumps(template, indent=4),
"enable_thinking": False
}
}
)
print(response.choices[0].message.content)
https://huggingface.co/numind/NuExtract3#vllm-inference-document-to-markdownvLLM inference: document-to-Markdown
For Markdown OCR, usemode="markdown"ormode="content"without a template.
import base64
from openai import OpenAI
client = OpenAI(
api_key="EMPTY",
base_url="http://localhost:8000/v1",
)
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode("utf-8")
image_base64 = encode_image("document.png")
data_url = f"data:image/png;base64,{image_base64}"
response = client.chat.completions.create(
model="numind/NuExtract3",
temperature=0,
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {"url": data_url}
}
],
}
],
extra_body={
"chat_template_kwargs": {
"mode": "markdown",
"enable_thinking": False
}
}
)
print(response.choices[0].message.content)
https://huggingface.co/numind/NuExtract3#vllm-inference-reasoning-modevLLM inference: reasoning mode
Reasoning can be enabled for harder structured extraction or Markdown tasks.``` response = client.chat.completions.create( model=“numind/NuExtract3”, temperature=0.7, messages=[ { “role”: “user”, “content”: [ { “type”: “image_url”, “image_url”: {“url”: data_url} } ], } ], extra_body={ “chat_template_kwargs”: { “mode”: “markdown”, “enable_thinking”: True } } )
result = response.choices[0].message.content
if “” in result:
reasoning = result.split(“
print(answer)
## [https://huggingface.co/numind/NuExtract3#in-context-examples-for-extraction](https://huggingface.co/numind/NuExtract3#in-context-examples-for-extraction)In\-context examples for extraction
NuExtract supports in\-context examples for structured extraction\.Examples are especially useful when the desired formatting is ambiguous or when the schema requires task\-specific conventions\. Examples can be provided by using`developer`messages, for which all items of the contents except the last one are the input, and the last one is the expected output\.
import json from openai import OpenAI
client = OpenAI( api_key=“EMPTY”, base_url=“http://localhost:8000/v1”, )
template = { “names”: [“string”] }
response = client.chat.completions.create( model=“numind/NuExtract3”, temperature=0, messages=[ { “role”: “developer”, “content”: [ { “type”: “text”, “text”: “Stephen is the manager at Susan’s store.”, }, { “type”: “text”, “text”: “{"names": ["-STEPHEN-", "-SUSAN-"]}”, } ], }, { “role”: “user”, “content”: [ { “type”: “text”, “text”: “John went to the restaurant with Mary. James went to the cinema.” } ], } ], extra_body={ “chat_template_kwargs”: { “template”: json.dumps(template, indent=4), “enable_thinking”: False } } )
print(response.choices[0].message.content)
Example output:
{ “names”: [“-JOHN-”, “-MARY-”, “-JAMES-”] }
## [https://huggingface.co/numind/NuExtract3#vllm-inference-template-generation](https://huggingface.co/numind/NuExtract3#vllm-inference-template-generation)vLLM inference: template generation
NuExtract can generate an extraction template from a natural language description\.
from openai import OpenAI
client = OpenAI( api_key=“EMPTY”, base_url=“http://localhost:8000/v1”, )
response = client.chat.completions.create( model=“numind/NuExtract3”, temperature=0, messages=[ { “role”: “user”, “content”: [ { “type”: “text”, “text”: “I want to extract the key details from a rental contract.” } ], } ], extra_body={ “chat_template_kwargs”: { “mode”: “template-generation” } } )
print(response.choices[0].message.content)
Example output:
{ “contract_title”: “verbatim-string”, “landlord”: “verbatim-string”, “tenant”: “verbatim-string”, “property_address”: “verbatim-string”, “start_date”: “date-time”, “end_date”: “date-time”, “monthly_rent”: “number”, “currency”: “verbatim-string”, “deposit”: “number”, “signatories”: [“verbatim-string”] }
## [https://huggingface.co/numind/NuExtract3#curl-examples](https://huggingface.co/numind/NuExtract3#curl-examples)Curl examples
The following examples assume that vLLM is running locally on port 8000\. They use`jq`to build valid JSON request bodies without manually escaping the image data or template string\.
### [https://huggingface.co/numind/NuExtract3#single-image-structured-extraction](https://huggingface.co/numind/NuExtract3#single-image-structured-extraction)Single image structured extraction
API_KEY=“EMPTY” IMAGE_BASE64_FILE=(mktemp) REQUEST_BODY_FILE=(mktemp)
base64 < receipt.png | tr -d ‘\n’ > “$IMAGE_BASE64_FILE”
TEMPLATE=$(cat <<‘JSON’ { “store”: “verbatim-string”, “date”: “date-time”, “total”: “number”, “payment_method”: “verbatim-string” } JSON )
jq -n
–rawfile image_base64 “IMAGE_BASE64_FILE" \
--arg template "TEMPLATE”
‘{
model: “numind/NuExtract3”,
temperature: 0,
messages: [
{
role: “user”,
content: [
{
type: “image_url”,
image_url: {url: (“data:image/png;base64,” + $image_base64)}
}
]
}
],
chat_template_kwargs: {
template: $template,
enable_thinking: false
}
}’ > “$REQUEST_BODY_FILE”
curl http://localhost:8000/v1/chat/completions
-H “Content-Type: application/json”
-H “Authorization: Bearer API_KEY" \
--data-binary "@REQUEST_BODY_FILE”
rm “IMAGE_BASE64_FILE" "REQUEST_BODY_FILE”
### [https://huggingface.co/numind/NuExtract3#single-image-content-extraction](https://huggingface.co/numind/NuExtract3#single-image-content-extraction)Single image content extraction
API_KEY=“EMPTY” IMAGE_BASE64_FILE=(mktemp) REQUEST_BODY_FILE=(mktemp)
base64 < document.png | tr -d ‘\n’ > “$IMAGE_BASE64_FILE”
jq -n
–rawfile image_base64 “IMAGE_BASE64_FILE" \
'{
model: "numind/NuExtract3",
temperature: 0,
messages: [
{
role: "user",
content: [
{
type: "image_url",
image_url: {url: ("data:image/png;base64," + $image_base64)}
}
]
}
],
chat_template_kwargs: {
mode: "content",
enable_thinking: false
}
}' > "REQUEST_BODY_FILE”
curl http://localhost:8000/v1/chat/completions
-H “Content-Type: application/json”
-H “Authorization: Bearer API_KEY" \
--data-binary "@REQUEST_BODY_FILE”
rm “IMAGE_BASE64_FILE" "REQUEST_BODY_FILE”
## [https://huggingface.co/numind/NuExtract3#transformers-example](https://huggingface.co/numind/NuExtract3#transformers-example)Transformers example
You can also run NuExtract directly with \`transformers\`\. The same \`template\`, \`mode\`, and \`enable\_thinking\` options are passed to \`processor\.apply\_chat\_template\`\.```
import json
import torch
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "numind/NuExtract3"
processor = AutoProcessor.from_pretrained(
model_id,
trust_remote_code=True,
)
model = AutoModelForImageTextToText.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
).eval()
def run_nuextract(messages, **chat_template_kwargs):
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
**chat_template_kwargs,
).to(model.device)
with torch.inference_mode():
generated_ids = model.generate(
**inputs,
max_new_tokens=4096,
do_sample=False,
)
generated_ids = generated_ids[:, inputs.input_ids.shape[1]:]
return processor.batch_decode(
generated_ids,
skip_special_tokens=True,
clean_up_tokenization_spaces=False,
)[0].strip()
# Single image structured extraction
receipt_image = Image.open("receipt.png").convert("RGB")
receipt_messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": receipt_image,
}
],
}
]
template = {
"store": "verbatim-string",
"date": "date-time",
"total": "number",
"payment_method": "verbatim-string"
}
structured_output = run_nuextract(
receipt_messages,
template=json.dumps(template, indent=4),
enable_thinking=False,
)
print(structured_output)
# Single image content extraction
document_image = Image.open("document.png").convert("RGB")
document_messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": document_image,
}
],
}
]
content_output = run_nuextract(
document_messages,
mode="content",
enable_thinking=False,
)
print(content_output)
Special thanks to the Lambda.ai team for the compute that made this project a success.
https://huggingface.co/numind/NuExtract3#citationCitation
If you use NuExtract, please cite NuMind and link to the model page.
@misc{nuextract3,
title = {NuExtract3},
author = {NuMind},
year = {2026},
url = {https://nuextract.ai/}
}
Similar Articles
hwatu: a verification browser for local coding agents. Headless WebKit, DOM eval, pixel-diff with real match %, no Chromium (MIT, Rust)
hwatu is a lightweight verification browser for local coding agents, featuring headless WebKit, pixel-diff scoring with real match percentage, and no Chromium dependency; it is MIT-licensed and written in Rust.
@lqiao: At Fireworks, we believe open models and ecosystem let intelligence compound where value is created - inside every comp…
A Fireworks AI representative signs an open letter supporting open weights, arguing that open models enable intelligence to compound within companies.
ARC-AGI Leaderboard
The ARC-AGI leaderboard shows model performance on three versions of the benchmark, measuring fluid intelligence and efficient adaptation, with trend lines for reasoning systems and raw LLMs.
Shoutout & update: Fixing agent retry loops in CrewAI using turn-scoped sliding window hashes
TokenShield, an open-source FastAPI gateway proxy, now uses per-turn sliding window hashes to prevent agent retry loops in CrewAI, reducing token waste and cost.
DKV: Open-source KV-cache compression framework for local LLM inference (CLI + technical report)
DKV is an open-source framework for compressing KV-cache during local LLM inference, providing a CLI and a technical report.