r/LanguageTechnology • • 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:

  1. Do you know of a good benchmark for extracting quantities and their units from long texts, especially implicit denominators?
  2. Do you rely more on traditional tools like quantulum3 or grobid-quantities than on language models for this step, or do you combine both?
  3. 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.

4 Upvotes

4 comments sorted by

2

u/robotnarwhal 3d ago • Bravo

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:

  • I checked the quantulum3 GitHub. It has a brief explanation about how it works (I'm glad it's at least using glove vectors, but I'm surprised that a project in 2026 isn't using something newer). I didn't see anything about benchmarking or a publication, so I searched for research publications(literally just googled "quantulum3 arxiv").
  • This paper was the top hit, but it's not from the Quantulum3 authors, so the its performance is likely slightly lower than what the Quantulum3 authors would have found -- researchers inherently focus on maximizing the results of their model but don't always put the same effort into ensuring that they're using competitor's tools to the best of their ability as well. https://arxiv.org/pdf/2305.08853 From the fact that it "cites" Quantulum3 with a github repo footnote instead of a paper in the references tells me there probably isn't a paper to find. Still, it gives me a better idea of how Quantulum3 works compared to the intro of Quantulum3's own repository (from the paper: "Quantulum3 uses regular expression to extract quantities and a dictionary of units for normaliza tion. For units with similar surface forms, a classifie r based on Glove embeddings (Pennington et al., 
  1. is used for disambiguation, e.g., “pound” as weight  or currency.").
  • If you haven't worked in NLP for very long, it will take time to know which conferences and journals have the best reputations, but that paper was published at ACL. That's a top-tier NLP conference with a peer review system, so the paper is likely trustworthy but it's no guarantee.
  • Finally, looking at the benchmarks. Existing benchmarks (NewsQuant and R-Txt) are described in section 4.2; a new benchmark created for this paper is described in section 4.3. Unless I'm reading a paper closely enough to judge the quality of a new benchmark myself, I personally pay much more attention to the model's performance on existing benchmarks. I would also trust it more if the new benchmark has been used by a bunch of other papers published by other teams at good conferences, which you can determine by using a tool like Google Scholar or Semantic Scholar to find papers that cite this paper.
  • Performance on those benchmarks is reported in Tables 3 and 4. For Information Extraction tasks, Precision and Recall are important, but F1 combines the two in a way that you have to do well at both Precision and Recall to get a good F1-score, so F1 is the main metric. All of the scores are out of 100. Quantulum3 does alright, but CQE does much better.

Questions I would still have at this point: 

  • Should I use CQE instead? I would look at papers by other teams/institutions that cite this paper and mention NewsQuant or R-Txt to see if the CQE results hold up when tested by a third party.
  • Are NewsQuant and R-Txt the best benchmarks? I honestly don't even know if they're even good benchmarks. I'm just pulling them from the first paper I found to illustrate the idea since no one else has responded. I'd personally check another 10+ papers that evaluate Quantulum3 and/or in a similar way and create a spreadsheet with papers as the columns, models as the rows, and model performance as the values. Papers won't always use the same metrics or calculate them the same way, so this grid helps me see the overall picture: which models seem to perform well across the board? Which benchmarks do papers use the most? Once you gather a list of benchmarks, you could even get a rough idea of quality by seeing how many citations their corresponding research papers received.

Best of luck!

2

u/RhubarbFlat6247 2d ago

I loved how you replied acactually, Thank you for ur time, and no reason to apologize, The CQE paper is exactly what I'm looking for. I'm planning to try it as a baseline against my two extractors.

I agree that LLM is good, but in these type of cases it's not about the budget, The model can fill a gap from its training, like: "2 Million dollar" could be filled "2 Million dollar yearly" because that's more common and sounds reasonable, That's why I keep extraction separate from validation, allow "unknown", and let the code check the quote.

NewsQuant was created by the CQE authors themselves, so I will look for other teams that evaluated it, as you suggested.

And a question based on your experience: the medical dosage is similar to my problem; the number is incomplete without specifying "how often." When the document doesn't mention the frequency, how did you deal with it? Did you leave it blank, infer it, or reject the value?

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.

1

u/RhubarbFlat6247 2d ago

Thank you, that's exactly what I was looking for for my third question. I will evaluate each field individually, then check if the quote supports it. I agree that the implied denominator requires human judgment, and I have two annotators who label each case.

One question: How do you score "unknown" in precision and recall? If the correct answer is "unknown" and the model says "unknown," that's correct. But if the model guesses "annually" when the correct answer is "unknown," do you count it as a regular error, or a separate category?