The invoice did not reveal a finance problem. It revealed a product architecture we had never measured end to end.
One user action triggered classification, extraction, retrieval, generation, review and reformatting. Each call looked inexpensive in isolation. Together, they multiplied cost and latency.
We were also sending more context than the task needed because ‘more information’ felt safer. Retries repeated the same expensive work. Stable documents were processed again and again.
I realized cost optimization had started too late. The architecture was already expressing our assumptions in money.
A cheap model call did not mean a cheap completed task.
I mapped every call from the user’s request to the final accepted output. That exposed hidden generation, validation and formatting steps that had never appeared in the original cost estimate.
- Classification
- Extraction
- Retrieval
- Generation
- Quality review
- Reformatting
The useful unit was not cost per token. It was cost per successful report, reviewed document or completed workflow.
The strongest model did not need to perform every kind of work.
Structured extraction and routine classification could use smaller models or deterministic rules. More capable reasoning was reserved for the few steps where it changed quality meaningfully.
