text-classification · 110.30 MB WASM q8 · 4 Politeness Tiers · BERT-base · Apache-2.0

Intel Polite Guard — 4-Class Politeness & Tone Meter

Intel/polite-guard is a fine-tuned bert-base-uncased classifier (110M params, 92% accuracy / F1 on the Intel Polite Guard benchmark, Apache-2.0) that scores text across four calibrated courtesy tiers — polite, somewhat polite, neutral, and impolite — entirely off the main thread in ~84 ms via CPU WASM q8.

Model ID Intel/polite-guard
Pipeline task text-classification
Artifact & Quant 110.30 MB · WASM q8
4-Class Labels polite · somewhat · neutral · impolite
Architecture BERT-base (12L · 512 ctx)
License Apache-2.0

1. Interactive 4-Class Politeness & Tone Meter

Local-only tone analysis: Loads onnx/model_quantized.onnx (110,300,605 B, Apache-2.0) via shared Transformers.js 3.7.5 in a dedicated Web Worker with { top_k: null } so all four class probabilities return live without sending your drafts or logs to any server.

Select a curated workplace/support/PR preset, edit the message below, or upload a local .txt / .csv file:

Press Score Tone (or pick a preset) to classify the full message plus each sentence.
Dominant class–
Top confidence–
Politeness index–
Inference latency–
WordPiece tokens–
NaN logit check–

4-Class Probability Distribution

Initialize Intel Polite Guard above to inspect all 4 class probabilities.

Composite Politeness Index (0–100)

– Waiting
0 · Impolite 42 · Neutral 68 · Somewhat 100 · Polite

Weighted expectation over live softmax probabilities: 100×P(polite) + 68×P(somewhat polite) + 42×P(neutral) + 0×P(impolite).

2. Sentence-by-Sentence Tone Breakdown

Long emails often mix a polite greeting with a blunt critique. Polite Guard classifies each sentence individually in a single off-main-thread batch so hot spots stand out immediately.

Per-sentence politeness classification with dominant class, Politeness Index, and impolite probability
# Sentence Dominant Tier Confidence Index P(impolite)
Run a tone check above to inspect sentence-level scores.

3. How Intel Polite Guard Works & Source Code

Fine-tuned from google-bert/bert-base-uncased on the Intel Polite Guard dataset using Intel Gaudi accelerators (92% test accuracy and F1), then exported to INT8 quantized ONNX (onnx/model_quantized.onnx, 110.30 MB) for client-side WASM execution.

Show the code · worker.js — runSingleClassify() & classify() (WASM q8 pipeline)
Show the code · polite-core.mjs — normalizePolitenessScores() (4-class index & NaN check)