Data Audits and Release Governance
Learn how to audit training data with sampling design, Wilson intervals, approval gates, and traceability records that support accountable release decisions.
Language AI HandbookAll chapters Data Audits and Release Governance
Every filter in the earlier part removes something. Deduplication removes near-copies, quality classifiers remove low-scoring documents, PII detectors strip identifiers, toxicity classifiers suppress abusive text. Each of those chapters taught you how to build a control. This chapter is about a different question: how do you know the controls worked, and who decides that the result is good enough to ship?
That question is not answered by better filtering. It is answered by auditing, and the answer is only meaningful when it flows through a decision process that someone owns. A data audit produces evidence. Release governance turns evidence into an accountable decision. The two are inseparable. An audit nobody reads is theatre, and a release decision made without evidence is a guess dressed in a signature.
For a checkpoint release under the governance process described here, decide which of these assurances apply and collect the evidence to support them:
- The training corpus is what the documentation says it is.
- Known categories of sensitive content were screened, and the residual rate is within a stated bound.
- The provenance of the data is recorded well enough to answer a challenge later.
- Someone with authority looked at the evidence and accepted responsibility.
Use evaluations and red-team exercises to investigate suspicious output behavior. A model can memorize some training examples. To establish which source, license, or category entered a mixture, follow the recorded joins from the training run to its data manifest and upstream provenance. An output you can reproduce does not supply those joins. The audit checks the records behind them.
There is a useful analogy from financial auditing. A company installs controls (approval workflows, segregation of duties, reconciliation). In an audit of internal control over financial reporting, the auditor tests selected controls and issues an opinion on their effectiveness. A transaction sample can help where it fits the test. Other tests, including many tests of segregation of duties, use procedures without sampling. Data pipelines work the same way. Your PII detector is a control. A sampled content audit can test that control and estimate residual document prevalence with uncertainty. Compare that result with the stated release criterion.
The analogy helps explain why the audit is separate from the work of building controls. In U.S. public-company audits of internal control over financial reporting, PCAOB standards require control testing as a basis for an opinion on effectiveness. If a scope restriction prevents the necessary procedures, the auditor withdraws or disclaims an opinion. The standards specify how to plan a control-test sample when one is used. Auditor independence rules also restrict financial information systems design and implementation under specified conditions. For a corpus audit, ask about residual prevalence within the stated scope and whether the estimate and its uncertainty support the release criterion.
A structured, evidence-producing examination of a dataset version or pipeline stage against explicit criteria. A review may sample from a defined frame or cover it in full. Record the results and methods so decision-makers can evaluate them and authorized reviewers with access can reproduce them.
Three properties separate an audit from ordinary quality assurance. First, the criteria are stated before the examination, not after. Second, the sampling design is written down, so the estimate is interpretable. Third, the output is a durable artifact: a record that survives personnel changes and can be produced under legal or regulatory demand.
All three properties are responses to a specific failure mode. If the criterion is chosen after seeing the results, the audit is unfalsifiable: any outcome can be declared acceptable by inventing a threshold that matches it. If the sampling design is not written down, the prevalence estimate is not measurable, because there is no well-defined distribution from which the observed sample was drawn. If the output is not durable, the audit becomes folklore: the current team knows the corpus was checked, but cannot demonstrate it, and cannot answer questions about a model released two years ago. Each property converts a vague assurance into a testable claim.
We will build all three, then wrap them in gates and traceability.
The Anatomy of a Dataset Audit
Use the six workstreams below as questions to scope your audit. For each one, record the population of interest and whether you will review every item or use a sample.
- Content audit. What harmful, sensitive, or regulated material is present, and at what prevalence? This is where PII, abuse, sexual content involving minors, violent material, self-harm content, credentials and secrets, and malware live.
- Provenance audit. Where did each document come from? Which crawler, which snapshot, which upstream corpus, which license? What fraction of documents have an unbroken chain back to a source?
- Rights and licensing audit. What is the distribution of terms under which the data was obtained, and what share is unresolved or restricted? See Licensing, Consent, and Data-Use Signals earlier in Part XXI: Data Governance, Provenance, and Synthetic Ecosystems.
- Representation audit. How does the corpus composition compare against intended or claimed coverage across languages, domains, regions, and registers?
- Contamination audit. Did evaluation data leak into training? (The mechanics build directly on Deduplication.)
- Pipeline audit. Do the filters that were supposed to run actually run, and do they still work on today's data?
These workstreams fail in different ways and consequently need different instruments. A content audit depends on classifiers and human review; a provenance audit depends on crawl logs and metadata capture; a licensing audit depends on a maintained mapping from sources to terms; a representation audit depends on language identification and domain classification; a contamination audit depends on near-duplicate search against the evaluation suite; a pipeline audit depends on canary data and version pinning. Bundling them into a single "data audit" obscures that each has its own operating characteristics, its own sampling implications, and its own owner. The bundle is shared because the outputs feed the same decision, not because the methods are interchangeable.
Bind the audit record to a content hash of the exact snapshot it measured, such as normalized source documents before tokenization. Bind the derived training shards to their own trusted manifest. Record the transformation between those snapshots and the loader's actual inputs. A valid source audit and a valid shard manifest can describe different data if those links are missing.
Controls versus tests of controls
Here is the distinction that organizes the whole chapter.
| Filter (control) | Sampled content audit (test of control) | |
|---|---|---|
| Runs on | Every document | A probability sample from the audit frame |
| When | In-line, during curation | Offline, at stage boundaries |
| Illustrative time per item | Microseconds to milliseconds for a fast filter | Seconds to minutes for a human review |
| Optimized for | Throughput and recall | Measurement accuracy and defensibility |
| Output | A filtered corpus | An estimate with an interval that accounts for the sampling design |
| Failure mode | Silent drift, threshold decay | Sample bias, unmeasured categories |
Keep filter execution and audit measurement separate, with a record of the documents each process examined. For a filter that discards scores at or above its threshold, lowering the threshold while scores stay fixed can only keep or enlarge the discard set. A team rewarded for retaining volume may favor raising it or downplaying residual findings. Assign audit ownership separately from the team measured on corpus yield.
The unit of analysis problem
Before you can sample, you must decide what a "unit" is. The choice changes the answer.
- Document sampling answers "what fraction of documents contain X?" An equal-probability document draw weights a short document as heavily as a long one. A token draw weights each document by length. The fraction of documents with a property and the fraction of tokens with that property answer different questions.
- Token sampling answers "what fraction of training tokens are X?" A 400,000-token book contributes 400,000 units to the token-level population. Its weight depends on the total token count and the audit’s sampling design.
- Source sampling answers "what fraction of sources contain X?" Use it to estimate source-level provenance or licensing coverage. To estimate document prevalence from a sample of sources, account for the documents each source represents.
- User or author sampling requires a frame of identifiable users or authors. In a web crawl, a frame limited to pages with visible bylines can exclude other authors and bias an estimate intended to cover all authors.
State the unit and denominator in the audit record. A property can appear in 10% of documents and 0.01% of tokens in the same corpus. Token prevalence measures the share of tokens with that property in the defined population. Document prevalence, together with the sampling design and review protocol, helps estimate the chance that a manual audit finds an affected document. A source audit can inventory provenance and licensing records. Use separate evidence to determine licensing obligations or what a training run actually consumed. The same corpus can pass one threshold and fail another when the thresholds apply to different quantities. Record why the unit fits the audit question.
Sampling: Auditing a Corpus You Cannot Read
A full manual review is impractical at pre-training scale. At an assumed 300 tokens per minute, reading 50 billion tokens continuously would take about 317 years. A probability sample gives the audit a way to estimate a property of a defined population and quantify sampling uncertainty.
The temptation is to treat the audit as an editorial review process in miniature: read a few thousand documents, form an impression, and report the impression. That is not an audit. It is a spot check, and spot checks are systematically unreliable for two reasons. First, humans are bad at estimating prevalence from small samples without explicit counting: a reviewer who reads forty documents and finds no harmful content will report the corpus as clean, whereas the true prevalence could easily be 5%. Second, spot checks are not reproducible. If a colleague runs the same review on a different slice, they get a different impression and there is no principled way to reconcile the two. Sampling statistics exist because humans systematically misjudge the frequency of rare events, and because principled reconciliation requires a stated estimator.
The sampling frame
The population you audit is not "the web" or "the world's text." It is a specific, enumerable set: the documents in dataset version ds-2025.06. The mapping from that set to the thing you actually care about (all human expression, or all text the model will encounter) is the coverage problem, and it cannot be fixed by sampling more. Crawl reachability, robots.txt exclusions, and language filters have already shaped the population before you drew a single sample. (See Web Crawling.)
Record the frame. If your crawl excludes domains that disallow crawling, the estimate applies to the documents included in the audited dataset version. Extending it to the wider web requires a separate representativeness argument.
This is the subtlest pitfall in the whole chapter because the frame is invisible in the data. The documents you have do not carry a record of the documents you do not have, and the absences shape the audit's conclusions silently. An English-only frame gives no coverage of the excluded languages. A crawl without login-walled content gives no direct evidence about credentials in material behind logins. Every audit is a statement about the frame, and any application to a population outside the frame is an assumption of representativeness that should be tested rather than presumed.
Sample size for a proportion
To plan a simple random sample for a prevalence estimate, choose an anticipated rate , a two-sided absolute margin , and a nominal confidence level . The normal approximation starts with
where is the standard-normal quantile. The examples use 1.96 for 95%. For simple random sampling without replacement from a finite population of size , use the following adjustment:
Two things follow immediately. First, is largest at , so the conservative choice is when you know nothing. Second, and more importantly for data governance, estimating a rare proportion to tight relative precision can require a large sample. At 95% confidence, and an absolute margin of yield a normal-approximation planning size of about 15,351 documents before finite-population correction (15,351.03, conventionally rounded up to 15,352).
The shape of the formula has a consequence that surprises teams the first time they encounter it. The sample size needed to estimate a common proportion is small: at and an absolute margin of 0.03, the normal approximation with gives 1,068 reviews before finite-population adjustment. For small , at fixed relative precision the planning size grows approximately as , while at fixed absolute margin it falls roughly in proportion to ; the operative variable when estimating rare harms is the ratio of to . Estimating a rarity of 1 in 100 to within ±0.1 percentage points requires about 38,000 reviews, not a few thousand. Estimating a rarity of 1 in 1,000 to within ±0.05 percentage points is possible at a comparable number. For the same rarity and a margin of ±0.005 percentage points, the uncorrected planning size is about 1.54 million reviews. Apply the finite-population adjustment if that count is large relative to the audited frame. The margin must be chosen with the rarity in mind; otherwise the sample size blows up for a precision no one will use.
When the prevalence is low, a feasible random sample may have no positive cases. A small sample with zero observed cases still leaves substantial uncertainty about prevalence.
The rule of three
When you observe zero events in independent trials, the 95% upper bound on the true rate is approximately (Hanley and Lippman-Hand, 1983). Audit 300 documents and find no CSAM, and the 95% upper bound on prevalence is about 1%. Whether that bound is tight enough depends on the release criterion. Give the bound alongside the count, so the reader can assess what the sample rules out.
A zero-count sample is entirely compatible with nonzero prevalence. At prevalence , the probability of observing zero in independent draws is , which approaches . The approximation is conservative for this one-sided 95% binomial bound. With fifty independent reviews and no positives, it gives an upper bound of about 6%.
The figure below makes the bound concrete across a range of zero-finding audit sizes.
PythonIn [2]Expand
import numpy as np
rule_n = np.unique(np.geomspace(1, 2000, 200).astype(int))
rule_upper = 1 - np.power(0.05, 1 / rule_n)
rule_marks = np.array([50, 300])
rule_mark_bounds = 1 - np.power(0.05, 1 / rule_marks)VisualizationOut [3]Expand

