Own Weights

What is an F1 score? Precision and recall for LLM tasks

What is F1 score? It combines precision and recall into one number. Here is what each measures for LLM extraction and which metrics to ask a vendor for.

Updated

F1 score is one number from 0 to 1 that combines precision and recall. It is the harmonic mean of the two, so it stays low if either one is weak, and it reaches 1.0 only when every expected item is found and nothing extra comes back.

Precision and recall come from two different mistakes. Precision asks: of everything the model returned, how much was right? Recall asks: of everything that should have been returned, how much did the model find? A model that returns one correct field and nothing else has perfect precision and poor recall. A model that returns every line of a document has high recall and poor precision.

Precision vs recall in AI extraction

In extraction, the two numbers map to two failures a buyer can name. A missed field is a recall failure: the contract has a termination date and the model returned nothing for it. An invented field is a precision failure: the model returned a value that is not in the text, or the wrong date from a similar clause.

Here is a hypothetical example with round numbers. A test set has 100 expected fields. The model returns 90 fields, and 75 of them are exactly right.

  • Precision: 75 right out of 90 returned, about 0.83.
  • Recall: 75 right out of 100 expected, 0.75.
  • Missed fields: 25. Returned but wrong: 15.
  • F1: 2 times 0.83 times 0.75, divided by (0.83 plus 0.75), about 0.79.

Which side matters depends on the workflow. If a person checks every output, a missed field is the costly failure, because the reviewer only sees what the model returned. If output goes straight into a database or a payment step, a wrong value that looks right is the costly failure, so precision matters more. Tell the vendor which failure costs you more, then ask for that number first.

Accuracy vs F1 score

Accuracy is the share of answers that are right. For extraction it is hard to use, because a document has many possible fields and most of them are often empty. A model that answers “not present” for almost every field can look accurate while missing the fields you care about.

F1 leaves out the empty cases and scores only the positives: the fields that exist and the answers the model gave. That makes it more useful for extraction and for classification where one label is rare. With balanced classes, accuracy is fine. Check the label mix before you trust either number.

What metric to ask a vendor for

Ask for precision, recall and F1 on your own test set, broken out by field type. A single average across all fields hides a field that is never found. Ask for the counts of missed and invented fields too. Those counts are the numbers your team will argue about after launch.

Ask how each answer was judged. A score on exact quotes and a score on loose matches are different numbers. A vendor who reports only one should say which.

Ask for the same test run on the model you use now. A score with no baseline does not tell you whether to switch.

How to measure LLM accuracy, and what a good F1 score is

There is no universal good F1 score. A middling score can be strong on a hard field where human labelers disagree, and weak on a simple date. The useful question is whether the candidate beats the current model on the same test, by more than the noise in that test.

Our public exam shows the shape of that comparison. It uses CUAD, a public set of 510 commercial contracts with answers marked by lawyers. We looked for 10 kinds of passage and scored each model on the share of exactly-right quotes, using 5-fold cross-validation, so every document was scored by a model that never saw it in training. Our Accuracy model scored 0.717, our Standard model 0.650, Claude Opus 0.635 and Claude Haiku 0.584. Our Accuracy model led Opus by +0.082 and Haiku by +0.133, both larger than the margin of error. It was ahead of both in all 5 groups of 102 documents.

Those numbers measure exactly-right quotes, not F1, so do not set them beside an F1 from a different test. Check the full exam results for how each figure was scored.

Claude took the exam with one prompt, no examples and no task training. Our models were fine-tuned for this exam. That shows what training for one task can do. It is not a legal product or legal advice, and it does not mean our model beats Claude at everything. On a narrow task with good data, a fine-tuned model can beat a frontier model. Do not assume it always will. Test it on your documents, as the evaluation guide explains.

Exact match vs partial match evaluation

Exact match counts an answer as correct only when it equals the gold text, character for character, after any normalization you set. Partial match gives credit for overlap, so a model that returns most of a clause gets some credit.

Exact match suits quotes that must be copied from the source. It is strict, and it punishes a stray space or a punctuation difference, so write the normalization rules before the test runs, not after. Partial match suits labels and summaries, where wording varies. Its weakness is that a clause cut in half can still score well. Pick the rule that matches what your team does with the output.

Extraction at volume has its own pitfalls, covered in the extraction accuracy guide. Before you trust a gap between two models, check whether it survives a significance test.

Own Weights fine-tunes an open-weight model for one high-volume task, tests it against your current model on your data, and serves it in your own cloud account or on-prem. The first step is a free AI cost audit, which shows where your AI spend goes and which task is worth measuring first. If you want help building the test set and scoring the current model, book a call.

Questions

What is F1 score?

F1 score is a single grade from 0 to 1 for a task with two ways to fail. It rewards finding the right items and penalizes returning wrong ones at the same time. A perfect 1.0 means every expected item was found and nothing extra was returned.

Precision vs recall in AI extraction: which one matters more?

Protect the one whose failure your process catches least well. If nobody checks outputs before they reach a system of record, precision is usually the number to protect. If a person reviews every output, recall tells you how much review work is hidden.

How to measure LLM accuracy?

Build a test set from real documents, with answers that people agreed on. Score the current model on that set first, then score the candidate on the same documents. Compare the gap against the margin of error before you decide.

Exact match vs partial match evaluation: which should I use?

Exact match needs the answer to equal the gold text after normalization rules you wrote down in advance. Partial match gives credit for overlap. Exact match is the stricter choice when a downstream system reads the text as written.

What is a good F1 score?

Set the bar from your current process, not from a leaderboard. If people already get a field right at a known rate, a model should match that rate on the same test before it replaces them.