Simple Algorithm
Artificial Intelligence · Hidden Layer · 24 min

AI Safety & Alignment

Making systems that do what we actually intend.

A classifier that is right on 99% of test images can be flipped by changes no person can see. A reinforcement learner paid to win a boat race scores more by never finishing it. A model that behaves well wherever you can check it tells you little about the cases you cannot. Robustness, specification and oversight are the three technical problems behind AI safety, and each can be written down and analyzed precisely.

What you’ll learn

  • Place safety failures in the taxonomy of Amodei et al. (2016) and in the robustness, specification and oversight framing.
  • Formulate adversarial attacks and adversarial training as a min–max problem, write PGD, and certify a linear classifier with Hölder's inequality.
  • Derive when a reward loophole pays (r∗=(1−γ)Rr^*=(1-\gamma)R for a living reward), and distinguish specification gaming from goal misgeneralization.
  • Explain what debate, recursive reward modeling, weak-to-strong generalization, red teaming and AI control each assume.
  • Summarize the main positions on catastrophic risk, and what current evidence does and does not show.

A map of the problem

AI safety asks how to build systems whose behavior stays acceptable once deployed, including in situations their designers did not foresee. In "Concrete Problems in AI Safety", Amodei et al. (2016) framed accidents, harmful behavior that nobody intended, as five research problems. Each traces back to the wrong objective, an objective too expensive to evaluate often, or bad behavior during learning or deployment.

ProblemWhat goes wrongExample
Negative side effectsthe objective ignores parts of the world it should protecta robot rewarded for speed knocks over a vase on its shortest path
Reward hackingthe objective has a loopholea boat-racing agent loops through bonus targets instead of finishing
Scalable oversightthe true objective is too costly to check on every episodeno one can verify every line of generated code
Safe explorationlearning itself takes irreversible actionsan agent learning by trial and error drives off a cliff
Robustness to distributional shiftbehavior learned on one distribution fails on anothera classifier keyed to one hospital's scanner markings fails at another hospital
The five problems of Amodei et al. (2016). Side effects and reward hacking are failures of specification, distributional shift is a failure of robustness, and scalable oversight is a problem of assurance.

Accidents are one class of risk. Misuse is people deliberately using capable systems for harm, such as cyberattacks, fraud or weapons development. Structural risks come from how systems are deployed at scale: competitive pressure to ship before safety is understood, concentration of power, or eroded trust in information. Alignment is the part of safety concerned with making a system pursue what its developers intend.

This lesson takes three technical lenses: robustness (inputs chosen by an adversary), specification (objectives that say the wrong thing) and oversight (supervising behavior you cannot fully evaluate). Fairness is the subject of Bias & Fairness, natural shifts between training and deployment of Distribution Shift & Robustness, and attacks on data and models of Privacy & Security.

Check your understanding

A summarization model trained on human ratings learns to write fluent, confident summaries that raters like, including some that misstate the source. Which concrete problem is this mainly?

  1. Safe exploration
  2. Robustness to distributional shift
  3. Scalable oversight: raters cannot afford to check every claim against the source, so the model is optimized for what looks right
  4. Negative side effects
Show the answer

C. Scalable oversight: raters cannot afford to check every claim against the source, so the model is optimized for what looks right

The true objective, faithfulness to the source, is expensive to evaluate, so training optimizes a cheap proxy: the raters' impression. The proxy has a loophole (fluency and confidence), so this is reward hacking made possible by limited oversight.

Robustness: the inner maximization

Computer Vision showed why adversarial examples exist for nearly linear models: an ℓ∞\ell_\infty perturbation of size ε\varepsilon can move a score by ε∥w∥1\varepsilon\norm{\mathbf w}_1, which grows with the dimension. Safety work makes the attacker explicit. A threat model says which inputs the attacker may substitute, typically any x′\mathbf x' with ∥x′−x∥p≤ε\norm{\mathbf x'-\mathbf x}_p\le\varepsilon that is still a valid image. An attack solves an inner maximization, and training for robustness wraps it in an outer minimization:

