LLM extraction accuracy: getting exact text from documents
LLM extraction accuracy explained: how to score exact quotes from contracts and documents, and how a trained model compared with Claude on a public exam.
Updated
LLM extraction accuracy is the share of values a model pulls out of a document that match the source text exactly. In contract work, an answer counts only when it is the passage a reviewer would have marked, quoted word for word.
What counts as an exact extraction
A model can sound right and still fail. It paraphrases a clause, drops the last condition, or returns text from the wrong page. Each of these is a miss if the next system needs the original wording, for example to highlight the passage in a review tool or to compare two versions of an agreement.
Decide the scoring rules before you run anything. Do you allow differences in whitespace or in curly versus straight quotes? Do you accept a missing final period? Does a span that covers the right sentence plus one extra sentence count as a match? Write the answers down, so the score does not move when someone reads the output and feels generous.
A worked example from a contract
Take a hypothetical renewal clause: “This Agreement renews automatically for successive one-year terms unless either party gives written notice of non-renewal at least sixty days before the end of the then-current term.”
A model returns “This Agreement renews automatically for successive one-year terms.” Every word it returned appears in the document, but the notice condition is gone. Under an exact-span rule that is a miss, and it is the costly kind, because the reader sees an automatic renewal and no way out. A loose check that only asks whether the output contains a renewal sentence would pass it. That gap is why the rule must say whether the full clause is required.
Fields worth testing in a contract workflow usually include governing law, notice periods, assignment limits, indemnity caps and change-of-control triggers. Pick the ones a person would act on, and score each field on its own. A model can be strong on governing law and weak on notice periods, and an average hides that.
What the public exam showed
On the public CUAD exam of 510 commercial contracts, scored with 5-fold cross-validation, our fine-tuned Accuracy model reached 0.717 on exact quotes against 0.635 for Claude Opus, but Claude had one prompt and no examples, so the gap reflects training for one task more than general skill. Full results list every model in the comparison.
Training helps narrow extraction because the model learns where a clause type starts and stops in real documents. It is only as good as its labels, though. If the labels are wrong or the test set leaked into training, the score will look better than the real work. The split and the scoring rules matter as much as the model. Cost per document also depends on page count, so price the test on your own files rather than on any published per-token figure.
Common mistakes that distort the score
- Splitting by chunk instead of by document. When one contract is cut into pieces and the pieces land on both sides of the split, the model has seen the neighbors of every answer it is tested on.
- Letting near-duplicate templates leak across splits. Contracts from one counterparty often share most of their wording. A test set full of siblings measures memory, not extraction.
- Changing the prompt between models. If one model gets a tuned prompt and another gets a bare one, the comparison says nothing about the models. Freeze the prompt and output format first.
- Letting reviewers see model output. Once a reviewer reads a suggested passage, they tend to accept it. Have the reference passages marked from the source alone, then compare.
- Scoring by eye. Rules set after seeing the results move the score in whichever direction the reader prefers.
- Ignoring format drift. A model that adds quote marks, corrects a typo in the source or wraps the answer in prose fails an exact check even when the words are right. If your pipeline parses the output, JSON reliability covers how to keep it stable.
Running the test on your documents
- Pull a small sample of real documents, around five, and run the whole pipeline end to end on them before you scale up.
- Have a reviewer mark the passages you need, working from the source alone.
- Split by document, and keep every file from one contract on the same side of the split.
- Score your current model first, with the prompt and output format fixed.
- Run the candidate on the same held-out documents and count exact matches for each field.
- Read every miss and sort it into boundary errors, format drift or wrong passages. Each has a different fix, so a single overall score hides what to change.
Trade-offs are real. One model for all fields is simpler to run, but a weak field can hide behind strong ones unless you score fields separately. Checking every output by hand is slower, but it catches errors a score can miss, such as a passage that matches exactly and answers the wrong question. For the full method, including how to set pass criteria, see the LLM evaluation guide. For clause-level work, see contract clause extraction.
If you send documents to a frontier API today, start with the free audit, which maps your AI spend by task from your code and invoices. To learn more about the service, visit the Own Weights home page, or book a call to build the test on your own documents.
Questions
What is LLM extraction accuracy?
It is the share of values a model returns that match the source document exactly. A passage counts as right only if it is copied word for word from the place a reviewer would mark. Measure it on a labeled set of documents from your own workflow.
How do I test an LLM on clause extraction before switching models?
Start with documents that a reviewer has already checked. Keep the held-out documents out of any training data, and use the same prompt and scoring rules for every model you compare.
Can a fine-tuned open-weight model beat Claude at extraction?
On one public exam, a fine-tuned open-weight model scored higher than Claude Opus and Claude Haiku. Claude had a single prompt and no examples, so the result says more about training for one task than about general intelligence. Your own documents decide the question for your work.