Liang 2022 - The Seven Metrics

Summary

HELM measures seven categories of desiderata for each core scenario: accuracy (scenario-specific: exact match, F1, RR@K, NDCG@K, ROUGE-2, BPB), calibration (10-bin uniform-mass ECE plus selective classification acc@10% and the coverage-accuracy area), robustness (worst-case accuracy over invariance and equivariance perturbations), fairness (counterfactual perturbations and performance disparities), bias (TVD of demographic representation and stereotypical associations from uniform), toxicity (Perspective API on generations) and efficiency (training energy and CO; denoised and idealized inference runtime). The paper stresses these are contested constructs measured by specific operationalizations.

Overview

The central rule: “measuring these 7 desiderata for the same scenarios makes explicit potential tradeoffs and helps to ensure these desiderata are not treated as second-class citizens to accuracy.” Metrics are defined for black-box text-to-text models. Table 4 in the paper shows 98 of 112 (scenario, metric) pairs are measured.

Main Content

1. Accuracy (Sec. 4.3, App. C.1)

An umbrella term for the standard accuracy-like metric of each scenario, averaged over test instances (so minority subpopulations can have low accuracy despite a high mean).

MetricCorrectness conditionDefault for
Exact matchgeneration equals the reference stringHellaSwag, OpenBookQA, TruthfulQA, MMLU, BLiMP
Quasi-exact matchequal after lower-casing and stripping whitespace, punctuation, articlesBoolQ, IMDB, CivilComments, RAFT, WikiFact, synthetic reasoning (abstract symbols), bAbI, LegalSupport, LSAT, EntityMatching, DataImputation
F1 (word overlap)graded partial overlap (Rajpurkar et al. 2016)NaturalQuestions (open and closed book), NarrativeQA, QuAC
RR@K of the first relevant document if rank , else 0 ()MS MARCO (regular)
NDCG@Knormalized discounted cumulative gain with graded relevance ()MS MARCO (TREC)
ROUGE-2bigram overlapCNN/DailyMail, XSUM
BPBbits per byte under model probabilitiesThe Pile, ICE, TwitterAAE
F1 (set match)set-level F1synthetic reasoning (natural)
Exact match up to indicatorcompare prefixes up to a specified indicatorDyck, GSM8K
Code metricsas defined in the dataset papersHumanEval, APPS
Equivalent / Equivalent (CoT)mathematically equivalent answerMATH

NDCG@K

With graded relevance of the document at rank ,

where IDCG@K is the DCG@K of the ideal ordering (sorted by relevance grade descending).

2. Calibration and uncertainty (Sec. 4.4, App. C.2)

Setting: classification with labels. True label , predicted probability vector with , predicted label , top probability .

Expected calibration error (population)

(The paper writes the expectation of the absolute difference between the model’s top probability and the probability that it is correct given that top probability.)

Finite-sample ECE with uniform-mass bins

Sort the examples by and partition into bins of equal size (sizes differ by at most 1; “uniform-mass” bins, Kumar et al. 2019; default ). With the mean top probability in bin and the accuracy in bin ,

Selective classification

Coverage at threshold : . Selective accuracy: (defined when ). The selective coverage-accuracy area (SCAA) is the area under the curve of against :

acc@10% is at the threshold with : accuracy on the 10% of examples the model is most confident about. Finite-sample: with data sorted by decreasing , is the accuracy of the most confident examples, and .

Selective classification captures something different from calibration: many models can rank which examples are hard even when raw probabilities are off. Figure 17 worked example (2 bins for illustration): bin means 0.15 and 0.85, giving ECE .

3. Robustness (Sec. 4.5, App. C.3, D.1)

Local robustness only (distribution shift needs subpopulation annotations and knowledge of training data; adversarial robustness needs many adaptive queries).

Worst-case robustness

Let be the scenario’s basic metric, and transformations (including the identity). Then

Because the identity is included, Robustness Accuracy. With accuracy as , an instance counts correct only if it is correct on all its perturbations.

  • Invariance: natural, mild, semantics-preserving perturbations (capitalization, common misspellings, typos; NL-Augmenter based). Only for text classification, question answering and information retrieval, because gold-standard changes are hard to specify for long-form generation.
  • Equivariance: semantics-altering perturbations from contrast sets (Gardner et al. 2020) via counterfactually augmented data; available only for BoolQ and IMDB.

4. Fairness (Sec. 4.6, App. C.4, D.2)

Following Khani and Liang (2020), two operationalizations:

  • Counterfactual fairness (Dwork et al. 2012; Kusner et al. 2017): accuracy on perturbed test instances that swap group terms. Speaker property: Standard American English vs African American English (dialect perturbation); subject properties: race and binary gender (e.g. “He bends down…” to “She bends down…”). Restricted to classification, QA and IR. Computed like robustness: per-group accuracy on perturbed instances and the worst case across them.
  • Performance disparities: subgroup accuracy when instances carry group metadata (speaker gender, nationality, spoken vs written; subject gender, sex, race, religion, disability status), compared manually; the paper defers choosing an aggregate fairness score to context.

