News · New this week
Scam SMS spam filter design: rules, model and reports
Blocking the word "prize" fails the moment a scammer writes "pr1ze". Here is a layered filter that holds up better, in interview-style system design.
The interview question sounds simple. How do you stop prize scam SMS? Most people say block the word "prize". That fails the same day, because the scammer writes "pr1ze" and walks straight past your filter.
So a single word list isn't a design. You need layers, and each layer catches something the others miss.
Start with rules
Every SMS arrives with two things, the sender and the text. The first layer looks at both using two plain checks.
A blocklist is a black list of bad numbers. If the sender is on it, you're done.
A link check looks inside the message. Is the link pointing at a fake or dangerous site? That check doesn't care how the message is worded.
Rules catch the old, known scammers.
Add a model for new wording
Rules only catch what you already know about. When a new scam shows up with new wording, the rule list has nothing to say.
That's where the smart model comes in. It's a machine learning program that looks at a lot of examples and learns the spam patterns on its own. You don't write "pr1ze" into a rule. The model picks up the pattern from examples.
The split is worth remembering. Rules catch the old. The model catches the new.
Use a score to decide
The model gives a score, and you can think of it like marks in an exam.
In the reel's example, a score of 90 means pretty much certain spam. Anything above 70 goes to the spam folder. The rest lands in the inbox.
The flow so far is SMS, then rules, then the model, then the inbox or the spam folder.
Feed reports back as labels
Models get things wrong. So what happens then?
The last piece is the Report spam button. When a user taps it, the model gets the right answer for that message. In ML terms that answer is a label. Those labels are how the model learns what it missed, so it can keep up with new wording.
That closes the loop. The filter doesn't stay frozen at whatever you knew on launch day.
What to try
Next time you get this question, answer in order. Rules with a blocklist and link check for the old scammers, a model for new wording, a score with a spam folder cutoff, and Report spam taps as labels. Then, if they ask whether you'd put rules or the model first, have your reason ready.



