r/LanguageTechnology • u/RhubarbFlat6247 • 4d ago
Extracting quantities with their units and denominators from real documents: how do you measure extraction accuracy before building calculations on it?
I am building a methodology that seeks out what institutional decision files have missed. The code, not the model, decides which numbers combine, tests combinations whose units are compatible, and then the results pass through acceptance and rejection gates. But all of this rests on one step: extracting each quantity, along with its unit, denominator, period, and scope, from authentic reports, studies, and PDF files. If the extraction is flawed, everything that follows is wrong, just calculated precisely.
What I'm doing now:
Two models extract each quantity with structured outputs: value, unit, denominator, period, scope, and verbatim quote from the source. The value is only accepted if the two extractions agree, or if it's settled by a verbatim quote. The code verifies that the number actually exists within the quote. I learned from a previous discussion to add an explicit "unknown" field, instead of the model guessing a reasonable unit.
The difficult cases:
- The implied denominator: “The center spends $2 million on the program.” Annually? Or for the entire project?
- The discrepancy in scope: A figure for one branch and a figure for the entire organization, both in the same document.
- Quote matching in PDF: curly quotation marks, ligatures, and words split by a hyphen at line ends. I solved these, but it took longer than I expected.
I pre-registered the evaluation: 100 cases, with a false-positive limit of 5%. Happy to share the link if anyone wants it.
Questions seeking your help:
- Do you know of a good benchmark for extracting quantities and their units from long texts, especially implicit denominators?
- Do you rely more on traditional tools like quantulum3 or grobid-quantities than on language models for this step, or do you combine both?
- How do you measure the accuracy of the extraction itself, separate from the accuracy of the final result?
Thank you
I'm an independent developer in Gaza.
2
u/robotnarwhal 3d ago •
I apologize in advance that this is probably written for a more junior researcher. I started writing before I fell asleep last night and only just now looked back at your post to see that you're writing like you'll know most of this. Sorry, but I'll still post it in case any of it is helpful.
I've been pulling key-value-unit triplets from medical documents (e.g. medication-dose-unit) for over 10 years and I've never heard of quantulum3 or grobid-quantities. So to answer #2, I'd say LLMs and self-hosted fine-tuned LMs are the modern preference because one model can do the entire task, but the cost is of course much higher. Before BERT, the best approaches were often a combination of tools: sentence splitting, parse trees, part-of-speech tagging, and more plus you would write a bunch of manual rules over the top to combine those tools' outputs into tabular data.
To answer #3, I use public or private benchmarks so you're on the right track.
Back to #1, I have some basic benchmark suggestions but I only spent a couple minutes looking. Here's how I got to them, just in case you want to continue the search:
Questions I would still have at this point:
Best of luck!
0
u/Ok_Analysis952 2d ago
for this, i'd separate field-level exact match from evidence match: value/unit/denominator/scope each get scored independently, then require the quote span to actually support them. OXR outputs markdown or json with layout coordinates and reading order, which fits preserving the source structure before scoring. pragmatic baseline, but the implicit denominator still needs manual adjudication.