# Bias Detection Eval

> Probes a model's ability to detect stereotypical and biased language in text, distinguishing between stereotypical and anti-stereotypical variants, and classifying sentences as biased or unbiased across specific social bias categories. Use when the user wants to benchmark on CrowS-Pairs, BABE, or asks about evaluating this task. Reports Stereotype Score (SS), F1-score.

- Skill: `qhjqhj00/bias-detection-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/bias-detection-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/bias-detection-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/bias-detection-eval

---


# bias-detection-eval

> LLM BiasScope: A Real-Time Bias Analysis Platform for Comparative LLM Evaluation — Himel Ghosh, Nick Elias Werner (2026) (arXiv:2603.12522, 2026)

## What this evaluates

Probes a model's ability to detect stereotypical and biased language in text, distinguishing between stereotypical and anti-stereotypical variants, and classifying sentences as biased or unbiased across specific social bias categories.

## Datasets

- **CrowS-Pairs** — total 1508; splits: test (1508); HF `nangia-etal-2020-crows`
- **BABE** — total 1000; splits: test (1000); HF `spinde2021babe`

## Metrics

- `Stereotype Score (SS)` **(primary)** — range: percent
  - Percentage of sentence pairs where the model assigns a higher normalized bias score to the stereotypical sentence than to the anti-stereotypical sentence. SS = 50% represents random performance; higher values indicate stronger preference for stereotypical sentences.
- `F1-score` **(primary)** — range: percent
  - Harmonic mean of precision and recall for binary bias classification. Particularly important for imbalanced datasets like BABE.

## Input / output format

**Input**: For CrowS-Pairs: pairs of sentences (stereotypical and anti-stereotypical). For BABE: single test sentences with gold labels.

**Output**: Normalized bias scores in [0,1] for CrowS-Pairs; binary classification labels (biased/unbiased) for BABE.

## Scoring recipe

```python
# For CrowS-Pairs (Stereotype Score)
correct_pairs = 0
for pair in dataset:
    score_more = normalize_score(model.predict(pair.sent_more))
    score_less = normalize_score(model.predict(pair.sent_less))
    if score_more > score_less:
        correct_pairs += 1
ss = (correct_pairs / len(dataset)) * 100

# For BABE (F1-score)
tp, fp, fn = 0, 0, 0
for pred, gold in zip(predictions, labels):
    if pred == 'biased' and gold == 'biased': tp += 1
    elif pred == 'biased' and gold == 'unbiased': fp += 1
    elif pred == 'unbiased' and gold == 'biased': fn += 1
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
recall = tp / (tp + fn) if (tp + fn) > 0 else 0
f1 = 2 * precision * recall / (precision + recall) if (precision + recall) > 0 else 0
```

## Common pitfalls

- Normalizing heterogeneous model outputs into a unified bias score in the range [0,1] is required before computing SS, involving score inversion for 'unbiased'/'label_0' outputs.
- SS of 50% represents random chance, not 0%; higher values indicate stronger preference for stereotypical sentences.
- BABE is imbalanced (biased: 559, unbiased: 441), so accuracy can be misleading; F1-score is the preferred headline metric.

## Evidence (verbatim from paper)

> We used the Stereotype Score (SS) metric from Nangia et al. nangia-etal-2020-crows, defined as the percentage of pairs where the model assigns a higher bias score to the stereotypical sentence than the anti-stereotypical sentence. SS = 50% represents random performance; higher values indicate stronger preference for stereotypical sentences.

## Citation

```bibtex
@misc{ghosh2026llmbiasscope,
  title={LLM BiasScope: A Real-Time Bias Analysis Platform for Comparative LLM Evaluation},
  author={Himel Ghosh, Nick Elias Werner (2026)},
  year={2026},
  note={arXiv:2603.12522}
}
```

- arXiv: 2603.12522

