Lecture 27 · Safety and Security: Deployment Guardrails and Open-Weight Safety

Scalable AI: Bridging Theory, Understanding, and Practice · Lecture 27。个人学习讲义与配套实验,按主题整理并持续修订。

课程源码 ZIP ↓

个人整理的学习笔记,非官方讲义;课程来源与整理说明见课程介绍。配套示例未逐一运行验证。

本篇目录

Maps to: UC Berkeley EE 290/194 Scalable AI:

  • Spring 2026 L23, Safety Guardrails (guest: Leon Derczynski, NVIDIA; “guardrails, red teaming, monitoring, and risk mitigation”, with slides by Nanna Inie and Chris Parisien);
  • Fall 2026 L24, Safety and Security (Part 1): Deployment Guardrails, and L25, (Part 2): Open-Weight Safety (scheduled Nov 25 and 30; not public when these notes were written).

Sources beyond the slides: the OWASP Top 10 for LLM Applications and MITRE ATLAS (cited on the slides); Qi et al., Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To! (ICLR 2024); O’Brien et al., Deep Ignorance: Filtering Pretraining Data Builds Tamper-Resistant Safeguards into Open-Weight LLMs (arXiv 2508.06601); Wallace et al., Estimating Worst-Case Frontier Risks of Open-Weight LLMs (OpenAI, arXiv 2508.03153).

Scope note. This lecture covers defensive practice: policies, guardrails and how to evaluate them, monitoring, incident response, and what open weights change. The guest deck also walks through specific techniques for getting models past their safeguards; these notes do not reproduce them. The taxonomies cited below are the place to look up categories.

Code: code/lecture27/ contains:

  • guard_world.py: a fictional deployed assistant (“Atlas Desk”) with a written policy and labelled traffic;
  • rails.py: a topical rail, a catalogue-aware rail, a redaction rail, a grounding check, evaluation metrics and a latency model;
  • four demos: evaluating one rail, layered rails and latency, monitoring and incident response, open-weight safeguards under fine-tuning.

Reading time: ~2 hours for the prose; ~1 minute to run all demos.


0. How to read this lecture

0.1 Learning goals

After this lecture you should be able to:

  1. Separate topical, safety and security risks of a deployed model, and write the application policy that defines them.
  2. Treat the model as a system component: find where its output can drive actions or leak data, and apply system-level mitigations.
  3. Evaluate a guardrail: ROC curves, thresholds chosen by cost, precision at realistic base rates, and generalization to traffic the rail was not trained on.
  4. Compose rails (input, output, grounding) and account for their false positives and their latency.
  5. Monitor rails in production and detect incidents with seasonality-aware, accumulating detectors.
  6. Explain what changes with open weights: safeguards can be trained away; refusal hides knowledge while filtering removes it; evaluate safeguards after fine-tuning.

0.2 Prerequisites and scope

  • Prerequisites: Lecture 25 (context, retrieval, the reader), Lecture 26 (agents, permissions, sandboxes), Lecture 16 (post-training and refusals).
  • Not in scope: specific techniques for evading safeguards; biosecurity or other hazardous-domain content (the open-weight demo uses an invented stand-in).

0.3 Section → code map

SectionIdeaCode in code/lecture27/
§1risks, policies, what counts as an attack–
§2test systems, not models–
§3guardrailsguard_world.py, rails.py
§4evaluating a rail01_rail_metrics.py
§5layered rails and latency02_layered_rails.py
§6red teaming and scanners as practice–
§7monitoring and incident response03_monitoring.py
§8open-weight safety04_open_weights.py

0.4 What is real and what is simulated

The rails, the metrics, the detectors and the open-weight experiment are real code. The traffic and the base model’s mistakes are simulated with stated rates (guard_world.py): 20% of requests are out of scope; the base model states a wrong value in 5% of answers and copies an internal account reference from a raw tool record into 4% of them. Everything is fictional: invented entities, invented reference numbers, and (in §8) an invented relation standing in for knowledge a developer does not want a released model to provide.


