6.4.7 · D1AI Safety & Alignment

Foundations — Jailbreaks and adversarial prompts

1,776 words8 min readBack to topic

Before you can read the parent topic comfortably, you must own every symbol it throws at you. This page builds each one from nothing, in an order where each idea leans only on the ones before it.


1. Text as a list of tokens

Look at the strip below. The sentence "Sure, I'd be happy to help" is chopped into boxes. Each box is one token. The model's whole life is: read the boxes so far, guess the next box.

Figure — Jailbreaks and adversarial prompts

We will write a token as , meaning "the token in position ." So is the first token the model writes, the second, and so on.

  • ::: the token at position (the -th box the model produces)
  • ::: all tokens before position — i.e.

2. Prompt vs completion: and

Figure — Jailbreaks and adversarial prompts

The parent page writes things like . Once you know is "your text" and is "the model's reply," that expression stops being scary — read on.


3. Probability, and the bar ""

  • ::: probability the model's first word is "Sure," given the prompt

4. Model weights

So means: "the probability of completion given prompt , according to a model with settings ." The little underneath is just a reminder that a different-trained model would give different probabilities.


5. The autoregressive product

The parent's key formula is:

Let's earn every piece.

Reading the formula in plain words: the chance of the whole reply equals the chance of token 1, times the chance of token 2 (given token 1), times the chance of token 3 (given tokens 1–2), and so on to the last token .

Figure — Jailbreaks and adversarial prompts
  • ::: the total number of tokens in the completion
  • :::

6. Arg-max, expectation, and the reward

The parent writes safety training as . Three new symbols.

Read together: = "pick the model settings that give the best average helpful-and-harmless score over normal user prompts." (See 5.3.04-RLHF for how this is actually done.)


7. The indicator and the attacker's goal

The attacker's objective from the parent, now reads cleanly: find the prompt that makes harmful output most likely, among only those prompts that look legitimate (indicator ). If a prompt looks suspicious, the indicator is and the whole product dies — so the attacker must stay disguised. ( is the "adversarial" prompt; see also 6.4.05-Red-Teaming and 3.2.07-Adversarial-Examples.)


8. Why safety leaves gaps: the space of prompts

The parent claims .

Figure — Jailbreaks and adversarial prompts

9. How the foundations feed the topic

Tokens y_t

Sequences and y before t

Conditional probability P of A given B

Model weights theta

Model distribution P theta of y given x

Autoregressive product over t

Prefix injection cascades

Reward R and arg max training

Safety leaves blank regions

Attacker arg max finds a pocket

Jailbreaks and adversarial prompts


Equipment checklist

Test yourself — you are ready for the parent page when each of these is instant:

  • What is a token, and what does mean? ::: A token is a small chunk of text (word or word-piece); is the token at position .
  • What does the bar mean in ? ::: "The probability of given that is already true."
  • What does stand for? ::: All the tuned numbers (weights) inside the model.
  • Read in plain English. ::: The probability the model (settings ) writes completion given prompt .
  • What does do? ::: Multiplies the terms together for up to .
  • Why does an early "Sure" token make later harmful tokens more likely? ::: Because each factor is conditioned on all previous tokens, so "Sure" enters the right side of every later and shifts those probabilities.
  • What does return? ::: The setting that makes the following quantity largest (not the value itself).
  • What does mean? ::: A likelihood-weighted average.
  • What does the indicator do in the attacker's objective? ::: It zeroes out prompts that don't look legitimate, forcing the attack to stay disguised.
  • Why do jailbreaks exist even after safety training? ::: Safety covers only a tiny painted region of all possible prompts (); blank regions still produce harmful output.
Recall One-line summary

Predict the next token, one at a time, given everything so far — jailbreaks just steer that "given."