text-classification ยท text (finance) ยท WASM ยท ~111 MB
A BERT further pre-trained on a financial corpus and fine-tuned on the Financial PhraseBank, it scores a headline or sentence as positive, negative or neutral โ from a market participant's point of view. "Shares tumbled after the firm slashed its outlook" reads clearly negative to FinBERT, where a movie-review sentiment model often shrugs and calls it neutral. Paste some finance text and watch the three-way verdict, then look inside to see which words moved it. Nothing leaves your device.
| Model | Xenova/finbert (ONNX of ProsusAI/finbert) |
|---|---|
| Task / pipeline | text-classification |
| Labels | positive / negative / neutral (softmax over 3 logits) |
| Architecture | BERT-base (12-layer, ~110M params) โ domain-adapted on Reuters TRC2, fine-tuned on the Financial PhraseBank |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~111 MB, cached after first load |
| License | Apache-2.0 |
| Web APIs | WebAssembly, Web Workers โ all Baseline widely available |
Signal, not advice. FinBERT reports the tone of a sentence, not a buy/sell recommendation or a price prediction. It knows nothing after its training data, and sarcasm, hedging and forward-looking spin can all fool it โ treat every score as one noisy input, never a trade.
Paste or type a financial sentence โ a headline, an earnings line, an analyst note. The verdict re-scores automatically a moment after you stop typing; the meter shows the full three-class split.
FinBERT's head is a softmax over three logits, so every score is a real probability and the three add to 1. The bars below are those exact probabilities for the current text.
This is occlusion attribution: we re-run the model with each word removed and measure how much the net sentiment (positive minus negative, in log-odds) shifts. Remove a word that was pushing bullish and the signal drops โ green. Remove a bearish word and it rises โ red. No gradients: just N+1 forward passes, batched in a Web Worker so typing never janks.
The domain caveat. FinBERT was tuned on short, formal financial statements. It shines on headlines and earnings language; it is weaker on tweets, slang, heavy sarcasm, and long multi-clause paragraphs โ and it has no notion of magnitude or causation, only tone. The head-to-head demo makes the domain gap vivid against a general model.
General sentiment models learn tone from product and movie reviews, so they miss the vocabulary of markets: "impairment", "guidance cut", "beat", "headwind", "buyback". A domain-tuned model reads that language the way an analyst does โ and doing it in the browser means you can triage a feed as it streams, privately, with no data leaving the tab.
Type a finance sentence, get positive / negative / neutral with the full probability split.
Paste a batch of headlines and auto-triage a news feed by tone โ signal, not advice.
Probe the edges โ sarcasm, hedging and ambiguous finance text that fool a tone model.
FinBERT vs a general movie-review sentiment model on the same finance sentence, head to head.
Contrast with the general DistilBERT SST-2 sentiment demo โ same task, movie-review training instead of finance.
Classification is one call; top_k: 3 returns every class score:
import { pipeline } from "@huggingface/transformers";
const classify = await pipeline(
"text-classification",
"Xenova/finbert",
); // downloads + caches ~111 MB once
const out = await classify("Shares tumbled after the firm cut its outlook.", { top_k: 3 });
// โ [ { label: "negative", score: 0.76 },
// { label: "neutral", score: 0.14 },
// { label: "positive", score: 0.10 } ]
Pass top_k: 3 (or null) to get all three classes โ the default returns only
the winner. "See inside" reuses the same call: it classifies the full text plus one copy per word with
that word deleted (batched in a single pass), then attributes the net-sentiment shift to each word. It
all runs in a Web Worker so the control UI stays responsive.