Dharma Field Extractor: Any Document In, Structured Fields in JSON Out
Hugging Face introduces Dharma Field Extractor, a 2-billion-parameter model converting document images into structured JSON fields at lower cost and higher accuracy than frontier LLMs.
A new 2-billion-parameter model, Dharma Field Extractor, converts document images into structured JSON fields, addressing the gap left by OCR which only extracts raw text. Unlike OCR, which returns every line of text without field labels, this model identifies and organizes specific data points such as invoice line items, patient details, or ID fields into a machine-readable format. The tool supports two input modes: an open request for unknown document structures or a predefined schema to match existing data pipelines. Outputs are typed, nested JSON, with null values for missing fields, enabling direct integration into downstream systems.
The model is built on DharmaOCR-LITE v1.1, a 2-billion-parameter checkpoint optimized for OCR and fine-tuned with 43,384 field-level annotated examples across multiple domains including receipts, invoices, forms, and IDs. It was evaluated on a benchmark of 546 documents with 1,638 test cases, covering scenarios with no schema, partial schemas, and schemas including nonexistent fields. Performance was measured using field-level F1 scores, Levenshteehn similarity for matched values, and JSON validity, demonstrating consistent superiority over general-purpose LLMs.
In benchmark tests, Dharma Field Extractor outperformed four frontier LLM configurations by 1.8 to 9.3 points in quality while reducing costs by 6 to 147 times. The comparison used published pricing and measured token usage, including reasoning tokens, with all frontier models running at low reasoning settings. The model’s self-hosted cost is based on GPU time on a single L40S at $2.24 per hour, though actual deployment costs vary by hardware and volume. The benchmark included public datasets SROIE and FUNSD, which were not used in training, to validate performance on unseen document types.
The release follows prior evidence from Dharma-AI’s OCR model, which initially outperformed frontier APIs in Portuguese before newer models narrowed but did not close the gap. The company argues that smaller, task-specific models trained on relevant data can surpass larger general-purpose models on bounded tasks, achieving both higher quality and lower operational costs. The Field Extractor is available for self-hosted deployment, with documentation and examples provided for integration into existing workflows.