Opportunity

Reduce LLM token costs by preprocessing documents

The PainHunt Team· Published · Updated · 2 min read

TL;DR: A team wants to reduce model input while preserving the information needed for a defined task. Investigate whether the document input preprocessing proposal improves that task.

The workflow to examine

Evidence to inspect: Representative documents, required answer fields, extraction output and actual token usage.

Proposed design

  • A preprocessing layer that shows the token cost before you send. Strip the parts that tokenize badly — image tiles, scanned-page OCR noise, repeated headers and footers, boilerplate, irrelevant pages — and surface the token budget of a document before it hits the model. The product is the number you didn't have, not another chart after the fact.
  • Fidelity as a first-class control, not a side effect. The reason this isn't already solved by a shell script is that stripping too hard breaks answers. Making the reduction adjustable and showing what was removed turns a risky optimization into a deliberate cost-versus-accuracy dial.
  • Price against the tokens saved. The buyer is an API-heavy developer or an AI product team with a real, recurring bill. "We cut your document tokens by N% and show you the trade-off" is a sharper pitch than a generic FinOps tier, and it maps directly to money.

Risks and honest caveats

  • The model vendors can absorb this. Anthropic and OpenAI could add ingestion-time document optimization natively, which would erode a thin wrapper. The defensible ground is cross-provider visibility and the fidelity controls, not one format trick.
  • Conversion is already commoditized. unstructured, markitdown and pandoc convert files for free. If the pitch is "we turn PDFs into text," there's no business — the value has to be the token-budget visibility and the accuracy-preserving reduction, which those tools don't provide.
  • Aggressive reduction is a correctness risk. Cutting tokens can cut context the model needed. Any honest version of this ships with "here's what we removed" and a way to dial it back, or it trades a cost problem for a quality problem.

A proposed test for document input preprocessing

Compare answers on original and preprocessed test documents, including tables and difficult layouts.

A reason to stop or change direction: Lower token use loses required evidence or preprocessing costs exceed the measured saving.

Research aids: Pain Point Browser, Idea Validator and how the research scores work.

Related reading: governing shadow AI spend across a team; hard spending caps that stop bill shock.

Frequently asked questions

Does every uploaded PDF use the same billing units?

No universal calculation is assumed here. Check the chosen service's current document handling and billing definition, then measure representative inputs. File size, extracted text and billed usage are different quantities.

Can a developer preprocess documents directly?

Possibly. Compare a small existing extraction or cleanup step with the proposed product using the real document formats. If that process is sufficient, an additional service may not be needed.

Can preprocessing reduce answer quality?

Yes, it can remove required context, table structure or source evidence. Compare accepted answers and failure cases on original and preprocessed documents, alongside the total processing cost.

Research the problem behind your idea

Explore problem summaries and source links to compare workflows and decide what to investigate next.

Open the Pain Point Browser

Related articles