Skip to content

docs: add devnote for hybrid entity detection - #258

Open
asteier2026 wants to merge 3 commits into
mainfrom
asteier2026/docs/hybrid-entity-detection-devnote
Open

docs: add devnote for hybrid entity detection#258
asteier2026 wants to merge 3 commits into
mainfrom
asteier2026/docs/hybrid-entity-detection-devnote

Conversation

@asteier2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a devnote explaining Anonymizer's three-stage entity detection pipeline (candidate detection, validation, augmentation) and why each stage is handled by a specialized model (GLiNER for structured extraction, LLM for reasoning).
  • Includes benchmark results comparing Anonymizer against Azure AI Language, Rescriber, Privacy Filter, and GLiNER2-PII on OpenPII and Nemotron PII, plus an ablation study isolating each pipeline stage's contribution.

Test plan

  • Rendered locally via make docs-serve and reviewed the post, images, tables, and footnote citations
  • make format-check

🤖 Generated with Claude Code

Explains Anonymizer's three-stage entity detection pipeline (candidate detection, validation, augmentation) and presents benchmark results on OpenPII and Nemotron PII.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: asteier2026 <asteier@nvidia.com>
@asteier2026
asteier2026 requested a review from a team as a code owner September 2, 2026 16:06
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a developer note describing Anonymizer’s hybrid entity-detection architecture and benchmark results.

  • Explains candidate detection, validation, and augmentation as separate pipeline stages.
  • Clarifies that validation applies only to first-stage candidates and that augmented entities are added afterward without another validation pass.
  • Provides benchmark, ontology-coverage, and ablation-study results with supporting visualizations.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
docs/devnotes/posts/hybrid-entity-detection.md Adds the hybrid-detection developer note and now accurately scopes validation to candidates produced before augmentation.
docs/devnotes/posts/assets/hybrid-entity-detection-pipeline.png Adds the pipeline illustration referenced by the developer note.
docs/devnotes/posts/assets/hybrid-entity-detection-ablation-openpii.png Adds the OpenPII ablation-study visualization.
docs/devnotes/posts/assets/hybrid-entity-detection-ablation-nemotron.png Adds the Nemotron PII ablation-study visualization.
docs/devnotes/posts/assets/hybrid-entity-detection-openpii-pr.png Adds the OpenPII precision-recall benchmark visualization.
docs/devnotes/posts/assets/hybrid-entity-detection-nemotron-pr.png Adds the Nemotron PII precision-recall benchmark visualization.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    D[Original document] --> C[Candidate detection<br/>GLiNER2-PII]
    C --> V[Validation<br/>Keep, drop, or reclassify]
    V --> A[Augmentation<br/>Recover missed explicit entities]
    A --> F[Final entity set]
Loading

Reviews (3): Last reviewed commit: "docs: fix Rescriber recall values in hyb..." | Re-trigger Greptile


> **Was this candidate the right decision?**

Validation never searches for new entities. It simply reviews each candidate and decides whether to keep, drop, or reclassify it. That's fundamentally a reasoning task, making it a natural fit for an LLM.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Validation coverage is overstated

Validation decisions are generated before augmentation, and augmented entities without matching decisions are kept unchanged. Saying that validation reviews “each candidate” therefore gives readers an inaccurate model in which augmented entities also receive keep/drop/reclassify review.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made suggested changes

Augmentation runs after validation, so recovered entities are never sent through validation. Explain why: GLiNER trades precision for recall so its candidates need LLM review, while the augmenter's own suggestions are already high precision.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: asteier2026 <asteier@nvidia.com>

<div style="text-align: center;" markdown>

![Precision vs. recall scatter plot on OpenPII showing Anonymizer with the strongest balance between precision and recall, ahead of Privacy Filter, Rescriber, GLiNER2-PII, and Azure.](assets/hybrid-entity-detection-openpii-pr.png){ loading=lazy }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Rescriber recall values in the plots conflict with the tables. The OpenPII plot places Rescriber at approximately 0.52 recall, while Table 1 reports 83.0%. The Nemotron plot likewise shows approximately 0.52, while Table 2 reports 67.8%. This appears specific to the Rescriber data, other plotted values seem to match their table entries 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I fixed it.


> **What explicit entities haven't been identified yet?**

This stage isn't correcting earlier decisions. It's looking for entities that were never proposed as candidates.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this some more, I wonder if this is truly accurate 🤔

The augmenter receives the post-validation tagged text and validated entity list. A candidate dropped during validation is therefore untagged and absent from that list, allowing the augmenter to propose it again. This stage searches for entities missing from the validated set—not exclusively entities that GLiNER never proposed. Maybe it's just semantics, but just raising in case we want to clarify

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine. What are the odds of gliner suggesting something, then validate drops it, then augment finds again. Pretty slim.


**One problem. Three specialized reasoning tasks.**

As the next section shows, each stage contributes measurable improvements, and together they consistently outperform any individual stage operating alone.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is from agents: The OpenPII ablation reports an F1 score of 0.837 for augmentation alone and 0.826 for the complete pipeline, as the article later acknowledges. Should we describe it as achieving the highest recall, or explicitly state the privacy-weighted objective being optimized?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I explain this later, that all together gives us the highest recall, but just aug gives slightly higher F1, then tried to say that recall is what we want.

Table 1 and Table 2 listed stale Rescriber recall figures that conflicted with the precision/recall plots. Corrected to match the plotted values (51.9% on OpenPII, 52.0% on Nemotron PII).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: asteier2026 <asteier@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants