FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Guides

Your masked LLM prompts may still be personal data

Vietnam's Decree 356 tightens transfers of sensitive data abroad, and a mapping table kept for convenience can mean a system no longer counts as de-identified.

ShareLinkedInFacebookX

In brief

  • Under Vietnam's Personal Data Protection Law 2025, de-identified data falls outside the scope of personal data, while data that has only been encrypted is still personal data.
  • Replacing names with labels such as PERSON_001 while keeping a mapping table to restore them only reduces exposure risk. As long as a route back to the real name exists, it is hard to call that de-identification, and the client's legal team should make the call.
  • The filter must block the request when the detector fails, and its miss rate must be measured on real Vietnamese data.
Table comparing three ways of masking personal data. Encryption: a way back remains, still personal data. Relabelling with a mapping table kept (highlighted): a way back remains, and it is hard to rule out that it is still personal data. True de-identification: no way back, no longer personal data.
Replacing names with labels such as PERSON_001 reduces risk. But while the table mapping back to real names remains, a system is hard to treat as de-identified; the final call rests with the client's lawyer. Source: Personal Data Protection Law 2025, Decree 356, as analysed in the article.

On January 1, 2026, Vietnam’s Decree 356 took effect, replacing Decree 13/2023 and changing the rules for anyone sending customer data to a model hosted abroad.

If sensitive data that has not been thoroughly de-identified still passes through an API hosted overseas, the decree applies stricter cross-border transfer procedures and requires encryption, anonymization or equivalent security measures.

Take an FDE in the first week at a financial client, assigned to build a feature that summarizes customer support tickets with an LLM. The best model runs behind an API in another country. At the review, the head of the legal team asks: “Do the names, phone numbers and passwords that customers read out to our agents leave Vietnam?”

Many engineers would answer that the team has masked everything. That answer holds up only if you know how far the masking goes, because the law draws a fairly sharp line between masking to reduce exposure and de-identification. The gap between the two determines how many obligations the client still carries.

When does masked data stop being personal data?

Start with the definition. Vietnam’s Personal Data Protection Law 2025 defines personal data as information that identifies a specific person or helps to identify that person. The “helps to identify” part matters most: delete the name but keep “teacher, Hoi An branch, born in 1990” and a reader may still be able to trace exactly one person.

The law also offers a clear way out. It no longer treats de-identified data as personal data, with de-identification understood as altering or deleting information to produce a new dataset that no longer points to anyone.

Decree 356 itself requires data to be de-identified before it is traded on a data exchange, so this is a measure the law formally recognizes.

Engineers tend to trip in two places. Under the law, encrypted data is still personal data, so encryption is no way out.

Article 14, clause 6, meanwhile, prohibits re-identifying data that has been de-identified, which means genuine de-identification has to be a one-way street. A pipeline that needs to put real names back into the LLM’s answer is hard to place in de-identified territory from the outset.

Approach Example Under the law
Encryption Sending the ciphertext of a phone number Still personal data
Label replacement, mapping table kept PERSON_001 ↔ “Nguyen Thi Lan” Reduces risk, but a route back to the real name remains, so it is hard to treat as de-identification
Genuine de-identification Deleting the name and the details that allow identity to be inferred, with no way back No longer personal data

Wavect’s analysis of GDPR reaches a similar conclusion about the middle row: renaming someone PERSON_001 helps reduce the risk of exposure, but the processing flow remains within the scope of GDPR.

Treat that as a signal to be cautious rather than a legal conclusion for Vietnam. Which row applies to the client’s system is for its lawyers to decide. Your job is to help them see clearly which row the system is in.

A ticket goes through the filter

Consider a hypothetical ticket:

Ms. Nguyen Thi Lan, phone 0912345678, teacher in Hoi An, reports being unable to log in to her electronic identification account, old password is Lan@1990.

It contains four kinds of information to deal with. The name and phone number are the easiest to spot. Decree 356 classes the password to an electronic identification account as sensitive data, so catching it is a priority. The phrase “teacher in Hoi An” does not point to anyone directly but can help identify the person.

To summarize the ticket, the LLM needs to know only the type of incident. The desired output can therefore be as simple as this:

[USER], phone [PHONE], [OCCUPATION] in [LOCATION], reports being unable to log in to their electronic identification account, old password is [SECRET].

There are no sequence numbers here and no mapping table. The internal system still returns the result to the right person through the ticket ID, which the LLM never sees.

But be candid: the ticket ID is also a link back to the user. This approach sharply reduces the amount of information that goes out without making the whole system genuinely de-identified, and you should describe it to the client in those terms.

