Flintglass PrismParse-4B

Flintglass PrismParse-4B is a compact, Apache-2.0 4B Vision-Language Document Parsing & OCR specialist built on Qwen/Qwen3.5-4B. Trained end-to-end on 40,044 zero-leakage, strictly permissively licensed document images across five core production ingestion tasks, PrismParse-4B outperforms the 2Γ— larger Qwen/Qwen3.5-9B on scientific PDF table extraction (+7.14 pts Cell F1, +22.08 pts HTML structure), printed & handwritten math LaTeX OCR (+12.68 pts Exact Match), and achieves 100% valid JSON on receipt and invoice extraction.


Zero-Leakage 5-Benchmark Evaluation (2,244 Held-Out Document Images)

All models below were evaluated identically with deterministic greedy decoding (temperature=0, enable_thinking=False) across 2,244 strictly held-out document images with zero page or expression overlap (482 LaTeX eval leaks caught and removed from training splits):

Model (All Apache 2.0) Avg 5-Bench CORD-v2 Receipts (Field F1 / Valid JSON) Invoices (Field F1 / Valid JSON) PubTabNet Tables (Cell F1 / HTML 1-NED) LaTeX-OCR Math (1-NED / Exact) DocVQA (ANLS)
Qwen/Qwen3.5-2B (Base) 49.65% 2.87% / 99.0% 3.08% / 100% 61.99% / 64.50% 90.71% / 37.68% 89.62%
Qwen/Qwen3.5-4B (Base) 53.83% 7.75% / 100% 3.60% / 78.9% 72.84% / 67.84% 91.59% / 40.67% 93.36%
Qwen/Qwen3.5-9B (Base, 2Γ— larger) 54.06% 4.64% / 100% 2.35% / 76.3% 76.81% / 70.92% 92.52% / 46.65% 94.00%
flintglass/PrismParse-2B (2.2B) 88.44% 87.27% / 100% 91.45% / 100% 79.58% / 90.98% 95.07% / 57.04% 88.82%
flintglass/PrismParse-4B (4.5B) 90.05% 87.61% / 100% 91.18% / 100% 83.95% / 93.00% 95.80% / 59.33% 91.69%

LaTeX-OCR Breakdown (Printed vs. Handwritten Math)

Model Printed Math (n=500, 1-NED / Exact) Handwritten Math (n=68, 1-NED / Exact)
Qwen/Qwen3.5-4B (Base) 91.28% / 35.80% 93.84% / 76.47%
Qwen/Qwen3.5-9B (Base) 92.23% / 42.60% 94.64% / 76.47%
flintglass/PrismParse-2B 95.26% / 54.40% 93.63% / 76.47%
flintglass/PrismParse-4B 95.79% / 56.80% 95.89% / 77.94%

Transparency Note on CORD-v2 & Invoices: Base Qwen3.5 models produce valid JSON on most receipts but invent arbitrary field names rather than the exact CORD/Donut schema keys (nm, cnt, price, header, items, summary), which accounts for their low exact-key Field F1. On schema-free tasks (PubTabNet tables and LaTeX-OCR printed/handwritten math), PrismParse-4B still outperforms both Qwen3.5-4B and the 2Γ— larger Qwen3.5-9B substantially while generating 18% fewer tokens (711.9 vs 865.9 on PubTabNet).


Supported Parsing Prompts & Quickstart

import torch
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor

model_id = "flintglass/PrismParse-4B"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(
    model_id, torch_dtype=torch.bfloat16, device_map="auto"
)

image = Image.open("table_or_receipt.png").convert("RGB")
prompt = (
    "Convert this table image into clean, accurate HTML table markup "
    "(<table><thead>...</thead><tbody>...</tbody></table>). Output ONLY the HTML table."
)

messages = [{"role": "user", "content": [{"type": "image", "image": image}, {"type": "text", "text": prompt}]}]
inputs = processor.apply_chat_template(
    messages, tokenize=True, add_generation_prompt=True,
    return_dict=True, return_tensors="pt", enable_thinking=False
).to(model.device)

out = model.generate(**inputs, max_new_tokens=1536, do_sample=False)
print(processor.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Recommended Task Prompts

Mode Prompt
PDF / Scientific Table -> HTML Convert this table image into clean, accurate HTML table markup (<table><thead>...</thead><tbody>...</tbody></table>). Output ONLY the HTML table.
Receipt -> Structured JSON Extract all structured fields from this receipt image as a single valid JSON object (with keys such as menu, sub_total, total). Output ONLY valid JSON with no markdown or extra text.
Invoice -> Structured JSON Extract all structured fields from this invoice image as a single valid JSON object (with keys: header, items, summary). Output ONLY valid JSON with no markdown or extra text.
Math Formula -> LaTeX Transcribe this mathematical expression into exact LaTeX. Output ONLY the raw LaTeX expression.
Full-Page Reading-Order OCR Transcribe all readable text in this document image in natural top-to-bottom reading order. Output ONLY the extracted text.
Document QA Answer the question concisely using ONLY the text visible in this document image. Output ONLY the exact answer.\nQuestion: <your question>

Permissive Training Data Provenance

Trained with full-parameter BF16 SFT exclusively on explicitly permissively licensed upstream datasets (zero proprietary distillation, zero NC/GPL/SA training data):

  • naver-clova-ix/cord-v2 (CC-BY-4.0, train+val only)
  • katanaml-org/invoices-donut-data-v1 (MIT, train only)
  • apoidea/pubtabnet-html (CDLA-Permissive-1.0, train only)
  • linxy/LaTeX_OCR (Apache-2.0, train only, deduplicated against test)
  • pixparse/docvqa-single-page-questions (MIT, train only β€” QA + reading-order full-page OCR)

The Flintglass Prism Open-Source Agent & RAG Stack

License

Apache 2.0. Built by Flintglass Labs.

Downloads last month
33
Safetensors
Model size
5B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for flintglass/PrismParse-4B

Finetuned
Qwen/Qwen3.5-4B
Finetuned
(1,761)
this model
Quantizations
1 model

Collection including flintglass/PrismParse-4B