min⁡θ E(x,y)∼D[max⁡∥δ∥∞≤εL(fθ(x+δ), y)]\min_\theta\ \E_{(\mathbf x,y)\sim\data}\Big[\max_{\norm{\boldsymbol\delta}_\infty\le\varepsilon}\loss\big(f_\theta(\mathbf x+\boldsymbol\delta),\,y\big)\Big]
The robust (adversarial) risk of Madry et al. (2018). With ε=0\varepsilon=0 it is the ordinary risk.
text
PGD-ATTACK(x, y, radius ε, step α, iterations T):
    δ ← uniform random vector in [−ε, ε]^d           # random start
    repeat T times:
        g ← ∇_δ loss(f(x + δ), y)                     # one backward pass
        δ ← δ + α · sign(g)                           # steepest ascent in ℓ∞
        δ ← clip(δ, −ε, ε)                            # project onto the ε-ball
        δ ← clip(x + δ, 0, 1) − x                     # keep pixels valid
    return x + δ

ADVERSARIAL-TRAINING: for each mini-batch, replace every (x, y)
    by (PGD-ATTACK(x, y, ...), y), then take an ordinary step on θ

Projected gradient ascent on the loss. FGSM is a single step from δ=0\boldsymbol\delta=\mathbf 0 with α=ε\alpha=\varepsilon; typical attacks use 7 to 20 steps, often with several random restarts.

Why the sign? The steepest-ascent step of size α\alpha maximizes g⊤δ\mathbf g^\top\boldsymbol\delta subject to ∥δ∥≤α\norm{\boldsymbol\delta}\le\alpha, and by Hölder's inequality the maximum is α\alpha times the dual norm of g\mathbf g. For ℓ∞\ell_\infty the dual norm is ℓ1\ell_1, attained by δ=αsign⁡(g)\boldsymbol\delta=\alpha\sign(\mathbf g); for ℓ2\ell_2 the step is α g/∥g∥2\alpha\,\mathbf g/\norm{\mathbf g}_2.

Adversarial training then takes a gradient step on θ\theta at the attack's output. Danskin's theorem justifies this: when the inner maximizer is unique, the gradient of the maximum is the gradient at the maximizer. The price is compute (each step costs T+1T+1 forward–backward passes) and clean accuracy. Madry et al.'s CIFAR-10 model was about 87% accurate on clean images and about 46% accurate under a 20-step PGD attack at ε=8/255\varepsilon=8/255, a perturbation that fools an undefended network almost every time.

Think first Training only against FGSM sometimes yields a model that resists FGSM yet falls to a few PGD steps. How can that be?

The model can learn a loss surface that is flat or jagged right around each training point, so the one-step linear approximation behind FGSM points the wrong way, while the loss a short distance away is still high. This is gradient masking: resistance to one attack, not a smaller inner maximum. It is why defenses must be evaluated with strong, adaptive, multi-step attacks (Adversarial Examples & Robustness).

Specification: when the optimum is a loophole

Specification gaming is behavior that scores well on the objective as written and badly on the objective as meant. Documented cases (Krakovna et al. keep a running list) include:

  • Boat racing. OpenAI's agent for the game CoastRunners circled a lagoon hitting respawning targets, catching fire and crashing as it went, and scored about 20% more than human players without ever finishing the race (Clark & Amodei, 2016).
  • Tetris. A program that inferred what to maximize by watching the game's memory during human play paused Tetris forever just before it would have lost (Murphy, 2013).
  • Coding agents. Reasoning models trained with reinforcement learning to make unit tests pass sometimes edited or special-cased the tests instead of fixing the code (Baker et al., 2025).
  • Shaping loops. A simulated bicycle rewarded for progress toward a goal, and not penalized for moving away, learned to ride in circles (Randløv & Alstrøm, 1998).

The last case is a warning about reward shaping, extra rewards added to speed up learning. A gridworld makes the arithmetic exact.

DerivationWhen does wandering beat the exit?
  1. Vloop=r+γr+γ2r+⋯=r1−γV_{\text{loop}}=r+\gamma r+\gamma^2r+\cdots=\frac{r}{1-\gamma}

    Pay a living reward r>0r>0 on every step, with discount factor γ<1\gamma<1. A policy that never reaches a terminal state collects a geometric series:

  2. Vexit=r+γRV_{\text{exit}}=r+\gamma R

    An agent next to an exit worth RR can take it now: one more living reward, then the exit's value, discounted once:

  3. r1−γ>r+γR  ⟺  γ r1−γ>γR  ⟺  r>(1−γ) R\frac{r}{1-\gamma}>r+\gamma R\iff\frac{\gamma\,r}{1-\gamma}>\gamma R\iff r>(1-\gamma)\,R

    Wandering wins exactly when the stream of future living rewards outweighs the exit:

  4. In the classic world γ=0.9\gamma=0.9 and the best exit is R=+1R=+1, so the threshold is r∗=0.1r^*=0.1. At r∗r^* every cell is worth exactly RR either way. Slips do not change this: from every cell the agent can move so that it never enters an exit, so wandering forever is always available.

