Dataset and model provenance
Trace assets before using them
Data governance defines who may use data, for which purpose, under which constraints, and who is accountable over its lifecycle. Provenance records where an asset came from and how it was produced; lineage records dependencies between versions. W3C PROV describes entities, activities and responsible agents. In a fictional library FAQ assistant, A@1 is invented source text, a chunk is a derived entity, chunking is an activity, and the editor is a responsible agent. Public visibility does not grant permission to train, redistribute, or retrieve. Record the actual rights evidence, restrictions, consent or other applicable authorization, owner and review date. The local gate below accepts only trusted metadata, with nonblank source, revision, rights record and owner, explicit approval and matching purpose. A is permitted for retrieval only; B is blocked. Training blocks both. This is a teaching policy, not a legal license interpreter. Purpose lists must be trusted lists of strings; records have unique IDs. Missing authorization must trigger review, not deployment.
def blocked_assets(rows, purpose): # Trusted review metadata, not a legal or license interpreter. required = ("source", "revision", "rights_record", "owner") return sorted(row["id"] for row in rows if any(not isinstance(row.get(k), str) or not row[k].strip() for k in required) or row.get("approved") is not True or purpose not in row.get("purposes", []))
assets = [dict(id="A", source="invented FAQ", revision="1", rights_record="P1", owner="editor", approved=True, purposes=["retrieval"]), dict(id="B", source="public page", revision="2", rights_record="", owner="editor", approved=False, purposes=[])]print(blocked_assets(assets, "retrieval"))print(blocked_assets(assets, "training"))Build dataset and model cards
A dataset card documents origin, collection method, intended use, excluded uses, license or restrictions, composition, quality limitations, transforms, split versions, and contact. A model card documents model revision, base model, training and evaluation data references, intended and excluded uses, metrics with dataset and conditions, risks, limitations and license. Hugging Face Hub cards support metadata such as license and dataset language or size; a card is evidence to inspect, not proof of ownership or safety. Example lineage table: A@1 (invented FAQ, P1, retrieval only, editor); chunk-A@1 (from A@1, same restrictions, chunker v1); index-A@1 (from chunk-A@1, embedding version E1, retrieval only, index owner); mock-model@2 (separate fictional model, review record P2, no training on FAQ). Record restrictions for each asset independently, including code and model weights. Check duplicates, missing fields, inconsistent revisions, and leakage between train and test before acceptance. Record the quality check results and owner rather than only a pass label.
Freeze a reproducible manifest
A versioned manifest identifies exact input revisions, transformation code, parameters, dependencies, split assignments, model revision, artifact digests and review references. The small example serializes a restricted JSON object using sorted keys, compact separators and UTF-8, then computes SHA-256. The two differently ordered dictionaries have identical digests; changing the dataset revision changes the digest. List order remains meaningful. This is a local serialization convention, not a general canonical JSON standard. A hash detects changes relative to a trusted reference; it does not establish authenticity, data rights or reproducibility on different hardware. Preserve actual byte hashes for assets and an authenticated manifest or trusted registry, with access restrictions. A digest is not anonymization; sensitive text and even some hashes can reveal information. Store references to protected evidence instead of copying raw content into logs.
import hashlibimport json
def manifest_digest(manifest): # Restricted fixture: JSON objects with string keys, strings and lists. data = json.dumps(manifest, sort_keys=True, separators=(",", ":"), ensure_ascii=False, allow_nan=False).encode("utf-8") return hashlib.sha256(data).hexdigest()
first = {"dataset":"FAQ-v1", "model":"mock-v2", "parents":["A@1"]}second = dict(reversed(list(first.items())))print(manifest_digest(first) == manifest_digest(second))print(manifest_digest(first) == manifest_digest(dict(first, dataset="FAQ-v2")))Lifecycle gates and ownership
At intake, assign an owner and verify origin and usage rights. During preparation, version transformations and evaluate quality. Before release, review the dataset and model cards, confirm approved purposes and dependencies, and obtain independent approval. During operation, monitor changes in rights, data quality, incident reports and retention deadlines. On retirement, revoke access and propagate removal decisions. An incident owner coordinates triage, containment, investigation, review and evidence preservation under a defined policy. Model artifacts and logs may contain sensitive information; restrict access, redact where appropriate and never assume embeddings or weights are harmless. For an ambiguous license or revoked permission, pause use and request qualified review; do not make legal compliance claims from metadata.
Practice: review a manifest
Add an invented asset C with a missing owner and a public URL but no approved rights record. Predict the gate output. Give A a new revision and update its child lineage record; compare the manifest digests. Explain why changing a manifest without changing artifact bytes cannot verify those bytes. Draft a dataset card and model card for the fictional library, with explicit restrictions, evaluation limitations and incident contacts. Review Chapter 4 data quality and Chapter 50 responsible AI. Reference: ref-ai-dataset-and-model-provenance. Next: deletion propagation.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Dataset and model provenance quiz
Assess provenance, rights, manifests, retention and deletion propagation.
Does a publicly visible dataset automatically permit training?
What does lineage primarily describe?
Why does A fail the training gate?
What does a matching manifest digest establish?
What belongs in a model card?