1. Risks, policies and attacks

1.1 Three kinds of risk

The guest lecture starts from the fact that generative output is intrinsically fragile, unpredictable and unstable, and sorts what can go wrong into:

  • topical risks: the system says things outside what it should discuss (e.g., misinformation);
  • safety risks: harm to people who use the system or are affected by it (e.g., a children’s book generator producing inappropriate content);
  • security risks: breaches of confidentiality, integrity or availability (the CIA triad of classic security).

Safety has two dimensions: whether the subject harmed is the user or someone else, and whether the harm is intentional or not. Non-intentional examples include hallucination, misinformation, propagated biases and unequal performance for different groups; intentional ones include data leakage and automated misuse.

1.2 The policy defines the failure

What counts as a failure depends on the application. Should a banking assistant make small talk about stock prices? Discuss account balances? How should a school chat system respond to messages that suggest self-harm? A policy definition says where failures and attacks can happen. Catalogues such as Language Model Risk Cards help enumerate hazards; the application domain decides which apply. Atlas Desk’s policy (§0.4, guard_world.py) is the toy version: answer questions about the catalogue’s entities, decline other topics, never show internal account references, only state what the evidence supports.

1.3 What is an “attack”?

The slides’ defining criteria: a policy breach (the behaviour violates the generation policy), a malicious adversary who could exploit it, and a deviation from standard behaviour. The last one is the methodological point: if the model does it when asked directly, no attack is needed. That is a policy gap to fix, and asking directly is the baseline every evaluation should report first.

The slides also make a point specific to LLMs: unlike a classic exploit (where, say, remote code execution lets an attacker run anything), a marginal LLM vulnerability enables only some failures, and which content category is targeted changes the measured success rate. So results must be reported per category, not as one number.

1.4 How vulnerabilities are found and shared

Inie, Stray and Derczynski’s grounded-theory study of LLM red teaming (PLoS One 2024) found people motivated intrinsically (curiosity, fun, concern) and extrinsically (professional, social), describing their work with metaphors of alchemy and spell-casting more than engineering. The slides’ timeline of disclosure: small communities first (day 0), social media (days 1–7), arXiv (days 30–90, often claiming novelty without connecting to earlier community work), then academic and corporate publications (day 100+). Major providers tend to respond within these windows. Two practical consequences: defenders should follow practitioner communities, not only papers; and responsible disclosure norms from classic security apply.


2. Test systems, not models

2.1 The model is a component

The slides’ framing: test cars, not engines. Content-safety failures in chat have limited security impact (if it takes twenty minutes to make a model say something rude, the person who elicited it expected it). The picture changes when model output drives execution: agents, generated code that is run, output rendered by a browser or a terminal. Then the questions are classic security ones.

2.2 System-level failure classes and their mitigations

The OWASP Top 10 for LLM applications (the version on the slides): prompt injection; insecure output handling; training-data poisoning; model denial of service; supply-chain vulnerabilities; sensitive-information disclosure; insecure plugin design; excessive agency; overreliance; model theft. MITRE ATLAS organizes adversarial ML along an attack lifecycle (reconnaissance through exfiltration and impact), useful for planning. The mitigations that matter most for the systems in this course:

failure classwhere it bitesmitigation
untrusted content in contextretrieved pages, tool output, emails (Lecture 25)treat it as data, never as instructions; label provenance; least privilege for any action it could trigger
insecure output handlingoutput rendered as HTML/markdown, run as code, printed to a terminalescape or sanitize before rendering; do not auto-load remote resources from model output; strip control sequences; run generated code only in a sandbox
excessive agencyagents with broad tools (Lecture 26)allow-lists, sandboxes with filesystem and network isolation, reversibility-weighted approval
supply chaindependencies a model suggestsverify that suggested packages exist and are the trusted ones before installing
sensitive-information disclosurerecords and secrets in tool outputper-user credentials and tenant isolation; redaction rails on output (§5)
model theftAPIs exposing logits or probabilitiesrate limits, monitoring; Carlini et al. (2024) showed parts of production models can be extracted through APIs

