Imagine a support team that replaces names, phone numbers and equipment codes with one placeholder before sending tickets to an LLM. The model can read them but cannot tell which records refer to the same customer or machine.
PII redaction is the process of finding personally identifiable information in text, such as names, phone numbers and ID numbers, and removing or replacing that information before the text is stored, shared or sent to an AI model. How a team replaces each value affects whether the model can still perform the intended task.
Adapted from “Data Masking for AI: Can the Model Still Do the Job?” by Minchan Chung, Co-Founder and Co-CEO of CUBIG, on the CUBIG Tech Blog (November 2026).
Key takeaways
- Teams need to measure how accurately they detect sensitive information separately from how they replace it.
- Replacement formats affect whether an LLM can distinguish values, identify their types and connect related records.
- A restorable mapping cannot correct an answer when the model selects the wrong item or makes a judgment based on changed facts.
- Teams should compare model performance on original and redacted documents before using redacted data in an AI workflow.
What does PII redaction for LLMs involve?
Teams that prepare text for an LLM have to solve two separate problems. First, they must identify which parts of the text contain sensitive information. Second, they must decide how to replace those values without removing the information the model needs to complete its task.
The OWASP Top 10 for LLM Applications 2025 lists sensitive information disclosure as a risk for applications that use LLMs: models can expose sensitive data, proprietary algorithms or confidential details through their output. OWASP recommends data sanitization, including scrubbing or masking sensitive content before it is used in training, and lists pattern matching to detect and redact confidential content before processing.
Detecting sensitive information becomes difficult when documents follow different formats or describe similar information in different ways. Garza, Kotal and their co-authors address this problem in PRvL, published in August 2025. The researchers describe redacting PII from unstructured text as critical to data privacy and say earlier rule-based and domain-specific named entity recognition approaches fail to generalize across formats and contexts. They evaluate LLMs on redaction performance, semantic preservation and PII leakage, and release an open-source suite of fine-tuned models and evaluation tools.
Detection quality tells a team whether its method found the sensitive values it intended to remove. Replacement quality tells the team whether the resulting text still contains the distinctions and relationships the model needs. A detection method can find every intended value while a replacement method still removes the information needed to answer a question, so teams measure the two separately.
How do PII redaction methods differ?
Different replacement methods give the model different information about the values a team removes. Some methods conceal the original value without keeping its identity. Others provide a substitute that lets the model tell one item from another or recognize what kind of information the item represents.
| Method | Example | Can the original be restored? | What the model can still tell |
|---|---|---|---|
| Plain masking | *** | No | Nothing about the value |
| Opaque or hash code | 96dcb10b8009 | Yes, with a mapping | Which values repeat, but not their type |
| Typed label | [PHONE_A] | Yes, with a mapping | The type of value and which item it is |
| Original text | 010-1234-5678 | Not redacted | Everything |
Teams should assign the same label to the same entity across a document so the model can link related records.
Consider a support ticket that mentions several phone numbers. When a team replaces every number with identical asterisks, the replacement itself carries no information about which number appears in each record. An opaque code gives each value a distinct identifier, so the model can recognize a repeated value, but the code does not say whether it stands for a phone number, a name or another identifier. A typed label keeps both: the model can tell [PHONE_A] from [PHONE_B] and recognize that both are phone numbers.
What did CUBIG’s benchmark show about replacement formats?
The CUBIG Korean PII Replacement Benchmark (2026) used 500 Korean OpenPII documents and 500 Korean KDPII dialogues (revised release; dataset paper in IEEE Access, 2024). The results page calls the conditions typed entity tokens and hash tokens, and the benchmark used Korean labels such as [전화번호_A]. Every redaction method hid the same PII positions, set in advance, so only the replacement format varied among them; the original-text reference reused an earlier, separate run.
In the CUBIG benchmark, one answering model ran once per method and listed every identifier; document-level F1 counted missed and wrong values. Documents: typed label 99.3, original text 98.0, hash code 76.7, plain masking 0. Dialogues: typed label 96.3, original text 96.3, hash code 67.4, plain masking 0. Both label and code methods restored original values after the answer. In the documents, the typed label scored slightly above the original text; the results page says this is likely because the label points to the target and does not mean replacement makes answers better than the original.