Below is a sketch of the skeleton. The regexes are only examples, and you must adapt them to the format of the client’s real data:

import re

RULES = [
    ("SECRET", r"((old|new)\s+)?(password|passcode|pw)\s*(is|:)\s*\S+"),
    ("PHONE", r"\b0\d{9}\b"),
    ("EMAIL", r"[\w.+-]+@[\w-]+\.[\w.]+"),
]

class PIIFilterError(Exception):
    pass

def redact(text: str, ner) -> str:
    for label, pattern in RULES:
        text = re.sub(pattern, f"[{label}]", text, flags=re.IGNORECASE)
    # People's names, places, occupations: needs an NER model (e.g. Presidio + a Vietnamese model)
    for span in sorted(ner(text), key=lambda s: -s.start):
        text = text[:span.start] + f"[{span.label}]" + text[span.end:]
    return text

def build_prompt(ticket: str, ner) -> str:
    try:
        clean = redact(ticket, ner)
    except Exception as e:
        # Fail closed: if the filter breaks, send NOTHING out
        raise PIIFilterError("PII filter unavailable") from e
    return f"Summarize the following incident:\n{clean}"

The except block matters most. Wavect advises that a filter should never silently “fail open” just because the detector is slow or down. In practice, trouble often starts with a line such as “on timeout, just send the original so users aren’t affected.”

You have to measure the detector yourself

Microsoft Presidio is an open-source library that makes a reasonable detection layer, because it can identify and anonymize private entities in both text and images.

Yet Presidio’s own introduction page says there is no guarantee the library will find all sensitive information. With Vietnamese names that are typed without diacritics, abbreviated or misspelled, you cannot predict how much it will miss.

Before going to production, Wavect therefore recommends measuring on the client’s own data: the miss rate, task quality, latency, and how the filter handles text that mixes Vietnamese and English.

Suppose, for illustration, that you hand-label 200 tickets and count 412 entities to mask, of which the filter catches 375. Recall is 375/412, or about 91%, which means 37 pieces of personal data still go out.

A figure of 91% sounds high, but with thousands of tickets a day, a great many pieces of data still slip through daily. Break the results down by entity type, because missing a password is far more serious than missing the name of a district. Each time you add a rule or change the model, rerun this test set as you would a regression test.

Five steps at the client

Step one: sit down with the client to classify the data. You need to know which fields are sensitive under Decree 356 and what the LLM’s task actually requires. Most summarization and classification tasks do not need people’s names.

Step two: build a layered filter. Regex handles anything structured, while NER handles names, places and occupations. Step three: wrap the LLM call in a fail-closed mechanism and log every time a request is blocked.

Step four: measure recall on labeled data, broken down by entity type. Step five: write a one-page description of the data flow, stating which row of the table above the system is in and which links back remain, then hand it to the legal team for a decision.

Masking the data does not end the obligations. The law lists encryption, decryption and de-identification as personal data processing activities, so the masking step itself, running on the client’s infrastructure, must comply like any other processing step.

Common mistakes

The most common mistake is masking direct identifiers while overlooking details that help identify someone. Next comes treating encryption or reversible tokens as de-identification.

The third mistake is closely related: keeping a placeholder ↔ real name mapping table, then telling the client the data has been de-identified.

Read together, the “helps to identify” definition, the rule that encrypted data is still personal data and the ban on re-identification make it hard to regard a setup with a route back to real names as de-identified.

The final conclusion belongs to the client’s lawyers, but they must be told that the mapping table exists.

Two more mistakes remain. One is testing the filter only with the sample English sentences in the documentation. The other is assuming the filter will always be running.

How to put this skill on your CV

“Used Presidio” is too thin. Say that you measured PII masking recall on Vietnamese data and designed a fail-closed mechanism, with the numbers if you have them.

When you read the job description for an FDE role, phrases such as “data residency,” “PII” or “compliance review” are signs that the employer needs this skill.

This week’s exercise

Take the sample ticket above and write 20 more variants, such as text in Vietnamese without diacritics, abbreviations, phone numbers with dots or a password that follows the word “pass.” Run them through your filter and count how many entities get through. That number is what you need to take into the meeting with the legal team.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
5 sources
Read next on the roadmap · Stage 5: DeploymentRabbitMQ forgets your queued jobs on a crash unless told otherwiseAn evening spent on durable queues, safe workers and an HTTP 202 API keeps minutes-long model calls from timing out or vanishing.