Distil-PII-Llama-3.2-1B-Instruct

A small language model (SLM) fine-tuned by Distil Labs for policy-aware PII redaction that outputs a single JSON object with redacted_text and entities. Optimized to run locally with strong accuracy and strict schema adherence.

Model Details

  • Developed by: Distil Labs GmbH
  • License: Llama 3.2 Community License Agreement
  • Finetuned from: meta-llama/Llama-3.2-1B-Instruct

Intended Use & Limitations

  • Use cases: Redacting support chats, logs, tickets, transcriptsβ€”removing identity while preserving ops signals (IDs last-4, order numbers, etc.).
  • Out of scope: Legal or compliance advice; languages beyond English (generalization not guaranteed); domain-specific IDs unseen in training.

Input & Output

Input: A plain-text prompt with task instruction + context. Output (JSON only):

{
  "redacted_text": "Text with in-place tokens",
  "entities": [
    {"value": "<original>", "replacement_token": "[TOKEN]", "reason": "<why>"}
  ]
}

Tokens: [PERSON] [EMAIL] [PHONE] [ADDRESS] [SSN] [ID] [UUID] [CARD_LAST4:####] [IBAN_LAST4:####] [GENDER] [AGE] [RACE] [MARITAL_STATUS]

Training

Instruction-tuned on a compact policy spec + ~20 curated examples emphasizing exact JSON schema, minimal in-place edits, and entity correctness.

Evaluation

Judged by a frontier LLM using a deterministic rubric: JSON-only, schema validity, redacted_text exact match, and set-equality of (value, replacement_token) pairs (reason/order ignored). Score: 0.82 Β± 0.03.

How to Use

Details of deployment can be found in docs. Deploy the model using vllm or ollama (-gguf version available in this collection) and use the following snippet to get results

SYSTEM_PROMPT = """
You are a problem solving model working on task_description XML block:
<task_description>
Produce a redacted version of texts, removing sensitive personal data while preserving operational signals. The model must return a single json blob with:

* **redacted_text** is the input with minimal, in-place replacements of redacted entities.
* **entities** as an array of objects with exactly three fields {value: original_value, replacement_token: replacement, reason: reasoning}.

## What to redact (β†’ replacement token)

* **PERSON** β€” customer/patient/person names (first/last/full; identifying initials) β†’ `[PERSON]`
* **EMAIL** β€” any email, including obfuscated `name(at)domain(dot)com` β†’ `[EMAIL]`
* **PHONE** β€” any international/national format (separators/emoji bullets allowed) β†’ `[PHONE]`
* **ADDRESS** β€” street + number; full postal lines; apartment/unit numbers β†’ `[ADDRESS]`
* **SSN** β€” US Social Security numbers β†’ `[SSN]`
* **ID** β€” national IDs (PESEL, NIN, Aadhaar, DNI, etc.) when personal β†’ `[ID]`
* **UUID** β€” person-scoped system identifiers (e.g., MRN/NHS/patient IDs/customer UUIDs) β†’ `[UUID]`
* **CREDIT_CARD** β€” 13–19 digits (spaces/hyphens allowed) β†’ `[CARD_LAST4:####]` (keep last-4 only)
* **IBAN** β€” IBAN/bank account numbers β†’ `[IBAN_LAST4:####]` (keep last-4 only)
* **GENDER** β€” self-identification (male/female/non-binary/etc.) β†’ `[GENDER]`
* **AGE** β€” stated ages (β€œI’m 29”, β€œage: 47”, β€œ29 y/o”) β†’ `[AGE_YEARS:##]`
* **RACE** β€” race/ethnicity self-identification β†’ `[RACE]`
* **MARITAL_STATUS** β€” married/single/divorced/widowed/partnered β†’ `[MARITAL_STATUS]`


## Keep (do not redact)

* Card **last-4** when only last-4 is present (e.g., β€œending 9021”, β€œβ€’β€’β€’β€’ 9021”).
* Operational IDs: order/ticket/invoice numbers, shipment tracking, device serials, case IDs.
* Non-personal org info: company names, product names, team names.
* Cities/countries alone (redact full street+number, not plain city/country mentions).

## Output schema (exactly these fields)
* **redacted_text** The original text with all the sensitive information replaced with redacted tokens
* **entities** Array with all the replaced elements, each element represented by following fields
  * **replacement_token**: one of `[PERSON] | [EMAIL] | [PHONE] | [ADDRESS] | [SSN] | [ID] | [UUID] | [CREDIT_CARD] | [IBAN] | [GENDER] | [AGE] | [RACE] | [MARITAL_STATUS]`
  * **value**: original text that was redacted
  * **reason**: brief string explaining the rule/rationale

for example
{
  "redacted_text": "Hi, I'm [PERSON] and my email is [EMAIL].",
  "entities": [
    { "type": "PERSON", "value": "John Smith", "reason": "person name"},
    { "type": "EMAIL", "value": "[email protected]", "reason": "email"},
  ]
}
</task_description>
You will be given a single task with context in the context XML block and the task in the question XML block
Solve the task in question block based on the context in context block.
Generate only the answer, do not generate anything else
"""

PROMPT_TEMPLATE = """

Now for the real task, solve the task in question block based on the context in context block.
Generate only the solution, do not generate anything else
<context>
{context}
</context>
<question>Redact provided text according to the task description and return redacted elements.</question>
"""

from openai import OpenAI

PORT = "PORT GOES HERE"  # 8000 for vllm, 11434 for ollama
MODEL_NAME = "NAME USED FOR SETTING UP THE CLIENT"
TEXT_TO_REDACT = "NI number AB123456C confirmed."

client = OpenAI(base_url=f"http://127.0.0.1:{PORT}/v1", api_key="EMPTY")
chat_response = client.chat.completions.create(
    model=MODEL_NAME,
    messages=[
        {"role": "system", "content": SYSTEM_PROMPT},
        {"role": "user", "content": PROMPT_TEMPLATE.format(context=TEXT_TO_REDACT)},
    ],
    temperature=0,
)

Risks & Mitigations

  • False negatives/positives: May miss novel formats or over-redact generic terms. Mitigate via guardrails + post-validation.
  • Policy drift: Keep task preamble fixed; monitor with unit tests.

Model Sources

Downloads last month
21
GGUF
Model size
1B params
Architecture
llama
Hardware compatibility
Log In to view the estimation

We're not able to determine the quantization variants.

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for distil-labs/Distil-PII-Llama-3.2-1B-Instruct-gguf

Quantized
(306)
this model

Collection including distil-labs/Distil-PII-Llama-3.2-1B-Instruct-gguf