Oleksandr Kuzmenko, EditorPublished 7 min readAI-assisted · editor-reviewed
TL;DR
- A 2B specialized model beats Claude Opus 5 on document field extraction benchmarks (0.834 vs 0.816).
- Schema-directed mode outputs strictly typed JSON and emits null for absent fields without hallucinating.
- Self-hosting on a single NVIDIA L40S ($2.24/hr) cuts processing costs by up to 147x compared to frontier APIs.
Key facts
- Model Size
- 2 billion parameters
- Training Dataset
- 43,384 annotated examples (LoRA)
- Evaluation Score
- 0.834 (vs 0.816 Claude Opus 5, self-reported)
- Cost Difference
- 6x to 147x cheaper than frontier APIs on L40S ($2.24/hr)
Architectural Design and Dual Modes
Built on top of DharmaOCR-LITE v1.1 (a 2B checkpoint refined through supervised fine-tuning and Direct Preference Optimization), Field Extractor uses a LoRA adapter trained on 43,384 diverse examples. It offers two distinct operational modes:
1. Open Extraction: Requires no schema. The model infers structured layout, tables, and labeled key-value pairs directly from document context. 2. Schema-Directed: Accepts an exact target schema with declared data types (string, number, boolean). Missing fields return strict null values instead of hallucinated text, and outputs strictly follow requested keys.
Benchmark Performance vs Frontier Models
The evaluation spanned 546 documents across 1,638 scenarios, testing open extraction, partial schema matching, and schemas with intentionally nonexistent fields. The benchmark scored field-level F1 multiplied by Levenshtein similarity and valid JSON conformance:
- Dharma Field Extractor (2B): 0.834 composite score
- Claude Opus 5: 0.816 (closest frontier competitor)
- GPT-5.6 Luna: 0.741 (9.3 points lower)
Public datasets SROIE (receipts) and FUNSD (variance forms) confirmed zero-hallucination compliance, with checkbox booleans and multi-line addresses accurately parsed.
Self-Hosted Economics on L40S
Frontier API costs were calculated using published token pricing against measured input/output/reasoning tokens per page. In contrast, Dharma Field Extractor runs self-hosted on a single NVIDIA L40S GPU ($2.24 per hour). When handling high document volumes, local inference costs are approximately 6x lower than GPT-5.6 Luna and roughly 147x lower than GPT-5.6 Sol API calls.
Try it in 2 minutes
{
"schema": {
"supplier": "string",
"invoice_number": "string",
"due_date": "string",
"total": "number"
}
}When to use
- High-throughput document ingestion pipelines for receipts, invoices, medical forms, and contracts.
- Strict JSON schema enforcement requiring zero hallucinations and fast local batch execution.
When NOT to use
- Long-form document summarization or qualitative textual reasoning where full-page synthesis is required.
- Projects with extremely low document volumes where maintaining a dedicated GPU instance is cost-ineffective.
What to do today
- Evaluate document parsing workloads to identify high-volume pipelines spending thousands on API tokens.
- Test schema-directed JSON extraction on challenging scanned PDFs using the DharmaOCR-LITE base checkpoint.
Step names are taken from What to do today.
Step names are taken from What to do today. Evaluate document parsing workloads to identify high-volume pipelines spending thousands on API tokens.. Test schema-directed JSON extraction on challenging scanned PDFs using the DharmaOCR-LITE base checkpoint.
- Evaluate document parsing workloads to identify high-volume pipelines spending thousands on API tokens.
- Test schema-directed JSON extraction on challenging scanned PDFs using the DharmaOCR-LITE base checkpoint.
