Sub topic 7
Thresholds and Tuning: False Positives Versus Missed Matches
This chapter assumes you have read the previous chapter on name matching. You should know that a matching function returns a similarity score, and you should be able to read short Python functions. You do not need statistics beyond counting and dividing.
What a threshold does
A matching function turns two names into a number. In the examples in this tutorial, that number runs from 0.0 (nothing in common) to 1.0 (identical after normalization). A threshold is the cutoff. Any pair that scores at or above it creates an alert, which is a case a person must review. Any pair below it is dropped without review.
Two points follow from this.
- The score is not a probability. A score of 0.90 does not mean a 90% chance of a true match. It means the two strings are similar by one particular measure. Whether 0.90 is rare or common depends on your customer population, the list, and the algorithm.
- The threshold is a policy decision. It decides how many potential matches your analysts see and which ones nobody sees. Treat it as a documented risk decision, not a technical default.
The two kinds of error
Every threshold produces two kinds of mistakes.
| Outcome | What happened | Typical cost |
|---|---|---|
| False positive | An alert was raised for someone who is not the listed party | Analyst time, delayed onboarding or payments, customer friction |
| False negative (missed match) | A true match scored below the threshold and was never reviewed | Possible sanctions violation, regulatory penalty, reputational damage |
| True positive | An alert was raised for a real match | Triggers the response process |
| True negative | No alert, and none was needed | None |
The costs are not symmetric. In many jurisdictions, dealing with a sanctioned party can be a violation whether or not the firm knew. A missed match can therefore be far more costly than thousands of false positives. This is why screening programs accept very high false-positive rates. Alert-to-true-match ratios of hundreds to one are common in practice.
The asymmetry does not mean you should set the threshold as low as possible. A very low threshold floods analysts, and tired reviewers make mistakes. A flood of alerts can cause a true match to be cleared by accident, which is the same failure you were trying to prevent.
Two ratios are useful.
- Recall is the share of true matches that your threshold catches: true positives divided by (true positives plus false negatives). You want this to be effectively 1.0 on the cases you can measure.
- Precision is the share of alerts that are true matches: true positives divided by (true positives plus false positives). This is usually very low in sanctions screening, and that is expected.
Tuning means keeping recall at the level your risk appetite requires while reducing avoidable false positives.
Measuring the trade-off with labeled data
You cannot choose a threshold by intuition. You need a labeled test set: pairs of a customer-style name and a list-style name, each marked as a true match or not. Build it from three sources:
- Historical alerts with their recorded dispositions.
- Known true matches, including the tricky ones (transliteration variants, reordered names, nicknames, missing middle names).
- Deliberately confusing non-matches, such as common surnames and names that differ by one letter.
The script below reuses the normalization and token-sort scoring from earlier chapters. It sweeps a range of thresholds over a small labeled set and prints the counts at each one.
import re
import unicodedata
from difflib import SequenceMatcher
def normalize(name: str) -> str:
decomposed = unicodedata.normalize("NFKD", name)
no_accents = "".join(c for c in decomposed if not unicodedata.combining(c))
no_punct = re.sub(r"[^\w\s]", " ", no_accents.casefold())
return " ".join(no_punct.split())
def token_sort_score(a: str, b: str) -> float:
ta = " ".join(sorted(normalize(a).split()))
tb = " ".join(sorted(normalize(b).split()))
return SequenceMatcher(None, ta, tb).ratio()
# (customer name, listed name, is_true_match)
LABELED_PAIRS = [
("Mohammed Al-Sayed", "Al Sayed, Mohamed", True),
("Viktor Petrov", "Victor Petrow", True),
("Ali Hassan", "Hassan Ali", True),
("Jose OBrien", "José O'Brien", True),
("Jane Doe", "Mohammed Al-Sayed", False),
("Maria Garcia", "Mario Garcia", False),
("John Smith", "Jon Smythe", False),
("Anna Petrova", "Viktor Petrov", False),
]
def sweep(pairs, thresholds):
scored = [(token_sort_score(a, b), truth) for a, b, truth in pairs]
positives = sum(1 for _, truth in scored if truth)
print("threshold alerts true_hits missed recall")
for t in thresholds:
alerts = [truth for score, truth in scored if score >= t]
true_hits = sum(alerts)
missed = positives - true_hits
recall = true_hits / positives if positives else 0.0
print(f"{t:9.2f} {len(alerts):6d} {true_hits:9d} {missed:6d} {recall:6.2f}")
sweep(LABELED_PAIRS, [0.95, 0.90, 0.85, 0.80, 0.75, 0.70])Read the output from the top down. As the threshold falls, the alert count rises, and recall rises until it reaches 1.0. The threshold you want is usually the highest one at which recall on your hard cases is acceptable. Raising it further would start dropping true matches.
Run the sweep on your own labeled data, not on this toy set. Eight pairs cannot support a production decision. Real tuning sets contain hundreds or thousands of cases, and the true matches in them should include variants that earlier alerts missed.
The tuning cycle
Tuning is a loop, not a one-time setting.
Notice that the loop checks recall before it checks volume. Reducing workload is a legitimate goal, but it comes second.
Levers other than a single global threshold
One global number is a blunt tool. Most programs use several finer controls.
Different thresholds for different situations
- By name length. Short names, such as "Li Wei", are the hardest case. One character is a large share of the string, so the score swings widely. Many firms require exact match on very short names, or add review rules for them, because fuzzy scoring behaves poorly there.
- By list or program. A list of people and entities you are legally barred from dealing with may justify a lower threshold than an internal watchlist used for risk rating.
- By party type. Individuals and organizations have different name structures. Company names contain common words such as "Trading", "Holdings", and "Limited" that inflate scores between unrelated firms.
Reducing noise safely
- Stop-word handling. Remove or down-weight generic words such as legal suffixes before scoring. Test this carefully. A listed entity named "Global Trading Company" could be reduced to almost nothing.
- Secondary-identifier rules. A mismatch on date of birth or nationality can lower an alert's priority. The earlier
triageexample does exactly this. A mismatch should lower priority, not delete the alert, because customer data and list data are both frequently incomplete or wrong. - Good-guy lists. A good-guy list (also called an allow list or white list) records pairs a reviewer has already cleared, such as a long-standing customer who shares a name with a listed person. Suppressing a repeat alert saves effort, but the entry must be tied to the specific customer, the specific list entry, and the identifiers used to clear it. It must also expire when either record changes. Otherwise a later list update can be silently suppressed.
- Algorithm choice. If one algorithm produces many false positives of a known type, such as phonetic matching on very common sounds, you may get a better result by changing or combining algorithms than by moving the threshold.
Common errors
- Tuning only for volume. Lowering alert counts is easy to measure, so it gets optimized. Missed matches are invisible unless you test for them deliberately.
- Accepting vendor defaults without testing. A default threshold was chosen for a generic population. Your customers, languages, and products differ.
- Comparing thresholds across algorithms. A score of 0.85 from token-sort ratio and 0.85 from a phonetic or edit-distance measure are not equivalent. Re-sweep whenever the algorithm changes.
- A test set made only of easy cases. If every true match in your set is a near-exact match, any threshold will look perfect.
- Letting rules hide true matches. Each suppression rule, such as stop-word removal, good-guy entries, or country filters, is a place a true match can fall out. Each needs its own test.
- Changing settings without a record. An undocumented threshold change cannot be defended to an auditor and cannot be rolled back.
Testing what you do not alert on
The alerts you raise are reviewed, so errors there tend to be caught. The risk sits in what falls below the line. Below-the-line testing means sampling pairs that scored under the threshold, in a band just beneath it, and having an analyst review them as if they were alerts.
If the sample contains true matches, the threshold is too high or a rule is hiding them. If it contains none, you have evidence for the current setting. For this reason, keep a written record of how large the sample was, which score band it covered, who reviewed it, and what they found. The later chapter on testing and governance returns to this evidence.
Changes should follow a controlled process: a written rationale, the before-and-after sweep results, approval by someone accountable for the sanctions risk, and a deployment date. Regulators in several jurisdictions expect a risk-based program that is tested and that can show why its settings are reasonable. The exact expectations vary by jurisdiction, so check the guidance that applies to your firm.
Summary of decision criteria
| Question | Guidance |
|---|---|
| Where do I start? | Sweep thresholds on a labeled set and find the highest threshold that still catches the hard true matches. |
| A name is very short | Use stricter handling, such as exact match or a dedicated rule, rather than relying on a fuzzy score. |
| Too many alerts from generic words | Test stop-word handling, then re-run the sweep. |
| A cleared pair keeps alerting | Add a scoped, expiring good-guy entry tied to identifiers. |
| How do I know I am not missing matches? | Run and document below-the-line sampling. |
| Who approves a change? | A person accountable for sanctions risk, with the sweep results attached. |
Exercise
Your labeled set shows that at threshold 0.85 you get 200 alerts and catch 4 of the 5 true matches. At threshold 0.80 you get 500 alerts and catch all 5. How many additional alerts must analysts review to catch the one extra true match, and what should you do before deciding?
Show answer
Analysts review 300 additional alerts (500 minus 200) to catch one more true match. Before deciding, look at why the fifth match scored between 0.80 and 0.85. If it is a type of variant that will recur, such as a transliteration, you should lower the threshold or add a targeted rule for that variant. Then re-measure on a larger set. The decision is a documented risk judgment, and the missed match must not be accepted just to save analyst time.
Exercise
A below-the-line sample of 100 pairs scoring between 0.75 and 0.85 is reviewed, and no true matches are found. Does this prove that no true matches exist below 0.85? What else should the record contain?
Show answer
No. A sample finding none is evidence, not proof. The sample covers only one score band and only 100 pairs. The record should state the sample size, the score band, how pairs were chosen, who reviewed them, the date, and the result. If rules such as stop-word removal or good-guy entries can suppress alerts, those should be sampled and documented separately.