AI from scratch · Lesson 2 of 100 · Module 1: What AI actually is
Rules vs learning: how a phone spots scam SMS
Two ways to catch a scam message. One has you writing rules by hand, the other learns from examples and can judge messages it has never seen.
You get an SMS saying you won ten lakh rupees. Your phone flags it as a scam. There are two basic ways software can make that call, and the difference between them is the core of this lesson.
Way 1: you write the rules
The first approach is the one most of us would try. You write a check by hand. If the SMS says "lottery", block it.
It's simple, and for a problem that stays fixed, a hand-written rule does the job.
The trouble starts when someone is working against your rule. Scammers write "L0ttery winner!" with a zero. Your rule looks for the word "lottery", doesn't find it, and the message goes through.
So you add another rule. Scammers change one word, and that's enough to slip past you. Then you add more rules, and the work of keeping up stays with you.
Way 2: show it lots of examples
The second approach flips the work around. Instead of describing what a scam looks like, you show the computer thousands of messages, each marked as scam or safe. It learns the scam words from them.
You supply examples, and the computer works out the pattern from those labels.
Then a new message arrives. The computer checks it against what it learned and decides whether it's a scam. No new rule needed. That's the part that matters here. It can judge a message it never saw while it was learning.
Which one to use
The reel boils it down to one test. Is the problem simple and fixed? Write rules. Does it keep changing? Let the computer learn from examples.
Scam SMS is a changing problem. The messages don't stay the same, and the zero in "L0ttery" is a small example of how they shift. With rules, each change means you write another one. With learning, a new message gets checked against what the computer already learned.
That gives you a practical way to sort problems. The question isn't which approach sounds more advanced. It's whether the thing you're checking stays put or keeps moving.
What to try
Next time you face a "detect X" problem, ask whether X is fixed or changing. Fixed means a rule is the plain answer. Changing means look at whether you can gather labelled examples instead. Lesson 3 in the AI from scratch course covers narrow AI vs general AI.



