fix: switch augment prompt to plain text input, drop GLiNER seed entities - #267
asteier2026 wants to merge 1 commit into
Conversation
|
cbf4e98 to
36d76a3
Compare
| """ | ||
| non_augmenter = [item for item in entities if item.source != "augmenter"] | ||
| augmenter = [item for item in entities if item.source == "augmenter"] |
There was a problem hiding this comment.
Broader sensitive spans discarded
When the augmenter identifies a broader sensitive value that overlaps a narrower detector span, this filter discards the entire augmenter entity instead of preserving its non-overlapping sensitive portion. For example, if the augmenter finds a full street address containing a detector-identified city, only the city reaches validation and replacement. The rest of the address can remain unanonymized.
How this was verified: Only entities retained by resolve_overlaps() are passed into validation and replacement, and no later stage reconstructs the discarded span or its residual intervals.
There was a problem hiding this comment.
This is by design. If gliner finds Seattle and augment finds "near downtown Seattle", it's better to hold on to the validated gliner entity "Seattle" and throw out the rest. I think it's too messy to try and weed out parts of the augment span that should still be an entity. Augment is supposed to find minimal spans. If "Seattle, Washington" shows up, we want augment to tag "Seattle" and "Washington" individually.
There was a problem hiding this comment.
That makes sense. Given the augmenter’s minimal-span contract, dropping an overlapping augmenter result is intentional: the validated GLiNER span is preserved, while the augmenter is expected to emit separate minimal entities such as Seattle and Washington rather than a broader span containing Seattle. I’m withdrawing this concern.
…ties Uses COL_TEXT (plain, untagged) instead of COL_INITIAL_TAGGED_TEXT so the augment LLM sees a clean slate with no GLiNER annotations. Removes the seed entities line and the do-not-repeat rule. Updates both strict and non-strict example blocks to match plain text input. Because the augmenter now sees plain text, it commonly re-detects spans GLiNER already found and validated. resolve_overlaps() previously broke ties on identical spans purely alphabetically by label, and let a longer overlapping augmenter span win outright over a shorter validated span, so an augmenter's unvalidated relabeling (e.g. "near downtown Seattle" -> address) could silently swallow and displace an already-validated span (Seattle -> city). Any augmenter-sourced entity that overlaps an entity from any other provenance is now dropped before span length is even considered, so it can never displace a validated span regardless of length, matching the invariant resolve_overlaps() already documented but didn't enforce. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: asteier2026 <asteier@nvidia.com>
36d76a3 to
a6f683a
Compare
Summary
COL_TEXT(plain, untagged) instead ofCOL_INITIAL_TAGGED_TEXT, so the augment LLM sees a clean slate with no GLiNER annotations. Removes the seed entities line and the do-not-repeat rule; updates both strict and non-strict example blocks to match plain text input.resolve_overlaps()previously broke ties on identical spans purely alphabetically by label, so an unvalidated augmenter relabeling (e.g.Seattle -> address) could silently overwrite an already-validated detector span (Seattle -> city). Adds a provenance tiebreak so entities sourced from the augmenter always lose to any other source on identical spans, matching the invariantresolve_overlaps()already documented but didn't enforce.Test plan
python -m pytest tests/engine/test_detection_postprocess.py— 70 passed, including new regression tests covering the augmenter-vs-detector provenance tiebreakmake format-check🤖 Generated with Claude Code