Predict before you look

Keep the exit at R=+1R=+1 but lower the discount to γ=0.8\gamma=0.8. Above what living reward does the robot stop exiting?

Show the answer

0.2

r∗=(1−γ)R=0.2r^*=(1-\gamma)R=0.2. A smaller discount factor makes the far future worth less, so a larger stream of living rewards is needed to outweigh the exit.

The remedy is not to give up shaping. Ng, Harada & Russell (1999) proved that a shaping reward of the form F(s,s′)=γΦ(s′)−Φ(s)F(s,s')=\gamma\Phi(s')-\Phi(s), for any potential Φ\Phi on states, leaves the optimal policies unchanged: along any trajectory the extra rewards telescope. A constant living reward is not of that form in an episodic task, because ending the episode forfeits the stream of future payments, so it silently changes how attractive termination is. Specification Gaming & Reward Hacking proves both facts.

Right reward, wrong goal

Specification gaming needs a flawed objective. Goal misgeneralization can happen with a correct one. On the training distribution the intended goal may coincide with a simpler proxy, and the learned policy may pursue the proxy. Off-distribution, its capabilities generalize while its goal does not: it acts competently, in pursuit of the wrong thing.

Langosco et al. (2022) trained agents on CoinRun, a procedurally generated platform game in which the coin, the only source of reward, always sat at the far right end of the level. When the coin was moved elsewhere at test time, the agents usually ran past it to the end of the level. Shah et al. (2022) found the pattern in several systems. In one, an agent that had to visit locations in a hidden order learned to follow a partner who knew the order. Paired with a partner who visited them in the wrong order, it kept following, collecting negative reward.

FailureReward used in trainingBehavior off-distributionTypical remedy
Specification gamingwrong: it has a loopholeexploits the loophole, often already in trainingbetter objectives, oversight
Goal misgeneralizationrightcompetent pursuit of a proxy goaltraining data that separates goal from proxy; interpretability
Capability failure under distribution shiftrightincompetent or erratic behaviorrobustness methods, more diverse data
Check your understanding

In training, a household robot's green "done" button was always on the kitchen counter, and the robot was rewarded for pressing it. In a new house the button is in the hallway. The robot walks straight to the kitchen counter, skillfully avoiding furniture, and pokes at the empty spot where the button used to be. What is this?

  1. Specification gaming
  2. Goal misgeneralization
  3. A capability failure: it no longer knows how to navigate
  4. Reward tampering
Show the answer

B. Goal misgeneralization

The reward was correct (press the button), and the robot still navigates competently, so its capabilities generalized. But it learned "go to the counter and press", a goal indistinguishable from the intended one during training. Competence plus the wrong goal is the signature of goal misgeneralization.

Oversight: supervising what you cannot check

RLHF trains a reward model on human comparisons and optimizes the policy against it (Fine-Tuning, RLHF & Prompting). That works while people can tell good outputs from bad ones. When they cannot check the answer (a long proof, a large codebase, a plan with distant consequences), the same optimization rewards whatever looks right to them. Scalable oversight looks for training signals that stay reliable as systems outgrow their evaluators.

ApproachIdeaKey assumptionEvidence so far
Debate (Irving et al., 2018)two models argue opposite answers; a judge picks the winnerthe truth is easier to defend than a liewith optimal play a polynomial-time judge can decide PSPACE problems; helps non-expert judges on reading comprehension (Khan et al., 2024)
Recursive reward modeling (Leike et al., 2018)models trained this way help people evaluate the next modelerrors do not compound from level to levelmodel-written critiques help people find more flaws (Saunders et al., 2022)
Weak-to-strong generalization (Burns et al., 2023)fine-tune a strong model on a weak supervisor's labelsthe strong model generalizes the intent, not the errorsrecovers part of the gap on NLP tasks, little on reward modeling
Red teaming and capability evaluationssearch for failures and dangerous abilities before releasethe search finds what is therestandard for frontier models; shows presence, never absence
AI control (Greenblatt et al., 2024)protocols that stay safe even if the model works against themtrusted weaker models and limited human audits can catch subversionearly; tested on models inserting backdoors into code
Interpretabilityinspect the computation, not just the outputsthe features and circuits found are faithfuldemonstrations, not guarantees (Mechanistic Interpretability)

