Inspiration
Every day in Egypt, our parents and grandparents get texts that look like they come from Vodafone Cash, InstaPay or their bank. "Your account will be closed, send the activation code now." "Mabrook! You won 5000 EGP, click the link." One wrong reply can empty a family's savings.
Most filters just hunt for scary money words, and that fails in both directions. It misses scams written in Egyptian Arabic or Franco-Arabic (Arabic typed in Latin letters), and it panics at real bank notices that simply mention money. I realized a scam isn't about the words in a message. It is about what the message asks you to do. So I built a tool that reads the ask.
What it does
Khalli Balak (خلي بالك, "be careful") is an AI scam text detector built for families. You paste any message and get an answer in seconds:
- A clear verdict: SCAM, SAFE or NOT SURE.
- The reasons, in plain words: the risky phrases it found and what to do next, so you see why and not just a label.
- Three writing styles: Egyptian Arabic, Franco-Arabic and English.
- Honesty about doubt: when it isn't confident enough (under 75%), it says NOT SURE instead of guessing. A careful "don't send anything yet" is safer than a confident wrong answer.
- Calm about real notices: a genuine bank or OTP message that says "don't share this code" is recognized as safe.
How I built it
The system works in three steps:
- Understand. Multilingual sentence embeddings (paraphrase-multilingual-MiniLM-L12-v2) capture the meaning of a message across Arabic, Franco-Arabic and English.
- Detect the ask. Intent features I wrote by hand in all three writing styles check what the message wants from you: a code or PIN, money or a fee, an unofficial link, urgency or threats, or a prize. They also look for safe signals, like "don't share this code" or a plain notice with no request.
- Decide. A classifier I trained combines both and returns the verdict with its reasons.
I compared four models side by side: an always-SAFE baseline, a TF-IDF keyword model, a standard multilingual embedding model, and my intent-based model. I trained on the UCI SMS Spam Collection plus hard examples I wrote myself: realistic safe money notices and scam requests, so the model learns that money words alone do not make a scam. The Egyptian test messages were kept completely out of training.
Stack: Python, PyTorch, Hugging Face Transformers, sentence-transformers, FastAPI, Gradio, and a simple web page deployed on Vercel.
Results
On 40 Egyptian messages the model had never seen:
- Khalli Balak: 95% accuracy (38/40)
- Standard multilingual AI: 72.5%
- Keyword model: 50%
- 100% precision on SCAM alerts. Every time it said scam, it was right.
- 0 real bank notices wrongly flagged. The keyword and standard embedding models each flagged 5.
- On the English held-out test it reached 91% precision and 95% recall.
An honest note: the Egyptian test set is small and synthetic (20 scam and 20 safe messages that I wrote), so I treat these numbers as promising, not proven.
Challenges I faced
- Egyptian Arabic and Franco-Arabic have almost no ready-made data, and Franco-Arabic spelling varies a lot (5 for خ, 3 for ع, and so on).
- Money words are a trap. My first models flagged real money notices as scams. Teaching the model what safe notices look like mattered as much as showing it scams.
- Knowing its limits. The two scams it missed were both marked NOT SURE, and I know it still struggles with family-emergency stories and "call and confirm your PIN" texts.
Accomplishments that I'm proud of
- A big jump over the baselines: 95% against 72.5% and 50%.
- Zero false alarms on real bank and wallet notices, which is what keeps families from learning to ignore warnings.
- One tool that works across the three ways Egyptians actually write.
- Explanations a parent or grandparent can understand.
What I learned
Reading the ask beats reading the words. I also learned that saying "I'm not sure" is a feature, not a failure, in a tool people trust with their savings.
What's next for Khalli Balak
- Check messages right from the phone.
- Support more dialects and languages.
- A simpler version built especially for parents and grandparents.
- Train on a larger set of real Egyptian messages collected from others.
- Catch voice-call and family-emergency scams.
Try it
- Live demo: khalli-balak.vercel.app (the first check can take about a minute while the model wakes up)
- Code: GitHub
Khalli Balak is a prototype and not financial advice. Never send a PIN, OTP or money because of any tool, including this one.
Built With
- cursor
- fastapi
- gradio
- html
- hugging-face
- python
- pytorch
- scikit-learn
- sentence-transformers
- vercel