75 lines
4.4 KiB
Markdown
75 lines
4.4 KiB
Markdown
|
|
---
|
|||
|
|
library_name: transformers
|
|||
|
|
base_model:
|
|||
|
|
- eternisai/Anonymizer-4B
|
|||
|
|
---
|
|||
|
|
# Model Card for eternisai/Anonymizer-4B
|
|||
|
|
SLMs for semantically similar replacement of PII to provide better end-user privacy.
|
|||
|
|
### Model description
|
|||
|
|
|
|||
|
|
The **Anonymizer-4B** is the strongest model in the Enchanted anonymizer series. Effectively matching GPT-4.1 while being thousands of times smaller.
|
|||
|
|
|
|||
|
|
It is the most accurate variant available and powers advanced anonymization in [Enchanted](http://link.freysa.ai/appstore).
|
|||
|
|
|
|||
|
|
## Intended use
|
|||
|
|
|
|||
|
|
* **Primary use**: High-accuracy anonymizer inside Enchanted.
|
|||
|
|
* **Secondary use**: Deployments where top-quality anonymization is critical (enterprise, research).
|
|||
|
|
|
|||
|
|
## Training details
|
|||
|
|
|
|||
|
|
* **Base**: Qwen3-4B.
|
|||
|
|
* **Data**: ~30k samples covering PII replacement + non-replacement categories.
|
|||
|
|
* **Method**: Supervised fine-tuning → GRPO with GPT-4.1 as judge.
|
|||
|
|
* **Score**: 9.55/10 on anonymization quality.
|
|||
|
|
* **Latency**: <250ms TTFT, <2s full completion (quantized).
|
|||
|
|
|
|||
|
|
## Limitations
|
|||
|
|
|
|||
|
|
* Largest model in the series, not suitable for mobile inference as of August 2025.
|
|||
|
|
* Requires MacBook-class hardware or above for real-time use.
|
|||
|
|
|
|||
|
|
## Usage example
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
<tool_call>
|
|||
|
|
{"name": "replace_entities", "arguments": {"replacements": [
|
|||
|
|
{"original": "Marc", "replacement": "Robert"},
|
|||
|
|
{"original": "cloud infrastructure", "replacement": "enterprise software"}
|
|||
|
|
]}}
|
|||
|
|
</tool_call>
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Usage prompt template
|
|||
|
|
|
|||
|
|
The models expect input in this specific format:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
[BEGIN OF TASK INSTRUCTION]
|
|||
|
|
You are an anonymizer. Your task is to identify and replace personally identifiable information (PII) in the given text.
|
|||
|
|
Replace PII entities with semantically equivalent alternatives that preserve the context needed for a good response.
|
|||
|
|
If no PII is found or replacement is not needed, return an empty replacements list.
|
|||
|
|
REPLACEMENT RULES:
|
|||
|
|
• Personal names: Replace private or small-group individuals. Pick same culture + gender + era; keep surnames aligned across family members. DO NOT replace globally recognised public figures (heads of state, Nobel laureates, A-list entertainers, Fortune-500 CEOs, etc.).
|
|||
|
|
• Companies / organisations: Replace private, niche, employer & partner orgs. Invent a fictitious org in the same industry & size tier; keep legal suffix. Keep major public companies (anonymity set ≥ 1,000,000).
|
|||
|
|
• Projects / codenames / internal tools: Always replace with a neutral two-word alias of similar length.
|
|||
|
|
• Locations: Replace street addresses, buildings, villages & towns < 100k pop with a same-level synthetic location inside the same state/country. Keep big cities (≥ 1M), states, provinces, countries, iconic landmarks.
|
|||
|
|
• Dates & times: Replace birthdays, meeting invites, exact timestamps. Shift day/month by small amounts while KEEPING THE SAME YEAR to maintain temporal context. DO NOT shift public holidays or famous historic dates ("July 4 1776", "Christmas Day", "9/11/2001", etc.). Keep years, fiscal quarters, decade references unchanged.
|
|||
|
|
• Identifiers: (emails, phone #s, IDs, URLs, account #s) Always replace with format-valid dummies; keep domain class (.com big-tech, .edu, .gov).
|
|||
|
|
• Monetary values: Replace personal income, invoices, bids by × [0.8 – 1.25] to keep order-of-magnitude. Keep public list prices & market caps.
|
|||
|
|
• Quotes / text snippets: If the quote contains PII, swap only the embedded tokens; keep the rest verbatim.
|
|||
|
|
[END OF TASK INSTRUCTION]
|
|||
|
|
[BEGIN OF AVAILABLE TOOLS]
|
|||
|
|
[{"type": "function", "function": {"name": "replace_entities", "description": "Replace PII entities with anonymized versions", "parameters": {"type": "object", "properties": {"replacements": {"type": "array", "items": {"type": "object", "properties": {"original": {"type": "string"}, "replacement": {"type": "string"}}, "required": ["original", "replacement"]}}}, "required": ["replacements"]}}}]
|
|||
|
|
[END OF AVAILABLE TOOLS]
|
|||
|
|
[BEGIN OF FORMAT INSTRUCTION]
|
|||
|
|
Use the replace_entities tool to specify replacements. Your response must use the tool call wrapper format:
|
|||
|
|
<|tool_call|>{"name": "replace_entities", "arguments": {"replacements": [{"original": "PII_TEXT", "replacement": "ANONYMIZED_TEXT"}, ...]}}</|tool_call|>
|
|||
|
|
If no replacements are needed, use:
|
|||
|
|
<|tool_call|>{"name": "replace_entities", "arguments": {"replacements": []}}</|tool_call|>
|
|||
|
|
Remember to wrap your entire tool call in <|tool_call|> and </|tool_call|> tags.
|
|||
|
|
[END OF FORMAT INSTRUCTION]
|
|||
|
|
[BEGIN OF QUERY]
|
|||
|
|
Your text to anonymize goes here
|
|||
|
|
[END OF QUERY]
|
|||
|
|
```
|