Build vs. Buy Is Not One Decision: A Layer-by-Layer Flow
Build vs. buy is a per-layer decision, not a single platform choice. This flow splits a system into layers, tests each for differentiation, then sets the buy criteria and the exit path.
Hugging FaceGabriel Pimenta de Freitas Cardoso, Paulo Henrique de Medeiros Araujo, Bruno Duarte, Francisco de Almeida Rocha AlvesAnnouncement
The Dharma Field Extractor is a 2-billion-parameter model that takes a document image and returns structured JSON by open extraction or by following an exact schema. In open mode it recognizes labels, values, and tables from layout; in schema-directed mode it uses the caller’s key names and types, returning null for absent fields and filling table rows. It was fine-tuned from DharmaOCR-LITE v1.1 via a LoRA adapter on 43,384 field-level annotations drawn from public, Brazilian, and multilingual sources. On a 546-document benchmark covering three extraction scenarios, the Field Extractor scored a field-level F1 of 0.834, beating Claude Opus 5’s 0.816 and GPT-5.6 Luna’s 0.741, while its self-hosted cost ($2.24/hour on one L40S) was 6 to 147 times less per extraction than each API. This supports Dharma-AI’s thesis that a small model specialized on a bounded task outperforms general-purpose frontier models.
OCR returns raw text without field mapping, forcing downstream systems to manually parse fields from unstructured output.
The Field Extractor is built by training a LoRA adapter on the DharmaOCR-LITE v1.1 checkpoint using 43,384 examples across three streams: English multi-domain documents from the public web, Brazilian documents in Portuguese, and multilingual data covering other languages. Training covers both open extraction and schema-directed modes. The benchmark uses 546 documents across three scenarios (no schema, partial schema, schema with nonexistent fields) and scores field-level F1 multiplied by Levenshtein similarity and proportion of valid JSON.
The Field Extractor achieves higher field-level F1 than every frontier API tested while costing 6 to 147 times less per extraction.
The model supports open extraction (finds all structural fields) and schema-directed extraction (outputs exact keys with types, null for missing).
A 2-billion-parameter model fine-tuned on the specific task, DharmaOCR-LITE v1.1, beats frontier models, supporting the specialization thesis.
When a schema specifies a field not present in the document, the model returns null for that field instead of inventing a value, ensuring the output matches the schema exactly.
The Field Extractor runs on a single L40S GPU at $2.24/hour, making it 6 times cheaper than GPT-5.6 Luna and 147 times cheaper than GPT-5.6 Sol per extraction, though actual cost depends on deployment hardware and volume.
The training data includes receipts, invoices, forms, bank statements, IDs, and synthetic documents across English, Portuguese, and other European and Asian languages.
Summaries are generated from the original by a language model. Check the original before relying on it.
See the idea
Build vs. buy is a per-layer decision, not a single platform choice. This flow splits a system into layers, tests each for differentiation, then sets the buy criteria and the exit path.
Keep reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
One useful email. Unsubscribe anytime.