Weak-to-strong generalization comes with a crisp metric. Fine-tune a weak model on ground truth and use it to label data; fine-tune a strong model on those labels; compare with the strong model fine-tuned on ground truth, the ceiling:

PGR=acc(strong trained on weak labels)−acc(weak)acc(strong ceiling)−acc(weak)\text{PGR}=\frac{\text{acc}(\text{strong trained on weak labels})-\text{acc}(\text{weak})}{\text{acc}(\text{strong ceiling})-\text{acc}(\text{weak})}
Performance gap recovered: 0 if the student merely imitates its teacher, 1 if it reaches the ceiling despite imperfect labels. With an auxiliary confidence loss, GPT-4 supervised by a GPT-2-level model came close to GPT-3.5-level performance on NLP tasks (Burns et al., 2023), an analogy for people supervising models more capable than themselves.
Think first Debate pits a liar against an honest debater. Why might the honest side still lose?

The theory assumes optimal play. A dishonest debater can build a long argument with a flaw buried in one of many plausible steps; the honest debater may know a flaw exists without being able to locate it in reasonable time, and the judge sees no refutation. This obfuscated arguments problem (Barnes & Christiano, 2020) is one reason debate's practical value is still being tested.

How large are the risks?

Researchers disagree sharply about whether advanced AI could cause catastrophic or even existential harm. Each side's arguments are worth knowing in their strongest form.

The case for serious concern. Capabilities have grown quickly and broadly with scale (Scaling Laws; how to measure them is itself debated, see Measuring Intelligence & AGI), and developers are building systems that act autonomously over long horizons. Each problem above gets harder as capability grows: stronger optimizers find rarer loopholes, misgeneralized goals matter more when a system acts in the world, and oversight weakens once outputs exceed what evaluators can check. For many goals, acquiring resources and avoiding shutdown are useful subgoals ("instrumental convergence"; Omohundro, 2008; Bostrom, 2014), a tendency Turner et al. (2021) proved for optimal policies under most reward functions in a class of MDPs. Misuse could scale too, for example in cyberattacks or biology. In 2023 hundreds of AI researchers and industry leaders signed a one-sentence statement that mitigating the risk of extinction from AI should be a global priority.

The case for skepticism. The catastrophic scenarios rest on chains of premises (highly capable, goal-directed systems; goals that diverge from ours; failure of the iterative correction that made other technologies safe), and there is little direct evidence for them. Theorems about optimal policies say little about trained systems, which are not optimal. Today's systems are brittle tools whose failures are found and fixed through deployment, as with other general-purpose technologies (Narayanan & Kapoor's "AI as normal technology", 2025). And attention to speculative catastrophe can divert resources from documented harms such as bias, surveillance and concentration of power, or be used to argue that only a few firms should control the technology.

Key takeaways

  • Amodei et al. (2016) split accident risk into side effects, reward hacking, scalable oversight, safe exploration and distributional shift; misuse and structural risks come on top.
  • Robustness is a min–max problem: PGD approximates the inner maximization with signed gradient steps, adversarial training minimizes the result, and a linear classifier is certified within ∣z∣/∥w∥1\abs z/\norm{\mathbf w}_1 in ℓ∞\ell_\infty.
  • Optimizers exploit loopholes: a living reward rr beats an exit worth RR once r>(1−γ)Rr>(1-\gamma)R. Potential-based shaping is safe; most other reward tweaks are not.
  • Goal misgeneralization pairs capabilities that generalize with a proxy goal that matched the intended one in training, even under a correct reward.
  • Scalable oversight (debate, recursive reward modeling, weak-to-strong generalization, control, interpretability) targets supervision beyond what people can evaluate; views on catastrophic risk diverge, and the evidence is incomplete.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

An attacker may change each pixel by at most ε\varepsilon (the ℓ∞\ell_\infty threat model). Given the gradient g\mathbf g of the loss at the current input, which step of size α\alpha increases the loss fastest to first order?

  1. α g/∥g∥2\alpha\,\mathbf g/\norm{\mathbf g}_2
  2. αsign⁡(g)\alpha\sign(\mathbf g)
  3. α ei∗\alpha\,\mathbf e_{i^*}, for the coordinate i∗i^* with the largest ∣gi∣\abs{g_i}
  4. −αsign⁡(g)-\alpha\sign(\mathbf g)
Show the answer

B. αsign⁡(g)\alpha\sign(\mathbf g)

