← Multilingual sentiment

Multi-model · detect → read → contrast

Detect the language, then read the mood

A real analytics pipeline does two things at once: it needs to know which language a post is in (to route and segment it) and how it feels. Here two on-device models run back to back — XLM-R language detection labels the language, then multilingual sentiment scores the mood. Then, optionally, add an English-only model to see exactly what you'd lose without a multilingual one. Both stages are ~270 MB downloads (cached once); the contrast model adds ~65 MB.

The pipeline

Stage 1 — language detection

Stage 2 — multilingual sentiment

Contrast — what an English-only model sees

The classic English-only sentiment model (DistilBERT SST-2) has no idea what non-English words mean. Load it alongside the pipeline and run the same text through both: on English the two mostly agree, but on French, Spanish or Arabic the English-only model collapses — that gap is the whole case for a multilingual model.

Optional stage 3 — English-only contrast (~65 MB)

Why chain them