feat: enhance augment prompt to detect disguised identifiers#207
feat: enhance augment prompt to detect disguised identifiers#207asteier2026 wants to merge 1 commit into
Conversation
Adds an 'Additional extraction requirements' block covering verbatim span extraction and detection of identifiers written as digit words (phone/SSN/credit card numbers) or letter-by-letter name spellings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: asteier2026 <asteier@nvidia.com>
Greptile SummaryAdds an
Confidence Score: 4/5The change is prompt-only with no surrounding code logic altered; the verbatim extraction intent is sound and the new detection examples are well-chosen. The prompt addition is logically coherent and solves a real gap. Two structural weaknesses — missing labeled output examples for the new cases and the post-example placement of the requirements — could cause inconsistent labeling or reduced LLM adherence across model versions, but neither causes an immediate breakage in the current workflow. src/anonymizer/engine/detection/detection_workflow.py — specifically the ordering of the new requirements block relative to <<EXAMPLE_BLOCK>> and the absence of worked output examples for digit-word and letter-spelled identifiers. Important Files Changed
|
| Additional extraction requirements: | ||
| - The "value" field must be the EXACT verbatim span from the input text. | ||
| Copy the text character-for-character exactly as it appears. | ||
| Do NOT normalize, correct spelling, expand abbreviations, decode encodings, | ||
| infer hidden values, translate text, reformat numbers, or otherwise modify | ||
| the extracted span. | ||
| - Extract only text that is explicitly present in the input. | ||
| Never reconstruct, guess, or generate a value that does not appear verbatim. | ||
| - Identifiers may be disguised, fragmented, hyphenated, misspelled, obfuscated, | ||
| spaced out, mixed with punctuation, or written in words instead of digits. | ||
| Detect the identifier and extract the exact text as written. | ||
| Examples of disguised identifiers to detect: | ||
| - Phone numbers, SSNs, and credit card numbers spoken as digit words, | ||
| including "o" or "oh" used in place of zero: | ||
| "nine o two, five five five, one two three four" | ||
| - Names spelled out letter by letter with hyphens or commas: | ||
| "J-O-H-N", "M, A, R, Y" | ||
|
|
There was a problem hiding this comment.
Extraction requirements placed after the example block
Standard few-shot prompting places all instructions before the demonstrations so the example can illustrate those instructions. Here, "Additional extraction requirements" appears after <<EXAMPLE_BLOCK>>, so the concrete example does not show verbatim extraction of a disguised identifier — leaving the LLM without a worked instance of the most novel new behavior. Moving these requirements above <<EXAMPLE_BLOCK>> (or adding a second worked example that demonstrates digit-word extraction) would make the prompt self-consistent.
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!
There was a problem hiding this comment.
I think it's good the way it is.
Summary
Additional extraction requirementsblock to the LLM entity augmentation promptMotivation
The augmenter was missing entities that were obfuscated or spoken aloud, e.g.:
"nine o two, five five five, one two three four"(phone number)"J-O-H-N"(name spelled out with hyphens)