Foundations to Frontier
Tests
P. Responsible AI › P Responsible AI

AI Safety: Alignment, Misuse, Robustness

AI safety is the work of making AI systems do what we intend, reliably, and hard to turn to harm. It has three strands that this page connects: alignment (the system pursues the goal we meant, not a proxy that training happened to reward), robustness (it keeps working when inputs shift or are attacked) and misuse (people cannot easily use it to cause harm). The exercises show a classifier that learns a shortcut because training rewards it, scoring 95.8% in distribution and 35.9% when the shortcut flips, and then build layered safeguards against misuse: three filters that fail independently let 0.01% of harmful requests through, but when 90% of their noise is shared they let through 2.5%, about 250 times what multiplying miss rates predicts. Practice problems cover how many tests a rare failure needs, group-balanced training, abstaining on low confidence, Goodhart's law with heavy-tailed errors, and attackers who retry.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Making systems do what we meant

A trained model does whatever its training rewarded, which is not always what we wanted. It may lean on a shortcut that fails in the real world, game a proxy objective, break under inputs nobody tested, or help someone cause harm. Safety work tries to find these failures before deployment and to add defences that still hold when the first line fails.

🎮 Responsible AI lab

200,000 requests, 5% harmful. Each filter refuses 1% of benign requests; a request is blocked if any layer fires. Bars: harmful requests that get through (log scale); the grey tick is what independent layers would give.

1 layer
4.709%benign refused 1.02%
2 layers
3.103%benign refused 1.45%
3 layers
2.466%benign refused 1.76%

Requests that fool one filter tend to fool the others, so stacking correlated layers buys far less than multiplying their miss rates suggests.

Why engineers care

In Exercise 2, three filters that each miss about 5% of harmful requests let through 0.01% when they fail independently, but 2.5% when their errors are strongly correlated.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A model that relies on a feature correlated with the label only in training…
  2. 2. Alignment asks whether a system…
  3. 3. Defence in depth means…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Alignment: the objective a system optimises (a loss, a reward model, a proxy metric) differs from what we want; optimising the proxy hard exposes the gap (Goodhart’s law; reward hacking in topic F7-6).
  • Shortcut learning: a model picks up whatever predicts the label in training, including spurious features (backgrounds, watermarks, hospital tags), and fails when they change.
  • Robustness: performance under distribution shift and under deliberate attack (adversarial examples, topic M1-1; jailbreaks and prompt injection for language models).
  • Misuse: capabilities that help people cause harm (cyber attacks, weapons, fraud, harassment); defences include refusal training, input and output classifiers, access controls and monitoring.
  • Evaluation: red teaming, capability and dangerous-capability evaluations, and statistical limits on what a finite test set can show.
  • Defence in depth: several layers (training, filters, monitoring, human review); they help only as far as their failures are independent.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Goodhart's law says that a measure that becomes a target…
  2. 2. A jailbreak is…
  3. 3. Red teaming means…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Shortcuts and safeguards

Exercise 1.

  • Generate data with a noisy core feature and a clean shortcut that agrees with the label 95% of the time.
  • Fit logistic regression and look at the weights.
  • Test with the shortcut agreeing 95%, 50% and 5% of the time, and compare groups where it agrees and disagrees.

Practice.

  • Test under shift: evaluate on groups where spurious correlations break, not only on held-out data from the same source.
  • Report worst-group performance alongside the average.
  • Never trust a zero-failure result from a small test set: about 3/q tests are needed to rule out a failure rate q.
  • Make safeguards diverse: different data, methods and signals, so their failures are less correlated.
  • Assume attackers retry and measure the chance of getting through within many attempts.
w = fit_logreg(X, y)                      # core weight about 2, shortcut about ln 19
for p in (0.95, 0.5, 0.05):               # shortcut agreement at test time
    Xt, yt, _ = make_data(rng, 20000, p); print(p, accuracy(w, Xt, yt))
t = thresholds(benign_scores, fpr=0.01)   # each filter refuses 1% of benign
passed = 1 - layered(scores[harmful], t).mean()
🐍 Exercise 1: a shortcut in training data
Train logistic regression on data with a spurious shortcut, and measure accuracy as the shortcut's agreement with the label changes.
📝 Quick check (Level 2)
0/3 answered
  1. 1. A failure rate of 0.003 went unseen in 1,000 tests in about…
  2. 2. Group-balanced training raised worst-group accuracy from about 32% to…
  3. 3. Picking the best of 10,000 candidates by a proxy with heavy-tailed errors gave a true value of about…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

What a shortcut is worth. With a core feature ±1 plus standard normal noise, the log-likelihood ratio is 2x; a clean shortcut that agrees with probability p adds ln(p/(1 − p)) times its sign. For p = 0.95 that is ln 19 = 2.94, more than the core feature, so the model leans on the shortcut (the fitted weights were 1.95 and 2.83). It is right with probability Φ((2 + 2.94)/2) = 99.3% when the shortcut agrees and Φ((2 − 2.94)/2) = 31.8% when it disagrees, so accuracy is 0.993p + 0.318(1 − p): 96.0%, 65.6% and 35.2% for p = 0.95, 0.5 and 0.05.

