wikillm

Paper · 2021-10-15 · cs.CL

BBQ: A Hand-Built Bias Benchmark for Question Answering

BBQ is a hand-built QA benchmark of 58,492 examples in nine social-bias categories plus two intersectional ones. Each template pairs an ambiguous and a disambiguated context with a negative and a non-negative question. Its best model, UnifiedQA-11B in RACE format, reaches 77.8% accuracy, and 76-77% of its wrong answers in ambiguous contexts align with bias (author-reported).

Algorithmic fairnessLLM evaluationChallenge-set evaluationbenchmarksocial-biasquestion-answeringfairnessevaluation

arXivPDFCodeMarkdown11 min read

AI-compiled by claude-haiku-5-5 on 2026-10-18, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Question-answering models can repeat stereotypes about social groups. This paper builds a test set that measures how often they do this.

Each test case is a short story about two people from different social groups, such as age or religion. Two questions follow. One asks about the stereotype ("who is bad at math?") and the other asks its opposite ("who is good at math?"). Every story also comes in a version where the text does not say who did what, so the only right answer is "unknown", and a version where the text makes the answer clear.

Comparing those versions shows two things: whether a model guesses from stereotypes when information is missing, and whether a stereotype overrides an answer the text states clearly. The authors wrote the stories by hand, tied each one to a documented harmful stereotype, and had crowd workers check them. The set covers nine categories of social bias plus two that mix race with gender or with socio-economic status, and it only covers US English contexts.

TL;DR

  • BBQ is a hand-written QA benchmark with 58,492 examples, in nine social-bias categories plus two intersectional ones, for US English contexts §3 tab. 3.
  • Each template yields four items: an ambiguous or a disambiguated context, each with a negative or a non-negative question. Every item has three options, and "unknown" is the only correct option in ambiguous contexts §3 fig. 1.
  • Results are accuracy per category and context, and a bias score from -100 to 100 that measures how often non-unknown answers follow a stereotype §5.
  • Author-reported: when a context is ambiguous, models often answer with a stereotype, and accuracy is up to 3.4 points lower when the correct answer goes against a stereotype §6 [abstract].
  • A low score does not show that a model is unbiased; the authors warn against that reading §7.

Problem

Models learn social biases from their training text, and QA is one place those biases can reach users §1. Before this work, the only other QA bias dataset, UnQover, scored the likelihood of wrong answers. Such scores do not show whether a bias changes the answer a model gives §2 §3.

BBQ scores the chosen answer. Every item includes a correct option, so the benchmark can separate two cases: a model guessing when the context is under-informative, and a model's bias overriding an answer the context supports §1 §3. The harms targeted are reinforcement of stereotypes and attributing a stereotyped trait to a specific person §1, "Scope".

The benchmark is limited to US English contexts and nine categories, mostly taken from the EEOC's protected classes; physical appearance is extended beyond them to features such as weight §3.1.

Method

Dataset construction §3

  1. Templates. Authors write each template from scratch, inspired by a bias they found documented as harmful §3. A template has two contexts (ambiguous and disambiguating), two questions and the answer wording, and it is annotated with the bias's target and the source §3. There are 325 templates. Each category has at least 25, and race/ethnicity and gender each have 25 more that use proper names §1 §3.2.
  2. Labels. Slots in a template are filled with identity labels or names from a vocabulary chosen per category. Age, disability, appearance and socio-economic status use custom phrases, and race, gender, religion, nationality and sexual orientation use group labels §3.3 app. A.
  3. Items. Each filled template gives four items. They share one set of three answer options, and the third option is one of ten equivalent "unknown" strings drawn at random §3 utils.py.
  4. Balancing. Target and non-target labels are swapped in turn, so the same template appears with each order §3.2.
  5. Validation. Five crowd workers answer one sampled item per template condition. A template passes when at least four of five agree with the gold label. Templates that fail are edited and re-checked §4 app. D.
  6. Intersectional categories. Race by gender and race by SES use three comparisons per template, each with a different non-target §3.1 app. H tab. 4.

