Tools

Dharma Field Extractor: A 2B-Parameter Model for High-Volume Document Parsing

Hugging Face releases a specialized 2-billion-parameter model that extracts structured JSON from any document type, outperforming frontier LLMs at lower cost.

Last verified:

The Problem: OCR Plus Manual Mapping

Document processing at scale creates a bottleneck: optical character recognition (OCR) recovers all text on a page faithfully, but downstream systems need structured data in specific fields. According to Hugging Face, extracting an invoice requires identifying which printed string is the supplier name, which is the due date, which line represents a single line item with quantity and unit price—work that traditionally requires custom code to map each value to the correct database column.

General-purpose large language models can perform this extraction through careful prompting, but at frontier API pricing and latencies, high-volume extraction tasks become expensive. A business processing thousands of invoices, medical requisitions, or employment contracts daily faces a trade-off: build custom extraction pipelines or accept the cost of repeated API calls to models like GPT-4 or Claude Opus.

Dharma Field Extractor: Specialized Extraction at Scale

Dharma AI, presented on the Hugging Face Blog, released the Field Extractor, a 2-billion-parameter model designed to convert document images into structured JSON without per-document-type training. The model operates in two modes:

Open mode infers all structured fields from a document’s layout and context—labels paired with values, tables with headers—and returns them as key-value pairs without a predefined schema.

Schema-directed mode accepts an explicit JSON schema from the user and fills in only the requested fields, ensuring the output matches the shape expected by downstream systems.

According to the announcement, the same checkpoint handles invoices (returning line items as ordered lists with quantity and value), medical requisitions (extracting patient name, exam type, and appointment date for scheduling), employment IDs (mapping fields to an employee database schema), and contracts (recovering parties, term length, and penalty amounts). No separate training is required for each document type.

Performance and Economics

The blog post reports that the Field Extractor outperforms “every frontier LLM we tested” on extraction tasks, though specific benchmarks and the identity of tested competitors are not disclosed in the published excerpt. Hugging Face emphasizes the cost advantage: operating the 2B-parameter model locally or via inference endpoints costs “a fraction” of frontier API pricing, a critical advantage for businesses running thousands of daily extractions.

The model builds on Dharma AI’s April 2026 release of DharmaOCR-LITE, a specialized OCR model that demonstrated the value of domain-focused architectures—smaller models trained narrowly outperforming general-purpose APIs on their specific task.

Why This Matters

This release highlights a widening pattern in the AI industry: frontier LLMs excel at open-ended reasoning, but specialized smaller models are capturing use cases where the problem is well-defined and high-volume. Document field extraction is a concrete business function—thousands of companies process invoices, medical forms, and contracts daily—and trading frontier-model API calls for a locally deployable 2B-parameter model compounds savings across millions of documents annually.

For procurement teams, healthcare schedulers, and compliance systems, the elimination of per-document-type fine-tuning means faster deployment and lower operational friction. The schema-directed mode is particularly significant: it transforms the model into a plug-in replacement for custom extraction code, with the extraction logic residing in the schema rather than in hand-written parsing rules. Teams evaluating document automation solutions will likely compare Field Extractor’s cost-per-extraction and latency against frontier LLM APIs, making this model a decision-changer for high-volume workflows.

Frequently Asked Questions

What is the difference between Dharma Field Extractor and OCR?

OCR returns all text from a page with formatting preserved; the Field Extractor returns only specified fields in structured JSON (e.g., invoice line items as a list with quantity and value). OCR requires downstream code to map text to fields; the Field Extractor handles that mapping automatically.

Does the model require fine-tuning for different document types?

No. According to Hugging Face, the same checkpoint handles invoices, medical forms, IDs, and other document types without per-type fine-tuning, using either open discovery of all fields or a user-provided schema.

How does cost compare to frontier LLM APIs?

The blog post states the Field Extractor operates 'at a fraction of the cost' of frontier APIs and is designed for high-volume document processing where API pricing becomes prohibitive. Specific pricing is not disclosed in the announcement.

#document-processing #structured-extraction #domain-specialization #ocr #json-output