kiji-proxy
kiji-proxy copied to clipboard
Benchmark any-label score understates masking
Found while reviewing #689. Code: tests/benchmark/run.py on that branch.
1. Out-of-schema predictions are dropped before any-label scoring (run.py:817-825)
source.project() splits predictions into predicted and ignored. Only predicted goes to any_label_metrics.update. So when a gold span is masked under a label the source doesn't annotate, it counts as missed:
- nym: IDCARDNUM over a gold NATIONALID span;
- nobody: USERNAME or CREDITCARDNUMBER over a PERSON or IBAN span.
Effect on the shipped model:
| Set | such predictions | any-label F1 now | if counted |
|---|---|---|---|
| nobody-de | 119 | 0.627 | 0.664 |
| nobody-en | 42 | 0.643 | 0.662 |
| nym-en | 40 | 0.879 | 0.881 |
It hits the mix models harder, because they predict IDCARDNUM more often. Every any-label number in GERMAN_EVAL.md and #690 understates masking.
2. Any-label reuses the one-to-one greedy matching (run.py:541-584)
So it isn't the coverage measure that its docstring and GERMAN_EVAL.md describe:
- Gold FIRSTNAME "Klaus-Dieter" + SURNAME "Müller", predicted as one span, gives tp=1, fn=1, although the whole name is masked.
- A 1-character overlap counts as fully masked, although "Müller" leaks.
Suggested fix
- Score any-label on
predicted + ignored. - Measure coverage per gold span (the share of its characters covered by any prediction, with a threshold) instead of one-to-one matching.
- Add tests for both cases.
- Re-run the quoted numbers.