Email sorter
A 157 MB model that keeps cold pitches out of your inbox and lets the people through.
Runs on the CPU of any laptop, in about a tenth of a second per email. Your mail never leaves the computer.
Email app ยท How filters work ยท Use it
What it does
You describe a filter in plain words, for example "Unsolicited sales pitches: agencies, dev shops, SEO, lead generation, recruiters offering candidates". The sorter reads that description together with the start of an email and returns one number: the probability that the email belongs there.
It is a decision model, not a chat model. It never writes text, so an email can't talk it into anything. The worst an email can do is score itself into the wrong filter, and Email keeps anything it isn't sure about in the inbox.
Because the filter is just a description, your own filters work too: "Trips: plane, train and hotel confirmations", "Media requests from reporters and podcast hosts", or anything else you can write in a sentence.
Small and still accurate
The hard part isn't spam. It's telling a stranger selling to you apart from a stranger who wants something from you: a customer, an investor, a journalist, a student. We measured both engines Email has shipped on 200 hand-written emails that neither was trained on, using the app's real thresholds:
| Email sorter | Qwen3 4B, prompted (previous engine) | |
|---|---|---|
| Right on the blind test | 186 / 200 | 154 / 200 |
| Real mail wrongly moved out of the inbox | 2 | 4 |
| Download | 157 MB | 2.5 GB |
| Memory while sorting | ~0.5 GB | ~3 GB |
| Time per email, four filters | ~0.1โ0.2 s on the CPU | 0.8 s on an M3 Max GPU, 3โ10 s on a CPU |
The two emails it wrongly moved were genuinely borderline: a headhunter recruiting the reader, and a fund asking to invest in the reader's business. On the launch demo mailbox in the app, it caught all four cold pitches, told newsletters, promotions and receipts apart, and moved no mail from a person.
How Email uses it
The model is the last step, not the first:
- People you know never reach it. Mail from anyone you've written to, from your own company's domain, or in a conversation you replied in stays in the inbox, untouched.
- Your corrections win. Moving an email sets a rule for that sender, and their later mail follows it without the model.
- Unsure means inbox. A filter only takes mail at 80% confidence or higher. Ignore, which also marks mail read, needs 95%.
- Nothing is deleted. Filtered mail is archived and one click away from the inbox.
Use it
In Email. Choose Set up filters in the sidebar. The app downloads this model, checks its SHA-256 and starts sorting.
From Python with sorter.py from this repository (needs torch, transformers and safetensors):
from sorter import EmailSorter
sorter = EmailSorter.from_pretrained("YCorpLabs/email-sorter")
filters = [
"Unsolicited sales pitches: a stranger offering their own service or product. "
"Agencies, dev shops, SEO, lead generation, recruiters offering candidates.",
"Newsletters, digests and blog posts I subscribed to.",
]
email = """From: Ravi Menon <ravi@brightforge.example>
Subject: Quick question about your roadmap
Hi Alex, we're a 40-person studio that has shipped desktop apps and could take
a mobile client off your plate. Open to a 15-minute call next week?"""
print(sorter.score(filters, email)) # about [0.96, 0.02]
From Rust. The reference runtime is crates/mail-ai (pure Rust on candle, no GPU or native libraries needed).
Details
- Architecture:
intfloat/multilingual-e5-small(118M parameters, 12 layers) fine-tuned as a cross-encoder, with a single logit on the mean-pooled last layer and a sigmoid on top. Each filter is scored separately, so filter order doesn't matter. - Input:
query: <filter description>paired withpassage: From: โฆ\nSubject: โฆ\n\n<body>, up to 320 tokens. Use the base model's tokenizer. - File: one safetensors file with
format: email-sorter-1in its metadata. Word embeddings are int8 per row (u8 with a +128 offset and an f16 scale per row); everything else is f16. - Training data: about 2,900 synthetic emails written for the purpose, about half English and the rest Norwegian, German, Spanish, Danish, Swedish, French, Dutch and a few others. No real mail. Each email was paired with the starter descriptions and with paraphrased and made-up filter descriptions, so filters people write themselves also work.
- Evaluation: a separate set of 200 emails, written by a different author and kept out of training.
Limitations
- Synthetic training data. Real inboxes are messier than any test set. Expect some pitches to stay in the inbox. That's deliberate: missing a pitch costs a second, hiding a customer costs a lot more.
- Custom filters are weaker than the starters. Short, concrete descriptions work best.
- Built for first contact from strangers. It isn't a phishing or malware detector, and it isn't meant to judge mail from people you already talk to.
License
MIT, like the base model. Built by YCorp Labs for Email.
Model tree for YCorpLabs/email-sorter
Base model
intfloat/multilingual-e5-small