Email Spam Filters
The ML you use every day without noticing: classifiers that decide whether each email is spam, phishing or legitimate, evolving from naive Bayes to deep neural networks.
Also spam filtering · Gmail spam filter · junk mail · phishing detection
Bayesian filtering popularized by Paul Graham, 2002; Gmail launched 2004
A tireless mail sorter who has seen billions of junk letters. It learns the tricks spammers use, and every time someone clicks 'report spam', it gets a bit smarter.
Where it fits
+All relationships as a list
Is a kind of / part of
Siblings
Uses / built on
How it works
Spam filtering is one of the oldest and most successful everyday applications of machine learning.
The naive Bayes era. In 2002, Paul Graham’s essay A Plan for Spam popularized a simple idea: learn from your own mail how often each word appears in spam versus normal mail, then combine those probabilities with naive Bayes. It worked remarkably well and adapted to each user.
Today. Large email providers combine many signals:
- Who sent it, and does their domain check out?
- What links and attachments does it contain?
- What does the text, and even text inside images, say? Neural classifiers handle this.
- What did millions of other users do with similar messages?
Spam is an adversarial problem: spammers constantly change tactics to get past the filter, so the filter keeps learning from fresh reports (online learning) and must watch for data drift. Attackers even try to poison it by marking their own spam as “not spam” (data poisoning).
The trade-off is classic precision and recall: catching more spam risks sending a real email (a job offer, say) to the junk folder.
Everyday use cases
- Case 01
How you've probably met it
Every time a scam email lands in your junk folder instead of your inbox, or when you click "Report spam" and help train it.
Strengths, weaknesses and when to use it
Strengths
- Huge scale, fast adaptation to new campaigns from user reports.
Weaknesses
- An adversarial arms race; legitimate emails sometimes end up in spam (false positives).
When to use itAs the classic everyday example of supervised classification and of adversarial, constantly shifting data.
Compare with
Go deeper
Sources
- [1]Paul Graham, A Plan for Spam (2002)
- [2]Google Cloud blog, Ridding Gmail of 100 million more spam messages with TensorFlow (2019)
Facts checked as of 2026-10-12