
Sentiment Analysis Engineer
- 4 installs
- 7 repo stars
- Updated May 20, 2026
- daemon-blockint-tech/agentic-enteprises-skill
Build and evaluate sentiment and opinion-mining systems: label schemas, lexicon/ML/transformer/LLM classifiers, annotation and IAA, F1/calibration, and drift monitoring.
About
Guides building and evaluating sentiment and opinion-mining systems covering label schemas, classifier stacks, annotation programs, evaluation, domain adaptation, and production inference with drift monitoring. A developer uses it for document-level or aspect-based sentiment, emotion detection, or review/social-media sentiment.
- Covers lexicon, classical ML, fine-tuned transformer, and LLM classifiers
- Handles negation, sarcasm, code-switching, and macro-F1 error analysis
Sentiment Analysis Engineer by the numbers
- 4 all-time installs (skills.sh)
- Ranked #1,625 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
- Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/daemon-blockint-tech/agentic-enteprises-skill --skill sentiment-analysis-engineerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 4 |
|---|---|
| repo stars | ★ 7 |
| Last updated | May 20, 2026 |
| Repository | daemon-blockint-tech/agentic-enteprises-skill ↗ |
What it does
Build and evaluate sentiment and opinion-mining systems: label schemas, lexicon/ML/transformer/LLM classifiers, annotation and IAA, F1/calibration, and drift monitoring.
Files
Sentiment Analysis Engineer
When to Use
- Define labeling schemas — document-level polarity, aspect-based (ABSA), emotion taxonomies, or multi-label targets
- Choose and implement model stacks — lexicon/rules, classical ML, fine-tuned transformers, or LLM prompt classifiers
- Design annotation programs — guidelines, adjudication, inter-annotator agreement (IAA), and gold-standard refresh
- Run evaluation and error analysis — macro-F1, calibration, confusion slices, and failure-mode catalogs
- Adapt models to domains — product reviews, social posts, support tickets, news, or finance text
- Handle edge cases — negation, sarcasm, entities, code-switching, and demographic or topical bias
- Plan production inference — batch vs streaming, latency budgets, model serving, and API contracts
- Operate monitoring and governance — label drift, score drift, human audit loops, and dashboard integration
When NOT to Use
- Writing marketing copy, brand voice, or content strategy →
content-creator,brand-voice-enforcement - General ML platform MLOps without sentiment/NLP scope →
ml-ops-engineer - Exploratory analytics or predictive modeling without text-sentiment focus →
data-scientist - Social media campaigns, calendars, or channel strategy →
social-content,marketing-analyst - AI safety classifier or harm-benchmark research only →
ml-research-engineer-safeguards - Legal, regulatory, or compliance conclusions from sentiment scores alone →
compliance-engineer,legal-risk-assessment - Production LLM agents, RAG, or copilot features (unless sentiment is one component) →
ai-engineer - Literature surveys without building or evaluating sentiment systems →
ai-researcher
Related skills
| Need | Skill |
|---|---|
| Classical ML, A/B tests, general model evaluation | data-scientist |
| LLM apps, RAG, agents, prompt eval harnesses | ai-engineer |
| Papers, benchmarks, research methodology | ai-researcher |
| Warehouse metrics, dbt, analytics pipelines | analytics-engineer |
| Campaign performance and channel ROI | marketing-analyst |
| De-AI-ing prose or editorial voice | content-humanizer |
| MLOps deploy, drift, retraining platform | ml-ops-engineer |
Core Workflows
1. Scope and problem framing
Clarify unit of analysis (document, sentence, span, aspect), label set, languages, latency, and success metrics.
See `references/sentiment_analysis_engineer_scope.md`.
2. Labeling and annotation
Draft guidelines, pilot batches, measure IAA, and lock gold standards before model training.
See `references/labeling_schemas_and_annotation.md`.
3. Model selection and training
Compare lexicon, classical, fine-tuned encoder, and LLM-prompt baselines; document tradeoffs and compute.
See `references/models_lexicon_transformers_llm.md`.
4. Evaluation and error analysis
Report slice metrics, calibration, and qualitative failure buckets with reproduction examples.
See `references/evaluation_metrics_and_error_analysis.md`.
5. Domain, multilingual, and edge cases
Plan domain adaptation, translation vs native models, and tests for sarcasm, negation, and bias.
See `references/domain_multilingual_and_edge_cases.md`.
6. Production, monitoring, and governance
Specify serving paths, SLAs, drift monitors, human review queues, and analytics handoffs.
See `references/production_serving_monitoring_governance.md`.
Outputs
- Problem spec — labels, languages, domains, latency, and acceptance thresholds
- Annotation guide — definitions, examples, edge-case rules, adjudication process
- Model card — data, architecture, metrics, limitations, and known failure modes
- Eval report — headline metrics, slice tables, confusion analysis, calibration plots
- Serving spec — API schema, batch/streaming mode, versioning, and rollback plan
- Monitoring plan — drift metrics, audit sampling, and escalation triggers
Principles
- Treat labels as product decisions — ambiguous guidelines inflate disagreement and model variance
- Always report macro-F1 or per-class recall when classes are imbalanced; accuracy alone misleads
- Separate offline eval from online impact — production KPIs may differ from held-out test F1
- Document residual risk for sarcasm, negation, and out-of-domain text; do not overclaim coverage
- Prefer human-in-the-loop for high-stakes routing; scores support decisions, they do not replace policy
Domain, multilingual, and edge cases
Table of contents
1. Domain adaptation 2. Multilingual strategies 3. Sarcasm and negation 4. Bias and fairness 5. Entity-level sentiment
Domain adaptation
| Domain | Challenges | Mitigations |
|---|---|---|
| Product reviews | Long text, aspects, rating skew | ABSA, align stars vs text slice |
| Social media | Slang, hashtags, short text | Emoji rules, character models, dedupe |
| Support tickets | PII, procedural tone | Redact entities; separate urgency vs sentiment |
| News | Neutral wire copy, multiple entities | Target-aware models; headline vs body |
| Finance | Market vs opinion, tickers | Entity linking; domain lexicon; disclaimers |
Techniques: in-domain fine-tune, continued pretrain on unlabeled domain corpus, adapter layers, self-training with confidence filtering (audit high-impact paths).
Always evaluate on in-domain test; cross-domain F1 is optimistic for deployment.
Multilingual strategies
| Strategy | Pros | Cons |
|---|---|---|
| Translate-then-analyze | One English model | Translation errors, idiom loss |
| Multilingual encoder (XLM-R) | Single pipeline | Weaker on low-resource pairs |
| Per-language models | Best per locale | Ops overhead, routing |
| Language ID + route | Right tool per lang | Mis-ID errors |
For code-switching: train on mixed examples; evaluate dedicated code-switch slice; avoid translating away language signal.
Document primary languages, script, and locale (en-US vs en-GB) in model card.
Sarcasm and negation
- Sarcasm: often needs context (thread, user history); document-level models beat bag-of-words
- Negation: dependency-aware features, NLI-style models, or LLM with explicit negation examples in prompt
- Do not rely on lexicon antonym flip alone ("not good" ≠ "good")
- Report sarcasm slice separately; do not merge into generic "hard examples"
Bias and fairness
- Audit slices by demographic proxies only when ethical and legal review allows
- Check dialect and identity terms for systematic score shifts
- Avoid using sentiment for high-stakes decisions without policy and human review
- Log disparate impact on routing rates if scores trigger workflows
Partner with governance when scores affect customers or employees.
Entity-level sentiment
- Target extraction then polarity (pipeline) vs joint ABSA models
- Finance: link ticker/company mentions; disambiguate homographs
- News: coreference and headline-body alignment
- Evaluate target F1 and polarity F1 separately
When entities are ambiguous, prefer abstain or human review over forced labels.
Evaluation metrics and error analysis
Table of contents
1. Splits and leakage 2. Classification metrics 3. Calibration and thresholds 4. Error analysis 5. Regression testing
Splits and leakage
- Temporal split for reviews and social streams (train past, test future)
- Group split by author, product, or ticket ID to detect memorization
- Stratify rare classes in dev/test
- Remove duplicates and near-duplicates (MinHash) before metrics
- Hold out adjudicated gold never used for hyperparameter tuning
Classification metrics
| Metric | When to use |
|---|---|
| Accuracy | Balanced classes only |
| Macro-F1 | Default for imbalanced polarity/emotion |
| Weighted-F1 | When class frequency reflects production |
| Per-class precision/recall | Cost-sensitive routing (e.g., miss negative) |
| ROC-AUC / PR-AUC | Score ranking; not a business KPI alone |
| Cohen's κ vs human | Model–human agreement on eval set |
For ABSA: micro-F1 over (aspect, polarity) pairs; separate aspect extraction F1 if two-stage.
Report confidence intervals (bootstrap) when test set < 2k examples.
Calibration and thresholds
- Plot reliability diagrams; apply temperature scaling or Platt scaling if scores drive automation
- Tune thresholds on cost matrix (false positive vs false negative), not default 0.5
- Report expected calibration error (ECE) when scores feed dashboards or alerts
Error analysis
Build a failure taxonomy with 20–50 quoted examples per bucket:
| Bucket | Examples |
|---|---|
| Sarcasm / irony | Positive words, negative intent |
| Negation | "not bad", "hardly recommend" |
| Mixed sentiment | Pros and cons in one document |
| Domain shift | Training reviews, test support chat |
| Entity-specific | Sentiment toward brand vs competitor |
| Neutral vs weak polarity | "OK", "it arrived" |
| Language / script | Code-switching, transliteration |
| OCR / ASR noise | Garbled text in pipelines |
Link each bucket to mitigation (more labels, rules, model swap, human review).
Regression testing
- Freeze golden eval set (500–5k adjudicated items) per schema version
- CI gate: macro-F1 drop > 1–2 pts or per-class recall breach
- Compare lexicon, encoder, and LLM baselines on every release
- Log confusion matrix and top regression examples in model card
For production monitoring metrics, see production_serving_monitoring_governance.md.
Labeling schemas and annotation
Table of contents
1. Labeling schemes 2. Guideline design 3. Annotation workflow 4. Quality metrics
Labeling schemes
| Scheme | Granularity | Typical use |
|---|---|---|
| Document polarity | One label per review/post | Dashboard aggregates, routing |
| Sentence / span | Sub-document units | Long documents, mixed sentiment |
| Aspect-based (ABSA) | (aspect, opinion, polarity) triples | Product features, NPS drivers |
| Emotion | Multi-class or multi-label (joy, anger, …) | CX analytics, moderation signals |
| Intensity | Ordinal or continuous score | Fine-grained trends |
| Target-aware | Sentiment toward entity X | News, finance tickers |
Choose the smallest schema that answers the business question; extra labels increase cost and disagreement.
Guideline design
- Define in-scope text (title + body, quoted replies, emojis, hashtags)
- Provide positive, negative, neutral, and borderline examples per class
- Document neutral rules (factual statements, questions, mixed without dominant polarity)
- Specify handling for emoji-only, URLs, @mentions, and deleted/edited content
- For ABSA: list aspect inventory (closed vs open vocabulary) and opinion span rules
- For finance/news: separate market sentiment from author opinion when required
Run a pilot batch (50–200 items) before full annotation; revise guidelines when adjudication rate exceeds ~15%.
Annotation workflow
1. Dual annotation on training/eval gold; single pass only for low-stakes exploratory sets 2. Adjudication by senior annotator or SME on disagreements 3. Active learning queue for uncertain model predictions in production (optional) 4. Version guidelines (v1, v2) and remap or re-label when definitions shift
Store: text_id, annotator_id, label, timestamp, guideline_version, adjudicated flag.
Quality metrics
| Metric | Interpretation |
|---|---|
| Cohen's κ / Fleiss' κ | Pairwise or multi-rater agreement on nominal labels |
| Krippendorff's α | Nominal/ordinal, handles missing raters |
| % adjudicated | Volume of unresolved disagreements |
| Guideline violation rate | QA spot-checks on random samples |
Targets (rule of thumb): κ ≥ 0.6 acceptable for noisy social text; κ ≥ 0.75 for reviews with clear guidelines. Below 0.5 → fix guidelines before training.
Do not treat majority vote on ambiguous social text as ground truth without SME review on error slices.
Models: lexicon, transformers, and LLMs
Table of contents
1. Approach ladder 2. Lexicon and rules 3. Classical and neural encoders 4. Fine-tuning transformers 5. LLM prompt classification 6. Selection heuristics
Approach ladder
Always establish baselines in order:
1. Lexicon + rules — fast, interpretable, domain lexicons 2. Classical ML — TF-IDF + linear models on labeled data 3. Fine-tuned encoder — DistilBERT/RoBERTa/XLM-R for accuracy and latency balance 4. LLM prompts — few-shot or structured output when labels are fluid or low data
Document cost, latency, and maintainability at each step; stop when acceptance metrics are met.
Lexicon and rules
- Use domain lexicons (product, finance) plus negation handling (not, never, without)
- Combine VADER-style heuristics with custom intensifiers and emoticons
- Rules excel for compliance keywords, banned phrases, and bootstrap labels
- Weakness: sarcasm, domain shift, multilingual code-switching
Classical and neural encoders
- TF-IDF + logistic regression / linear SVM: strong baseline on ≥1k labeled docs
- Character n-grams help short social text
- FastText-style embeddings for multilingual baselines with modest data
Fine-tuning transformers
- Prefer encoder-only models for classification and token-level ABSA heads
- Use class weights or focal loss for imbalanced negative/neutral skew
- Early stopping on macro-F1 on dev; avoid optimizing accuracy alone
- Export ONNX/TorchScript when latency matters; quantize after accuracy check
Hyperparameters (starting points): lr 2e-5–5e-5, batch 16–32, 2–4 epochs with early stop.
LLM prompt classification
- Fixed JSON schema outputs:
{"polarity":"positive","confidence":0.82} - Few-shot examples from adjudicated gold; keep prompts versioned
- Use for label schema changes, long-tail aspects, or <500 labels
- Mitigate: temperature 0, self-consistency only for research, cache by hash
- Cost and latency usually exceed encoders at scale — reserve for tier-2 or audit
Selection heuristics
| Signal | Favor |
|---|---|
| <500 labeled examples | Lexicon + LLM few-shot; data collection first |
| 1k–100k labels, stable schema | Fine-tuned encoder |
| Strict latency (<50ms p99) | Small encoder or linear + embeddings |
| Multilingual, one model | XLM-R, mBERT, or language-specific heads |
| Open-vocabulary aspects | ABSA span models or LLM extraction + validation |
| Frequent schema churn | LLM prompts with eval regression suite |
Pair with ai-engineer when sentiment is one tool inside a larger agent; own the classification eval and labels here.
Production serving, monitoring, and governance
Table of contents
1. Inference modes 2. Serving architecture 3. API and versioning 4. Monitoring and drift 5. Human review and governance 6. Analytics integration
Inference modes
| Mode | When | Notes |
|---|---|---|
| Batch | Nightly dashboards, backfill | Higher throughput; stale up to SLA |
| Micro-batch | Near-line aggregations | Kafka + windowed scoring |
| Real-time API | Routing, alerts | p99 latency budget drives model size |
| Edge / on-device | Mobile, privacy | Quantized models; limited labels |
Size models to p99 latency; keep LLM tier for low-volume or audit queues unless budget allows.
Serving architecture
- Model server: TorchServe, Triton, HF TEI, or managed endpoints
- Preprocessor: normalize unicode, strip PII, language ID, max length truncation
- Postprocessor: threshold, abstain class, aspect aggregation
- Feature store (optional): cache embeddings for repeat texts
- Shadow deploy: new model scores logged without affecting routing
Document cold start, batch size, and GPU vs CPU footprint in runbook.
API and versioning
Expose stable contract:
{
"text_id": "…",
"polarity": "negative",
"confidence": 0.91,
"aspects": [{"name": "battery", "polarity": "negative", "span": [12, 24]}],
"model_version": "sentiment-encoder-v3.2",
"schema_version": "polarity-v1"
}- Semantic model_version per trained artifact; schema_version per label definition
- Rollback to prior version without redeploying consumers
- Abstain when confidence below τ or language unsupported
Monitoring and drift
| Signal | Detection | Action |
|---|---|---|
| Label drift | Score distribution vs baseline | Investigate product/event change |
| Prior drift | Class prevalence shift | Retrain or recalibrate thresholds |
| Concept drift | Macro-F1 drop on audit sample | Guideline refresh, new labels |
| Language drift | Language ID mix change | Route or retrain per locale |
| Latency / errors | p99, 5xx rate | Scale, rollback model |
- Sample human audit (e.g., 0.1–1% daily) on live traffic
- Store input hash + score + model_version; avoid raw PII in logs when policy requires redaction
Human review and governance
- Route low-confidence or high-impact items to review queues
- Never present sentiment as legal or compliance verdict
- Align with retention and deletion policies for stored text
- Incident playbook: schema change → re-eval golden set → staged rollout
Analytics integration
- Emit scores to warehouse (
analytics-engineer) withscored_at,model_version, dimensions - Dashboards: volume-weighted sentiment, aspect trends, slice by product/region
- Separate model metrics from business KPIs (CSAT, churn) in reporting
Partner ml-ops-engineer for CI/CD, canaries, and infra; own NLP-specific eval gates in this skill.
Sentiment analysis engineer scope
Table of contents
1. Role boundary 2. In-scope deliverables 3. Lifecycle coverage 4. Engagement checklist
Role boundary
Own engineering and evaluation of sentiment and opinion-mining systems:
| Own | Partner skill |
|---|---|
| Label schema, annotation, and gold data | data-scientist — general ML when sentiment is not the focus |
| Model selection, training, and eval harnesses | ai-engineer — LLM product features beyond classification |
| Production serving, drift, and audit loops | ml-ops-engineer — platform MLOps without NLP design |
| Research memos and SOTA surveys | ai-researcher — papers without build/eval scope |
| Marketing copy and brand tone | content-creator, brand-voice-enforcement |
| Social campaigns and channel strategy | social-content, marketing-analyst |
| Legal or compliance determinations | compliance-engineer, legal-risk-assessment |
In-scope deliverables
| Artifact | Contents |
|---|---|
| Problem spec | Unit of analysis, label set, languages, domains, SLA |
| Annotation guide | Definitions, borderline examples, adjudication rules |
| Baseline ladder | Lexicon → classical ML → fine-tuned encoder → LLM prompt |
| Eval harness | Held-out splits, slice definitions, significance checks |
| Model card | Data lineage, metrics, limitations, bias notes |
| Serving contract | Input schema, score outputs, versioning, fallback behavior |
| Monitoring spec | Drift metrics, human audit rate, alert thresholds |
Out of scope: using sentiment scores as sole evidence for employment, credit, or legal outcomes without human review and policy.
Lifecycle coverage
Define labels → Annotate → Train/eval → Deploy → Monitor
│ │ │ │ │
schema/IAA gold set metrics batch/stream drift/auditDocument which stages are in scope per engagement (e.g., eval-only refresh vs greenfield build).
Engagement checklist
- [ ] Business question stated (routing, analytics, research, moderation support)
- [ ] Label definitions signed off with product/legal where scores affect users
- [ ] Language and domain list frozen (reviews, social, tickets, news, finance)
- [ ] Baseline and acceptance metrics pre-registered (macro-F1 floor, calibration target)
- [ ] PII and retention policy for text samples in logs and error analysis
- [ ] Production path chosen (batch nightly vs real-time API) with latency budget
- [ ] Handoff owners for dashboards (
analytics-engineer) and infra (ml-ops-engineer) identified