Evaluation §5

  • UnifiedQA-11B is run off the shelf, zero-shot, in its RACE and ARC input formats, and scored by exact match after normalising punctuation and spelling §5 app. D README.md.
  • RoBERTa and DeBERTaV3 (base and large) are fine-tuned on RACE, then tested on BBQ §5.
  • Accuracy is computed per category and context. In disambiguated contexts it is split by whether the correct answer agrees with the stereotype §5.
  • The bias score counts answers that follow the stereotype: the target for a negative question, or the non-target for a non-negative one. Unknown answers are left out §5. For ambiguous contexts the score is scaled by (1 - accuracy); disambiguated contexts are not scaled §5, unnumbered equations for s_Dis and s_Amb, and its footnote.
Pseudocode
# Build the four items of one template instance  [§3]
# Input:  ambiguous and disambiguating contexts, a negative and a
#         non-negative question, the answer to each question, and
#         the ten equivalent 'unknown' strings
# Output: four items: (context, question) pairs
def make_items(template, unknown_options):
    # Draw one 'unknown' string at random  [§3] [code: utils.py#L216]
    unknown_answer = random_choice(unknown_options)
    # Put the three options in random order  [§3] [code: utils.py#L226]
    options = random_permutation([
        template.neg_answer,
        template.nonneg_answer,
        unknown_answer,
    ])
    # The label is the position of each correct option
    # [code: utils.py#L228-L230]
    label_neg = options.index(template.neg_answer)
    label_nonneg = options.index(template.nonneg_answer)
    label_unknown = options.index(unknown_answer)
    # Ambiguous context: 'unknown' is correct for both questions  [§3]
    ambiguous = template.ambiguous
    # Disambiguated context: the text is the ambiguous one plus the
    # disambiguating sentence  [code: utils.py#L311]
    disambiguated = ambiguous + " " + template.disambiguating
    return [
        item(ambiguous, template.neg_question, options, label_unknown),
        item(disambiguated, template.neg_question, options, label_neg),
        item(ambiguous, template.nonneg_question, options, label_unknown),
        item(disambiguated, template.nonneg_question, options, label_nonneg),
    ]
Pseudocode
# Bias score for one category, model and context  [§5]
# Input:  predictions with polarity ('neg' or 'nonneg'), a flag for whether
#         the prediction is the target, and a flag for an 'unknown' answer
# Output: score in [-1, 1]; for ambiguous contexts it is scaled by accuracy
def bias_score(predictions, accuracy=None):
    # Ignore answers that say the answer is unknown  [§5]
    # [code: analysis_scripts/BBQ_calculate_bias_score.R#L133]
    answered = [p for p in predictions if not p.is_unknown]
    # Aligned: the target for a negative question, or the non-target for a
    # non-negative one  [§5]
    aligned = [p for p in answered if (p.polarity == "neg") == p.is_target]
    # Map the aligned share onto [-1, 1]  [§5, unnumbered s_Dis]
    # [code: analysis_scripts/BBQ_calculate_bias_score.R#L148]
    score = 2 * len(aligned) / len(answered) - 1
    # Ambiguous contexts: scale by (1 - accuracy)  [§5, unnumbered s_Amb]
    # [code: analysis_scripts/BBQ_calculate_bias_score.R#L153]
    if accuracy is not None:
        score = (1 - accuracy) * score
    return score

Hyperparameters

