Skip to main content
Back to timeline
Hugging Face - BlogSource publication:

Dharma Field Extractor turns any document into schema-shaped JSON: a 2B-parameter model self-hosted on one L40S, 6 to 147 times cheaper than frontier APIs

Synopsis

Dharma-AI released the Dharma Field Extractor, a 2-billion-parameter model that takes a document image and returns structured JSON, with one checkpoint covering both open extraction and schema-directed requests. On a benchmark of 546 documents across three request scenarios, 1,638 cases in total, it scored 0.834 field-level F1, above the best frontier configuration tested, Claude Opus 5 at 0.816, and the lowest, GPT-5.6 Luna at 0.741; self-hosted on a single L40S, each extraction cost roughly 6 to 147 times less than those APIs.

AI-generated editorial illustration: Dharma Field Extractor: Any Document In, Structured Fields in JSON Out

Interpretation

Document processing gains a path from full-page text to structured fields: the model returns typed JSON directly, with field names and nesting as requested, so downstream systems no longer need mapping code. The earlier DharmaOCR-LITE only performed OCR, returning every line printed on the page without indicating which string is the exam type, which is the date, or which number is the total, so someone still had to write code mapping each value to a field. On a benchmark of 546 documents across three request scenarios, 1,638 cases in total, the model scored 0.834 field-level F1, above the four general-purpose frontier configurations tested, with Claude Opus 5 at 0.816 and GPT-5.6 Luna at 0.741.

One set of weights handles both request modes: with no schema, the model judges from context and layout which parts are structured fields and returns all key-value pairs; with a schema, it fills each field under the given key names and types. In schema-directed requests each field is declared as string, number or boolean, and tables are filled cell by cell, row by row, column by column; a field absent from the document returns null instead of an invented value. The model builds on the DharmaOCR-LITE v1.1 base with a LoRA adapter trained on 43,384 examples covering both request modes, split into English multi-domain, real Brazilian Portuguese and multilingual streams, all annotated at the field level.

The cost side of the comparison comes from self-hosting: the model runs on a single L40S, billed as GPU time at $2.24 per hour rather than per token. Frontier API costs come from measured average input and output tokens per page, reasoning tokens included, against each provider's published list pricing, with every frontier model at low reasoning effort and Claude Opus 5 using adaptive effort. The cost gap runs from roughly 6 times (against GPT-5.6 Luna) to roughly 147 times (against GPT-5.6 Sol); the release states this is not a sales price and that self-hosted cost depends on hardware, volume and the latency a deployment needs.

Perspective

The demonstrated scope is extraction from document images into JSON fields, covering receipts, commercial invoices, forms, bank statements and ID documents; the benchmark contains 546 documents across three request scenarios, 1,638 cases in total, and SROIE and FUNSD are public datasets held out from training, each illustrated with one example.

The cost comparison rests on GPU time on a single L40S against providers' published list pricing, and the release states this is not a sales price, with actual self-hosted cost depending on hardware, volume and required latency; multilingual data is only a smaller share of the training mix.