The slides’ storage example is worth remembering: a chat service where every user’s documents live in secure storage, but all access goes through one shared service account, lets any logged-in user read every other user’s data. No model behaviour is involved; the bug is in the system around it.


3. Guardrails

3.1 What a rail is

A guardrail (rail) is a check that runs outside the model and can block, rewrite or flag:

  • input rails: before the model sees a request (topic control, content safety, PII detection);
  • output rails: before the user sees an answer (content safety, PII and secret redaction);
  • dialogue / topical rails: keep the conversation inside the application’s scope;
  • retrieval / grounding rails: check that answers are supported by the evidence (Lecture 25’s RAG);
  • execution rails: gate tool calls (Lecture 26’s permissions).

NVIDIA’s NeMo Guardrails (on the slides) packages these as configurable rails (content safety, PII detection, jailbreak protection, topic control, RAG enforcement, custom rails) and runs several in parallel to limit latency. The online game Gandalf, used in the lecture as an exercise, shows the difference between rail designs on a toy secret: an output rail that blocks responses containing the secret verbatim, versus a separate model checking the whole transcript (input plus output).

3.2 Atlas Desk’s rails

rails.py implements four, all from scratch:

  • TopicRail: naive Bayes over words, trained on labelled requests; score = log-odds of “out of scope”.
  • CatalogueRail: the same, plus a lookup: a request naming an entity in today’s catalogue counts as in scope.
  • redact: masks internal account references (AR-1234-5), optionally verifying the check digit.
  • grounded: is the answer’s fact stated in the evidence? (exact here; real grounding checkers are models with their own errors).

4. Evaluating one rail (Demo 01)

4.1 Familiar traffic overstates a rail

The topical rail is trained on 6 out-of-scope topics and on questions about the 200 entities in the catalogue at training time. It is tested on familiar traffic, and on two held-out topics with questions about all 400 entities (the catalogue doubled after training):

railtest trafficAUCTPR at FPR ≤ 1%
naive Bayesseen topics, old entities1.00001.000
naive Bayesnew topics, all entities0.99370.910
keyword baselinenew topics, all entities0.80330.625
naive Bayes + catalogue lookupnew topics, all entities1.00001.000
  • Perfect on familiar traffic, 91% at a 1% false-positive budget on new traffic. Evaluate on the traffic the rail will meet.
  • The keyword baseline fails on out-of-scope requests that share words with the policy (“capital gains tax”, “a river cruise”): surface features are not intent.
  • The hard cases are questions such as “what is the capital of france”: in-scope form, out-of-scope entity. Questions about entities added after training look exactly like them to word statistics. Looking the entity up in today’s catalogue restores AUC 1.0000: give a rail the knowledge the policy depends on.

4.2 Thresholds and base rates

Operating points along the naive Bayes rail’s ROC curve on the new traffic:

TPRFPRprecision at 30% out of scopeat 2%at 0.2%
0.7300.00001.0001.0001.000
0.9510.05990.8720.2450.031
1.0000.11330.7910.1530.017

Precision at prevalence π is TPR·π / (TPR·π + FPR·(1 − π)). Catching every out-of-scope request costs an FPR of 11%; when 30% of traffic is out of scope a flag is then right 79% of the time, at 2% only 15%, at 0.2% only 2%. A rail for a rare event needs an FPR far below the prevalence, or a second stage (a slower, more precise check on what the first stage flags).

Scale makes small rates concrete: at a million in-scope requests a day, an FPR of 1% wrongly declines 10,000 users a day; 0.1%, 1,000.

4.3 The threshold is a policy decision

Minimizing c_FN·FN + c_FP·FP: with equal costs the best threshold lets 107 out-of-scope requests through and blocks no legitimate ones; when a miss costs 10× a false block, it blocks 319 legitimate requests to let none through. There is no policy-free “best” rail: write the costs down before setting the threshold.


5. Layered rails and their costs (Demo 02)