Rare failures. If a failure has probability q per input, n tests see none with probability (1 − q)^n ≈ e^(−qn). Ruling q out at 95% confidence needs e^(−qn) ≤ 0.05, so n ≥ ln 20 / q ≈ 3/q (the rule of three).

Correlated safeguards. If each of k filters misses with probability m and they fail independently, all miss with probability m^k. With a shared noise component u, the joint miss is the average over u of m(u)^k, which by Jensen’s inequality is at least m^k and approaches m as the shared share approaches 1.

Goodhart with heavy tails. Choosing the best of n by proxy = value + error: with normal errors of equal variance, E[value | proxy] = proxy/2, so the pick improves like the square root of ln n. With heavy-tailed errors, the largest proxies are mostly large errors, and the pick’s true value falls back towards average.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Ruling out a failure rate q at 95% with no failures observed needs about…
  2. 2. Correlated filters let through…
  3. 3. With heavy-tailed proxy errors, optimising the proxy harder…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How much protection do stacked safeguards give when their failures are correlated?

History.

  • N. Wiener (1960) warned that a machine pursuing a purpose we specified imperfectly could act against our intentions; C. Goodhart (1975) stated his law about targets and measures.
  • D. Amodei, C. Olah and colleagues (2016) set out concrete problems in AI safety: side effects, reward hacking, scalable oversight, safe exploration and distributional shift.
  • R. Geirhos and colleagues (2020) described shortcut learning in deep networks; S. Sagawa and colleagues (2020) introduced group distributionally robust optimisation for worst-group accuracy.
  • J. Reason (1990) described accidents as holes lining up in several layers of defence (the Swiss cheese model); developers of large language models now combine refusal training, classifiers, monitoring and staged release.

Exercise 2.

  • 200,000 requests, 5% harmful. Each of up to three filters scores a request as 4 × harmful + noise with unit variance; a share r of that variance is common to all filters for the same request.
  • Each filter’s threshold refuses 1% of benign requests (fitted on 50,000 separate benign requests); a request is blocked if any filter fires.
  • Compare the harmful pass rate with the prediction for independent layers, the single-layer miss rate raised to the number of layers.

Seed 0:

shared noise layers harmful passed if independent benign refused
0 1 4.315% 4.315% 1.00%
0 2 0.222% 0.186% 2.00%
0 3 0.010% 0.008% 2.94%
0.5 1 5.174% 5.174% 0.98%
0.5 2 1.304% 0.268% 1.89%
0.5 3 0.424% 0.014% 2.72%
0.9 1 4.709% 4.709% 1.02%
0.9 2 3.103% 0.222% 1.45%
0.9 3 2.466% 0.010% 1.76%

Seeds 1 and 2: three layers let through 0.03% and 0.02% with independent noise, 0.34% and 0.51% with half shared, and 2.33% and 2.34% with 90% shared.

Findings.

  • Independent layers multiplied protection: three filters let through about 0.01% to 0.03% of harmful requests, close to the product of their miss rates.
  • Shared failure modes destroyed most of the benefit: with 90% of the noise shared, three layers still let through about 2.3% to 2.5%, against the 0.01% predicted for independent layers.
  • Correlated layers also refused fewer benign requests (1.8% instead of 2.9% for three layers), because they flag the same ones.
  • Diversity of safeguards matters as much as their number.
🐍 Exercise 2 (research): how much protection do stacked safeguards give when their failures are correlated?
Simulate requests passing through one to three filter layers whose errors share a common component, and compare the harmful pass rate with the independent-layers prediction.

Safety in practice

  • Specify what you want carefully, and watch for the system satisfying the letter of the objective rather than its intent (topic F7-6).
  • Evaluate under shift and attack: held-out data from new sources, worst-group metrics, adversarial and red-team testing (topics M1-1 and M1-3).
  • Size evaluations for rare failures and report confidence bounds, not just observed rates.
  • Build diverse layers: training-time safeguards, independent classifiers, monitoring, rate limits and human escalation.
  • Plan for failure: incident reporting, staged release and the ability to roll back (topic P-6).

References

  1. D. Amodei, C. Olah, J. Steinhardt, P. Christiano, J. Schulman and D. Mané (2016). “Concrete problems in AI safety.” arXiv:1606.06565.
  2. R. Geirhos, J.-H. Jacobsen, C. Michaelis, R. Zemel, W. Brendel, M. Bethge and F. Wichmann (2020). “Shortcut learning in deep neural networks.” Nature Machine Intelligence.
  3. S. Sagawa, P. W. Koh, T. Hashimoto and P. Liang (2020). “Distributionally robust neural networks for group shifts.” ICLR.
  4. D. Hendrycks, N. Carlini, J. Schulman and J. Steinhardt (2021). “Unsolved problems in ML safety.” arXiv:2109.13916.
  5. J. Reason (1990). Human Error. Cambridge University Press.