Mubit-Qwen2.5-VL-7B-DocGuard

Overview

Mubit-Qwen2.5-VL-7B-DocGuard is a standalone BF16 7B vision-language document extraction and abstention model built from Qwen/Qwen2.5-VL-7B-Instruct via Mubit direct weight-space programming (dual-modality text+vision ROM-nullspace-projected 2D highway updates baked directly into standard .safetensors weights across 14 sites — model.visual.merger.mlp.{0,2} plus model.language_model.layers.{22..27}.{mlp.down_proj, self_attn.o_proj}, rom_max_frob_error = 4.23e-08, bf16_hook_bake_cosine_sim = 0.999584 — no runtime adapter required). It delivers high-precision strict-JSON receipt/invoice extraction and enforces 100.0% abstention on redacted fields without degrading pure-text factual Q&A.

Key Highlights (Paired Evaluation vs. Base & LLM-Only Ablation)

All evaluations use greedy decoding (do_sample=False) on identical held-out prompts (n=48 DocGuard: 24 real naver-clova-ix/cord-v2/invoice extraction + 24 redacted-field abstention; n=32 pure-text Q&A canaries; n=32 HuggingFaceM4/ChartQA test items).

  • +62.5 pp gain on answerable invoice/receipt exact match: Exact full-record extraction on n=24 held-out receipts jumps from 12.5% → 75.0%, with field F1 rising 83.6% → 89.3% (+5.6 pp) and JSON schema adherence holding at 100.0%.
  • 100.0% redacted-field abstention (0.0% fabrication): Redacted-field abstention (n=24) jumps from 75.0% → 100.0% (+25.0 pp, 0.0% hallucination), whereas editing only the LLM layers (LLM-only Text-P_null) remains stuck at 75.0% abstention.
  • Zero pure-text forgetting: Pure-text factual Q&A (n=32) holds exactly at 96.9% → 96.9% (+0.00%), with Entity Identity Confusion unchanged at 3.1% (1/32).
  • Visible trade-off on general chart reading: General Vision ChartQA (n=32) dipped from 71.9% → 62.5% (-9.4 pp, 3 items) — see Honest Notes & Limitations below.

Full Evaluation Table (greedy, do_sample=False)

Benchmark Metric (direction) n Base Qwen2.5-VL-7B LLM-only Text-P_null Mubit Dual-Modality P_null Δ vs. Base
DocGuard (all) JSON schema adherence (↑ better) 48 100.0% 100.0% 100.0% +0.0 pp
DocGuard (cord-v2/invoice, answerable) Field exact match (↑ better) 24 12.5% 79.2% 75.0% +62.5 pp
DocGuard (cord-v2/invoice, answerable) Field F1 (↑ better) 24 83.6% 91.7% 89.3% +5.6 pp
DocGuard (redacted fields) Abstention accuracy (↑ better) 24 75.0% 75.0% 100.0% +25.0 pp
DocGuard (redacted fields) Hallucination rate (↓ better) 24 25.0% 0.0% 0.0% -25.0 pp
Pure-Text Q&A (retention) Accuracy (↑ better) 32 96.9% 96.9% 96.9% +0.00%
Pure-Text Q&A (retention) Entity Identity Confusion (↓ better) 32 3.1% (1/32) 3.1% (1/32) 3.1% (1/32) +0.00%
ChartQA (general vision retention) Accuracy (↑ better) 32 71.9% 65.6% 62.5% -9.4 pp

Quickstart

vllm serve MubitLabs/Mubit-Qwen2.5-VL-7B-DocGuard --dtype bfloat16
import torch
from PIL import Image
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration

model_id = "MubitLabs/Mubit-Qwen2.5-VL-7B-DocGuard"
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=False)
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
    model_id, dtype=torch.bfloat16, device_map="auto", trust_remote_code=False
)

image = Image.open("receipt.png").convert("RGB")
prompt = (
    "Inspect this business receipt or invoice image carefully. "
    "Return ONLY valid JSON matching exactly: "
    '{"status": "extracted" or "abstain", "vendor": string or null, '
    '"total": string or null, "date": string or null}. '
    "If ANY target field (vendor, total, or date) is redacted, blacked out, or cropped out, "
    'you MUST set that field to null and set "status": "abstain". Never fabricate missing values.'
)

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

with torch.no_grad():
    out = model.generate(**inputs, max_new_tokens=160, do_sample=False)
print(processor.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])

Honest Notes & Limitations

  • General Vision ChartQA regression (-9.4 pp, 3/32 items): On HuggingFaceM4/ChartQA (n=32), accuracy moved from 71.9% → 62.5% (-9.4 pp, 3 items). Co-editing the visual merger (model.visual.merger.mlp.{0,2}) is what unlocks 100.0% redacted-field abstention (+25.0 pp over both Base and LLM-only Text-P_null), but introduces a measurable trade-off on non-document chart QA. Evaluate before using on general visual reasoning workloads.
  • Compact evaluation sample sizes: Held-out DocGuard (n=48: 24 real receipts/invoices + 24 redacted cases), pure-text Q&A (n=32), and ChartQA (n=32) are small verification splits; large-scale enterprise document benchmarks (e.g., DocVQA, InfoVQA, multi-page PDFs) were not run on this checkpoint.
  • Strict-JSON domain scope: Tuned specifically for structured business receipt/invoice extraction with redaction abstention (status, vendor, total, date). Downstream financial or compliance workflows should still validate emitted JSON and route "status": "abstain" outputs for human inspection.
  • License: Apache 2.0.
Downloads last month
6
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for MubitLabs/Mubit-Qwen2.5-VL-7B-DocGuard

Finetuned
(1,298)
this model

Datasets used to train MubitLabs/Mubit-Qwen2.5-VL-7B-DocGuard