Document AI & OCR

Specialized AI model extracts document fields cheaper than frontier APIs

Hugging Face released Dharma Field Extractor, a 2-billion-parameter model that outputs structured JSON from documents. It outperforms general LLMs in benchmarks while reducing inference costs signific

Server rack processing documents into structured data blocks
Illustration created for this article

Hugging Face has released the Dharma Field Extractor, a specialized artificial intelligence model designed to pull specific data points from documents and output them as structured JSON. Announced on November 4, 2026, this 2-billion-parameter tool aims to replace expensive general-purpose large language models for high-volume document processing tasks. The release highlights a shift toward smaller, task-specific models that offer better accuracy and lower operational costs for enterprise workflows.

What happened

The new model addresses a common bottleneck in document automation: converting unstructured scans into usable database records. While optical character recognition (OCR) tools can read every word on a page, they do not understand which pieces of text correspond to specific business fields like invoice totals or patient names. Previously, teams relied on general-purpose frontier LLMs to interpret this text, but these models are often slow and costly when processing thousands of documents daily. The Dharma Field Extractor takes a different approach by focusing exclusively on field extraction, bypassing the need to generate full textual summaries.

This tool operates in two modes to suit different integration needs. In open mode, it analyzes a document without a predefined schema, identifying key-value pairs and tables based on layout and context. In schema-directed mode, users provide a specific structure with defined field names and data types. The model then fills this structure exactly, returning null for missing information rather than hallucinating data. This ensures the output is ready for immediate ingestion into downstream systems like ERPs or compliance databases without additional cleaning code.

Key details

  • The model contains 2 billion parameters, optimized from the earlier DharmaOCR-LITE v1.1 checkpoint.
  • Training involved 43,384 examples across English, Portuguese, and other multilingual datasets.
  • Benchmark tests covered 546 documents, resulting in 1,638 total extraction cases.
  • It achieved a field-level F1 score of 0.834, surpassing Claude Opus 5 (0.816) and GPT-5.6 Luna (0.741).
  • Operational costs were estimated at 6 to 147 times lower than comparable frontier API calls.
  • The model runs on self-hosted infrastructure, such as a single L40S GPU, avoiding per-token billing.

Background

To understand the significance of this release, it helps to distinguish between standard OCR and intelligent extraction. Traditional OCR engines convert image pixels into machine-readable text strings, preserving line breaks but losing semantic meaning. A human or a sophisticated algorithm must still determine that the number "150.00" next to the word "Total" is the amount due. General-purpose LLMs can perform this reasoning by reading the OCR output, but they are designed for broad conversational tasks, not specialized data parsing. This mismatch leads to higher latency and unnecessary compute usage for simple extraction jobs.

Specialized small language models (SLMs) like Dharma are trained on narrow domains using techniques such as supervised fine-tuning and direct preference optimization. By limiting the model's scope to document structures like invoices, IDs, and forms, developers can achieve higher precision with fewer parameters. This approach aligns with the growing trend of sovereign AI, where organizations run models on their own hardware to maintain data privacy and control costs, rather than relying on external API providers.

Why it matters

For teams managing self-hosted software stacks, this development offers a viable path to reduce dependency on external AI APIs. Running a 2-billion-parameter model on local hardware allows companies to process sensitive documents without sending data to third-party servers. This is critical for industries like healthcare and finance, where regulatory compliance restricts data movement. The ability to define strict schemas also reduces the engineering burden of writing custom parsers for every new document type that enters the system.

Cost efficiency is another major driver for adoption. The benchmark data suggests that self-hosting this model can be significantly cheaper than paying per token for frontier models, especially at scale. For businesses processing hundreds of invoices or contracts daily, the savings accumulate quickly. Moreover, the model’s ability to return valid JSON consistently means fewer errors in downstream applications, reducing the need for manual verification and rework.

What you can do

  • Evaluate your current document processing pipeline to identify tasks where general LLMs are used for simple field extraction.
  • Test the Dharma Field Extractor demo on Hugging Face with your own sample documents to assess accuracy.
  • Define clear JSON schemas for your most common document types, such as invoices or identity cards, to enable schema-directed extraction.
  • Calculate the total cost of ownership for running a small GPU instance versus your current API spend for document AI.
  • Consider integrating specialized models into your self-hosted infrastructure to improve data sovereignty and reduce latency.
  • Monitor open-source developments in small language models to stay updated on new specialized tools for niche tasks.

More news

All news