text-classification · 82.76 MB WASM q8 · 6-Layer DistilRoBERTa · Financial PhraseBank · Apache-2.0

DistilRoBERTa Financial News Sentiment — ~56 ms PhraseBank Polarity

mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis (served via Xenova/distilroberta-finetuned-financial-news-sentiment-analysis , Apache-2.0) is a compact 6-layer DistilRoBERTa (82M params, 82.76 MB q8 WASM, ~56 ms) fine-tuned on Financial PhraseBank to decode market polarity inversions — where “operating costs declined 12%” is positive and “debt surged 40%” is negative.

Upstream Model mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis
ONNX Artifact Xenova/distilroberta-finetuned-financial-news-sentiment-analysis
Pipeline Task text-classification
Size & Quant 82.76 MB · WASM q8
Classes (id2label) negative · neutral · positive
License Apache-2.0
Educational NLP Disclaimer: This demo measures linguistic sentiment learned from Financial PhraseBank (98.23% eval accuracy on sentences_allagree). It is an educational NLP demonstration only — NOT financial, trading, or investment advice.

1. Live Earnings & Market Headline Sentiment Inspector

Choose a synthetic market headline preset, drag & drop or paste (Ctrl/Cmd+V) text, or type your own:

Drop a .txt, .csv, .json, or .md file here, or press Ctrl/Cmd+V anywhere on the page. Everything executes locally in a Web Worker.
Inference latency–
Net Polarity–
Shannon entropy–
BPE tokens–
NaN score check–
Backend / dtypeWASM · q8

3-Class Financial Probability Distribution

Awaiting inference
Initialize the model above to compute live class probabilities.

Signal Breakdown & Polarity Interpretation

Net Financial Polarity = P(positive) − P(negative). Shannon entropy measures uncertainty across all 3 PhraseBank classes (max 1.585 bits).

2. Why DistilRoBERTa Financial Sentiment Differs from SST-2 & FinBERT

Generic SST-2 models are trained on movie reviews with only 2 classes (no neutral) and read “declined” or “narrowed” as bad. Full 12-layer FinBERT captures financial tone at ~111 MB, whereas 6-layer DistilRoBERTa keeps 98.23% sentences_allagree accuracy in a 82.76 MB q8 WASM footprint (~56 ms per headline) with a clean Apache-2.0 license.

import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.5";

const classifier = await pipeline(
  "text-classification",
  "Xenova/distilroberta-finetuned-financial-news-sentiment-analysis",
  { device: "wasm", dtype: "q8" }
);
const scores = await classifier("Operating costs declined 12% year-over-year.", { top_k: 3 });
Show the code · worker.js — classify() (82.76 MB q8 WASM worker)
Show the code · fin-news-core.mjs — normalizeScores() (3-class polarity & NaN check)