steinborn.dev
← all notes
data-engineering

The misses were identifiers

· 4 min read · Benjamin Steinborn

After my pipeline started asking about every pair of entities in a paper, the obvious next lever was the decision itself. A better prompt, a larger model, several runs and a vote. Before trying any of them, I sorted every miss into the first cause that explained it. That changed the plan.

Every number here is a development measurement on BioRED’s development set, used to decide between versions, not a result.

Sorting the misses

Across both halves of the development set, 705 gold pairs were missed. The largest group, 199, had both entities found, but one of them filed under a different identifier than the gold’s. Another 165 had an end whose gold identifier no namespace I used could reach. Pairs the model had looked at and decided none came to 151. The decision, the thing I had been about to tune, was the third cause, not the first.

The examples were consistent. “Cancer” grounded to MONDO’s cancer, where BioRED uses MeSH’s Neoplasms. Dyskinesia, psychosis and akathisia grounded to phenotype terms that no cross-reference ties to the MeSH headings the gold uses. The entities were right. They sat under the wrong key.

Each of these costs twice. The true pair is missed, and the same pair under the other identifier counts as a false one. To see the size of the problem, I ran an oracle: give every extracted entity the gold identifier its name has in the document, and score again. Pair F1 rose by about sixteen points on both halves. No real system gets the oracle’s identifiers, but it showed where the ceiling sat.

A lookup, not a model

BioRED normalises diseases and chemicals to MeSH, the vocabulary PubMed indexes with. So I added MeSH 2026 to the local ontology index and looked up each grounded disease, phenotype and chemical by its names. A hit becomes a second identifier. No model call, no gold, no new prompt.

Replayed on existing answers, it gained 11 and 8 points. Run inside the full ingest, on fresh vaults, pair F1 went from 45 to 57 on the first half and from 40 to 54 on the second, with the paired interval clear of zero on both. Precision and recall rose together, which is what the double cost predicts: one fixed identifier turns a false positive and a false negative into one true pair. Cost per paper went down slightly.

A gain that was partly a merge

The first version stored MeSH as a cross-reference on the entity node. A later experiment showed what that does: two different diseases from two papers, both filed under one broader heading, became the same node. The scorer then counted 452 gold pairs instead of 468. Part of the improvement came from the denominator getting smaller, not from finding more relations.

The fix moved the MeSH identifier from the node to the edge. Each statement carries the identifier its own paper supports, and nodes stay separate. The score barely moved, by a tenth of a point, so the gain was real. But I only knew that after checking, and a merge like this one is easy to miss when a number goes up.

What did not survive

Most of what I tried next did not hold.

  • A guideline prompt that paraphrased the annotation rules lifted recall by 7 to 15 points and cost 13 to 14 of precision. A narrower version was level with the plain prompt.
  • Votes across two to four runs landed inside the spread of single runs at twice the cost.
  • A larger model for the pair decision was level with the smaller one at 2.6 to 2.9 times the cost.
  • A model call that picks a MeSH heading where the name lookup found none fixed some entities and broke others, and did not hold on the first half. It is in the code, switched off.
  • Plural forms as extra lookup keys cost almost a point, because a chemical’s plural is often its class. They stay as a fallback for when the exact name finds nothing.

None of these were bad ideas. Each one moved something, and each one cost about as much somewhere else.

Where it stops

What is left on the disease side is mostly convention. “Cardiac dilation” filed as Cardiomegaly where the gold has dilated cardiomyopathy. “Hyperactivity” under Psychomotor Agitation where the annotators chose Hyperkinesis. Both readings are defensible. An oracle closes these gaps, and any rule that closes them without reading the gold would be one I had fitted to the gold. That is tuning on the test set under a different name, so I stopped there.

The general point: when an extraction system misses things, sort the misses before changing the model. In this case the biggest lever was a lookup table I had not loaded, and no amount of prompt work would have found it.