5.1 One layer per failure class

One simulated day: 50,000 requests (40,204 in scope, 9,796 out of scope), rails added one at a time (input rails at the high-recall threshold of §4.3):

pipelineoff-topic answeredleaks shownwrong values showngood requests blockedgood answers over-redactedgood traffic harmed
no rails9,7961,5862,050000.00%
input rail (naive Bayes)01,3821,7874,939012.28%
input rail + catalogue lookup01,5862,050000.00%
+ redaction (pattern only)002,05007661.91%
+ redaction (pattern + check digit)002,0500900.22%
+ grounding check0000900.22%
  • Each rail removes one failure class and none removes the others: defence in depth means a layer per failure, not one strong layer.
  • The stale input rail is expensive: at a threshold strict enough to answer no off-topic requests it blocks 4,939 legitimate requests a day (12.3% of good traffic), all of them about entities added after training. With the catalogue lookup, none.
  • False positives add up across layers. A redaction rail that matches only the pattern masks all 766 harmless order numbers that share the format; checking the check digit masks only the 90 (about 1 in 10) that happen to be valid. Every rail’s FPR is paid by good traffic.

5.2 Rails and latency

A guard model is a model call (here Llama-3-8B on one H100; the main model Llama-3-70B on 4 H100s, Lecture 22’s step model). For a 1,000-token prompt:

input rail placementTTFT
no rail70 ms
rail, then the main model (serial)104 ms
rail alongside the main prefill, first token held until it clears70 ms

Output rails check streamed text in chunks. With a 15.5 ms TPOT, a 32-token chunk takes 496 ms to generate and 14 ms to check: checks keep up with generation and each released chunk is delayed by a fixed 14 ms. The alternative, stream-and-retract (show text, then retract it on a hit), avoids that delay but shows up to a chunk of unchecked text. Run rails in parallel where their verdicts are independent; hold back output only as long as the check takes.


6. Red teaming and scanners as defensive practice

Red teaming is the practice of looking for failures before others do, against your own system and under your own policy. The guest lecture’s tool, garak, structures it as three components: probes (attempts drawn from community-collected and research-based families), generators (connectors to the system under test, local or remote) and detectors (decide whether a response is a policy failure), with results grouped by a typology (OWASP categories, effect tags). Two points generalize:

  • Discovery is not benchmarking. A benchmark is fixed and comparable, and research overfits to it until it expires. A discovery tool is updated constantly, drops what is already fixed, and its goal is to find new failures; “if it happens once, it happens.”
  • Report per category, with the direct-request baseline first (§1.3), and re-scan after every model, prompt or rail change, as a regression test.

The slides report, for illustration, that a 100-prompt mini-set of community-collected prompts got past gpt-3.5-turbo’s mitigations 56.1% of the time, and that automatically generated conversational probes produced toxic replies in 1.0% (gpt-3.5-turbo-0613) to 26.7% (OPT-6.7B) of responses. This lecture’s code does not include a scanner.


7. Monitoring and incident response (Demo 03)

7.1 Rails are sensors

What rails catch is a signal about the whole system. Demo 03 simulates 60 days of traffic (3,000 requests on weekdays, 1,500 at weekends, more off-topic chat at weekends) with two incidents:

  • A (day 21): a backend change makes raw records reach answers more often; the redaction rate rises from 4.0% to 5.5%. The rail masks every leak, so users see nothing; the rise is the only sign that something upstream broke.
  • B (day 40): a catalogue import the input rail was not updated for raises its FPR from 1% to 3%.

Three detectors, 300 simulated runs:

