GOSHUNCLE commited on
Commit
4612445
·
verified ·
1 Parent(s): 0b4b423

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -2
README.md CHANGED
@@ -62,12 +62,22 @@ Evaluated on 70 held-out Taiwan-style test cases:
62
  | JSON format accuracy | **100%** |
63
  | PII judgment accuracy | **98.6%** |
64
  | Entity recall | **100%** |
65
- | Mask accuracy (with rule-based post-processing) | **~100%** |
66
 
67
  The model produces correct PII values in 100% of cases. The included
68
  post-processing (`validate_and_fix_mask`) recomputes masks deterministically
69
  from the value, ensuring output masks are always character-accurate.
70
 
 
 
 
 
 
 
 
 
 
 
71
  ## Quick start
72
 
73
  ```bash
@@ -174,12 +184,22 @@ correspond to any real individuals.
174
  | JSON 格式正確率 | **100%** |
175
  | PII 判斷正確率 | **98.6%** |
176
  | 實體召回率 | **100%** |
177
- | 遮罩正確率(含規則式後處理) | **~100%** |
178
 
179
  模型在所有測試案例中皆能正確抽出 PII 原始值。內附的後處理函式
180
  (`validate_and_fix_mask`)會根據抽出的值重新計算遮罩,確保星號數量
181
  永遠正確。
182
 
 
 
 
 
 
 
 
 
 
 
183
  ## 快速使用
184
 
185
  ```bash
 
62
  | JSON format accuracy | **100%** |
63
  | PII judgment accuracy | **98.6%** |
64
  | Entity recall | **100%** |
65
+ | Mask accuracy (with included safeguards) | **~100%** |
66
 
67
  The model produces correct PII values in 100% of cases. The included
68
  post-processing (`validate_and_fix_mask`) recomputes masks deterministically
69
  from the value, ensuring output masks are always character-accurate.
70
 
71
+ ## Inference safeguards
72
+
73
+ The included `inference.py` applies two filters and one mask corrector:
74
+
75
+ - **Structural validation** — drops entities whose value shape doesn't match the claimed type (e.g., `BANK_ACCOUNT` value containing non-digits, or `ADDRESS` value lacking "號" or "樓")
76
+ - **Provenance check** — drops entities whose value doesn't verbatim appear in the input (rejects hallucinations and mistranslations)
77
+ - **Mask correction** — recomputes the `masked` field deterministically from `value`, guaranteeing correct star count
78
+
79
+ These guarantee output integrity even when the model occasionally misclassifies or fabricates.
80
+
81
  ## Quick start
82
 
83
  ```bash
 
184
  | JSON 格式正確率 | **100%** |
185
  | PII 判斷正確率 | **98.6%** |
186
  | 實體召回率 | **100%** |
187
+ | 遮罩正確率(含內建安全機制) | **~100%** |
188
 
189
  模型在所有測試案例中皆能正確抽出 PII 原始值。內附的後處理函式
190
  (`validate_and_fix_mask`)會根據抽出的值重新計算遮罩,確保星號數量
191
  永遠正確。
192
 
193
+ ## 推論安全機制
194
+
195
+ 內附的 `inference.py` 套用兩道過濾與一道遮罩修正:
196
+
197
+ - **結構驗證** — 丟棄 value 結構不符其宣稱類型的 entity(例如 `BANK_ACCOUNT` 含非數字字元、或 `ADDRESS` 缺「號」或「樓」)
198
+ - **來源驗證** — 丟棄 value 未逐字出現在原文中的 entity(擋幻覺與翻譯錯誤)
199
+ - **遮罩修正** — 從 value 確定性地重算 masked 欄位,保證星號數量精準
200
+
201
+ 這幾層確保即使模型偶有誤判或捏造,輸出仍然可信。
202
+
203
  ## 快速使用
204
 
205
  ```bash