Leanpub Header

Skip to main content

Safety, Ethics and Compliance

The arithmetic underneath the assurances

Safety, Ethics and Compliance
This book is 100% completeLast updated on 2026-08-22

"The model is safe." "The filter is effective." "We red-teamed it and found nothing." "We

reviewed a sample and it looked fine."

Each of those is a claim about evidence, and each is unfalsifiable as stated. Reviewing thirty

outputs and finding no problems is consistent with a failure rate of one in eleven. Three

hundred tests against a thousand possible failure modes leave seven hundred nobody looked at.

This book supplies the missing arithmetic — and it was written without generating a single

harmful output to study.

Minimum price

$16.00

$16.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
About

About

About the Book

Safety is the part of this field with the most confident language and the least visible

arithmetic. A model is described as safe, a filter as effective, an evaluation as thorough — and

almost none of those statements comes with a number attached, or with an account of what the

number would have to be to mean anything.

That is a problem for practitioners, because the claims are made about systems they are

responsible for. It is also what these exams actually test: not whether you believe a system is

safe, but what evidence would establish it, what a clean test result proves, and which failures

a given check cannot see.

This book supplies the measurable substrate. Not the ethics — which are contested and are not a

book's to settle — but the arithmetic underneath:

- **"We reviewed thirty and found no problems" permits a failure rate of one in eleven.**

Bounding a rate below one in a thousand takes 3,000 clean samples. The rule of three — the

bound is about 3/n — makes this arithmetic you can do while somebody is still describing their

testing.

- **A clean red-team run bounds almost nothing.** Three hundred tests against a thousand failure

modes cover 30% and leave 700 unexamined. Nobody knows the size of the space for a language

model, which is a real difficulty and does not excuse omitting it — state it as an assumption

so somebody can disagree.

- **Training has no fairness correction in it.** On a task where the true association is 50/50

by construction, a data gap of 0.80 produced an output gap of 0.804. Reproducing the imbalance

is the *optimum* of the training objective, not a failure to reach it — a model predicting

50/50 on 90/10 data would have higher loss.

- **Perfectly balanced data still produced a gap of 0.026.** That is the noise floor, and a

measured disparity of 0.03 in a real system means nothing until it is compared against one.

- **Ten repetitions is enough to memorise.** A unique seven-token string at 0.332% of a corpus

became fully recoverable from a two-token prompt. At three repetitions it was 60% recoverable

— a real leak that an exact-match test reports as a clean pass.

- **Misuse filtering is beaten by its base rate, not its quality.** A filter separating malicious

from benign requests by three standard deviations blocks 92 benign requests for every malicious

one it catches, when one request in a thousand is malicious. The same filter is fine when one

in ten is. Filters evaluated on balanced test sets overstate production performance by a factor

the test set does not contain.

- **"A human reviews the output" describes three different controls.** Full review prevents;

sampled review measures; escalated review inherits the flagging mechanism's blind spots. A

document that does not say which is describing a control nobody has characterised.

**On the constraint that shaped this book.** It would be possible to study refusal behaviour by

attempting to elicit harmful output, and bias by generating stereotyped text about real groups.

This book does neither. Every experiment measures a *mechanism* — how a known imbalance

propagates, how many repetitions make a string recoverable, what fraction of a space a test set

covers, what a review sample bounds — on synthetic, neutral tasks where the ground truth is exact

by construction.

That costs something and is stated openly: refusal behaviour is cited rather than measured. It

also buys something. Because the true answer is known by construction, "bias" has an exact

definition here rather than a contested one, and the noise floor of a perfectly fair setup can be

measured — which is the number every fairness claim should be compared against.

**On what is measured and what is not.** Ten objectives were listed from the published blueprints

and then triaged before any experiment: six are measured, two are reasoned, two are cited. The

ratio is printed on the cover. A book about safety could very easily imply more evidence than it

has, and on this subject in particular, overclaiming is itself a safety failure.

What you get:

- 8 chapters covering what a safety claim must contain, bias propagation and noise floors,

memorisation and privacy, red-team coverage, human oversight, the obligations that are not

measurements, misuse and base rates, and a final chapter of limits.

- 42 original practice questions, tagged by certification and by difficulty, where every option

is explained — not just why the right answer is right, but why each wrong answer is wrong.

- A reverse map from each certification to the chapters that serve it, in reading order.

- All the code, so every table can be regenerated.

Written to the published objectives of NVIDIA NCP-GENL, NVIDIA NCA-GENL, AWS Certified

Generative AI Developer – Professional, Databricks Certified Generative AI Engineer, and NVIDIA

NCP Agentic AI. Objectives were checked in August 2026; confirm the current blueprint with the

certifying body before you sit. Regulatory frameworks are described as of that date and this

book does not give legal advice.

You need to be able to read Python. The statistics — confidence bounds, coverage, noise floors —

are built up from the point where they are needed, and nothing in this volume assumes you have

read any other book.

Every question is original, written from published exam objectives. Nothing is reproduced from,

or based on recollection of, any live examination.

Bundles

Bundles that include this book

Author

About the Author

Hatem M.

Hatem M. is a programmer and technical author whose work focuses on modern C++, large language models, and AI systems.

His books combine first-principles explanations with complete implementations and reproducible experiments. They include C++ Algorithmic Mastery, an eight-volume series on algorithms and problem solving; Build an LLM Inference Engine in C++, which constructs a GPT-style inference engine from scratch; LLM Quantization: From the Bits Up, which develops the theory and practice of neural network quantization from the bit level upward; and C++ Autopsy, a forensic investigation of ten subtle C++ bugs that compiled successfully, ran correctly, and still produced the wrong answers.

Contents

Table of Contents

Contents
  • 1. What a Safety Claim Has to Contain
    • Absence of evidence, quantified
    • What a test set proves about what it did not test
    • The three questions
    • Why safety is harder to evidence than performance
  • 2. What Goes In Comes Out
    • Defining bias so it can be measured
    • The measurement
    • The row that matters most
    • Where a correction can be applied
  • 3. What the Model Keeps
    • The measurement
    • The row that a test would miss
    • What follows for data handling
    • The scale caveat, in both directions
  • 4. Testing for Things You Have Not Thought Of
    • Coverage, computed
    • Why random coverage is the optimistic case
    • What a red-team report should contain
  • 5. The Human in the Loop
    • Three different things called review
    • What a sample bounds
    • What the reviewer can actually see
    • Accountability, which is not the same as review
  • 6. The Parts That Are Not Measurements
    • Where the training data came from
    • Telling people what they are using
    • Documentation that is worth writing
    • Regulation, as of a date
  • 7. The Same Capability, Two Purposes
    • Why intent cannot be read from a request
    • The base rate, computed
    • What follows for a system that could be misused
    • Adversarial input, and where it is covered
    • Four obligations this book does not measure
  • 8. Limits, and Where Each Exam Goes
    • The limits, and what causes each
    • What safety work does reliably
    • What this book did not establish
    • The reverse map: your certification to these chapters

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub