Welcome back. The previous lesson turned “this feature represents carry” into predictions that could fail. It also exposed a design problem: changing an input to alter carry legitimately changes the correct tens digit. That is useful for testing carry, but not for testing whether a model follows an irrelevant cue instead of the evidence the task requires.
This lesson focuses on constructing matched examples: pairs that vary a suspected shortcut while preserving the task-relevant evidence and, therefore, the correct answer. The design will matter later when you compare input-level behavior with internal activation interventions. Allow about 35–45 minutes, including the reading.
Identify what must stay true
Consider a sentiment classifier applied to sentences about journeys. A location name may be correlated with sentiment labels in its training data without being evidence of the sentiment expressed in a particular sentence. The supplied image shows the diagnostic idea: two sentences differ in destination, both have an expected positive label, but the pictured model assigns different predictions.

There is an important annotation question hiding in this example: is “safe travel” unambiguously positive under the classifier’s task definition? If competent annotators could reasonably call it neutral, the prediction difference may partly reflect an uncertain gold label. A stronger pair uses clearer sentiment evidence:
“The trip to Chicago was pleasant and comfortable.”
“The trip to Dallas was pleasant and comfortable.”
For a task that labels the sentiment expressed by the sentence, “pleasant and comfortable” supplies the relevant evidence. The destination is the candidate shortcut cue. A matched-pair claim is conditional on that task definition: changing the destination should not change the gold sentiment label. For a different task—say, identifying where the trip went—the destination would be essential evidence, not a nuisance.
Formally, it helps to think of an input as containing task-relevant evidence , a candidate cue , and other context . The intended pair is
with the same gold answer for both. Natural language rarely separates into perfectly independent pieces, so this notation is a design goal, not a guarantee. Your job is to check whether editing accidentally changed or the meaning of .
Distinguish two kinds of close comparison
A paper on contrast sets explains why nearby examples can reveal a decision rule that ordinary test accuracy misses. Read its account of dataset gaps, then its distinction between label-changing contrast sets and label-preserving perturbations.
Evaluating Models' Local Decision Boundaries via Contrast ...
Read this paper’s discussion of local comparisons to see why a model can succeed on ordinary test examples while following an overly simple rule. Its formal contrast sets usually change the correct label; notice how that differs from the matched shortcut pairs in this lesson.
In Section 2.1, “The Problem” (pp. 1309–1310), find the paragraph beginning “However, as is common in practice, our toy dataset is rife”. Read systematic gaps through its account of sampling examples near a pivot. Focus on why an ordinary test split can preserve a misleading rule. In Section 2.3, “Contrast sets in practice” (p. 1311), find the paragraph beginning “A contrast set is not a collection of adversarial examples”. Read the distinction through its explanation of gold-label changes. Keep that label-changing design separate from the label-preserving cue swaps used here.
Both designs compare nearby inputs, but they ask different questions. A label-changing comparison edits consequential evidence and checks whether the model changes its answer appropriately. A label-preserving shortcut comparison edits a proposed nuisance cue and checks whether the model maintains its answer appropriately. For sentiment, replacing “pleasant and comfortable” with “miserable and exhausting” calls for a label change; replacing one destination with another does not, under the task definition above.
Using both comparisons makes the test sharper. A model that predicts “positive” for every sentence would appear perfectly invariant to destination, but it would not be performing sentiment classification. Invariance is informative only alongside evidence that the model responds to legitimate changes in sentiment.
Build a small matched design
Start with one sentence whose label you can defend without consulting the model. Specify the candidate cue narrowly—here, the destination name, not all geographical language. Then write a cue-swapped counterpart with the same sentiment words, syntax, question, and surrounding context. Finally, repeat the swap under a different gold label:
| Task-relevant evidence | Chicago cue | Dallas cue | Gold sentiment |
|---|---|---|---|
| Positive | “The trip to Chicago was pleasant and comfortable.” | “The trip to Dallas was pleasant and comfortable.” | Positive for both |
| Negative | “The trip to Chicago was miserable and exhausting.” | “The trip to Dallas was miserable and exhausting.” | Negative for both |
Each row is a label-preserving matched pair. Comparing rows checks whether the model responds when sentiment evidence genuinely changes. This four-example grid is a diagnostic seed, not an adequate evaluation set: one template and two destinations could produce an idiosyncratic result.
The arithmetic example from the previous lesson shows why matching sometimes requires more than a one-token edit. Suppose the suspected shortcut is the presence of a in the first operand, while the task is to give the tens digit. Compare with : one input contains that , but both have no ones-column carry and require the same tens digit. You can also compare with : both carry and require the same tens digit, although only one has the nominated . These pairs preserve more arithmetic evidence than a simple -to- edit would. They also change the second operand’s ones digit, which might itself become a cue. Matching controls named differences; it does not make every other possible explanation disappear.
For a larger set, vary operand combinations or sentence templates while retaining the same rule for what counts as task evidence. Include both cue values under each legitimate answer, rather than testing the cue only on positive sentences or only on carry problems. That balance helps separate “the model reacts to this cue” from “the model reacts to this cue only in one particular context.”
Audit the pairs before looking at predictions
The main threat to a matched design is an edit that changes more than you intended. A compact audit records the following for each pair:
- Gold-label stability. State why the answer is unchanged. For ambiguous language tasks, have the labels checked without revealing which prediction or internal feature motivated the pair.
- Cue isolation. Mark the exact tokens edited and any properties that changed with them. A name swap can also change tokenization, familiarity, sentence rhythm, or real-world associations. An arithmetic substitution can change another digit.
- Naturalness and scope. Keep both examples plausible members of the task’s intended input population. An awkward sentence may test handling of unusual wording rather than reliance on the nominated cue.
- Coverage. Use several independently chosen pivots and cue values. Decide on the edit rule before inspecting the model’s responses, so failures are not selected after the fact.
Some cues cannot responsibly be swapped while assuming the label stays fixed. In toxicity or hate-speech classification, for example, replacing an identity term may change who is being targeted, the meaning of a phrase, or the applicable annotation rule. Such a pair needs fresh label validation; superficial textual similarity is not enough. Likewise, a destination might be relevant if the assigned task asks about travel recommendations rather than expressed sentiment.
A model’s output change on a well-audited pair is evidence of input-level sensitivity to that edit on the tested examples. Repeated, consistent sensitivity strengthens a behavioral shortcut claim. It does not yet show which activation carries the cue, whether the model uses a particular proposed feature, or whether the same behavior holds outside the tested population. Those are separate claims requiring separate tests.
Conclusion
To construct matched shortcut examples, first fix the task and its legitimate evidence. Change the candidate nuisance cue while keeping the correct answer defensibly constant, then include comparisons where changing legitimate evidence should change the answer. Audit unintended changes and test more than one pivot or template. A close pair is valuable because it narrows an explanation—not because “minimal edit” automatically means “only one meaningful difference.”
The next lesson chooses a target-behavior measure and an off-target performance measure for these experiments, so that cue sensitivity can be assessed without mistaking a generally degraded model for an improved one.