App Icon

Text Spam Block

Trusterprise's first application. Providing a simple and secure way to filter spam messages on your iOS device.

The Text Spam Block iOS App uses a on-device machine learning model, technically a text classifier, to accurately identify and block spam messages. Read more about how it works below.

Overall Architecture

The spam filter application uses a hybrid of real and synthetically generated SMS messages to train a machine learning model that is then used to classify incoming messages. All of the classification (aka as inference) is done locally on your phone. There is an option in the main application to test the model with your own messages as well submit text samples that can be analyzed and added to the training data. This design has some great properties, but also some limitations that I believe are worthwhile to protect your privacy and security.

Pros
  1. Privacy: Your messages never leave your device.
  2. Cost: No server costs to maintain the service.
  3. Robustness: LLM (large language models) can be used to add variety to training data.
  4. Accuracy: The model can be enhanced with real-world messages.
  5. Fast: iPhones have hardware accelleration that ensure messages are near immediately classified with minimal battery impact.
Cons
  1. Static Models: Model updates need to be manually updated across devices.
  2. Observability: Local processing means I only know if the service is working well for you if you tell me.
  3. Donated data: LLM generated messages are a great baseline, but do not automatically adapt to political/spam/fraud trends.
Text Spam Block Architecture Diagram

Updating the Model

Model updates are done manually by me. I will periodically update the model with new data and retrain it to ensure it is up-to-date with the latest trends and accurately detected messages with minimal false positives.

Model build process:
  1. OpenAI is prompted to generate different types of spam and legitimate messages.
  2. Any new messages sent by customers are added to a curated list for training.
  3. All messages are tagged for training with some set aside as a validation dataset.
  4. A new Text Classifier using transfer learning with a static embedding is trained using Apple's ML Create tool.
  5. Data is validated and tested automatically and manually.
  6. The iOS application is rebuilt with the new model and sent to the App Store.

Filtering Messages

Below is an overiew of how the Text Spam Block works on your device:

On-device processing
  1. At runtime iOS will load a "Message Filter Extension" which in turn loads the Text Classifier.
  2. The Text Classifier will then classify the message against the set of potential text message categories.
  3. Thresholds are set for each of the enabled categories in App settings.
  4. If thresholds are met, then the message is marked as spam and sent to the Junk folder.
  5. Otherwise, the message will appear in the Messages app as normal.

User submitted messages

The only data that can be stored off your device is if you submit text from the app itself. This is done by clicking the "Submit Text Sample" button in the app and will never happen without your explicit action for every message.

Database details
  • Data is stored in Supabase, a secure and private database service.
  • The only data stored in this data is a timestamp of when the data is sent and the exact text submitted by the user.
  • No other metadata is saved, and no data is ever associated with device or user identifiers.
  • Supabase itself provides a client side library that allows me to easily interact with the database and provide some basic throttling to avoid abuse.

© 2024 Benjamin Poiesz. All rights reserved.