6.4.11 · D1AI Safety & Alignment

Foundations — Data poisoning and backdoor attacks

2,795 words13 min readBack to topic

This page assumes you have seen none of the notation in the parent note. We will build every symbol from a picture before we let it appear in a formula. Read top to bottom — each idea leans on the one above it.


1. What is an "example"? The pair

Everything starts with a single training example. An example is a question and its answer glued together.

Look at the picture: the input is a bag of numbers, the label is the tag stapled to it.

Figure — Data poisoning and backdoor attacks
  • The bold means "vector" ::: a list of numbers (all the pixels / features), not one number
  • is called the ::: label, the correct answer the model should learn to produce

2. The subscript and the dataset — counting examples

One example is never enough. The model learns from a whole pile of them.

  • counts ::: the total number of training examples
  • is a ::: counter / index that names one particular example

3. The model — the pattern-copying machine

Now the machine that eats an input and guesses an answer.

Figure — Data poisoning and backdoor attacks
  • (theta) stands for ::: all the tunable numbers (weights) inside the model
  • means ::: run the model, with knobs set to , on input
  • The star in means ::: the best / final knob values found after training

4. Loss — measuring "how wrong"

To turn the knobs sensibly the machine needs a score of its mistakes.

Look at the meter: when the guess matches the truth the needle sits at ; the further apart they are, the higher it climbs.

Figure — Data poisoning and backdoor attacks
  • The loss outputs ::: a single number: how wrong one guess was (0 = perfect)
  • Which symbol is the wrongness meter — , , or ? ::: (script-ell)

5. Empirical risk — average wrongness over the whole pile

One example's wrongness is not enough; we want the machine good on average.

Let us read it one piece at a time, left to right:

  1. — a capital script-L: the total wrongness for the whole pile, as a function of the knob setting . (Note: small = one example, big = the pile.)
  2. — the sum sign (Greek capital sigma). It means "add up the thing on the right, once for each from to ." Why a sum? because we want the wrongness across all examples, not just one.
  3. — the wrongness on example (from Section 4).
  4. — divide by the count. Why? turning a total into an average, so a pile of 10 and a pile of a million are comparable.
  • (sigma) tells you to ::: add up the term to its right, once per index value
  • Why divide by ? ::: to turn a total wrongness into an average wrongness
  • returns ::: the value of that makes the expression smallest

6. The perturbation and its size

The parent note tampers with inputs: , with . Two new symbols.

  • is ::: a small nudge added to the input to change it slightly
  • means ::: the total size of the nudge stays below a tiny budget (stays invisible)

7. The trigger function and the map

The backdoor part needs one more piece: the trigger.

  • (script-X) is ::: the set of all possible inputs the model could see
  • Plain produces ::: the input with the secret trigger pattern stamped on (a function/action)
  • Bold is ::: the trigger pattern itself — a picture/vector, same type as
  • in "" means ::: takes something of type , returns something of type

8. The target label , counts , and the rates

Three last pieces: the label the attacker wants, a symbol for "count of", and the fractions built from them.

Now the two rates, both fractions between 0 and 1 (often shown as a percent):

  • is ::: the wrong label the attacker wants when the trigger is present
  • The symbol means ::: "the number of" — a plain count / tally
  • ASR measures ::: the fraction of triggered inputs that go to the attacker's target class
  • in a blended trigger means ::: the trigger picture is mixed in faintly (mostly the original image)

Prerequisite map

Input x and label y

Dataset of n pairs

Model f with knobs theta

Loss l measures one wrong guess

Empirical risk L averages loss over pile

Training picks theta that minimises L

Perturbation delta and budget epsilon

Data Poisoning and Backdoor Attacks

Trigger function t on input space X

Robust Machine Learning

Certified Defenses

Everything on the left of must be solid before the parent note makes sense. The topic then feeds forward into Robust Machine Learning, Certified Defenses, and defence ideas like Differential Privacy, Explainable AI, AI Red Teaming, Federated Learning Security, and Model Provenance and Supply Chain.


Equipment checklist

Cover the right side and test yourself. If any answer is fuzzy, reread that section before opening the parent note.

  • A training example is written as ::: the pair — input and its correct label
  • Bold signals ::: a vector — a whole list of numbers (all the features/pixels)
  • The subscript in is ::: a counter naming the -th example (not a power)
  • is ::: how many examples are in the training set
  • is ::: the model (machine) with its knobs set to values
  • (theta) is ::: the bag of tunable weights inside the model
  • is ::: the final knob values after training finishes
  • (small ell) is ::: the loss — wrongness of one guess (0 = perfect)
  • (big L) is ::: the average loss over the whole training pile
  • tells you to ::: add the term once for each from 1 to
  • in the risk ::: turns the total into an average
  • returns ::: the value of that makes the expression smallest
  • (delta) is ::: a small nudge added to an input
  • means ::: the nudge's total length stays under a tiny budget (invisible)
  • (script-X) is ::: the set of all possible inputs
  • Plain is ::: the input with the secret trigger stamped on (a function/action)
  • Bold is ::: the trigger pattern itself, a picture/vector like
  • is ::: the wrong label the attacker wants when the trigger fires
  • The symbol means ::: "the number of" — a plain count
  • ASR is ::: fraction of triggered inputs sent to the attacker's target class
  • in a blended trigger is ::: the mixing dial (0 = original only, 1 = trigger only)