incidentdetectorfalse alarms / 30 daysmedian delaydetected within 7 days
Afixed baseline + 3σ0.170 days0.98
Aweekday-aware z-test0.6100.94
ACUSUM0.2111.00
Bfixed baseline + 3σ0.0080.01
Bweekday-aware z-test0.4320.67
BCUSUM0.1830.91
  • One baseline for all days must absorb the weekly rhythm, so its band is wide: no false alarms, but incident B is caught within a week in 1% of runs. Seasonality-aware baselines (compare with the same day type) make small shifts visible.
  • Persistent small shifts favour accumulating detectors. CUSUM (Page’s cumulative sum of standardized deviations, minus a slack of 0.5σ, alarming at 5) catches B within a week in 91% of runs vs 67% for the daily z-test, with fewer false alarms.
  • Monitor what the rails catch, not only what gets through. Incident A never reached users, and it was still an incident.

7.2 Delay is paid in users

Incident B declines ~42 extra legitimate requests a day; with one day from alarm to rollback, CUSUM’s median 3-day delay costs ~166 wrongly declined users, the fixed baseline’s 8 days ~374. Incident response is part of the guardrail: detect, triage (is the shift a real incident, a seasonal change, a new kind of legitimate traffic?), mitigate (roll back, switch a rail’s threshold, disable a feature), review, and add the case to the evaluation set.


8. Open-weight safety (Demo 04)

8.1 What changes when the weights are public

With an API, the provider controls the model, can monitor use (§7) and can change rails at any time. With open weights, anyone can run the model without rails, and anyone can train it further. So every safeguard that lives in the weights must be judged by how well it survives fine-tuning. Two public results frame the problem:

  • Qi et al. (ICLR 2024): fine-tuning GPT-3.5 Turbo on 10 adversarially designed examples (under $0.20 through the API) removed its safety behaviour, and fine-tuning on ordinary benign datasets also eroded it.
  • O’Brien et al. (Deep Ignorance, 2025): 6.9B-parameter models pretrained on data filtered to remove a dual-use domain resisted up to 10,000 steps and 300M tokens of fine-tuning on that domain without degrading unrelated capabilities. Filtered models could still use such information when it was supplied in context (e.g., by search), so the authors recommend defence in depth.

8.2 Hiding vs removing, measured

Demo 04 uses Lecture 25’s reader architecture and an invented stand-in: one relation of the 100 public (invented) countries is “restricted knowledge” a developer does not want the released model to provide. Three released models: base (trained on everything), refusal-trained (base plus a short fine-tune answering “unknown” to restricted questions), and filtered (trained from scratch on data with every restricted fact removed). Then the evaluation a holder of the weights could run: fine-tune on the restricted facts of 20 countries and ask about the other 80; or fine-tune on ordinary data with no restricted facts at all.

modelrefusesheld-out restricted facts knownother factsreading
base0.0001.0001.0001.000
refusal-trained0.9700.0251.0000.998
filtered0.4900.0000.9900.995
refusal-trained, +25 steps on 20 countries0.0000.9751.0001.000
filtered, +400 steps on 20 countries0.0000.0870.9500.990
refusal-trained, +400 benign steps0.7900.2121.0001.000

(16 possible values: uniform guessing scores ~6%, always answering the commonest value 15%.)

  • Refusal training hides knowledge; it does not remove it. Twenty-five fine-tuning steps on 20 countries restore 97.5% accuracy on the 80 countries that were never in the fine-tuning data: the facts were still in the weights.
  • Filtering the training data removes it. After 400 steps on the same 20 countries, the filtered model knows 8.7% of the other 80 (guessing level), while its other capabilities dip only slightly. It can only learn the facts it is shown.
  • Even benign fine-tuning erodes refusal (97% → 79%), as Qi et al. found at scale.

8.3 Practice for open releases

  • Evaluate safeguards after fine-tuning, not only at release. OpenAI’s gpt-oss release (Wallace et al. 2025) estimated worst-case risk by fine-tuning the model to maximize capability in two risk domains before release, and compared the result with frontier closed models.
  • Prefer safeguards that live in what the model never learned (data filtering) over safeguards that live in behaviour on top of what it learned (refusals), for the capabilities that matter most; keep refusals for everything else.
  • Defence in depth still applies: filtered models can use information supplied in context, so retrieval, tools and deployment rails still need their own controls.
  • Judge marginal risk: what does releasing these weights add over what is already available?

