gabriellarson commited on
Commit
37fb9dc
·
verified ·
1 Parent(s): 72f64e6

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -0
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ base_model:
4
+ - eternisai/Anonymizer-4B
5
+ ---
6
+ # Model Card for eternisai/Anonymizer-4B
7
+ SLMs for semantically similar replacement of PII to provide better end-user privacy.
8
+ ### Model description
9
+
10
+ The **Anonymizer-4B** is the strongest model in the Enchanted anonymizer series. Effectively matching GPT-4.1 while being thousands of times smaller.
11
+
12
+ It is the most accurate variant available and powers advanced anonymization in [Enchanted](http://link.freysa.ai/appstore).
13
+
14
+ ## Intended use
15
+
16
+ * **Primary use**: High-accuracy anonymizer inside Enchanted.
17
+ * **Secondary use**: Deployments where top-quality anonymization is critical (enterprise, research).
18
+
19
+ ## Training details
20
+
21
+ * **Base**: Qwen3-4B.
22
+ * **Data**: ~30k samples covering PII replacement + non-replacement categories.
23
+ * **Method**: Supervised fine-tuning → GRPO with GPT-4.1 as judge.
24
+ * **Score**: 9.55/10 on anonymization quality.
25
+ * **Latency**: <250ms TTFT, <2s full completion (quantized).
26
+
27
+ ## Limitations
28
+
29
+ * Largest model in the series, not suitable for mobile inference as of August 2025.
30
+ * Requires MacBook-class hardware or above for real-time use.
31
+
32
+ ## Usage example
33
+
34
+ ```json
35
+ <tool_call>
36
+ {"name": "replace_entities", "arguments": {"replacements": [
37
+ {"original": "Marc", "replacement": "Robert"},
38
+ {"original": "cloud infrastructure", "replacement": "enterprise software"}
39
+ ]}}
40
+ </tool_call>
41
+ ```
42
+
43
+ ## Usage prompt template
44
+
45
+ The models expect input in this specific format:
46
+
47
+ ```
48
+ [BEGIN OF TASK INSTRUCTION]
49
+ You are an anonymizer. Your task is to identify and replace personally identifiable information (PII) in the given text.
50
+ Replace PII entities with semantically equivalent alternatives that preserve the context needed for a good response.
51
+ If no PII is found or replacement is not needed, return an empty replacements list.
52
+ REPLACEMENT RULES:
53
+ • 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.).
54
+ • 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).
55
+ • Projects / codenames / internal tools: Always replace with a neutral two-word alias of similar length.
56
+ • 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.
57
+ • 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.
58
+ • Identifiers: (emails, phone #s, IDs, URLs, account #s) Always replace with format-valid dummies; keep domain class (.com big-tech, .edu, .gov).
59
+ • Monetary values: Replace personal income, invoices, bids by × [0.8 – 1.25] to keep order-of-magnitude. Keep public list prices & market caps.
60
+ • Quotes / text snippets: If the quote contains PII, swap only the embedded tokens; keep the rest verbatim.
61
+ [END OF TASK INSTRUCTION]
62
+ [BEGIN OF AVAILABLE TOOLS]
63
+ [{"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"]}}}]
64
+ [END OF AVAILABLE TOOLS]
65
+ [BEGIN OF FORMAT INSTRUCTION]
66
+ Use the replace_entities tool to specify replacements. Your response must use the tool call wrapper format:
67
+ <|tool_call|>{"name": "replace_entities", "arguments": {"replacements": [{"original": "PII_TEXT", "replacement": "ANONYMIZED_TEXT"}, ...]}}</|tool_call|>
68
+ If no replacements are needed, use:
69
+ <|tool_call|>{"name": "replace_entities", "arguments": {"replacements": []}}</|tool_call|>
70
+ Remember to wrap your entire tool call in <|tool_call|> and </|tool_call|> tags.
71
+ [END OF FORMAT INSTRUCTION]
72
+ [BEGIN OF QUERY]
73
+ Your text to anonymize goes here
74
+ [END OF QUERY]
75
+ ```