Stratified and detector-assisted sampling
If a detector concentrates positive cases in identifiable groups, consider allocating more reviews to those groups. Check the allocation against the goal, whether finding at least one positive, estimating prevalence to a target precision, or supporting a one-sided release bound.
The standard design is a two-phase audit:
- Run a cheap automatic detector over the entire corpus and partition documents into strata (for example, flagged versus unflagged, or flagged-high, flagged-low, unflagged).
- Draw human review samples within strata, at rates you choose.
The population prevalence is then estimated with the stratified estimator
where is the observed rate within stratum and is that stratum's share of the population. For independent simple random samples without replacement within each stratum, an unbiased estimator of the sampling variance is
The finite population correction matters here: if a stratum is small enough to review in full, its sampling variance contribution is zero. Use that zero directly for a census, including a one-document stratum. For a noncensus stratum, the displayed variance estimate requires .
The displayed estimator assumes a simple random sample within each stratum that contributes to the population. Record the stratum sizes and which design selected the reviewed items. A detector can miss an entire target category, while another rule still flags some documents containing it. Whether stratification reduces variance for that category depends on the allocation and the prevalence within each stratum.
The intuition behind the estimator is a reweighting argument. Human review measures rates within strata, and each stratum is then weighted by its share of the full population. If you review 100% of a flagged stratum containing 500 documents and find 250 positives, the flagged stratum contributes 250 * 1 = 250 estimated positives. If you review 10% of an unflagged stratum containing 49,500 documents and find 1 positive, that implies roughly 10 positives in the unflagged stratum, which contributes 10 to the total. The sampling rates can differ across strata. To compute the estimate, keep each review's stratum, the number reviewed there, and the stratum's population size. Pooling the sample directly weights strata by their review counts and can bias the estimate when sampling rates and outcome rates differ.
We will quantify both effects in the worked example.
Estimators for rare-event counts
When the question is "how many documents of type X are in this corpus?" rather than "what fraction?", you multiply: , with a confidence interval obtained from the interval on . For a small positive count under independent Bernoulli sampling, consider a Wilson score interval or an exact binomial interval. For finite sampling without replacement, invert the hypergeometric count distribution when the sampling fraction matters. A weighted stratified estimate requires an interval that accounts for its strata.
The choice between absolute count and prevalence matters for how the number is consumed. A safety review can use the estimated number of sensitive documents, while a release criterion may use residual prevalence. The estimated count is the prevalence estimate multiplied by the frame size. The number of documents a filter removes depends on its decision rule, including the documents it flags in error. A rare-event estimate can have a wide interval when the sample contains few positives. In a frame of 50,000 documents, a prevalence interval of 0.4% to 1.2% corresponds to 200 to 600 documents. Scaling the endpoints changes the units and preserves coverage for the corresponding fixed-population count.
For successes in trials, use the observed success fraction and the critical value :
The interval is . Unlike the Wald interval, it never extends below zero and behaves sensibly when is small, which is exactly the regime audits live in.
Sensitive-Content Review in Practice
Sensitive content is not one category. It is a hierarchy, and the review process for each branch is different because the stakes and the base rates are different.
The legal rules for child sexual abuse material depend on the jurisdiction and provider. In the United States, 18 U.S.C. § 2258A requires covered providers to report to NCMEC’s CyberTipline as soon as reasonably possible once they have actual knowledge of facts indicating certain apparent violations. Section 2258E defines providers as electronic communication service providers or remote computing services. Section 2258A(f) creates no duty to affirmatively screen. Under subsection (h)(1), a completed report under subsection (a)(1) triggers a one-year preservation period for the submitted contents. Subsection (h)(2) also covers reasonably accessible visual depictions, data, or other digital files that may provide context or additional information about the reported material or person. Subsection (h)(3) requires secure storage and limits staff access to what compliance requires. Subsection (h)(6) requires preservation under that subsection to be consistent with the latest NIST Cybersecurity Framework or its successor.
A working taxonomy
- Personal data. Names, email addresses, phone numbers, government identifiers, financial account numbers, home addresses, precise geolocation, health information.
- Credentials and secrets. API keys, passwords, private keys, session tokens, database connection strings.
- Child sexual abuse material. Keep this category separate from routine content review. Record the applicable reporting and preservation rules as part of the audit scope.
- Other illegal or severely harmful content. Instructions for weapons or explosives, malware source, recruitment material, targeted harassment.
- Hate and abuse. Slurs, dehumanizing language, coordinated harassment.
- Professional advice. For medical, legal, and financial advice, record any restrictions applicable to the intended use and jurisdiction as part of the audit scope.
- Private or proprietary material. Leaked documents, paywalled content, non-public personal information of public figures.
The taxonomy is not intended to be exhaustive. Every organization will find itself adding categories as its deployments surface them, and the categories will look different for a medical copilot than for a code assistant. What matters is that the taxonomy is stated in the audit record and that the report breaks prevalence out per category rather than pool-treating "harmful" as a single number. In a worked breakdown that assigns one primary finding per flagged document, an overall rate of 0.5% might consist of 0.4% with personal data in code comments, 0.05% with credentials, and 0.05% with targeted harassment. Report unresolved flags separately from reviewed positives.
The detection stack
A detection stack can combine methods with different scopes:
- Exact matching against hash lists. Compare a content digest with a reference list of known material. The result only establishes whether the digest is on that list. How the list was assembled and which hashing method it uses determine what the match can tell you.
- Pattern matching with validators. In the worked example below, a regular expression finds strings that resemble card numbers. A Luhn check rejects candidates that fail the checksum. A passing candidate can still be unrelated to a card. The reduction in false positives depends on the strings your matcher accepts.
- Lexicons and gazetteers. Match entries from name lists, profanity lists, or place lists. What they catch depends on the list and the text. An entry may be ambiguous in context, and new terms may be missing.
- Statistical classifiers. A learned classifier can use surrounding text. Toxicity benchmarks have shown changes in error rates across tested language varieties and domains. Validate on data resembling the deployment corpus.
- Model-based judging. Ask a language model to classify a document using a rubric. Record the model and input and output token counts so you can estimate costs under the applicable pricing or runtime measurements. Phrasing can affect the labels. A comparison with independently labeled examples helps establish how well the judge applies the rubric.
Choose layers with different failure modes. Hash-list matching is limited to the reference list. Pattern matching with validators catches structured identifiers in the forms the pattern anticipates. Lexicons catch lexical cues broadly at the cost of noisy flags. Statistical classifiers adapt to context and catch patterns lexicons miss, at the cost of opaque and drifting operating characteristics. Model-based judges add semantic flexibility and rubric-driven explanation, at the cost of expense and unreliability on inputs far from the model's training distribution.
Decide what action a detector's evidence can support. A checksum-validated match establishes that a string passed a format check, and a multilingual toxicity classifier assigns a score under a particular training and validation setup. An automated route can act on a narrow, validated criterion when its measured error rates meet the policy. Send ambiguous flags to a second stage such as human review. Record what each layer can establish and the population on which its error rates were measured.
Operating characteristics and the base-rate trap
Every detector has a true positive rate (TPR, or recall) and a false positive rate (FPR). Those two numbers do not tell you whether the detector is usable. Precision asks what fraction of flagged documents are positive. It is undefined if the detector makes no flags.
By Bayes' rule, at prevalence ,
This expression is brutal at low . Take a detector with 95% recall and a 1% false positive rate, which sounds excellent. At a prevalence of 0.1%, precision is
More than nine out of ten flags are wrong. If a person reviews every flag, about 91% of the reviewed documents are negatives. The share of review time depends on how long those cases take. Automatically removing every flag transfers that same mix of positives and negatives to the removed set. If false-positive rates differ by group, each rate is the fraction of that group's negative documents removed under this rule. See Toxicity Filtering for the implications of setting a threshold.
At a fixed threshold, use the TPR and FPR measured for the target population. The true-positive share is , and the false-positive share is . The two shares are equal at . With a 1% FPR and 95% TPR, that is about 1.04% prevalence. Below it, false positives outnumber true positives among the flags. In this example, more than 91% of flags are false at 0.1% prevalence, and the share rises as prevalence falls.
This is why the audit's job is not just to count positives. It is to characterize the detector well enough that someone can choose a threshold deliberately. Precisely characterizing the detector's ROC curve against human-labeled gold data, stratified by document type and language, is what allows the next subsection to be meaningful. Without that characterization, the threshold is chosen by gut feel or vendor default, and neither is a defensible answer to the question "why was this set here?"
Threshold selection as a decision under cost
Suppose each false negative costs in expected harm and each false positive costs in lost data and review time. Expected cost per document at threshold is
Minimizing over gives the operating point. The point of writing it this way is that and are policy decisions, not technical ones, and they belong in the audit record alongside the metrics. When someone later asks why the threshold was set where it was, "we minimized expected cost under the risk appetite approved by the safety review on 3 June" is a defensible answer. "It was the default" is not.
The detector's false-negative rate is the share of positive corpus documents it misses. To include deployment harm in , estimate the frequency and severity of harmful outputs separately and document the evidence and assumptions behind the estimate. When the cost is uncertain, show how the threshold choice changes across plausible costs.
Review workflow
Automated detection produces candidates. Humans produce adjudications. A workable workflow:
- Tiering. Route severe and uncertain-severe flags to qualified specialist triage. Count unreviewed flags separately from adjudicated positives. Send lower-severity, low-confidence flags to bulk review if the audit protocol calls for it.
- Dual review for the top tier. Two independent reviewers, with disagreements escalated to an adjudicator. Record both labels, not just the resolved one, so you can measure inter-annotator agreement.
- Blinding where possible. Reviewers should not see each other's labels before committing their own.
- Minimal retention. Keep ordinary review tickets limited to the reference and the decision, without the document content. A hash or location reference can still be personal data if it relates to an identifiable person. Include access controls for those records in the review design. See GDPR Article 4.
- Rate limits and welfare. Reviewers of severe content need rotation, psychological support, and exposure limits. This is an operational requirement, not a nicety.
The workflow has two goals: accurate labels and safe working conditions. Have two reviewers label a subset independently and compare their answers. Inspect cases where they disagree for ambiguous rubric language, ambiguous examples, and differences in interpretation before revising the rubric. Set exposure limits and provide support for reviewers handling severe material.
Canary documents: testing the controls
A content audit tells you what is in the corpus. A control test tells you whether your filters still fire. The cheapest version is a canary set: a small collection of documents with known labels, deliberately constructed to exercise each filter, run through the pipeline as if they were ordinary data.
If a canary meant to be removed survives, the pipeline missed a test case. If a canary meant to be kept is removed, the pipeline rejected a test case incorrectly. Inspect the path it followed before attributing either result to a threshold change.
Run canaries on pipeline changes to catch regressions before the next training run. A canary tied to a particular filter helps isolate the stage that failed, and running the same test on the previous version helps narrow down the change. If you find a failure after training, assess remediation separately for the corpus and for any checkpoint trained on it.
Documentation: Turning Evidence into an Artifact
Documentation gives reviewers a record they can read without being present for the audit. The formats below serve different audiences and purposes.
A datasheet accompanies a dataset as it moves between teams. A data statement describes linguistic and demographic characteristics that aggregated counts can hide. A model card can draw on those records when documenting training and evaluation data. A nutrition label gives readers a compact overview for comparing datasets. Choose the format by asking which decisions its readers need to make.
- Datasheets for Datasets (Gebru et al., 2018; CACM 2021). Structured around motivation, composition, collection process, preprocessing and cleaning, uses, distribution, and maintenance.
- Data Statements for NLP (Bender and Friedman, 2018, TACL). Focused on linguistic and demographic characteristics such as language varieties, speaker demographics, and annotation. In a hypothetical multilingual corpus with 94% English tokens, for example, report the language breakdown so readers can see how the remaining tokens are distributed.
- Model Cards for Model Reporting (Mitchell et al., 2018 preprint and 2019 proceedings). Describes the model and its evaluation. Training-data and evaluation sections can draw on audit outputs.
- System cards. Extensions for deployed systems that include the surrounding retrieval, tooling, and guardrails, beyond the base model.
- Dataset nutrition labels (Holland et al., 2018). A compact overview with quantitative and qualitative modules intended to be comparable across datasets. Useful as the front page of a longer document.
Versioned audit documentation
The failure mode of documentation is staleness. A datasheet written by hand in March describes a corpus that was rebuilt in May. Nobody notices, because the document and the data have no mechanical link.
The remedy is to generate the quantitative sections from the audit record. Counts, prevalences, confidence intervals, license shares, language distributions, and gate outcomes should be rendered from the same JSON that the gates consumed. Prose sections (motivation, intended use, known limitations) stay hand-written; numbers do not.
Generating reported numbers from the versioned audit record can keep sections tied to the same snapshot. Have the generator check that the record’s snapshot ID matches the one named in the release. A corpus change can leave all displayed aggregates unchanged, so include the snapshot ID or manifest digest in the document.
When teams report composition and prevalence from the same audit record, both sections can use the same snapshot. The record can still contain mistakes, and descriptions of intended use and limitations still need editorial review.
What the documentation needs to support
A good corpus document is not written for the auditors. It is written for the people who will need to answer questions later:
- A downstream team deciding whether this model is appropriate for their application.
- A legal team responding to a rights-holder complaint.
- A safety team investigating a reported behavior.
- A regulator asking what data went into the model.
- An external researcher studying the model's properties.
Each of these needs different fields. The provenance chain and the content-hash root serve the first three. The training-content summary serves the fourth. The representation audit and known-limitations sections serve the fifth.
A downstream team may need the languages, domains, and limits to judge fitness for purpose. Legal and safety teams can follow the provenance, rights, and residual-content measurements relevant to their decisions. An external reader may need the composition and known limits to interpret a result. One way to serve these readers is a standalone overview, a fuller datasheet, and a technical appendix with the underlying audit records. The datasheet should cite the appendix, and the appendix should be verifiable from those records.
Regulatory context
An audit record can support voluntary risk management, an AI management system, or a legally required disclosure. These uses differ in scope and audience.
- NIST AI Risk Management Framework. NIST released the voluntary AI RMF 1.0 in January 2023. Its four core functions are Govern, Map, Measure, and Manage. NIST published the Generative AI Profile (NIST AI 600-1) in July 2024 with risks and suggested actions specific to generative AI.
- ISO/IEC 42001:2023. The standard specifies requirements for establishing, implementing, maintaining, and improving an AI management system within an organization.
- EU AI Act. Article 53(1)(a) requires providers of covered general-purpose AI models to keep technical documentation current for the AI Office and national competent authorities on request. Article 53(1)(d) requires a sufficiently detailed public summary of training content using the AI Office template. Article 53(2) exempts providers of qualifying free and open-source models without systemic risk from the documentation duties in points (a) and (b). The license must allow access, use, modification, and distribution. Model parameters including weights, architecture information, and usage information must be publicly available. The public summary requirement still applies. Chapter V generally applies from 2 August 2025 under Article 113(b). Article 111(3) gives providers of general-purpose AI models first placed on the Union market before that date until 2 August 2027 to comply.
For each intended use of an audit record, identify the fields that support it. An internal safety team may need detailed sampling evidence, while a public training-content summary uses the format set by the AI Office.
The same versioned measurements and source records can feed more than one document. Keep the fields for each output tied to the relevant rule or framework. Treat the approval gates below as an example workflow that uses those records.
Approval Gates
A gate is a point in the pipeline where progress stops until a named person accepts the evidence. Gates convert an audit from a report into a decision.
The gate is the operational heart of governance because it is the point at which responsibility becomes visible. Prior to a gate, the audit is an artifact that anyone can ignore; after a gate, the release cannot proceed without a human's signature against evidence. The distinction between a report and a decision is the entire point of the gate, and it is what differentiates governance from dashboarding. A gate is also the point at which the tradeoffs become explicit: to accept the evidence, the approver is accepting the residual, and to reject it, the approver is blocking the release. Both are decisions someone must own.
Where the gates go
A typical pre-training pipeline has five:
- Intake gate. A new source is admitted to the pipeline. Criteria: legal basis established, robots and terms reviewed, provenance record created, source registered.
- Curation gate. The filtered corpus for this snapshot is frozen. Criteria: dedup rate within range, quality-filter yield within range, sensitive-content prevalence below threshold, language distribution matches intent.
- Mix gate. The final training mixture is composed. Criteria: domain proportions within tolerance of the mix specification, no source over-weighted beyond its allowance, contamination check clean.
- Pre-training gate. The tokenized shards are released to the training cluster. Verify their hashes against a trusted derived-artifact manifest, check that it names the audited input snapshot and tokenizer configuration, and record the signature and compute approval.
- Release gate. The resulting checkpoint is published. Criteria: evaluation results reviewed, documentation complete, incident-response plan assigned, rollback path identified.
Each gate has a different job. Intake checks licensing before curation. Curation catches filter failures, the mix gate checks the mixture, the pre-training gate checks the derived shards, and the release gate checks readiness. A mislicensed source caught at intake can be held out before any downstream processing. If it is discovered after training, the team may need to identify the affected runs and assess whether they need to be repeated.
Gates 3 and 4 cover interfaces between teams. A mix gate can reveal that one scraped forum received more weight than policy allows. A pre-training gate can catch a tokenization job pointed at a stale snapshot. Give one person ownership of each interface, and make filter changes, source additions, and tokenizer updates trigger checks wherever they change an audited artifact.
Criteria as machine-checkable predicates
A gate criterion should be a predicate over the audit record, evaluated automatically, with a pass/fail result and a pointer to the evidence. Not a PDF. Not a slide. A row.
CodeExpand
gate: sensitive-content prevalence, one-sided 95% upper bound
snapshot: ds-2025.06
observed: 0.01196
criterion: <= 0.010
status: BLOCKED
evidence: audit:sensitive/2025-06-11T09:14ZThis format has three virtues. It is falsifiable. It is diffable across corpus versions. And it can be recomputed by someone else from the underlying data.
Each virtue addresses a distinct governance pathology. A falsifiable criterion can be compared against the recorded evidence. The result is a decision under that policy and evidence record. Stable fields let reviewers compare criteria and observations across versions. Distinct snapshots can yield the same values, so include a snapshot identity in the row and bind it to the exact artifact in the decision record. Recomputation is the property that lets an external auditor or regulator verify the claim without trusting the organization's own evaluation; the row cites the evidence, and the evidence is reproducible from the raw data and the stated methodology.
Some criteria cannot be automated: "does the intended-use statement accurately describe what this model can do?" stays human. But the human judgment should be recorded in the same structured record, with the same evidence pointers.
Risk tiers
Not every release needs the same scrutiny. A tiering scheme lets you concentrate effort where it matters:
- Tier 1 (highest). Open-weights release of a frontier-scale model, or a model deployed to consumers at scale with broad capability. Full audit suite, external review, executive sign-off, published documentation.
- Tier 2. API release with usage policy and monitoring. Full content audit, provenance audit, and documented gates. Publish any disclosures required for the model and deployment.
- Tier 3. Research artifact, restricted access, no external distribution. Content audit and provenance record mandatory; documentation may be internal and abbreviated.
- Tier 4. Internal experiment on a frozen prior corpus with no new data. Gate light, but the manifest link to the already-audited corpus version must be present.
The tier is itself a decision that requires sign-off, and it should be recorded. Downgrading a release's tier late in the process is a governance red flag that should require the higher tier's approver to concur.
A release planned for open weights might be reclassified as research under schedule pressure. In this example process, a downgrade preserves the original scope in the record and requires a cosignature from the higher tier's approver. That gives reviewers a way to see what changed, when, and who accepted the change.
Waivers and the exception register
A failed internal gate can sometimes be waived for a stated period. For instance, a release may meet its legal and licensing requirements but miss an internal provenance documentation target. Record why the waiver is permitted and how the unresolved documentation will be handled.
Record the approver, rationale, expiry date, and compensating control for every waiver. The expiry tells the team when it must reconsider the decision. The exception register shows which criteria failed and where the organization knowingly accepted residual risk.
A waiver records the failed criterion, the justification for accepting the residual risk, the compensating control, and the approver. Review persistent patterns relative to release volume and waiver scope. Examine reasons, duration, recurring cases, and control failures before deciding whether to change gate calibration or approval policy.
Separation of duties
The person who built the filter should not be the only person who signs that the filter worked. In small teams, strict separation is impractical, but at minimum:
- The audit is executed by someone other than the pipeline owner, or by an automated system the pipeline owner does not control.
- The release approval is issued by someone other than the person who ran the audit.
- Any waiver of a failed gate requires an approver at least one level above the release owner.
Separating these roles gives the approver a chance to question the evidence and records who made each decision.
Separation creates the conditions for informed dissent. When the auditor and the approver are the same person, the audit becomes an internal monologue, and internal monologues rarely bring forward the evidence that contradicts the wanted conclusion. Separating them forces the auditor to package their findings as a legible artifact to a different reader, which is a stronger forcing function than any internal discipline. In a small team, use automation to enforce approval and change-control separation and to preserve the audit record. Assign review to a person or function with appropriate independence from the process owner, and document who can change the methods or inputs.
Post-Release Traceability
The moment a model is released, everything you knew about the data becomes a question someone will eventually ask. Traceability is the ability to answer, quickly and correctly:
- Was document in the training data for model version ?
- Which released models were trained on corpus version ?
- A specific document has been reported as containing illegal content. What is the blast radius?
- A third party has requested deletion. What must be retrained, and what can be patched?
The same lineage records can locate the sources, snapshots, and runs implicated in a request. Use that evidence to identify affected release versions. Assess the legal obligation and whether a proposed mitigation will work before deciding how to respond.
The chain
Traceability links versioned records to a final crawl record that includes the source URL, which may later serve different content.
Each arrow is a record. The model version points to a checkpoint hash. The checkpoint is produced by a run whose configuration pins a dataset root hash. The dataset root is a Merkle root over shard roots. Each shard root is a Merkle root over document hashes. The document record carries the URL, crawl timestamp, and extraction metadata.
Pay particular attention to the model-to-run join. If the checkpoint identifier exists only in a message or a spreadsheet, a later reviewer may be unable to connect the released model to its run configuration. Record each link when the corresponding artifact is created.
A hash tree in which each leaf is the hash of a data block and each internal node is the hash of its children's concatenated hashes. A specified tree format and root can commit to the leaf collection. In the example below, we sort the digests and bind their count, so the commitment captures multiplicity while allowing a different input order. An inclusion proof needs sibling hashes, plus the leaf position and count under this format.
This example first sorts the digests, which takes up to comparisons. Combining the sorted leaves takes hashes. Verification relies on the specified encoding and hash collision resistance. For selective disclosure, provide the exact document bytes that were hashed, the leaf position or path directions, the leaf count, and the sibling hashes. The fixture encodes stored text as UTF-8. If a production pipeline normalizes the text, apply the same frozen normalization and encoding used to compute the committed digest. The verifier rebuilds the path under the specified encoding and checks it against a previously authenticated expected root. This shows that the matching content appears in the committed shard. Document IDs and actual loader consumption require separate records.
What must be immutable
- The audit record itself. Append-only storage, with corrections recorded as new entries that reference the superseded one.
- The gate decisions, with the evidence pointers and the exact version of the policy that was evaluated.
- The dataset manifest, including both the source-document root and the tokenized-shard root. Verify each root against the expected commitment for its own artifact and record how the tokenization job links the two.
- The training run configuration, including the tokenizer version, the sequence length, and the mixture weights.
In this example, the system of record enforces append-only writes and links each entry to its predecessor by hash.
Corrections added as new entries leave the earlier decisions available for inspection. A reviewer can use a previously authenticated checkpoint to check whether the history up to that checkpoint changed. Keep checkpoint copies independently of the log so the reviewer has something to compare against if the stored history changes.
Answering "was this document in the training set?"
There are three honest answers and several dishonest ones.
The honest answers:
- Exact snapshot membership. Look up the document's normalized hash in the index for the committed snapshot. A sorted index supports binary search, while a hash table can provide expected constant-time lookup under suitable assumptions. Exact, given that you know the exact normalization applied to the document. (Normalization is where this gets hard: a document processed through Unicode normalization, whitespace collapsing, and boilerplate removal has a different hash than the raw crawl. You need the post-processing form, which means you need the pipeline version.)
- Probabilistic membership. A standard Bloom filter uses hash probes per lookup and can return false positives. With a fixed bit array and the same normalization and hash functions used to build it, an inserted key will not test negative. Under the usual uniform-hashing sizing approximation, keys at a target 1% false-positive rate need about ten bits per key, or roughly 125 GB for the bit array alone.
- Behavioral canary. Place a controlled marker where the audited pipeline can encounter it, then test for reproduction using prompts that omit the marker. Reproduction records model behavior. It can motivate a lineage check, since a marker may have reached the model through another source. A negative result leaves training membership unresolved.
Membership inference studies estimate how well an attack can distinguish members from nonmembers under stated conditions (Shokri et al., 2017; Carlini et al., 2022). Error rates depend on the data and the attack's operating point. Failure to infer membership for one document leaves its training status unresolved.
For exact membership, resolve the document to its post-processing form and check the shard index. In a correctly constructed Bloom filter for that index, a negative excludes the normalized key, while a positive needs confirmation because collisions can produce false positives. Record the normalization rules and the filter's error rate. Keep canary output as behavioral evidence. The run-to-manifest join identifies the intended snapshot. To verify which derived shards the run actually consumed, check the loader's consumption records and filtering, sampling, or truncation settings.
Incident response
The traceability chain exists so that an incident can be triaged fast. A workable procedure:
- Intake. A report arrives: a URL, a document, a generated output, or a rights complaint. Assign a case ID.
- Identification. Resolve the report to a document hash, if possible. If it is a generated output, resolve to the model version and reconstruct the likely prompt context.
- Blast radius. Query the chain: which shards contain the hash, which dataset roots contain those shards, which training runs used those roots, which released models used those checkpoints.
- Severity and obligation. Determine whether there is a legal reporting obligation (this is a counsel decision, not an engineering one), and whether downstream users must be notified.
- Mitigation. Options range from none (content was not in the corpus), through corpus-level removal for future training, to model patching or unlearning (see Part XLV: Knowledge, Memory, Editing, and Unlearning), to withdrawal of the model version.
- Disclosure and record. Write the outcome into the same append-only record. The incident log is part of the traceability substrate.
- Closure and control update. If the filter missed the incident, build a benign synthetic surrogate that exercises the failed behavior. Keep the canary outside training inputs and rerun the control test.
The single most valuable property here is speed of step 3. An organization that can answer "which models contain this document" in an hour can make good decisions. One that takes three weeks will make decisions based on what it can afford to investigate, which is usually nothing.
Route reports from support, public channels, publications, and internal teams through the same case-management process. Keep the evidence, decisions, and later revisions in the case record. An append-only history lets another reviewer reconstruct which information supported the decision at the time.
Retention and deletion
Plan separate retention schedules for raw documents and audit records. After a raw document is deleted, a retained manifest can still identify the recorded dataset snapshot. A hash on its own cannot reconstruct the document or the decisions made about it.
Record why each class of evidence is retained, who can access it, and when the retention decision will be reviewed. Where the GDPR applies to an audit entry, Article 5(1)(e) limits identifiable retention to what the processing purpose requires, subject to the longer-retention conditions specified there.
Keep enough linked evidence to answer questions about the models that used a snapshot. A digest can support checking a document supplied later against a recorded index. Treat linkable digests and provenance records according to what they can reveal in context.
Worked Example
We will build a miniature governance stack for a synthetic corpus of 50,000 documents. The scenario has three phases.
Phase 1, measurement. We plant known sensitive content so that we have ground truth, then evaluate two detectors against it. The first is a naive regex stack. The second adds a Luhn checksum validation to the card-number matcher. We will see the precision difference that a ten-line validator buys.
Phase 2, sampling. We draw a simple random sample, compute a Wilson interval, and compare it against a detector-stratified design at the same human review budget.
Phase 3, governance. We hash the corpus and toy token shards, assemble a manifest, evaluate a policy against a computed sensitive-content bound and three supplied example gate values, and identify candidate releases for a reported document by matching run configurations to one indexed source snapshot. Use loader records to check whether the run consumed the document.
We can enumerate this synthetic corpus and compare the estimates against the true prevalence. For an audit whose budget only covers a sample, the sampling design determines which population conclusions the reviewed cases support.
Sampling arithmetic
We start with the formulas, so the sample sizes in the rest of the example are derived rather than asserted.
PythonIn [5]Expand
from math import ceil, sqrt
import pandas as pd
Z = {0.90: 1.6449, 0.95: 1.9600, 0.99: 2.5758}
def n_for_proportion(p, margin, confidence=0.95, population=None):
"""Documents needed to estimate a proportion within +/- margin."""
z = Z[confidence]
n0 = z**2 * p * (1 - p) / margin**2
if population is None:
return n0
return n0 / (1 + (n0 - 1) / population)
def wilson_interval(k, n, confidence=0.95):
"""Score interval for a binomial proportion; behaves at small k."""
z = Z[confidence]
phat = k / n
denom = 1 + z**2 / n
centre = (phat + z**2 / (2 * n)) / denom
half = z * sqrt(phat * (1 - phat) / n + z**2 / (4 * n**2)) / denom
return max(0.0, centre - half), min(1.0, centre + half)
N_CORPUS = 50_000Now the table. We vary the assumed prevalence and the target margin, and report how much of the corpus would need human review.
PythonIn [6]Expand
rows = []
for p in [0.5, 0.05, 0.01, 0.0075, 0.001]:
for margin in [0.02, 0.005, 0.001]:
n = ceil(n_for_proportion(p, margin, population=N_CORPUS))
rows.append(
{
"prevalence": p,
"margin": margin,
"n_required": n,
"share_of_corpus": n / N_CORPUS,
}
)
sample_size_table = pd.DataFrame(rows)| margin | 0.001 | 0.005 | 0.020 |
|---|---|---|---|
| prevalence | |||
| 0.0010 | 3565 | 154 | 10 |
| 0.0075 | 18192 | 1119 | 72 |
| 0.0100 | 21602 | 1477 | 95 |
| 0.0500 | 39247 | 6370 | 453 |
| 0.5000 | 47526 | 21725 | 2292 |
For the table row with prevalence 0.1%, the normal planning formula gives 10 documents at a two-percentage-point margin after rounding up, and 3,565 documents at a 0.1-percentage-point margin. The first number is a planning calculation with an absolute margin much larger than the assumed rate. It is not a reliable normal-coverage guarantee for rare events.
That asymmetry is the whole story of rare-content auditing. The margin you can afford determines whether the answer is informative at all.
ConsoleOut [8]Expand
Corpus size: 50,000 documents prevalence 0.0500 -> 39,247 documents (78.5% of corpus) prevalence 0.0100 -> 21,602 documents (43.2% of corpus) prevalence 0.0010 -> 3,565 documents (7.1% of corpus)
The figure below makes the scaling visible across a continuous range of margins.
PythonIn [9]Expand
margin_grid = np.logspace(-3.3, -1.3, 60)
prevalence_levels = [0.5, 0.05, 0.01, 0.0075]
sample_size_curves = {
p: np.array(
[n_for_proportion(p, m, population=N_CORPUS) for m in margin_grid]
)
for p in prevalence_levels
}VisualizationOut [10]Expand

