1. Tokenization
Neural networks can't read text; they read numbers. A byte-pair-encoding (BPE) tokenizer splits your sentence into subword pieces ("incredible" might become "incred" + "ible") and maps each piece to an integer ID from a ~50k-entry vocabulary. Rare words split into more pieces; common words stay whole. This is why the explanation view highlights sub-word chunks rather than whole words.
2. The transformer encoder
Those IDs pass through RoBERTa: 12 layers of self-attention. Each layer lets every token "look at" every other token and update its representation based on context, so the "bank" in "river bank" and "bank account" ends up with different vectors. After 12 rounds of this, the model has a contextual summary of the whole sentence.
3. Classification head + softmax
A small linear layer maps that summary to three raw scores (logits), one per class. Softmax exponentiates and normalizes them into probabilities that sum to 1. Those are the confidence bars you see on the Analyze tab. High entropy (three similar bars) means the model is genuinely unsure.
4. Explainability: Integrated Gradients
To answer "which words made it say that?", we use Integrated Gradients: start from an empty baseline sentence (all padding tokens), interpolate step-by-step toward the real input in embedding space, and accumulate the gradients of the predicted class along the way. Each token gets a share of the credit. Green tokens pushed the model toward its answer, red pushed away.
Honest limitations
- The model was trained on tweets; long or formal text is out-of-domain.
- Inputs are truncated to 512 tokens; anything beyond is invisible to the model.
- English only; sarcasm and irony remain hard.
- IG is an approximation (50 integration steps), not a ground-truth explanation.
Why models disagree
The Compare tab runs one sentence through models trained on different data: tweets, movie reviews, financial news. Disagreement is the interesting part. A binary model has no neutral class to fall back on, so it must pick a side, and a finance model reads "revenue outlook improved" very differently from a general-purpose one. Confidence numbers are not comparable across models with different label sets: treat each readout as that model's opinion, not as ground truth.