CourseLarge Language Models: The Complete Course · Module 11: Safety, Security, and Alignment · part 81 of 103
Part 81 · Module 11: Safety, Security, and Alignment

Lab: Defences in code, and a red-team set

37 min read·13 Oct 2026
Module 11 · Lab · About 75 minutes · Needs: lessons 1 to 4 of this module, and the Module 1 lab (or the cells in Step 1)

What you are building

SUPPORTDESK/ AFTER MODULE 11 ticket text customer writes redact.py PII out first input layers clean and mark hosted model may obey authorise every tool call hold_reasons every draft evals/redteam.jsonl 27 cases, kept as tests security.py holds the input layers and both checks
Customer text (grey) is redacted and checked by code (blue) before the model (amber) reads it, and code checks (green) stand between the model and the money and the customer.

It is Thursday 13 August 2026, week 11, two days after the pilot incident. Anika wants the module's defences out of four notebooks and into the repository, where every later module and every test can reach them. You add two files and one data file. supportdesk/redact.py takes personal data out of text before any copy is made. supportdesk/security.py holds the attack-surface map, the input layers, the pinned injection classifier, the authority check in front of every tool call and the checks on every draft. evals/redteam.jsonl keeps Lesson 1's refusal set and T-1034's three forms as permanent tests. The running example is T-1034, Leo Park's planted refund request. Two blocks call the hosted model; the classifier runs on your own machine.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.