The dashed line is the corpus size. No sampling plan can cross it, and any plan that approaches it is really a census with extra steps.
Building a corpus with known ground truth
Now we plant content so that we can measure detector behaviour exactly.
PythonIn [11]Expand
import re
EMAIL_RE = re.compile(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}")
PHONE_RE = re.compile(r"\(\d{3}\)\s?\d{3}-\d{4}")
CARD_RE = re.compile(r"\b\d{16}\b")
def luhn_ok(number):
"""Check the Luhn checksum of a matched string of 16 decimal digits."""
if len(number) != 16 or not number.isdecimal():
return False
digits = [int(c) for c in number]
total = 0
for i, d in enumerate(reversed(digits)):
if i % 2 == 1: # every second digit from the right
d *= 2
if d > 9:
d -= 9
total += d
return total % 10 == 0
def luhn_check_digit(payload):
"""Given 15 payload digits, compute the 16th so that luhn_ok() passes."""
total = 0
for i, d in enumerate(reversed(payload)):
if i % 2 == 0:
d *= 2
if d > 9:
d -= 9
total += d
return (10 - total % 10) % 10A sanity check on the checksum, using a well-known test card number and a number that fails.
ConsoleOut [12]Expand
4111111111111111 valid? True 1234567812345678 valid? False
The first passes, the second fails. That single bit of validation is what separates a precision of 0.47 from a precision of 1.00 in a moment.
Now the generator. Each document is assigned a kind, and the kind determines the text and the ground-truth label.
PythonIn [13]Expand
rng = np.random.default_rng(SEED)
FIRST = ["ada", "grace", "alan", "katherine", "linus", "barbara"]
LAST = ["lovelace", "hopper", "turing", "johnson", "torvalds", "liskov"]
DOMAINS = ["example.org", "example.com", "mail.example.net"]
BENIGN = [
"The committee met on Tuesday to review the quarterly budget.",
"She published a short note about soil chemistry in the newsletter.",
"The bridge reopened after two weeks of structural repairs.",
"Attendance at the evening lecture was higher than expected.",
"The archive holds forty years of municipal planning records.",
"Their recipe for rye bread calls for a long, slow ferment.",
"The museum extended the exhibition through the end of March.",
"Local rainfall in April was well above the ten-year average.",
]
KIND_PROBS = {
"email": 0.0015, # plain email address, sensitive
"email_masked": 0.0040, # obfuscated email, sensitive but undetectable by regex
"phone": 0.0010, # phone number, sensitive
"card_valid": 0.0010, # Luhn-valid card number, sensitive
"card_invalid": 0.0040, # 16-digit order id that fails Luhn, NOT sensitive
}
KINDS = list(KIND_PROBS) + ["clean"]
PROBS = list(KIND_PROBS.values()) + [1 - sum(KIND_PROBS.values())]
def make_doc(kind):
base = " ".join(rng.choice(BENIGN, size=int(rng.integers(1, 3))))
if kind == "email":
user = f"{rng.choice(FIRST)}.{rng.choice(LAST)}{rng.integers(1, 999)}"
return base + f" Write to {user}@{rng.choice(DOMAINS)} for access."
if kind == "email_masked":
domain = str(rng.choice(DOMAINS)).replace(".", " [dot] ")
return base + f" Write to {rng.choice(FIRST)} [at] {domain} for access."
if kind == "phone":
return base + (
f" Call ({rng.integers(200, 999)}) "
f"{rng.integers(100, 999)}-{rng.integers(1000, 9999)}."
)
if kind == "card_valid":
payload = [
int(d) for d in "".join(str(rng.integers(0, 10)) for _ in range(15))
]
num = "".join(map(str, payload)) + str(luhn_check_digit(payload))
return base + f" Card on file: {num}. Renewal due."
if kind == "card_invalid":
num = "".join(str(rng.integers(0, 10)) for _ in range(16))
while luhn_ok(num):
num = num[:-1] + str((int(num[-1]) + 1) % 10)
return base + f" Order reference {num} was archived."
return base
kinds = rng.choice(KINDS, size=N_CORPUS, p=PROBS)
documents = [
{"doc_id": f"d{i:06d}", "kind": str(k), "text": make_doc(str(k))}
for i, k in enumerate(kinds)
]
SENSITIVE_KINDS = {"email", "email_masked", "phone", "card_valid"}
for d in documents:
d["sensitive_true"] = d["kind"] in SENSITIVE_KINDS| kind | documents | sensitive | share | |
|---|---|---|---|---|
| 0 | card_invalid | 193 | False | 0.3860% |
| 1 | card_valid | 52 | True | 0.1040% |
| 2 | clean | 49435 | False | 98.8700% |
| 3 | 78 | True | 0.1560% | |
| 4 | email_masked | 198 | True | 0.3960% |
| 5 | phone | 44 | True | 0.0880% |
In the synthetic corpus, 0.744% of documents are labeled sensitive. More than half of those contain the planted obfuscated email form, which the pattern used below misses. This setup leaves much of the sensitive material in the unflagged stratum.
Two detectors, one checksum apart
PythonIn [15]Expand
def detect_naive(text):
"""Regex only: any 16-digit run counts as a card number."""
return bool(
EMAIL_RE.search(text) or PHONE_RE.search(text) or CARD_RE.search(text)
)
def detect_validated(text):
"""Regex plus checksum: only Luhn-valid 16-digit runs count."""
if EMAIL_RE.search(text) or PHONE_RE.search(text):
return True
for m in CARD_RE.finditer(text):
if luhn_ok(m.group()):
return True
return False
def confusion(y_true, y_pred):
y_true = np.asarray(y_true, dtype=bool)
y_pred = np.asarray(y_pred, dtype=bool)
return (
int((y_true & y_pred).sum()), # tp
int((~y_true & y_pred).sum()), # fp
int((y_true & ~y_pred).sum()), # fn
int((~y_true & ~y_pred).sum()),
) # tnPythonIn [16]Expand
true_labels = [d["sensitive_true"] for d in documents]
detector_stats = {}
detector_rows = []
for name, fn in [
("naive regex", detect_naive),
("Luhn-validated", detect_validated),
]:
preds = [fn(d["text"]) for d in documents]
tp, fp, fn_ct, tn = confusion(true_labels, preds)
tpr = tp / (tp + fn_ct) if (tp + fn_ct) else np.nan
fpr = fp / (fp + tn) if (fp + tn) else np.nan
precision = tp / (tp + fp) if (tp + fp) else np.nan
detector_stats[name] = {
"tp": tp,
"fp": fp,
"fn": fn_ct,
"tn": tn,
"tpr": tpr,
"fpr": fpr,
"precision": precision,
}
detector_rows.append(
{
"detector": name,
"tp": tp,
"fp": fp,
"fn": fn_ct,
"precision": round(precision, 3),
"recall": round(tpr, 3),
"f1": round(2 * precision * tpr / (precision + tpr), 3)
if precision + tpr
else 0.0,
}
)
detector_table = pd.DataFrame(detector_rows)| detector | tp | fp | fn | precision | recall | f1 | |
|---|---|---|---|---|---|---|---|
| 0 | naive regex | 174 | 193 | 198 | 0.474 | 0.468 | 0.471 |
| 1 | Luhn-validated | 174 | 0 | 198 | 1.000 | 0.468 | 0.637 |
Two things are worth pausing on.
First, recall is identical for both detectors. Both detectors catch the same 174 of the 372 planted positives, including all 52 valid card-number examples. The generated card numbers pass the checksum, and the planted order references fail it, so the validator removes only false positive flags in this fixture.
Second, precision moves from about 0.47 to 1.00. The naive detector flags every 16-digit order reference in the corpus. The naive detector flags 193 benign documents in this fixture. The checksum rejects all 193 planted order-ID flags.
The figure below isolates what the checksum changes: the split between true and false positives for each detector.
PythonIn [18]Expand
detector_names = ["naive regex", "Luhn-validated"]
tp_counts = [detector_stats[name]["tp"] for name in detector_names]
fp_counts = [detector_stats[name]["fp"] for name in detector_names]
group_x = np.arange(len(detector_names))
bar_width = 0.36VisualizationOut [19]Expand

