This prompt is designed for security engineers and platform teams who need a post-generation safety net that catches personally identifiable information (PII) in model outputs before those outputs enter logs, databases, or user-facing surfaces. It is built for global platforms where model outputs may contain English, CJK, Arabic, Cyrillic, and other Unicode scripts. The prompt instructs the model to act as a multilingual PII scanner, returning a structured JSON report of findings with character-level spans, PII categories, and confidence scores. Use this when regex-based scanners fail on non-Latin scripts, when you need locale-aware name format recognition, or when you need a single prompt that handles mixed-language text without separate per-language pipelines.
Prompt
Multi-Language PII Detection Prompt Template

When to Use This Prompt
Understand the ideal use cases, required context, and limitations of the multi-language PII detection prompt before integrating it into your production pipeline.
Deploy this prompt in a post-processing layer that sits between your primary model's output and any downstream consumer—whether that's a logging pipeline, a database insert operation, or a user-facing UI. The prompt accepts free-text input and returns a machine-readable audit report, making it suitable for automated gating decisions. For example, if the confidence score for a detected email address exceeds 0.85, your application can automatically redact the span before storage. If a borderline case falls between 0.5 and 0.85, route it to a human review queue. This prompt is not a replacement for deterministic input sanitization or transport-layer encryption; it is a defense-in-depth measure for catching PII that the model inadvertently generated or regurgitated from its training data.
Do not use this prompt as your sole PII defense for regulated data subject to HIPAA, PCI DSS, or GDPR without additional controls. The model's detection recall will vary across languages and PII categories, and false negatives are possible—especially for uncommon name formats, oblique references to protected attributes, or PII embedded in images or structured tables. Always pair this prompt with a human review step for high-risk outputs, maintain an audit trail of redaction decisions, and run periodic evaluations against a golden dataset of known PII examples in your target languages. If your use case requires real-time streaming redaction with sub-50ms latency, a model-based scanner may be too slow; consider a hybrid approach where regex handles high-confidence patterns and this prompt handles ambiguous or multilingual cases.
Use Case Fit
Where the Multi-Language PII Detection Prompt Template works well, where it breaks, and the operational prerequisites for deploying it safely.
Good Fit: Global Support & Content Platforms
Use when: you process user-generated text, support tickets, or model outputs in multiple languages and scripts (CJK, Arabic, Cyrillic, Latin with diacritics). Guardrail: Pair with locale-specific PII pattern libraries and validate against a golden set of native-language PII examples before production deployment.
Bad Fit: Real-Time Streaming Without Buffering
Avoid when: you need token-by-token PII detection on streaming outputs with sub-50ms latency. Multi-language contextual analysis requires complete semantic units. Guardrail: Use a lightweight regex pre-filter for high-signal patterns (credit cards, API keys) on the stream, and route full utterances to this prompt for deeper inspection.
Required Inputs: Locale Context & PII Taxonomies
What to watch: The prompt cannot reliably detect PII across languages without knowing which linguistic and legal context applies. A name in one culture is a common noun in another. Guardrail: Always provide an explicit [LOCALE] or [LANGUAGE_CODE] input and a [PII_CATEGORIES] taxonomy aligned with your regulatory requirements (GDPR, HIPAA, PCI DSS).
Operational Risk: Name Format False Positives
What to watch: Multi-language name detection has a high false-positive rate, especially with short strings, brand names, or technical terms that resemble personal names in other scripts. Guardrail: Implement a confidence threshold. Route detections below 90% confidence to a human review queue and log all redactions with the detected locale and pattern for audit.
Operational Risk: Script Confusion & Mixed Encoding
What to watch: Text with mixed scripts (e.g., Arabic technical terms embedded in French prose) can confuse entity boundaries, causing partial redactions that leave PII recoverable. Guardrail: Normalize Unicode and detect script boundaries before PII scanning. Test with intentionally mixed-script adversarial examples in your eval set.
Operational Risk: Regulatory Scope Drift
What to watch: A prompt tuned for GDPR's definition of personal data will miss categories required by HIPAA, CCPA, or local data residency laws. Guardrail: Maintain separate prompt variants per regulatory regime. Do not use a single "general PII" prompt for compliance workloads. Document which legal definitions each variant covers.
Copy-Ready Prompt Template
A copy-ready prompt for detecting PII across multiple languages and scripts before model outputs enter logs, databases, or user-facing surfaces.
This template is designed for global platforms that process non-English model outputs. It detects personally identifiable information (PII) across multiple languages and scripts, including Unicode, CJK, Arabic, and Cyrillic, with awareness of locale-specific name formats and identifier patterns. Paste this prompt into your system or user message, replacing square-bracket placeholders with your specific inputs. The prompt instructs the model to scan the provided text, identify PII instances, and return a structured JSON report suitable for downstream redaction or logging pipelines.
textYou are a multilingual PII detection system. Your task is to scan the provided text and identify all instances of personally identifiable information (PII) across any language or script present in the input. ## INPUT [INPUT_TEXT] ## DETECTION CATEGORIES Scan for the following PII categories, adapting patterns to the locales and scripts detected in the text: - Person names (full names, given names, surnames, including CJK, Arabic, Cyrillic, and other script formats) - Email addresses - Phone numbers (international and local formats) - Physical addresses and postal codes - Government identifiers (SSN, national ID, passport numbers, etc., per locale) - Financial account numbers (credit cards, IBANs, bank accounts) - IP addresses - Dates of birth - Online identifiers (usernames, handles, profile URLs) ## CONSTRAINTS - Do NOT flag placeholder or test data (e.g., "John Doe", "test@example.com", "123-45-6789" used in documentation) as PII. - Do NOT flag fictional character names or public figures unless combined with other PII. - For each detection, assess whether the match is a true PII instance or a benign string that matches a PII pattern. - If the text contains multiple languages, apply locale-appropriate detection rules for each segment. ## OUTPUT_SCHEMA Return a valid JSON object with the following structure: { "contains_pii": boolean, "detections": [ { "category": string, "value": string, "language": string | null, "confidence": "high" | "medium" | "low", "needs_review": boolean, "rationale": string } ], "redacted_text": string, "uncertain_cases": [ { "value": string, "category": string, "reason_for_uncertainty": string } ] } ## INSTRUCTIONS 1. Scan the entire input text thoroughly. 2. For each detection, populate the category, value, language (if identifiable), confidence level, and a brief rationale. 3. Set `needs_review` to true for any detection with medium or low confidence, or where contextual disambiguation is required. 4. Generate `redacted_text` by replacing each detected PII value with a category-appropriate placeholder (e.g., [EMAIL], [PHONE], [NAME]). 5. List any borderline cases in `uncertain_cases` with the reason for uncertainty. 6. Return ONLY the JSON object. No additional commentary.
To adapt this template, replace [INPUT_TEXT] with the model output you need to scan. You can extend the DETECTION CATEGORIES list with additional PII types relevant to your domain—for example, adding medical record numbers for healthcare or passport numbers for travel platforms. If your application requires a specific redaction style (masking, hashing, or deletion), modify the redacted_text generation instruction accordingly. For high-risk domains such as healthcare or finance, always route uncertain_cases and needs_review: true detections to a human review queue before the output enters any persistent store or user-facing surface.
Before deploying this prompt to production, validate its performance against a golden dataset containing known PII instances in your target languages. Common failure modes include false negatives on non-Latin script names, misclassification of business addresses as personal PII, and over-redaction of benign strings that match PII patterns (such as version numbers that resemble dates). Run the prompt through your evaluation harness with recall and precision metrics, and log every detection decision for auditability. If your latency budget is tight, consider pre-filtering with regex-based pattern matching for high-confidence categories like emails and phone numbers before invoking the LLM for contextual disambiguation.
Prompt Variables
Inputs the prompt needs to work reliably. Validate these before sending the request.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[MODEL_OUTPUT] | The raw text or structured payload from the model that may contain PII across multiple languages | {"summary": "Patient Jean Müller (geb. 12.03.1987) reported..."} | Must be non-empty string or valid JSON. Check for encoding issues in CJK, Arabic, or Cyrillic scripts before scanning. |
[TARGET_LOCALES] | List of locale codes indicating which language-specific PII patterns to activate | ["de-DE", "ja-JP", "ar-SA", "ru-RU"] | Must be valid BCP 47 locale codes. Empty array triggers universal patterns only. Validate against supported locale registry before sending. |
[PII_CATEGORIES] | Specific PII types to detect and redact, drawn from a controlled taxonomy | ["PERSON_NAME", "NATIONAL_ID", "PHONE", "EMAIL", "ADDRESS", "BANK_ACCOUNT"] | Each value must match an enum in the PII taxonomy. Unknown categories should cause pre-flight rejection, not silent skip. |
[REDACTION_STRATEGY] | How detected PII should be handled in the output | REPLACE_WITH_TYPE_LABEL | Must be one of: REPLACE_WITH_TYPE_LABEL, MASK_PARTIAL, REMOVE_ENTIRELY, or FLAG_ONLY. Invalid strategy should abort the request. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score for a PII match to trigger redaction, reducing false positives | 0.85 | Must be a float between 0.0 and 1.0. Values below 0.7 increase false positive risk; values above 0.95 increase false negative risk. Log all matches below threshold for audit. |
[CONTEXT_WINDOW] | Number of characters before and after a potential PII match to include for disambiguation | 150 | Must be a positive integer. Too small (under 50) reduces disambiguation accuracy for names shared with common words. Too large (over 500) increases latency and token cost. |
[OUTPUT_FORMAT] | Desired structure for the redacted output and accompanying audit metadata | FULL_PAYLOAD_WITH_AUDIT | Must be one of: REDACTED_TEXT_ONLY, FULL_PAYLOAD_WITH_AUDIT, or AUDIT_LOG_ONLY. FULL_PAYLOAD_WITH_AUDIT is required for compliance workflows. |
[EXEMPTION_LIST] | Strings or patterns that should never be redacted, even if they match PII patterns | ["test@example.com", "000-00-0000", "Sample Street 123"] | Each entry must be a non-empty string. Validate that exemption list does not contain real PII. Log all exemption matches for security review. |
Implementation Harness Notes
How to wire the multi-language PII detection prompt into a production application with validation, retries, logging, and human review.
This prompt is designed to operate as a post-generation safety net, sitting between the model's raw output and any downstream system—logs, databases, APIs, or user-facing surfaces. The implementation harness must treat the prompt as a stateless function: accept a text payload and a locale hint, return a structured detection result, and never allow unvalidated output to bypass the guard. Because PII detection is a high-risk workflow with regulatory implications, the harness must include mandatory validation of the model's JSON response, a retry loop for malformed outputs, and an escalation path for low-confidence detections that require human review.
Wire the prompt into your application as an async post-processing step. After the primary model generates text, pass the raw output to this detection prompt along with a [LOCALE] parameter derived from the user's language preference or the detected language of the content. Use a structured output API or a JSON mode flag to enforce the expected schema. Validate the response immediately: check that detected_pii is an array, each item has the required fields (type, value, start_index, end_index, confidence), and confidence scores are floats between 0.0 and 1.0. If validation fails, retry up to two times with an explicit error message appended to the prompt context. Log every detection event—including the redacted output, the detection summary, and the model version—to an append-only audit store. For detections with confidence below 0.85, route the output to a human review queue before allowing it to proceed. Never log the unredacted original text to observability systems; only the sanitized version and the detection metadata should enter logs.
Choose a fast, cost-efficient model for this detection step—the prompt is a classification and extraction task that does not require a large frontier model. A smaller model with strong JSON-following behavior and multilingual tokenization (such as Claude 3.5 Haiku, GPT-4o-mini, or a fine-tuned open-weight model) is appropriate. If your application processes streaming output, buffer chunks into sentence-level segments before calling the detector to balance latency against detection accuracy. Avoid running this prompt on every token of a long stream; instead, flush the buffer at natural boundaries like newlines or paragraph breaks. The next step after implementing this harness is to build a regression test suite with known PII examples across all supported languages and scripts, including CJK names, Arabic numerals, Cyrillic addresses, and Unicode homoglyph attacks, to ensure the detection pipeline does not degrade as you update models or prompt versions.
Expected Output Contract
Defines the strict JSON schema for the PII detection response. Each field must be validated before the output enters any downstream system, log, or database. Use this contract to build a post-processing validator that rejects malformed or incomplete responses.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
findings | Array of objects | Must be a JSON array. Reject if null, missing, or not an array. An empty array is valid and indicates no PII detected. | |
findings[].type | String enum: [NAME, EMAIL, PHONE, ADDRESS, ID_NUMBER, CREDIT_CARD, IP_ADDRESS, CREDENTIAL, URL_WITH_CREDS, OTHER] | Must match one of the specified enum values exactly. Reject the entire finding if the value is missing or invalid. | |
findings[].value | String | The exact substring from [INPUT_TEXT] that was flagged. Must be non-empty. Reject if null or empty string. Perform a substring existence check against the original input to prevent hallucinated values. | |
findings[].language | String (ISO 639-1 code) or null | If provided, must be a valid two-letter ISO 639-1 code. Set to null if the language cannot be determined. Reject if the value is a non-null string that does not match the code pattern. | |
findings[].confidence | Number (0.0 to 1.0) | Must be a float between 0.0 and 1.0 inclusive. Reject if out of range. Use this field to route low-confidence findings to a human review queue per [CONFIDENCE_THRESHOLD]. | |
findings[].redaction | String | The suggested redacted version of the text. Must not be identical to findings[].value. Reject if the redaction still contains the original PII value. A common pattern is a type-based mask like [REDACTED_EMAIL]. | |
findings[].start_index | Integer | The zero-based character index of the finding in [INPUT_TEXT]. Must be a non-negative integer. Reject if the substring at this index does not match findings[].value. | |
findings[].end_index | Integer | The zero-based character index immediately after the finding. Must be greater than start_index. Reject if the length does not match the value or if the slice is incorrect. |
Common Failure Modes
Multi-language PII detection fails in predictable ways. Script blindness, locale mismatch, and contextual false positives are the most common production breakages. Each card below pairs a specific failure with a concrete guardrail you can implement before deployment.
Script Blindness: CJK and Arabic Names Pass Through
What to watch: The model treats non-Latin scripts as opaque tokens, missing names, addresses, and IDs written in Chinese, Japanese, Korean, Arabic, or Cyrillic. A Japanese address or Arabic national ID can sail through undetected because the model relies on Latin-centric pattern matching. Guardrail: Include explicit script coverage instructions in the prompt—list CJK, Arabic, Cyrillic, and Devanagari as detection targets. Validate against a multilingual golden set containing at least one example per supported script.
Locale Mismatch: Wrong PII Patterns for the Language
What to watch: The model applies US-centric PII patterns (SSN format, 10-digit phone numbers) to non-US text. A French NIR number, German IBAN, or Brazilian CPF gets missed because the prompt didn't specify locale-aware detection rules. Guardrail: Pass the expected locale or language code as a prompt variable and include locale-specific PII format examples. Maintain a locale-to-pattern mapping that the prompt can reference for each target region.
Name Format Confusion: Family Name Order Reversal
What to watch: The model misidentifies or misses names in cultures where family name precedes given name (Chinese, Japanese, Korean, Hungarian). A full name like 'Tanaka Hiroshi' may be partially redacted or entirely missed because the model expects Western given-name-first order. Guardrail: Add explicit name format instructions per locale—specify family-name-first cultures and instruct the model to treat both orders as valid PII candidates. Test with name pairs that violate Western ordering assumptions.
Contextual False Positives: Benign Strings Flagged as PII
What to watch: The model over-redacts in multilingual contexts, treating common words, place names, or technical terms as PII. A Japanese place name like 'Tokyo' or a product code matching a phone number pattern gets stripped, corrupting the output. This spikes in languages where word boundaries are less explicit. Guardrail: Add a disambiguation step—require the model to score confidence and flag borderline cases for human review. Include a list of known false-positive patterns per locale and instruct the model to check against them before redacting.
Unicode Normalization Gaps: Encoded Variants Evade Detection
What to watch: PII encoded with Unicode variants (full-width characters, homoglyphs, zero-width joiners) bypasses detection because the model matches against canonical forms. A phone number written with full-width digits or an email using Cyrillic 'а' instead of Latin 'a' goes undetected. Guardrail: Pre-process inputs with Unicode normalization (NFKC) before PII detection. Include explicit instructions to treat visually similar characters across scripts as potential PII obfuscation attempts.
Mixed-Language Snippets: Code-Switched PII Leakage
What to watch: PII embedded in code-switched text—where a sentence mixes two languages—gets partially detected or entirely missed. An English email body containing a Thai national ID or a Spanish paragraph with an embedded German IBAN confuses single-language detection logic. Guardrail: Instruct the model to scan each segment independently by language, not assume the entire input follows one locale. Use language-detection pre-processing to segment mixed input before PII scanning.
Evaluation Rubric
How to test output quality before shipping. Run these checks against a golden dataset of 100+ examples covering all target locales.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Per-Locale PII Recall |
| Recall drops below 0.90 for any single locale; model misses locale-specific name formats or ID patterns | Run per-locale recall calculation using labeled golden set; flag any locale below threshold for prompt revision |
Cross-Script False Positive Rate | <= 0.05 false positive rate on benign non-PII strings across all scripts | Benign Unicode strings, test data, or sample IDs flagged as PII; false positive rate exceeds 0.08 | Inject 200+ benign strings spanning CJK, Arabic, Cyrillic, and Latin scripts; measure flag rate per script |
Redaction Completeness | 100% of detected PII fields fully masked with no partial exposure in output | Partial redaction where first/last characters leak; redacted output reconstructable from context | Parse redacted output and verify no PII substring from input remains unmasked; check edge cases like single-character names |
Structured Output Field Integrity | All non-PII fields preserved with original values; output schema matches input schema exactly | Non-PII fields altered, dropped, or reordered during redaction; schema mismatch after processing | Diff input and output JSON/XML schemas; verify field count, names, types, and non-PII values unchanged |
Locale-Specific Pattern Coverage | Correct detection of locale-specific PII: Japanese My Number, Arabic national ID, Cyrillic passport formats | Locale-specific PII format missed entirely; model only detects Anglo-centric patterns like SSN or email | Include 10+ locale-specific PII examples per target locale in golden set; verify detection per format |
Audit Trail Completeness | Every redaction produces a log entry with field path, PII category, confidence score, and action taken | Missing audit entries for redacted fields; null confidence scores; category labeled as 'unknown' | Parse audit log output; verify one entry per redacted field with non-null category and confidence; check JSON path accuracy |
Latency Budget Compliance | End-to-end detection and redaction completes within 2x baseline prompt latency at P95 | P95 latency exceeds 3x baseline; timeouts on long documents with multiple locales | Benchmark with 100 mixed-locale documents of varying length; measure P50/P95/P99 latency vs baseline no-redaction prompt |
Boundary Case Handling | Correct handling of mixed-script names, honorifics, multi-word surnames, and script-mixed identifiers | Model splits or misidentifies multi-word CJK names; treats honorifics as PII; fails on Arabic name prefixes | Include 30+ boundary cases in golden set: compound surnames, patronymics, script-mixed strings; verify per-case accuracy |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base detection template but relax strict schema requirements. Use a simple list output instead of a full JSON audit log. Focus on recall over precision—flag everything that looks like PII and let a human reviewer filter false positives.
- Replace the [OUTPUT_SCHEMA] placeholder with a simple markdown list:
- [PII_TYPE]: [DETECTED_VALUE] (Confidence: [HIGH/MEDIUM/LOW]) - Remove locale-specific pattern libraries and use only the universal PII categories (email, phone, credit card, SSN-like patterns)
- Set [CONSTRAINTS] to: "Flag anything that resembles PII. Err on the side of caution. Do not attempt contextual disambiguation."
Watch for
- High false positive rate on CJK and Arabic names that look like random strings
- Unicode normalization issues causing missed detections in right-to-left scripts
- No confidence scoring, so reviewers can't prioritize borderline cases

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us