Scientify
AI Explained

How does spam end up straight in the Spam folder?

From lists of banned words to a machine that learns from millions of people's reports: how spam filters work, with sources from Google's own team.

Huge amounts of junk mail are sent to people's inboxes every day. You almost never see it, because it is filtered out before it arrives. The video above (in Indonesian) tells how spam filters evolved, from word lists to a machine that learns from users' reports.

Four ways to filter spam

  1. Word lists (1990s). Mail containing certain words, such as "free" or "prize", is thrown away. Easy to dodge: spammers just write "FR3E". Ordinary mail that happens to use the word is thrown away too.
  2. Sender blocklists (1997). Instead of the content, the sender is blocked. Addresses caught sending spam go on a blocklist. The catch: spammers can change address every day.
  3. Bayesian filters (2002). Every word in the email is weighed: how often it appears in spam, and how often in normal mail. The results are combined into one number, the probability that the email is spam. Spammers answered by putting their text inside images and adding ordinary words to tip the scales.
  4. Sender reputation and user reports. Gmail judges mail by who sends it (domain and IP address). Every time someone presses "Report spam" or "Not spam", that judgement is updated. Reports from millions of people every day keep the system learning.

Sources

The Gmail part of the video is based on two papers by Google's own team:

  • Bradley Taylor, "Sender Reputation in a Large Webmail Service", CEAS 2006. It explains that Gmail classifies mail by who sends it, and that the "Report Spam" and "Not Spam" buttons update the sender's reputation.
  • Bradley Taylor, Dan Fingal and Douglas Aberdeen, "The War Against Spam: A report from the front line", NIPS 2007 workshop. It explains that Google's anti-abuse system combines hard-wired rules, rules inferred by a learning system, clustering and a reputation system.

The first three methods are the general history of spam filtering, not how Gmail works. Paul Graham popularised Bayesian filtering in his essay A Plan for Spam (2002).

Want to build a model like this?

A Bayesian filter is one kind of classification model. How to build and test classification models is covered hands-on in Machine Learning Part 1.

More explainers

Want to build AI like this yourself?

Learn from zero in Indonesian, with a project in every topic. From Rp 79.000 for a month. 7-day money-back guarantee.