Original ↗
Technology
Better Bayesian Filtering
paulgraham.com
Technology
18 min read → 65 sec
Bayesian spam filtering works far better when it uses email-specific signals, richer tokenization, and per-user training. Results from late 2002 to early 2003 show high detection, low false positives, and limits of network-level filtering.
Bayesian spam filtering reaches 99.5% detection with under .03% false positives
Smarter tokenization and email-specific signals close the gap to CRM114
02 — 16
Pantel and Lin achieved only 92% detection and 1.16% false positives from weaker design choices
They trained on just 160 spam and 466 nonspam mails, too little data
03 — 16
Spam filters should use email-specific signals, because headers, structure, and adversaries matter
Ignoring message headers throws away strong spam signals and hurts performance
04 — 16
Preserving case and marking context creates stronger tokens like Subject*FREE with probability 0.9999
Stemming tokens is premature optimization that weakens discrimination when corpora grow
05 — 16
Using all tokens lets long spam and random filler dilute the spam signal
06 — 16
Degeneration backs off missing tokens to less specific forms and picks the probability farthest from .5
07 — 16
Thresholds now use .9999 and .0001, with extra scaling for tokens seen only in one corpus
08 — 16
Biasing against false positives by double-counting nonspam tokens gives a useful tradeoff knob
09 — 16
HTML should be partially parsed, because links and images help, but full parsing overfits HTML
10 — 16
December 10 2002 to January 10 2003
99.75%
4 of about 1750 spams got through
11 — 16
.06%
Five false positives out of about 7740 legitimate emails
This mostly reflects bugs, not fundamental limits
12 — 16
False positives from statistical filters tend to resemble spam, making them less costly than blacklist errors
13 — 16
The hardest remaining spam mimics normal personal mail or overlaps with the recipient's real vocabulary
14 — 16
Per-user statistical filters are more durable than network-level filters against spammer adaptation
Individual filters slow spammers' edit-compile-test loop because every user's probabilities differ
15 — 16
Read the full source
Better Bayesian Filtering
paulgraham.com
16 — 16
Carouse
Turn any article, video, or podcast into a carousel you can browse in 30 seconds.
Carouse any link