research28 min studyLesson 939 in Engineering

Check that the perturbation preserves the task

Define transformation families and label adjudication without equating pixel distance, human similarity, or model agreement.

On this page

What you’ll understand

  • Separate a transformation constraint from a label-preservation claim.
  • Compute validity coverage and conditional failure rates.
  • Design reproducible adjudication for ambiguous transformed examples.

Rotating a picture can preserve the identity of a chair while changing the label of an orientation-recognition task. A color change can preserve object category but alter a traffic-light label. Semantic robustness therefore cannot be defined by saying that an edit looks small or natural. Specify the task, the permitted transformation parameters, and the evidence that the intended label remains valid. A failure under a label-changing edit is not automatically a robustness failure against the original label, even when the model’s answer differs from the original dataset annotation.

Make the transformation family explicit

A semantic or spatial threat can use rotations, translations, lighting changes, controlled text edits, or another declared family. Define parameter ranges, interpolation, padding, cropping, and encoding. Those details change which pixels or tokens reach the model. A translation that removes the only relevant object does not necessarily preserve the original category, while padding can create artifacts that dominate a classifier. Save the transformed artifact actually evaluated, not just a parameter string that may render differently in another library.

Separate transformation feasibility from semantic validity. A point can satisfy an angle bound and still become ambiguous or label-changing. Conversely, a large pixel-norm displacement can preserve the intended category. Norm-bounded and semantic evaluations therefore address different sets rather than stronger and weaker versions of one universal task. Include any intersection explicitly when both constraints matter. Never present a certificate for one mathematical set as evidence for a different transformation family without a justified containment argument.

Ssemantic(x,y)={Tθ(x):θ∈Θ, V(x,y,Tθ(x))=1}\mathcal S_{\rm semantic}(x,y)=\{T_\theta(x):\theta\in\Theta,\ V(x,y,T_\theta(x))=1\}
Θ is a specified parameter domain and V a declared validity/adjudication rule. Membership requires both the transformation constraint and label preservation under the task. V is not automatically determined by pixel norm or by the tested model.↔ Scroll wide equations horizontally.

Adjudicate validity independently of model failure

Use a task-specific rule, trusted simulator, or blinded human adjudication where appropriate. Document annotator instructions, expertise, disagreement handling, and the information available to adjudicators. The evaluated classifier should not be the sole validity oracle, because that would exclude precisely the cases on which it disagrees. A second model can assist screening, but its errors and shared biases do not establish ground truth. Preserve uncertain cases instead of silently assigning them whichever label favors the defense.

Validity assessment after candidate generation can create selection effects. Report how many candidates were generated, how many passed parameter constraints, how many were judged label-preserving, and how many of those failed. Also report case-level coverage: several valid failures for one original example should not become several independent failed examples in a robust-accuracy table. If a generator rarely finds valid candidates, its conditional failure rate alone cannot describe the overall performance of the generation-and-testing procedure.

v^=NvalidNtested,s^valid=Nvalid and failedNvalid,Ntested>0, Nvalid>0\hat v=\frac{N_{\rm valid}}{N_{\rm tested}},\qquad \hat s_{\rm valid}=\frac{N_{\rm valid\ and\ failed}}{N_{\rm valid}},\qquad N_{\rm tested}>0,\ N_{\rm valid}>0
These candidate-level descriptive fractions use explicit validity decisions. They do not estimate worst-case robustness automatically, and repeated candidates for one original input require separate example-level aggregation.↔ Scroll wide equations horizontally.

Treat compound changes and ambiguity carefully

Two individually acceptable edits may produce an invalid combination, such as a crop followed by a rotation that removes the target. Validate the final composed input, and record transformation order. For text, an apparently harmless word replacement can change negation, reference, or the requested output. Use the actual task semantics rather than a generic similarity threshold as the final criterion. A fixed embedding-similarity cutoff is a model-based proxy, not a proof that the label remains unchanged.