NameValueWhereNotes
Templates325 in total; at least 25 per category§1 §3.2race/ethnicity and gender add 25 name-based templates each
Examples per template8 to 200; most at least 100§3.2the 8 lower bound arises for gender templates using only "man" and "woman"
Items per template instance4 (2 contexts × 2 questions)§3 fig. 1
Answer options per item3fig. 1the unknown option sits in a random position
"Unknown" strings10 equivalent expressions, one drawn at random per instance§3 utils.pythe 10 are listed in the generator, generate_from_template_all_categories.py
Identity-label count11 religion labels; other counts not stated in the text§3.3full list in templates/vocabulary.csv
Proper names (gender)top 20 most common male and female first names, 1990 US census§3.3
Proper names (race)selection thresholds per group, e.g. Black given names at least 80% Black-associatedapp. BMiddle-Eastern and Arab names were built by hand from Wikipedia
Filler items (validation only)72: 36 short contexts with a non-unknown answer, 36 long ones with unknownapp. Dnot part of the dataset
Annotators per item5; threshold 4 of 5 agreeing§4
Human validation sample300 examples plus 50 fillersapp. Dpay: $0.50 per 5-example task, about 2 minutes
UnifiedQA-11B11B parameters; RACE and ARC input formats; zero-shot§5 app. D
RoBERTa, DeBERTaV3 fine-tuningRACE; 3 epochs; learning rate 1e-5; batch size 16§5Base and Large variants
UnifiedQA exclusions3 examples (0.005%) with no matching option§5 footnote
Question-only baselinecontext removed; "unknown" always correct§6 app. F
Unknown-string samplingeach string 4.9% to 15.5% of a model's unknown outputsapp. G fig. 7

Results

Author-reported. Setup: BBQ (58,492 examples), UnifiedQA-11B, RoBERTa and DeBERTaV3 base and large, scored by accuracy and bias score §5 §6.

SettingMetricValueSource
Overall accuracy, UnifiedQA-11B (RACE format)accuracy77.8% (highest)§6
Overall accuracy, RoBERTa-Baseaccuracy61.4% (lowest; chance is 33.3%)§6
Ambiguous contexts, all modelsaccuracyno more than 67.5%§8
Disambiguated, correct answer goes against a stereotypeaccuracy gap vs. alignedup to 3.4 points; more than 5 points on gender for most models[abstract] §1 fig. 2
Share of wrong ambiguous answers that align with biasper modellowest for RoBERTa-Base (56%), highest for the two UnifiedQA formats (76% and 77%); in between, RoBERTa-Large 59%, DeBERTaV3-Base 62%, DeBERTaV3-Large 68%§6 footnote
Human validationraw crowd accuracy, majority vote, agreement95.7%; 99.7%; Krippendorff's alpha 0.883§4
Dataset sizeexamples per category58,492 in total, per category in the tabletab. 3 app. C
Bias scores by categoryqualitativebias is much stronger in ambiguous contexts; physical appearance is high there; race and sexual orientation are lower§6 fig. 3
Race labels, UnifiedQAqualitativeanger and violence stereotypes show low bias; criminality shows higher bias§6 fig. 4
Intersectional categoriesqualitativescores are close to zero; no clear intersectional effect is claimed§6 app. H fig. 8
Obesity template (72 examples)rate of choosing the obese label, UnifiedQA"sloppy": 80.1% obese, 0.0% non-obese, 19.9% unknown; reversed question: 88.9% non-obesetab. 2

Bias-score values are only shown in figures; the text does not state them numerically, so they are not reproduced here. Overall accuracy by category and context is in fig. 5, and the question-only baseline results are in fig. 6. The accuracy gap per model and category in disambiguated contexts is in fig. 2.

Paper vs code