In this one-model, one-run test from CUBIG’s 2026 benchmark, the hash-code results point to the limit of keeping identity without type: the model had distinct substitutes, and the team could restore them after the answer, but the substitutes told the model less about what each value was.
CUBIG states that the typed-label condition reproduces the replacement principle of LLM Capsule and is not a score of the LLM Capsule product. The benchmark did not test detection accuracy, and plain masking scored 0 partly because the task required answering with the original value. The results apply to the extraction task and conditions CUBIG used, and do not show that the same format will produce equally accurate summaries, recommendations or judgments.
Why doesn’t a restorable mapping guarantee a correct answer?
A mapping lets a team recover an original value after the model produces an answer. The mapping cannot decide whether the model selected the correct value in the first place.
Minchan Chung makes this point in his CUBIG Tech Blog post. Both the label and code methods in the benchmark had mappings that allowed the team to restore original values, yet the model still had to pick the right substitute. If an answer requires Phone number A and the model selects Phone number B, restoration returns the original value of Phone number B. The mapping works as intended, and the application still receives a wrong answer.

Teams also need to separate information they must conceal from facts the model needs to evaluate. Amounts, dates and times can decide which conclusion the model reaches. If a task compares amounts across records and the replacement process changes those amounts, the model may reach a different conclusion, and restoring a customer name afterward cannot correct a judgment made on a changed amount.
What should a team check before using PII redaction with an LLM?
Before introducing redacted text into an AI workflow, a team can define the task, identify the information the task requires and decide how it will measure answer quality:
- Measure detection separately. List the sensitive values the redaction process should find and check which ones it misses, so the team can tell detection failures from failures that happen after replacement.
- Keep the type and identity of each value. Choose a replacement format that keeps the distinctions the model needs, use the same label for repeated references to the same entity, and check whether the model can still connect records about the same customer or machine. CUBIG’s glossary entry on data masking explains the term.
- Keep the facts the task depends on. Identify whether the model needs real amounts, dates or times to produce a correct answer, and preserve them when the task depends on them and the company permits their use.
- Keep mapping and restoration inside the company. Keep the records that connect substitutes to original values within the company, perform restoration there and record which replacement rules were applied. A provider’s zero data retention arrangement is a separate question and does not show whether a replacement keeps what the task needs.
- Compare task accuracy before and after redaction. Run the task on original and redacted documents with the same model and settings, compare the answers after restoration, and look for missed identifiers, wrong items and changed conclusions.
Teams get the most useful results from documents that reflect the work their applications perform: if the task connects support records, the evaluation checks those connections; if it compares dates or amounts, the evaluation checks the judgment.
Teams deciding which work stays on a local model and which goes to a frontier model can start with CUBIG’s guide on which work belongs on a local LLM.
Where does LLM Capsule fit beyond PII redaction for LLMs?
CUBIG’s LLM Capsule replaces sensitive or controlled values, from names and phone numbers to internal codes and contract references, with context-preserving substitutes before the text reaches the model. After the model responds, LLM Capsule restores the original values so the result can be used in the work. CUBIG’s Korean PII Replacement Benchmark reproduces this replacement principle under the stated extraction task and conditions; it does not score the LLM Capsule product.
CUBIG still has to check, in each customer’s own data and systems, that the connections between values, substitutes and restored responses work as intended, and each customer’s own rules decide which data may leave the company.
Redaction choices depend on the task: if it relies on particular values, identities or relationships, the team picks a method that keeps that information. Test the chosen method on your own documents before relying on the model’s answers in an operational workflow.
CUBIG Shorts
Where LLM Capsule Sits in Your Workflow
A short clip from CUBIG on The Ravit Show.
If your team sends customer records or other sensitive values to an AI model, see how LLM Capsule fits.
