How do you measure demographic or stereotyping bias in an LLM using a standardized eval?
Describe two standardized approaches for measuring demographic or stereotyping bias in an LLM. What are the benchmark suites available and how do counterfactual methods work?
Measure bias two ways: counterfactual augmentation swaps a demographic attribute and checks if outputs diverge, and benchmark suites like BBQ and WinoBias score stereotyped versus neutral choices.
Imagine testing whether a hiring manager is fair. You hand them two identical resumes that differ only in the name at the top, one says John and one says Aisha, and you watch whether the decisions change. If the advice or tone differs, the difference itself is the bias, because nothing else changed. That is the counterfactual idea: swap one attribute, hold everything else fixed, and measure the gap. The second way uses ready-made test packs. Someone has already written hundreds of tricky questions where a fair answer is known in advance, like 'the doctor told the nurse that she was late, who was late?' A fair model says we cannot tell from the sentence. A biased model jumps to the stereotype. You just count how often the model picks the stereotype.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: counterfactual data augmentation and pair construction, BBQ ambiguous versus unambiguous design, WinoBias coreference, the per group metrics, and why aggregate scores and public benchmarks mislead.
Real products, models, and research that use this idea.
- BBQ (Bias Benchmark for QA) ships ambiguous and disambiguated splits and is a standard fairness gate in 2026 model cards from major labs.
- WinoGender and WinoBias remain the default coreference probes for occupational gender stereotyping in open-source eval harnesses.
- HELM by Stanford CRFM bundles BBQ and other bias suites into reproducible leaderboard runs.
- Anthropic and OpenAI system cards report demographic disparity tests built on counterfactual name and pronoun swaps before release.
- DeepEval and Promptfoo expose bias and counterfactual templates so teams can run CDA on their own production prompts.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does BBQ separate ambiguous from unambiguous contexts, and what does each reveal?
QHow do you keep a counterfactual name swap from being confounded?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Reporting a single aggregate bias score. Bias must be measured per demographic group and per context condition, because ambiguous and unambiguous cases reveal opposite failure modes.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.