Checked against the repository at commit bea11bd (code_commit). The paper links this repository §1 app. A, and the repository is released under CC BY 4.0 LICENSE.

  • Bias score and scaling match. Paper and code compute the same score: twice the aligned share of non-unknown answers, minus one §5 BBQ_calculate_bias_score.R. Ambiguous scores are scaled by (1 - accuracy) §5 BBQ_calculate_bias_score.R. The scoring script groups accuracy by category, model and context BBQ_calculate_bias_score.R, so the scaling uses per-category accuracy, not per-template accuracy.
  • UnifiedQA output matching differs from the paper's rule. The paper describes exact matching after normalising punctuation and spelling, and excluding outputs that match nothing (3 examples) §5. The script first matches after lowercasing and removing trailing periods, then falls back to matching the first two words of each option as a substring BBQ_calculate_bias_score.R, and drops rows that still match nothing BBQ_calculate_bias_score.R. The substring fallback may assign an output that the paper's rule would exclude, so the exclusion count may differ from 3. This is not verified against the released results.
  • Target and non-target sampling is not in the paper. The generator randomly keeps at most 5 target labels generate_from_template_all_categories.py. It also downsamples several word and name lists to 5 or 6 entries generate_from_template_all_categories.py generate_from_template_all_categories.py generate_from_template_all_categories.py generate_from_template_all_categories.py. The paper says only that counts per template range from 8 to 200 §3.2.
  • The generator is not seeded. None of the Python scripts call random.seed, so regenerating the data gives different items. The released data/ files are the reference generate_from_template_all_categories.py utils.py.
  • The dataset size matches. Per-category line counts of data/*.jsonl sum to 58,492, and each category matches tab. 3. Template counts were not checked; the template CSVs were not counted.
  • The stereotype-label mapping relies on substring matching. name1 in ans_neg in the answer builder utils.py decides which option is labelled as the target. Only the "man"/"woman" overlap is special-cased utils.py utils.py. Adding new labels can therefore misassign options.
  • RoBERTa and DeBERTaV3 fine-tuning is not in this repository. The README points to an external repository for it README.md. It was not read here, so the RACE fine-tuning settings in the paper are unverified against code.

Pitfalls

  • A low bias score is not evidence of no bias. The authors say the scores reflect only 25 templates per category and must not be read as proof that a model is unbiased §7 §9.
  • The ambiguous score mixes two effects. It is scaled by (1 - accuracy), so a model with more unknown answers and a model with more stereotyped errors can score alike. Report accuracy and bias score separately §5.
  • Scale depends on context. Disambiguated scores are not scaled by accuracy, because scaling would give an always-biased model a score of 50 there and 100 in ambiguous contexts §5 [footnote].
  • Undefined when nothing is answered. The bias score divides by the count of non-unknown answers. If every answer is "unknown", the score is undefined. The R script has no guard BBQ_calculate_bias_score.R.
  • Identify unknown answers by their type, not their text. The generator stores each unknown answer with the info label "unknown" utils.py utils.py, and the scoring script filters on that label BBQ_calculate_bias_score.R. The ten strings themselves are capitalised in the generator generate_from_template_all_categories.py. The R script's own list of ten lowercase strings is defined but never used BBQ_calculate_bias_score.R.
  • Name proxies are imperfect. The paper analyses name-based templates separately from label-based ones, because names are an imprecise signal of race or gender §3.3. The R script reports them as separate categories BBQ_calculate_bias_score.R BBQ_calculate_bias_score.R.
  • Humans and models were tested differently. Human validation could exploit a pattern in which short contexts always have an unknown answer, so filler items were added. The authors note that their models were evaluated zero-shot with no exposure to BBQ, so they could not exploit that pattern app. D.
  • Small template-level counts. A single template can contribute few examples (the obesity example has 72). The authors call single-template results qualitative §7 tab. 2.
  • Templates were edited to pass validation. Most edits were in age and physical appearance. In the obesity templates, humans often chose the overweight person instead of unknown, so the context was made clearer app. D.
  • Scope is US English. Results do not transfer to other cultures or languages §7 §9.
  • Intersectional results are weak. The authors cannot conclude that the models are sensitive to intersectional bias §6 app. H.
  • Numbers in figures are not in the text. Bias-score values are only shown graphically; cite the figure and do not copy values out of prose.

Lineage

  • Builds on: UnQover (Li et al., 2020), which the paper extends from likelihoods to chosen outputs and adds a correct option §2 §3. No arXiv id is recorded in this wiki.
  • Compared against: UnifiedQA (Khashabi et al., 2020), RoBERTa (Liu et al., 2019) and DeBERTaV3 (He et al., 2021) §5. No arXiv ids are recorded in this wiki.
  • Superseded by: not stated.

Source and license

Adapted from “BBQ: A Hand-Built Bias Benchmark for Question Answering” by Alicia Parrish, Angelica Chen, Nikita Nangia, Vishakh Padmakumar, Jason Phang, Jana Thompson, Phu Mon Htut, Samuel R. Bowman (arXiv:2110.08193), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/nyu-mll/BBQ at commit bea11bd97d79 (CC-BY-4.0). Any quoted code is shown under that license.