9. Summary

  1. The policy defines failure. Topical, safety and security risks depend on the application; ask directly first, because a failure that needs no attack is a policy gap.
  2. Test systems, not models. When output drives execution or is rendered, classic security applies: untrusted content is data, output is sanitized, privileges are least, tenants are isolated.
  3. A rail is a classifier with a threshold. Evaluate it on the traffic it will meet; give it the knowledge the policy depends on; pick the threshold from written-down costs; remember that at low prevalence most flags are false.
  4. Layer rails per failure class, and count every rail’s false positives against good traffic; run rails in parallel where possible and check output in chunks.
  5. Rails are sensors. Monitor what they catch with seasonality-aware, accumulating detectors; detection delay is paid in users.
  6. Open weights change the threat model. Behavioural safeguards can be trained away in a few steps; removing knowledge from training data survives fine-tuning; evaluate safeguards after fine-tuning.

10. Common pitfalls

  • Reporting one attack-success number instead of per category, without the direct-request baseline.
  • Evaluating a rail on the traffic it was trained on, or before the catalogue, product or user base changed.
  • Keyword rails that confuse surface words with intent.
  • Ignoring base rates: quoting accuracy for a rail that looks for a rare event.
  • Setting thresholds without costs, or one threshold for every category.
  • Counting only what gets through: a rail quietly catching a rising number of problems is an incident.
  • Monitoring with one baseline across weekly or seasonal rhythms.
  • Treating refusals as removal of a capability in open-weight models.

11. Exercises

  1. Base rates. A rail has TPR 0.95 and FPR 0.005. What fraction of its flags are correct when the target behaviour occurs in 1% of requests? In 0.01%?

    Answer1%: 0.95 × 0.01 / (0.95 × 0.01 + 0.005 × 0.99) = 0.0095 / 0.01445 = 66%. 0.01%: 0.000095 / (0.000095 + 0.0049995) = 1.9%. At 0.01% prevalence, 98% of flags are false: send flags to a second, more precise stage.
  2. Two rails in series. An input rail and an output rail each have FPR 2% on good traffic, independently. What share of good requests is harmed by at least one? What if the output rail runs only on requests the input rail passed?

    AnswerIndependent: 1 − 0.98² = 3.96%. In series the output rail sees only the 98% the input rail passed: 2% + 0.98 × 2% = 3.96% as well; series placement does not change the false-positive arithmetic, only latency and cost.
  3. Threshold by cost. Missing an out-of-scope request costs 1 unit; wrongly declining a customer costs 5. In Demo 01 Part C, would you move the threshold toward fewer misses or fewer false blocks than the 1:1 choice?

    AnswerToward fewer false blocks: false blocks are now the expensive error, so the threshold rises (more out-of-scope requests answered, fewer customers declined). In Demo 01 the 1:1 choice already blocks no legitimate requests, so it stays.
  4. Latency budget. Your product requires TTFT ≤ 150 ms for 2,000-token prompts. The main model’s prefill takes 120 ms; a guard model takes 50 ms for 2,000 tokens. Which input-rail placements meet the budget?

    AnswerSerial: 170 ms, no. Parallel with the first token held until the rail clears: max(120, 50) = 120 ms, yes. A cheaper guard on a truncated prompt (say the last 500 tokens, ~13 ms) would also fit serially, at some loss of recall.
  5. CUSUM tuning. In Demo 03, what happens to false alarms and detection delay if the CUSUM threshold rises from 5 to 8?

    AnswerFewer false alarms (random fluctuations must accumulate further) and longer delays (a shift of δσ per day needs about h/(δ − k) days to cross h). For incident B the delay roughly grows in proportion to h; the right h comes from the cost of a false alarm (on-call time, alarm fatigue) vs the cost per day of an undetected incident (§7.2).
  6. Open weights. In Demo 04, the refusal-trained model recovered held-out facts after fine-tuning on other countries. What does that say about where the facts were stored, and what test would distinguish “hidden” from “removed” in a real model?

    AnswerThe facts were stored in weights shared across countries; refusal training only gated the output. Fine-tuning on a subset reopened the gate for all. The test: fine-tune on a subset of the restricted domain and measure on a disjoint held-out subset; recovery far above what the subset could teach means the knowledge was hidden, not removed (Deep Ignorance and the OpenAI gpt-oss evaluation run versions of this at scale).