Compare clean and transformed performance using the same label policy and preserve the untouched examples for review. Report ambiguous or label-changing outputs in separate diagnostic categories so useful observations are not lost. A system may fail to recognize transformed objects, reject unusable inputs appropriately, or correctly change its answer after the task itself changes. Those outcomes have different implications. Reproducibility requires the validity protocol and adjudication evidence alongside attack code, because the semantic claim cannot be reconstructed from numerical perturbation size alone.

Do not count invalid edits as original-label failures

A toy evaluation tests 12 transformed candidates from distinct original examples. Four are invalid: two change the task label, one is unreadable, and one violates the transformation domain. All four disagree with the original label. Among the remaining eight valid candidates, five cause wrong decisions. Compute validity coverage and valid-conditional failure.

  1. The valid count is 12−4=8, so validity coverage is 8/12=2/3≈66.7 percent. Keep the invalidity reasons rather than treating all four as the same outcome.

  2. There are 5 failures among 8 valid candidates, giving valid-conditional failure 5/8=62.5 percent. Because the originals are distinct in this toy, no repeated-example deduplication is needed here.

  3. Counting all disagreements would yield (4+5)/12=75 percent, but that includes label-changing and otherwise invalid edits. It is not the declared valid-perturbation failure rate.

The result

Both validity coverage and conditional failure are necessary to interpret this generation procedure. Neither fraction alone gives a universal guarantee over the entire semantic transformation set.

Explore the model

Interactive lab

Interactive lab · matrix

An invertible transform does not certify semantic invariance

Reset, set Diagonal scale a to 1 and Shear b to 0. Predict determinant 1 and singular values 1,1 before Step. Reset, explicitly set a=1 and b=1, then Step: predict determinant 1 and singular values approximately 1.618,0.618. The selected triangular matrices remain invertible and preserve area in these runs, but that does not establish task-label preservation. Readouts describe the final matrix while the square geometry interpolates; no image or semantic oracle is modeled.

An invertible transform does not certify semantic invarianceThe selected matrix is A = [[a,b],[0,1]]. Playback interpolates geometry between the identity and A; readouts always describe A. Its determinant is a and its singular values come from AᵀA. Positive a makes every supported matrix invertible. This two-dimensional family is not a general eigensolver or a learned network. Current readings: Area scale · det A: 1.4; Singular values · σmax, σmin: 1.597, 0.876; Condition number · κ₂(A): 1.823. All parameters are adjustable with the labeled controls below.Matrix A with first row 1.4, 0.6 and second row zero, one; display interpolates between identity and A while final determinant remains 1.4.−4−2024−2−1012x · equal geometric scaleyA = [ 1.4 0.6 ; 0 1 ]Display blend: 0% · final values below
Interpolated geometryOriginal unit squareSelected final transform
Area scale · det A
1.4
Singular values · σmax, σmin
1.597, 0.876
Condition number · κ₂(A)
1.823
t = 0 s

The selected matrix is A = [[a,b],[0,1]]. Playback interpolates geometry between the identity and A; readouts always describe A. Its determinant is a and its singular values come from AᵀA. Positive a makes every supported matrix invertible. This two-dimensional family is not a general eigensolver or a learned network. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forGeometric properties and task validity are separate conditions.

Check your understanding

Why is the 75 percent disagreement rate not the valid-perturbation failure rate in the example?

Try it yourself

A generator produces 30 candidates for 10 original examples. Twenty-four candidates pass validity checks. Nine valid candidates fail the model, but they belong to only four originals. Compute candidate-level validity coverage, candidate-level valid failure, and the example-level discovered-failure fraction over all ten originals.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Use different denominators for generated candidates and distinct original examples.

Compare with the solution

Candidate validity coverage is 24/30=80 percent. Valid-conditional candidate failure is 9/24=37.5 percent. Distinct-original discovered failure is 4/10=40 percent. Report all three with their units of analysis; nine failed candidates do not mean nine independently failed original examples.

Take it with you

  • Define the task and final transformed-input validity separately from parameter bounds.
  • Use independent adjudication and preserve uncertainty and disagreement evidence.
  • Distinguish candidate-level rates from distinct-example failures.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.