Instructions to use flintglass/PrismParse-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flintglass/PrismParse-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="flintglass/PrismParse-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("flintglass/PrismParse-4B") model = AutoModelForMultimodalLM.from_pretrained("flintglass/PrismParse-4B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use flintglass/PrismParse-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "flintglass/PrismParse-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flintglass/PrismParse-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/flintglass/PrismParse-4B
- SGLang
How to use flintglass/PrismParse-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "flintglass/PrismParse-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flintglass/PrismParse-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "flintglass/PrismParse-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flintglass/PrismParse-4B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use flintglass/PrismParse-4B with Docker Model Runner:
docker model run hf.co/flintglass/PrismParse-4B
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.
- Compact sibling (2.2B, 4.2 GB BF16):
flintglass/PrismParse-2B - GGUF +
mmprojquantizations (llama.cpp / Ollama / LM Studio):flintglass/PrismParse-4B-GGUFΒ·flintglass/PrismParse-2B-GGUF
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.5models 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 (PubTabNettables andLaTeX-OCRprinted/handwritten math),PrismParse-4Bstill outperforms bothQwen3.5-4Band the 2Γ largerQwen3.5-9Bsubstantially while generating 18% fewer tokens (711.9vs865.9on 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
- Document Ingestion (VLM OCR):
PrismParse-4BΒ·PrismParse-2B - 8K Prompt-Injection Firewall:
PrismGuard-MultilingualΒ·PrismGuard-LargeΒ·PrismGuard-SmallΒ· Live Demo - Local Agent Execution (8B + GGUF):
PrismAgent-8BΒ·PrismAgent-8B-GGUFΒ·PrismAgent-RLVR-Dataset - 8K RAG Hallucination Verification:
PrismVerify-4BΒ·PrismVerify-4B-GGUFΒ·PrismVerify-LargeΒ·PrismVerify-MultilingualΒ·PrismVerify-Small
License
Apache 2.0. Built by Flintglass Labs.
- Downloads last month
- 33