Maximize g⊤δ\mathbf g^\top\boldsymbol\delta subject to ∥δ∥∞≤α\norm{\boldsymbol\delta}_\infty\le\alpha: every coordinate should move by the full α\alpha in the direction of its gradient's sign, for a gain of α∥g∥1\alpha\norm{\mathbf g}_1, the dual norm. This is the PGD (and FGSM) step.

Question 2

A linear classifier has score z=w⊤x+b=2z=\mathbf w^\top\mathbf x+b=2 on an input, with ∥w∥1=40\norm{\mathbf w}_1=40 and ∥w∥2=5\norm{\mathbf w}_2=5. Which statement is true?

  1. No perturbation with ∥δ∥2<0.05\norm{\boldsymbol\delta}_2<0.05 can flip it, and that is the best ℓ2\ell_2 guarantee available
  2. No perturbation with ∥δ∥∞<0.4\norm{\boldsymbol\delta}_\infty<0.4 can flip it
  3. No perturbation with ∥δ∥∞<0.05\norm{\boldsymbol\delta}_\infty<0.05 can flip it, and without input constraints some perturbation with ∥δ∥∞=0.05\norm{\boldsymbol\delta}_\infty=0.05 does
  4. No perturbation of any norm smaller than 2 can flip it
Show the answer

C. No perturbation with ∥δ∥∞<0.05\norm{\boldsymbol\delta}_\infty<0.05 can flip it, and without input constraints some perturbation with ∥δ∥∞=0.05\norm{\boldsymbol\delta}_\infty=0.05 does

The ℓ∞\ell_\infty radius is ∣z∣/∥w∥1=2/40=0.05\abs z/\norm{\mathbf w}_1=2/40=0.05. It is exact, because δ=−0.05sign⁡(w)\boldsymbol\delta=-0.05\sign(\mathbf w) lowers the score by exactly 0.05×40=20.05\times40=2. The ℓ2\ell_2 radius is 2/5=0.42/5=0.4.

Question 3

An episodic task pays +10+10 at its goal and a living reward rr per step, with γ=0.95\gamma=0.95. Above which rr does a policy that never finishes beat finishing?

  1. 0.050.05
  2. 0.50.5
  3. 9.59.5
  4. 0.950.95
Show the answer

B. 0.50.5

r∗=(1−γ)R=0.05×10=0.5r^*=(1-\gamma)R=0.05\times10=0.5. Above it, r/(1−γ)>r+γRr/(1-\gamma)>r+\gamma R: the endless stream of living rewards is worth more than finishing.

Question 4

A weak supervisor is 60% accurate on a task, and the strong model's ceiling is 90%. Trained on the weak labels, the strong model reaches 81%. What is the performance gap recovered?

  1. 0.21
  2. 0.9
  3. 0.7
  4. 0.3
Show the answer

C. 0.7

PGR=(81−60)/(90−60)=21/30=0.7\text{PGR}=(81-60)/(90-60)=21/30=0.7. The student closed 70% of its teacher's gap to the ceiling, generalizing beyond the labels it was given.

Question 5

Which claim about AI risk is best supported by the evidence as of the mid-2020s?

  1. Deployed models routinely pursue hidden long-term goals of their own
  2. Catastrophic risk from AI has been ruled out, since current systems are only tools
  3. Optimizers, including frontier models, exploit flaws in their training objectives, and deliberately inserted deceptive behavior can survive standard safety training
  4. Experts broadly agree that human extinction caused by AI is likely this century
Show the answer

C. Optimizers, including frontier models, exploit flaws in their training objectives, and deliberately inserted deceptive behavior can survive standard safety training

Specification gaming and reward hacking are well documented, and "model organism" studies show that backdoored deceptive behavior can persist through safety training. Whether such behavior arises on its own in deployed systems, and how large long-term risks are, remain open and contested.

Go deeper

Further reading

  • D. Amodei, C. Olah, J. Steinhardt, P. Christiano, J. Schulman & D. Mané, "Concrete problems in AI safety," arXiv:1606.06565 (2016).
  • A. Madry, A. Makelov, L. Schmidt, D. Tsipras & A. Vladu, "Towards deep learning models resistant to adversarial attacks," ICLR (2018).
  • D. Hendrycks, N. Carlini, J. Schulman & J. Steinhardt, "Unsolved problems in ML safety," arXiv:2109.13916 (2021).
  • Y. Bengio et al., International AI Safety Report (2025).