The paper raises the question of whether language models should (attempt to) speak particular dialects, and notes that LM norms need not match human norms.

5. Bias and stereotypes (Sec. 4.7, App. C.5)

Social bias

Following Blodgett et al. (2020) and Beukeboom and Burgers (2019): “a systematic asymmetry in language choice”. Fairness is about disparities in task accuracy across groups; bias is a property of generations with no explicit tie to task accuracy.

Demographic representation

For groups with word lists (binary gender: ; race with White, Hispanic, Asian: ) and generations , let count token in generation . Group counts , observed distribution , and with uniform reference ,

bounded above by (0.5 for gender, for race).

Stereotypical associations

For a target term (e.g. “mathematician”) count group words only in generations where appears: , compute the same TVD to uniform per term, and average over a term set (for example professions) for a single number.

The paper notes count-based measures are brittle (e.g. differential linguistic marking such as “female nurse” vs “male nurse”), and that predictive validity of such measures for downstream bias is contested. Reported for scenarios that involve generation.

6. Toxicity (Sec. 4.8, App. C.6)

Toxicity is treated as an instance-level property of generations, measured with the Perspective API (Lees et al. 2022); the reported quantity is the fraction of generations labeled toxic (Fig. 21: 1 toxic of 3 generations gives ). The authors chose Perspective over newer detectors because its limitations are extensively analyzed, and acknowledge the construct depends on context and annotators (Sap et al. 2019; Gordon et al. 2022; Rauh et al. 2022).

7. Efficiency (Sec. 4.9, App. C.7)

  • Training: energy (kWh) and emissions (kg), using creators’ reported numbers where available, otherwise

with the average GPU draw in kW, hours, PUE set to 1.1, and the datacenter’s carbon intensity (US national average if unknown). Training runtimes are not reported since they are rarely disclosed and ignore the number of accelerators.

  • Inference: per-request runtime cannot compare providers (hardware, software, contention). Two surrogates are computed: denoised inference runtime (the provider’s own hardware and software with performance-variation noise removed) and idealized inference runtime (uniform optimized hardware/software). The runtime model is , where maps prompt length to encoding time and is per-additional-output-token time.

Examples

ECE with uniform-mass bins (Figure 17 reproduced)

Eight predictions with top probabilities ; with two bins of four, the means are 0.15 and 0.85. If the low bin has accuracy 0.5 and the high bin 0.75, then , matching the figure.

import numpy as np
 
def ece_uniform_mass(pmax, correct, m=10):
    order = np.argsort(pmax)
    p, c = np.asarray(pmax)[order], np.asarray(correct)[order]
    bins = np.array_split(np.arange(len(p)), m)
    return sum(len(b)/len(p) * abs(p[b].mean() - c[b].mean()) for b in bins)
 
pmax = [0.0,0.1,0.2,0.3,0.7,0.8,0.9,1.0]
corr = [1,1,0,0, 1,1,1,0]            # bin accuracies 0.5 and 0.75
print(ece_uniform_mass(pmax, corr, m=2))   # 0.225
 
def scaa(pmax, correct):
    order = np.argsort(-np.asarray(pmax))
    c = np.asarray(correct)[order]
    return float(np.mean(np.cumsum(c)/np.arange(1, len(c)+1)))
print(scaa(pmax, corr))

Demographic-representation TVD

Suppose generations mention male terms 30 times and female terms 10 times: , uniform reference , so , half the maximum possible 0.5.

import numpy as np
def tvd_to_uniform(counts):
    p = np.asarray(counts, float); p /= p.sum()
    return 0.5*np.abs(p - 1/len(p)).sum()
print(tvd_to_uniform([30, 10]))       # 0.25
print(tvd_to_uniform([1, 0]))         # 0.5, the maximum for k=2
# worst-case robustness over perturbations
acc = np.array([[1,1,0],[1,0,0],[1,1,1]])  # instance x perturbation correctness (col 0 = identity)
print(acc[:,0].mean(), acc.min(axis=1).mean())  # accuracy 1.0, robustness 0.333

Connections

Relevance to marketing measurement. All seven have an MMM analogue: accuracy (bias and RMSE of channel ROI against experiments), calibration (credible-interval coverage; reliability diagrams for predicted lift), robustness (worst-case estimate across plausible data cleaning or prior choices, which mirrors the min-over-transformations definition), fairness (error disparities across geos or segments), and efficiency (compute cost of the sampler). The robustness definition is a ready template for a sensitivity-analysis report.

See Also