EmbeddingGemma 2 scam classifier
local scam detector for iOS
2 min readupdated
The new model is a fine-tuned google/embeddinggemma-2 text encoder featuring a linear head and Platt scaling, converted into the Core ML format with int8 quantization (reducing weight precision to 8 bits to save memory). Designed to run on the iPhone CPU, the tool evaluates the probability that an incoming message or conversation is fraudulent. The model was built as a component of the NotificationScan concept app, which analyzes incoming messages locally without sending data to the cloud. This solution is useful for iOS mobile developers to protect users from phishing and scams directly on the device.
Key features
- Local iOS operation: Runs on the iPhone CPU in about 0.05 seconds per message.
- Apple ecosystem integration: Supports export to Core ML with support for various context lengths (128, 512, and 1024 tokens).
- Multilingual support: Supports English, Chinese, and Japanese with individual trigger thresholds.
- Efficient architecture: Based on
google/embeddinggemma-2with fine-tuning of the last 4 encoder layers.
What you can do
- Integrate into an iOS app: Use the model as a local filter for incoming SMS, iMessage, and messenger notifications.
- Configure security thresholds: Use the
egemma_thresholds.jsonthreshold file to flexibly adjust the warning level from silent logging to an active alarm. - Analyze conversations: Feed not only single messages into the model, but also recent conversation chains for context checks.
Example
To run the model in Core ML, prepare the input data by adding the task: classification | query: prefix, tokenize the text using the built-in tokenizer, and pass input_ids and attention_mask to the compiled model.
Read more
DetailsBenchmarks: AUC reaches 0.999 on Japanese messages and 0.994 on English messages.
Hardware requirements: Core ML, strictly CPU execution (deviations from the baseline occur on the Neural Engine), peak memory consumption around 85–100 MB.
Limitations: weak annotation of some Chinese data, thresholds require validation on live traffic.
License: CC BY-SA 4.0 (base model under Apache 2.0).










Comments