No assignment targets safety directly. The habits transfer to Assignment 4 and to the project: define the policy and the costs first; evaluate any filter or classifier at realistic prevalence and on shifted traffic; report per category; measure the latency of every check you add to a serving path; and for anything trained, test whether a safeguard survives further training.


13. Research directions

  • Tamper-resistant safeguards: methods that survive fine-tuning (data filtering, unlearning that is verified by recovery tests, training-time defences), and honest measurements of how long they survive.
  • Rails that generalize: guard models evaluated on shifted traffic and growing catalogues; rails that consult the application’s own knowledge (§4.1).
  • Calibrated multi-stage rails for rare events: cheap high-recall first stages with precise second stages, under latency budgets.
  • Monitoring for LLM systems: seasonality-aware detectors over rail signals, attribution of shifts to upstream changes, incident playbooks.
  • System-level security of agents: how tools, retrieval, memory and rendering compose under adversarial content, and which architectural boundaries contain it (Lecture 26).
  • Marginal-risk evaluation for open releases: what a release adds over existing capabilities, measured after worst-case fine-tuning.

14. Further reading

  • OWASP Top 10 for LLM Applications; MITRE ATLAS.
  • Inie, Stray and Derczynski, Summon a Demon and Bind it: A Grounded Theory of LLM Red Teaming (PLoS One 2024).
  • NeMo Guardrails documentation; the garak documentation.
  • Qi et al., ICLR 2024; O’Brien et al., Deep Ignorance (2025); Wallace et al., Estimating Worst-Case Frontier Risks of Open-Weight LLMs (2025).
  • Carlini et al., Stealing Part of a Production Language Model (2024).

15. Next lecture

Lecture 28, Diffusion Language Models, opens Part VI. Instead of generating left to right, a masked diffusion model starts from a fully masked sequence and fills in many tokens per step. We train one on Atlas World next to Lecture 21’s autoregressive parent and measure what changes: training efficiency, sample quality against the true distribution, and the decoding-steps vs quality trade-off that makes parallel decoding attractive and expensive.


术语表 (Glossary, English → 中文)

English中文
topical / safety / security risk话题风险 / 安全风险(人身) / 安全风险(信息)
confidentiality, integrity, availability (CIA)机密性、完整性、可用性
usage policy / policy breach使用政策 / 违反政策
red teaming / responsible disclosure红队测试 / 负责任披露
guardrail / rail (input, output, topical, grounding)护栏(输入、输出、话题、依据)
redaction / PII脱敏遮蔽 / 个人身份信息
untrusted content / provenance不可信内容 / 出处
insecure output handling / excessive agency不安全的输出处理 / 过度代理权
supply chain / tenant isolation供应链 / 租户隔离
true / false positive rate真阳性率 / 假阳性率
ROC curve / AUC / operating pointROC 曲线 / 曲线下面积 / 工作点
base rate / prevalence / precision基础比率 / 流行率 / 精确率
cost-sensitive threshold代价敏感阈值
defence in depth纵深防御
stream-and-retract先流式输出后撤回
probe / generator / detector (scanner)探针 / 生成器连接 / 检测器(扫描器)
discovery vs benchmarking发现式测试 vs 基准测试
monitoring / seasonality / CUSUM监控 / 季节性 / 累积和检测
alarm fatigue / detection delay告警疲劳 / 检测延迟
incident response / rollback事件响应 / 回滚
open weights / tamper resistance开放权重 / 抗篡改性
refusal training / data filtering拒答训练 / 数据过滤
worst-case fine-tuning / marginal risk最坏情况微调 / 边际风险
← 返回课程目录