Paste a message, see what it reads
An e-mail, a text message or a link, in English or Portuguese. A neural network reads it with weights that were written by hand, each with its reason. Nothing was trained.
Message
The examples were written for this page; none comes from the evaluation data. Your text never leaves this page.
What it thinks
The strongest reasons
Inside the network
Everything behind the verdict for the message on the Try it tab, layer by layer, from the letters up.
Character layer
Every word is read by stem filters that convolve over letters. A digit, a symbol or a Cyrillic letter counts as the letter it imitates, and some stems are found inside longer words. These words reached a stem only that way:
Attention heads that fired
A head looks from a token to its neighbours: a number next to money is a sum, "click here" next to a link is a call to act. Pooled strength of each relation in this message:
Sentence roles
Each sentence is read on its own and given clamped roles; the message layer then looks for the order a pitch is built in (offer → ask → contact, threat → ask). Summed over sentences:
MLP units
Three layers of named units: concepts (advance fee, phishing, crypto, chatter…), gates (is there any way to act? is this prose?) and their combinations. Contribution to the verdict:
Pooled evidence read by the output
Each named dim is summed over the message and squashed (log of 1 + x), so ten ordinary words cannot outvote one strong one. Largest contributions to the verdict:
The layers
How far to trust it
Nine public datasets, split once into study, dev and a sealed test. The weights were written reading errors on the study split only; the sealed test was run once on the finished network. The comparisons that go against it are here too.
Sealed test
10,351 messages, run once. The trained model is logistic regression on hashed words, word pairs and URL parts: the classic spam filter. Given the same labels it is far ahead.
By channel
Sealed test, English only. On SMS the hand-written network is level with the model trained on every channel; a model trained on SMS alone (dev) reaches 99.0%.
By source
Sealed test. Phishing links and Enron spam are its weakest places.
Mail of a kind never seen
Dev split. Each source is left out in turn and the trained model learns from the other eight: most of its 97% is knowledge of these nine sources. The hand-written network is scored as it is, but its revisions read errors from every source, so for it no source is fully unseen. The clean comparison is the first draft, written before any label was read: 82.8% against 75.4%.
Word-swap attack
300 caught spam messages, dev split. An attacker who can query the model replaces, one at a time, the word whose swap lowers the score most with an invented word. The hand-written network keeps its evidence in fewer places: this is its main weakness.
Its layers, with a trained output
Dev split. The hand-written layers kept as they are and only the output layer (176 weights) trained: with 512 labels it beats a bag-of-words model with 65,875 weights. The layers are a good representation; the hand-set output weights are where most is lost.
How it's made
A neural network whose every weight was typed by hand with its reason: no training, no fitting, every decision traceable. A fun experiment, not a production filter.
How the weights were written
A first draft came from general knowledge alone, before any label was looked at. Each revision read the network's errors on the study split and added a concept the errors showed missing: receipts against payment requests, news prose, word salad, phishing kits on hacked sites, friends who refer to money they already agreed on. Never a dataset's names or addresses.
Then the network grew: sentence and message layers, a character layer of stem filters, a letter-pair layer, 36 attention heads in two layers and a three-layer MLP, to 25,114 non-zero weights. Fourteen times the weights bought less than a point. A hand-written weight is a fact someone has to know and write down; size is not what such a network lacks.
How the page works
The page loads the weights (model/spam.json, 110 KB) and the engine (spam.js) and runs the network in your browser on every keystroke. Nothing is sent anywhere.
The verdict is the network's output: a logistic of the weighted evidence, spam at 50% or more. The percentage is a score, not a calibrated probability.
Files and the log
- README.mdWhat it is, the results, how to run it.
- LOG.mdHow the weights were written: every stage, the numbers before and after, what did not work.
- AGENTS.mdHouse rules and how to work on it.
- gen/net.mjsThe network itself: every row, head and unit with its reason.
- eval/test-runs.mdEvery sealed-test run, recorded whatever the result.
Weights and code written by Claude Opus 5.5 (Anthropic) with the project's author. Sister projects, built the same way: WP-CharNet, a handwriting reader, and WP-Ductus, a calligraphy teacher. MIT licence.