In this simulation the validated detector makes true-positive flags and no false-positive flags, so its observed precision is 1.0. This result describes the seeded corpus and the specified detector. An observed zero on a sample by itself does not establish a zero population error rate.
The base-rate collapse
The seeded corpus has 0.744% sensitive documents. The next calculation holds detector rates fixed and varies prevalence to show what happens as positives become rarer.
PythonIn [20]Expand
prevalence_grid = np.logspace(-5.5, -1.0, 200)
precision_curves = {}
for name, s in detector_stats.items():
num = s["tpr"] * prevalence_grid
den = num + s["fpr"] * (1 - prevalence_grid)
precision_curves[name] = np.divide(
num, den, out=np.full_like(den, np.nan), where=den > 0
)VisualizationOut [21]Expand

Holding the fixture's measured rates fixed, the naive detector's precision falls below 50% at about 0.82% prevalence. At 0.01% prevalence, about 1.19% of its flags are positives. The validated detector's measured false-positive rate is zero, so its curve stays at 1.0 wherever it makes positive flags. Treat both curves as conditional on rates that must be checked for the population where the detector is used.
Simple random sampling and the Wilson interval
Now we shift from evaluating a detector to estimating prevalence. We draw 2,000 documents and use their known synthetic labels as a stand-in for human review. A real audit would apply its review protocol to the sampled documents.
PythonIn [22]Expand
n_sample = 2000
sample_idx = rng.choice(N_CORPUS, size=n_sample, replace=False)
sample = [documents[i] for i in sample_idx]
k_sample = int(sum(d["sensitive_true"] for d in sample))
p_hat = k_sample / n_sample
ci_lo, ci_hi = wilson_interval(k_sample, n_sample)
p_true = float(np.mean(true_labels))ConsoleOut [23]Expand
Sample size: 2,000 Positives in sample: 14 Point estimate: 0.7000% 95% Wilson interval: [0.4174%, 1.1716%] True corpus prevalence: 0.7440% Interval contains truth: True Interval width: 0.75 percentage points
The binomial Wilson approximation for this sample without replacement runs from about 0.42% to 1.17%. The interval crosses 1.0%, so it does not support a requirement that prevalence be below that threshold.
Choose the release criterion first. Plan the sample for the precision needed to tell whether the estimated rate is below the threshold.
Stratified review at the same budget
Suppose the same 2,000 human reviews are available, but instead of sampling uniformly we first run the validated detector over all 50,000 documents and split into a flagged stratum and an unflagged stratum. This allocation assumes a nonempty flagged stratum small enough to census while leaving at least two unflagged reviews. With a different detector or budget, choose a design that leaves enough observations in every sampled stratum.
PythonIn [24]Expand
flagged = [d for d in documents if detect_validated(d["text"])]
unflagged = [d for d in documents if not detect_validated(d["text"])]
N1, N0 = len(flagged), len(unflagged)
W1, W0 = N1 / N_CORPUS, N0 / N_CORPUS
n1 = N1 # census of the flagged stratum
n0 = min(n_sample - n1, N0) # remainder to the unflagged stratum
if not 0 < n1 < n_sample or n0 < 2:
raise ValueError(
"This allocation needs a flagged census and two unflagged reviews"
)
p1 = float(np.mean([d["sensitive_true"] for d in flagged]))
s0 = rng.choice(N0, size=n0, replace=False)
p0 = float(np.mean([unflagged[i]["sensitive_true"] for i in s0]))
p_strat = W1 * p1 + W0 * p0
# The flagged stratum is censused and adds no sampling variance.
var_strat = W0**2 * (1 - n0 / N0) * p0 * (1 - p0) / (n0 - 1)
se_strat = sqrt(var_strat)ConsoleOut [25]Expand
Flagged stratum: N=174 reviewed=174 p1=1.0000 Unflagged stratum: N=49,826 reviewed=1,826 p0=0.004929 Stratified estimate: 0.8392% (true: 0.7440%) Normal 95% half-width approximation: 0.314 pp
The validated detector misses the planted obfuscated email form. In this allocation, all sampling variance comes from the unflagged stratum. The displayed half-width uses a normal approximation to illustrate the estimated sampling variance. The release rule below uses a finite-population bound.
Use the known synthetic labels to compare both designs at an equal budget. This comparison uses population rates on both sides, so it does not depend on which positives a particular sample happened to contain.
PythonIn [26]Expand
n_review = n_sample
p0_true = float(np.mean([d["sensitive_true"] for d in unflagged]))
srs_pop_var = N_CORPUS / (N_CORPUS - 1) * p_true * (1 - p_true)
unflagged_pop_var = N0 / (N0 - 1) * p0_true * (1 - p0_true)
design_var_srs = srs_pop_var * (1 / n_review - 1 / N_CORPUS)
design_var_strat = W0**2 * unflagged_pop_var * (1 / n0 - 1 / N0)
half_srs = 1.96 * sqrt(design_var_srs)
half_strat = 1.96 * sqrt(design_var_strat)
# Solve the finite-population SRS variance identity for the review count.
effective_n = 1 / (design_var_strat / srs_pop_var + 1 / N_CORPUS)ConsoleOut [27]Expand
Simple random sampling (n=2,000): half-width 0.369 pp Detector-stratified (n=2,000): half-width 0.282 pp Smallest SRS sample with at least this precision: 3,325
VisualizationOut [28]Expand

