Pulling structured information out of unstructured documents is one of the most useful things these tools do, and one of the easiest to get subtly wrong. The output looks authoritative in a table regardless of whether every value came from the source.
What makes extraction reliable?
Naming the fields. A request for the key information produces whatever the model considers key, which varies between runs and makes two documents impossible to compare.
Specifying exact fields turns a judgement call into a search, and search is what these systems do well when the material is in front of them.
What is the template?
Extract the following from the attached document, as a table with one row per [item]: [field one], [field two], [field three]. Use exactly these column names. Take values only from the document. If a field is not stated, write not stated; do not infer it, calculate it or fill it from general knowledge. Where a value appears more than once and the versions disagree, list both and note the section each came from. Add a final column giving the section or page number for each row.
Why is the not stated instruction essential?
Because the default is to produce a complete table. A blank cell looks like a failure, so the model fills it with something plausible, and a plausible value in a table is indistinguishable from a real one.
Explicitly permitting an incomplete answer is what stops that, and it is the single most important line in the prompt.
Naming the unit of a row matters too. One row per invoice and one row per line item are different tables, and the model will pick one without telling you which.
Why ask for conflicts?
Because real documents contradict themselves. A date in the header differing from a date in a clause is exactly the thing you needed to know, and a summary that silently picks one has removed the finding.
Specifying the format of each field is worth doing where the output feeds a spreadsheet. Dates in particular arrive in whatever form the source used unless you state one.
What about calculations?
Forbid them unless the tool can run code. A model asked to total a column is predicting a number rather than adding, and a plausible total is worse than no total.
Where code execution is available, ask for it explicitly and ask to see the code, which turns an assertion into something you can check.
What goes wrong with tables in PDFs?
Position rather than structure is stored, so columns can be read in the wrong order and multi-column layouts can interleave. If values look wrong, check whether rows and columns have been transposed before assuming anything was invented.
Scanned documents are photographs, read visually, with more errors on poor scans and handwriting.
How do you handle many documents?
- Label each one. A, B, C, with the label in every row.
- Same fields for all. Otherwise the results cannot be compared.
- Batch small. Three or four at a time beats twenty, since context is finite.
- Ask for a JSON array where the output is going into a spreadsheet or a script.
What if the fields are not consistent between documents?
Common, and worth handling explicitly. Twenty invoices from different suppliers will call the same thing four different names, and a model asked for a field will sometimes find it under an unfamiliar label and sometimes not.
Listing the likely variants in the prompt fixes most of it: the payment terms field may be called terms, payment terms, or due date. Adding a column for the label actually used in the source is the other half, since it tells you immediately whether the model matched the right thing or found something adjacent and confident.
How much checking is enough?
Spot-check three rows, choosing the awkward ones rather than the obvious ones. If those are correct, the rest usually are. Full verification is only necessary where the consequences are severe, and the section references you asked for make each check a matter of seconds.