← ProjectsNovember 1, 2026
$

Smaller Models, Better Prompts

image
01 / Overview An enterprise document-AI pipeline was producing good results on large, expensive models: company-code prediction, vendor identification, and field extraction for finance documents. I led the work to show that smaller, cheaper models could do the same job, and sometimes do it better, once each step was clearly understood and the prompts were redesigned around that understanding. Details are kept high level and anonymized. No customer data, prompt text, or internal system names are shared.
Cost
−0%
LLM cost per document after the migration
Scope
0
core prompt families redesigned: company code, vendor, extraction
02 / Problem The pipeline worked, so the high model bill was accepted as the price of quality. My hypothesis was different: large models were making up for steps that asked too much at once, carried too much context, or relied on the model to infer things that could simply be provided. 03 / Approach
01
Audit every prompt
Mapped what each step really decided, what it received, and where it relied on the model guessing.
02
Redesign around patterns
Split mixed decisions, added structured reference tables, and made context a deliberate choice.
03
Prove it on smaller models
Ran every version against the same test set until cheaper models matched or beat the baseline.
04 / Patterns
design / decompose
One decision per step
Narrow, well-defined questions that small models answer reliably.
data / tables
Reference tables, not recall
Candidate companies and vendors passed as compact, consistent tables, so the model chooses instead of guessing.
context / ocr
OCR only when it helps
Decided per task when to include OCR text, which pages matter, and when to leave it out entirely.
output / shape
Strict outputs
Clear formats that remove a class of errors and make results easy to validate.
eval / evidence
Measured, not felt
Every change compared on the same documents for accuracy and cost.
craft / reuse
Reusable playbook
The same patterns carry over to new prompts and new document types, not just the ones that were migrated.
05 / Result
pipeline — before / afterlive
$eval --baseline large-models
→accuracy: baseline · cost per document: 100%
$eval --candidate small-models --prompts v-redesigned
✓company code: matches baseline
✓vendor: matches or beats baseline
✓extraction: matches or beats baseline
✓cost per document: ~20% of baseline
The saving came from understanding the work better, not from accepting worse results. Each step now has a single clear job, which makes the pipeline easier to debug, explain, and keep improving. The longer story, with the lessons I took from it, is on the blog: Doing More with Smaller Models.

Related projects

Agent Pipelines for Enterprise Invoices

Designing, rebuilding, and running multi-agent LLM pipelines that turn supplier invoices into clean, ERP-ready postings for enterprise finance teams, with judgement left to the model and numbers left to code.