Both bars use the true finite-population variances of their estimators for this fixture. Multiplying each design standard error by 1.96 puts the comparison on the same reference scale. The unflagged stratum contributes all of the stratified design's sampling variance because only that stratum was sampled.
Changing detector coverage can alter stratum sizes and outcome rates. Recalculate the comparison at the same review budget when the partition changes. Report the stratum results together with the weighted population estimate.
From audit to manifest
The fixed in-memory fixture yields source-document and toy token-shard hashes. The manifest's crawler, extractor, normalization, deduplication, and production-style filter entries are illustrative metadata. The provenance, licensing, and contamination audit references and values are supplied to demonstrate the release workflow. The sensitive-content estimate and bound come from the fixture reviews.
PythonIn [29]Expand
import hashlib
import json
def sha256_hex(data):
"""SHA-256 hex digest of a string or bytes."""
if isinstance(data, str):
data = data.encode("utf-8")
return hashlib.sha256(data).hexdigest()
MERKLE_SCHEMA = "sorted-digest-multiset-sha256-v1"
def merkle_root(leaves):
"""Commit to a sorted multiset of fixed-size input digests."""
digests = sorted(bytes.fromhex(leaf) for leaf in leaves)
if any(len(digest) != 32 for digest in digests):
raise ValueError("leaves must be SHA-256 digests")
layer = [hashlib.sha256(b"leaf:" + digest).digest() for digest in digests]
while len(layer) > 1:
if len(layer) % 2:
layer.append(layer[-1])
layer = [
hashlib.sha256(b"node:" + layer[i] + layer[i + 1]).digest()
for i in range(0, len(layer), 2)
]
tree_digest = layer[0] if layer else b""
return sha256_hex(
MERKLE_SCHEMA.encode()
+ b":"
+ len(digests).to_bytes(8, "big")
+ tree_digest
)
example_leaves = [sha256_hex(name) for name in ("A", "B", "C")]
assert merkle_root(example_leaves) == merkle_root(reversed(example_leaves))
assert merkle_root(example_leaves) != merkle_root(
example_leaves + [max(example_leaves)]
)PythonIn [30]Expand
SHARD_SIZE = 1000
doc_hashes = {}
doc_shard = {}
shard_hashes = []
tokenized_shard_hashes = []
for start in range(0, N_CORPUS, SHARD_SIZE):
shard = documents[start : start + SHARD_SIZE]
leaves = []
for d in shard:
h = sha256_hex(d["text"])
doc_hashes[d["doc_id"]] = h
doc_shard[d["doc_id"]] = start // SHARD_SIZE
leaves.append(h)
shard_hashes.append(merkle_root(leaves))
# Serialize the toy whitespace tokens as ordered UTF-8 JSON Lines.
token_bytes = "".join(
json.dumps(d["text"].split(), ensure_ascii=False) + "\n" for d in shard
).encode("utf-8")
tokenized_shard_hashes.append(sha256_hex(token_bytes))
source_root = merkle_root(shard_hashes)
tokenized_root = merkle_root(tokenized_shard_hashes)PythonIn [31]Expand
manifest = {
"dataset_id": "ds-2025.06",
"created_utc": "2025-06-11T09:14:00Z",
"document_count": N_CORPUS,
"shard_count": len(shard_hashes),
"shard_size": SHARD_SIZE,
"merkle_schema": MERKLE_SCHEMA,
"source_root": source_root,
"tokenized_root": tokenized_root,
"tokenized_shard_digests_in_index_order": tokenized_shard_hashes,
"pipeline": {
"crawler": "cc-snapshot-2025-04",
"extractor": "trafilatura-1.12",
"dedup": "minhash-lsh-threshold-0.85",
"normalization": "unicode-nfkc-whitespace-collapse",
"filters": ["quality-ppl-120", "toxicity-0.82", "pii-regex-luhn-v3"],
"tokenizer": "toy-whitespace-jsonl-utf8-v1",
},
"audit_refs": [
"audit:sensitive/2025-06-11T09:14Z",
"audit:provenance/2025-06-10T17:02Z",
"audit:licensing/2025-06-09T11:40Z",
],
}ConsoleOut [32]Expand
Dataset: ds-2025.06 Documents: 50,000 Shards: 50 Source Merkle root: 0d7ce7a257686626ac507167... Tokenized root: 32db9876dd1e1caf368302fc... Root schema: sorted-digest-multiset-sha256-v1
The source root commits to the synthetic documents grouped into shards. The derived root commits to serialized whitespace-token shards in this example. The manifest also records the derived shard digests in index order. In a real pipeline, verify the exact derived bytes and shard sequence against their own trusted manifest, and record which manifest the training run consumed. Comparing the two roots to each other does not validate the transformation.
Evaluating the gates
The audit record feeds a policy. For sensitive content, require a one-sided 95% upper bound at or below 1%. The flagged census gives its exact count. In the unflagged stratum, find the largest population count for which observing no more positives than we saw would still have probability at least 5%. Sampling without replacement makes that tail hypergeometric.
PythonIn [33]Expand
from scipy.stats import hypergeom
def finite_population_upper(population, reviewed, positives, alpha=0.05):
"""Largest positive population count consistent with a one-sided exact test."""
low, high = positives, population - reviewed + positives
while low < high:
mid = (low + high + 1) // 2
if hypergeom.cdf(positives, population, mid, reviewed) >= alpha:
low = mid
else:
high = mid - 1
return low
k0 = sum(unflagged[i]["sensitive_true"] for i in s0)
k1 = sum(d["sensitive_true"] for d in flagged)
upper_prevalence = (k1 + finite_population_upper(N0, n0, k0)) / N_CORPUS
POLICY = {
"sensitive_prevalence_upper_95_max": 0.010,
"sensitive_bound_method": "one-sided hypergeometric inversion, census of flagged stratum",
"provenance_coverage_min": 0.98,
"license_resolved_min": 0.95,
"contamination_flagged_docs_max": 0,
}
def digest_json(record):
"""Hash this fixture's stable JSON serialization."""
return sha256_hex(json.dumps(record, sort_keys=True, separators=(",", ":")))
def artifact_identity(m):
return {
"dataset_id": m["dataset_id"],
"merkle_schema": m["merkle_schema"],
"source_root": m["source_root"],
"tokenized_root": m["tokenized_root"],
"tokenizer": m["pipeline"]["tokenizer"],
"document_count": m["document_count"],
"shard_count": m["shard_count"],
"ordered_derived_shard_digests_sha256": digest_json(
m["tokenized_shard_digests_in_index_order"]
),
}
audit_report = {
"artifact": artifact_identity(manifest),
"pii_prevalence": p_strat,
"pii_upper_95": upper_prevalence,
"pii_bound_method": "one-sided hypergeometric inversion, census of flagged stratum",
"provenance_coverage": 0.994,
"license_resolved_share": 0.962,
"contamination_flagged_docs": 0,
"review_design": "detector-stratified, census of flagged stratum",
"reviewed_count": int(n1 + n0),
}
def evaluate_gates(report, policy):
if report["pii_bound_method"] != policy["sensitive_bound_method"]:
raise ValueError(
"sensitive-content upper bound uses a different method"
)
rows = [
{
"gate": "sensitive-content prevalence, 95% upper bound",
"observed": report["pii_upper_95"],
"operator": "<=",
"threshold": policy["sensitive_prevalence_upper_95_max"],
"pass": report["pii_upper_95"]
<= policy["sensitive_prevalence_upper_95_max"],
"evidence": "audit:sensitive/2025-06-11T09:14Z",
},
{
"gate": "provenance coverage",
"observed": report["provenance_coverage"],
"operator": ">=",
"threshold": policy["provenance_coverage_min"],
"pass": report["provenance_coverage"]
>= policy["provenance_coverage_min"],
"evidence": "audit:provenance/2025-06-10T17:02Z",
},
{
"gate": "resolved license share",
"observed": report["license_resolved_share"],
"operator": ">=",
"threshold": policy["license_resolved_min"],
"pass": report["license_resolved_share"]
>= policy["license_resolved_min"],
"evidence": "audit:licensing/2025-06-09T11:40Z",
},
{
"gate": "benchmark contamination",
"observed": report["contamination_flagged_docs"],
"operator": "<=",
"threshold": policy["contamination_flagged_docs_max"],
"pass": report["contamination_flagged_docs"]
<= policy["contamination_flagged_docs_max"],
"evidence": "audit:contamination/2025-06-08",
},
]
return pd.DataFrame(rows)
gate_table = evaluate_gates(audit_report, POLICY)| gate | observed | operator | threshold | pass | evidence | value_origin | |
|---|---|---|---|---|---|---|---|
| 0 | sensitive-content prevalence, 95% upper bound | 0.01196 | <= | 0.01 | False | audit:sensitive/2025-06-11T09:14Z | Computed bound |
| 1 | provenance coverage | 0.99400 | >= | 0.98 | True | audit:provenance/2025-06-10T17:02Z | Example input |
| 2 | resolved license share | 0.96200 | >= | 0.95 | True | audit:licensing/2025-06-09T11:40Z | Example input |
| 3 | benchmark contamination | 0.00000 | <= | 0.00 | True | audit:contamination/2025-06-08 | Example input |
ConsoleOut [35]Expand
Overall gate status: BLOCKED FAILED: sensitive-content prevalence, 95% upper bound (observed 0.01196, criterion <= 0.01)
The sensitive-content gate blocks this fixture because its upper bound exceeds 1%, even though the point estimate is below 1%. If an applicable policy permits a waiver, it must cover the failed gate before release. The waiver is a row in the same store, with an approver, a justification, an expiry, and the compensating control.
PythonIn [36]Expand
WAIVER_SCHEMA = {
"waiver_id": "wv-2025-014",
"gate": "internal provenance coverage",
"corpus_version": "ds-waiver-example",
"requested_by": "data-owner-role",
"approved_by": "counsel-role",
"justification": "One permitted source lacks a backfilled extraction timestamp.",
"compensating_control": "retain source receipts and reconcile recorded dates",
"expires_utc": "2025-09-30",
"status": "illustrative only",
}
print(json.dumps(WAIVER_SCHEMA, indent=2))The example shows a record format for a different snapshot. It does not waive the sensitive-content failure. Keep the approval and expiration date with the exact gate and artifact they cover.
Attaching gate outcomes to the manifest
Bind the decision to the artifact identity, policy, outcome, and the digests of the reviewed measurements. This fixture hashes a deterministic record and shows consistency checks. In production, have authorized decision-makers sign the record and verify those signatures using trusted identities.
PythonIn [37]Expand
fixture_decisions = [
{
"role": "data owner",
"decision": "refer for review",
"recorded_utc": "2025-06-11T10:20:00Z",
},
{
"role": "safety review",
"decision": "accept" if all_pass else "hold",
"recorded_utc": "2025-06-11T13:05:00Z",
},
{
"role": "counsel",
"decision": "legal review recorded",
"recorded_utc": "2025-06-11T15:41:00Z",
},
{
"role": "accountable executive",
"decision": "approve" if all_pass else "hold",
"recorded_utc": "2025-06-12T08:30:00Z",
},
]
manifest["gate_record"] = {
"artifact": audit_report["artifact"],
"policy": POLICY,
"gate_table_sha256": sha256_hex(gate_table.to_csv(index=False)),
"audit_report_sha256": digest_json(audit_report),
"overall": "pass" if all_pass else "blocked",
"evaluated_at_utc": "2025-06-11T10:02:00Z",
"fixture_decisions": fixture_decisions,
}
fixture_decision_digest = digest_json(manifest["gate_record"])ConsoleOut [38]Expand
Decision record digest: 648fa783b37b9c02b2d31fc8... Audit record digest: a07382bb66b6e5ceace19918... Overall: blocked data owner refer for review 2025-06-11T10:20:00Z safety review hold 2025-06-11T13:05:00Z counsel legal review recorded 2025-06-11T15:41:00Z accountable executive hold 2025-06-12T08:30:00Z
These role decisions and timestamps are synthetic. Separate the data owner's recommendation, safety and legal review, and the final decision so a reader can see who made each judgment. The accountable executive holds this fixture because its gate failed.
Post-release traceability
A separate toy incident record shows how to use the lineage from a reported document to potentially affected model releases. The run records below are illustrative historical records, not releases approved by the gate evaluated above.
PythonIn [39]Expand
# The earlier snapshot is represented by a placeholder root for this example.
DATA_ROOTS = {
"ds-2025.06": source_root,
"ds-2025.02": sha256_hex("ds-2025.02-placeholder-root"),
}
TRAINING_RUNS = [
{
"run_id": "run-0114",
"dataset": "ds-2025.06",
"checkpoint": "ckpt-0001200",
"release": "model-1.2",
"released_utc": "2025-06-20",
},
{
"run_id": "run-0127",
"dataset": "ds-2025.06",
"checkpoint": "ckpt-0002400",
"release": "model-1.3",
"released_utc": "2025-08-04",
},
{
"run_id": "run-0091",
"dataset": "ds-2025.02",
"checkpoint": "ckpt-0000900",
"release": "model-1.1",
"released_utc": "2025-03-02",
},
]
def blast_radius(doc_id):
if doc_id not in doc_shard:
return {
"doc_id": doc_id,
"searched_snapshot": "ds-2025.06",
"status": "not indexed",
}
shard_idx = doc_shard[doc_id]
shard_root = shard_hashes[shard_idx]
affected = [
r for r in TRAINING_RUNS if DATA_ROOTS[r["dataset"]] == source_root
]
return {
"doc_id": doc_id,
"doc_sha256": doc_hashes[doc_id],
"shard_index": shard_idx,
"shard_root": shard_root,
"dataset_id": "ds-2025.06",
"matching_configured_runs": [r["run_id"] for r in affected],
"candidate_releases": [r["release"] for r in affected],
}ConsoleOut [40]Expand
{
"doc_id": "d031337",
"doc_sha256": "cca2bb482bab2c360984ad870ad07c6ec43a0a73f5c4ab581a2defb270b6246d",
"shard_index": 31,
"shard_root": "567095e2af9134c9118527093deb290586fe88621d6f7cd0ff8c8249e5850a48",
"dataset_id": "ds-2025.06",
"matching_configured_runs": [
"run-0114",
"run-0127"
],
"candidate_releases": [
"model-1.2",
"model-1.3"
]
}The lookup covers one indexed source snapshot and returns runs associated with it. In the fixture, investigate model-1.2 and model-1.3 on that basis. model-1.1 uses another snapshot and remains unexamined. A root match identifies an intended input; use loader records to check selection.
In production, bind the documents and shards to an authenticated source manifest, join the source manifest to the derived one, then check the training run's recorded inputs. Consult the consumption records before stating that a run read a shard or specific sample.
PythonIn [41]Expand
def datasheet_card(manifest, report, gate_df, expected_decision_digest):
"""Check that this fixture's audit and gate data match the supplied decision."""
decision = manifest["gate_record"]
if digest_json(decision) != expected_decision_digest:
raise ValueError("unexpected decision record")
if (
artifact_identity(manifest) != decision["artifact"]
or report["artifact"] != decision["artifact"]
):
raise ValueError("audit refers to a different artifact")
if digest_json(report) != decision["audit_report_sha256"]:
raise ValueError("audit report does not match the decision")
if sha256_hex(gate_df.to_csv(index=False)) != decision["gate_table_sha256"]:
raise ValueError("gate table does not match the decision")
passed = int(gate_df["pass"].sum())
return "\n".join(
[
f"### Dataset card: {manifest['dataset_id']}",
"",
f"- **Content address (Merkle root):** `{manifest['source_root'][:32]}...`",
f"- **Toy tokenized artifact root:** `{manifest['tokenized_root'][:32]}...`",
f"- **Documents / shards:** {manifest['document_count']:,} / {manifest['shard_count']}",
f"- **Sensitive-content prevalence:** {report['pii_prevalence']:.2%} "
f"(one-sided 95% upper bound {report['pii_upper_95']:.2%})",
f"- **Review design:** {report['review_design']}, n = {report['reviewed_count']:,}",
f"- **Example provenance coverage:** {report['provenance_coverage']:.1%}",
f"- **Example resolved license share:** {report['license_resolved_share']:.1%}",
f"- **Fixture gate decision:** {decision['overall'].upper()} ({passed}/{len(gate_df)} gates passed)",
f"- **Example contamination findings:** {report['contamination_flagged_docs']} documents",
"- **Illustrative metadata:** crawler, extractor, normalization, "
"deduplication, production filter names, and non-sensitive audit references.",
]
)
card = datasheet_card(
manifest, audit_report, gate_table, fixture_decision_digest
)ConsoleOut [42]Expand
<IPython.core.display.Markdown object>
The card reads the sensitive-content measurement, supplied example values, and evaluated gate outcome from the bound records. For a release, regenerate it from current evidence, with a build check that rejects missing evidence or mismatched snapshot identifiers.
Limitations and Practical Impact
Start by checking what was measured and what the estimate can support.
Coverage. An audit measures the categories it was designed to look for. A prevalence estimate for PII says nothing about copyrighted material, extremist content, or benchmark leakage. Name the measured categories and their rates, and name the categories you left unmeasured.
Detector drift. Revalidate detectors on a human-labeled sample drawn from the current corpus. A decline in flags has more than one explanation. At a fixed prevalence and false-positive rate, lower sensitivity alone reduces the share of flagged documents.
Sampling design. For the stratified design above, weight each stratum's estimated rate by its population share. When review allocation is nonproportional, the raw pooled rate uses sample shares and can be biased. The direction depends on which strata are overrepresented and their rates. Publish the estimator alongside the estimate.
Reviewer effort and label quality. Budget for trained reviewers, rotation, psychological support, and careful handling of severe material. Measure disagreement on overlapping reviews. If label errors differ between strata, each stratum's errors affect the final estimate through its weight.
Record availability. At corpus freeze the manifests, run configurations, and shard records are available to join. If one of those records was never saved or its system is decommissioned, a later investigation may have no way to recover the missing link. Record the joins when you create the artifacts.
None of these limitations argue against auditing. They argue for a specific kind of audit: one that states its scope, publishes its estimators, re-validates its instruments, and records its evidence in a form that outlives the people who produced it.
The practical payoff is proportionate. It gives an organization the ability to make a release decision with a stated level of confidence rather than a vague impression. It gives downstream users, courts, and regulators a way to check the claims that accompany a model. And it gives engineers a feedback loop, because once you can measure the residual, you can tell whether a change to a filter helped, which is something that anecdote and dashboards cannot do.
There is also a cultural effect worth naming. The presence of a gate that can say "no" changes how pipelines are built. Teams start writing filters with a measurable operating characteristic because someone will ask. They start recording provenance because the intake gate will reject a source without it. They start avoiding the archive-and-forget pattern because a manifest that cannot be regenerated blocks the release. Governance, done well, is not overhead imposed on engineering. It is a set of constraints that make the engineering measurably better.
Summary
A data audit examines a defined population against a criterion and records the evidence. When it uses a probability sample, record the design and sampling uncertainty. When it covers the full population, record the census and any remaining measurement uncertainty. Release governance converts that evidence into a decision that a named person owns.
Key takeaways:
- Separate controls from tests of controls. Filters remove data; audits measure the residual. Keep them in separate code paths and separate ownership.
- State the sampling frame and the unit of analysis. "Prevalence" without a denominator (documents, tokens, sources) is not a measurement.
- Plan for rare findings. At prevalence , 100,000 independent draws have about a 9.5% chance of finding at least one positive. State what a sample with zero findings would still let you conclude.
- Publish the estimator and its sampling uncertainty. Where an informative detector supports a stratified design, report the weighted estimate, stratum sizes, allocations and variance.
- Report the rule of three. With zero findings in independent Bernoulli reviews, report the approximate one-sided 95% upper bound alongside the count.
- Evaluate precision and recall at the intended base rate. With scarce positives, even a 1% false-positive rate can produce many false flags. A checksum can reject strings that fail it. Measure what that saves on the kinds of candidates your matcher actually produces.
- Generate documentation from the audit record. Rebuild it from versioned evidence and configure the release build to reject missing or mismatched snapshot identities.
- Record both machine checks and human decisions. Evaluate numeric criteria against the audit record, and bind the checked values, evidence references, and human approvals to the audited artifact.
- Record waivers with expiry dates and compensating controls. The exception register is where an external auditor looks first.
- Record traceability as artifacts are created. Link released models and checkpoints to training runs, record the derived shards consumed, and preserve the transformation link back to the source manifest and individual documents.
- Set retention by record type. Preserve the evidence needed to trace deployed models, with a defined purpose, access controls, and a retention period for each record type.
The earlier Synthetic Data, Synthetic Data Pipelines, and Recursive Training and Model Collapse chapters explain why generated data also needs lineage. The book continues with Part XXII: Pre-training Objectives, starting with Causal Language Modeling. When a tokenizer, mixture, or filter changes, record the new settings and recompute the affected artifact hashes.
Quiz
Ready to test your understanding? Take this quick quiz to reinforce what you've learned about data audits and release governance.
Data Audits and Release Governance
Join the discussionAsk a question or share what you learned.
Keep exploring
Reference
Citation details
Cite or share this article.


Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!