Retention and deletion propagation
Retention is a lifecycle policy
Retention specifies how long an asset is needed for an approved purpose, how it is reviewed, who authorizes deletion and what exceptions apply. Define a schedule per asset class: source documents, derived chunks, vector indexes, response caches, logs, backups and trained artifacts. Use the shortest appropriate duration consistent with authorized requirements; a legal hold or other valid obligation may require restricted preservation. The UK ICO storage-limitation guidance illustrates purpose-linked retention, but obligations depend on jurisdiction and context; obtain qualified review. In this fictional lab, an authorized removal of A triggers a dependency traversal. Every node whose parent is affected also becomes affected, including a cache combining A and B. B itself stays available. The example computes the transitive closure to a fixed point, not a deletion command. Cycles terminate because the finite set only grows; cycles should still be investigated as lineage quality defects. Unknown parent IDs raise an error rather than silently overlooking a dependency.
def affected_nodes(parents, removed): # Map artifact ID to its direct parent IDs. Include the removed ID. if removed not in parents or any(p not in parents for ps in parents.values() for p in ps): raise ValueError("unknown lineage node") affected = {removed} while True: expanded = affected | {node for node, ps in parents.items() if affected.intersection(ps)} if expanded == affected: return sorted(affected) affected = expanded
parents = {"A":[], "B":[], "chunk-A":["A"], "chunk-B":["B"], "index-A":["chunk-A"], "cache-AB":["index-A","chunk-B"]}print(affected_nodes(parents, "A"))Plan propagation and verify completion
Maintain a lineage inventory with immutable IDs, revision, parent IDs, storage location, owner and state. Before physical cleanup, revoke serving access to the affected revision using an authoritative deletion state (often called a tombstone). Then remove or rebuild derived chunks, indexes and mixed-source cache entries, invalidate CDN or application caches if applicable, and reconcile replica and backup policies. A shared cache entry derived from A and B must be invalidated even if B remains valid. A backup restore must reapply deletion state before serving traffic. Track requested, access-blocked, pending cleanup, verified and exception states separately. A failed deletion or inaccessible store is pending, not complete. Record a minimal incident ID, timestamps, responsible owner and verification evidence; never log removed document text. These steps require atomic or coordinated state changes in real distributed systems, not demonstrated here.
Reject stale retrieval candidates
Index updates may lag behind source deletion. Use a trusted current active-revision set plus a deletion deny set at the serving boundary; do not trust cached authorization decisions. The local function preserves the candidate order, removes duplicates and rejects unknown, inactive or tombstoned IDs. In the first call A is inactive and B appears once. In the second call an outdated active set still includes A, but its tombstone blocks it. All candidate lists must be filtered before text is loaded, sent to a model or returned to a user. A production system also needs tenant and purpose authorization, freshness guarantees, and fail-closed behavior when trusted state is unavailable. This in-memory function does not implement those requirements or prove physical erasure. For cached answers that embed deleted content, invalidate the whole affected response using the dependency map rather than filtering its citations alone.
def visible_hits(candidates, active, tombstones): # IDs are immutable revision IDs from trusted metadata. seen = set() result = [] for item in candidates: if item in active and item not in tombstones and item not in seen: result.append(item) seen.add(item) return result
# Source removal has been approved; stale index and cache still return A.active = {"B@1"}tombstones = {"A@1"}print(visible_hits(["A@1", "B@1", "B@1"], active, tombstones))print(visible_hits(["A@1"], {"A@1", "B@1"}, tombstones))Model and backup removal boundaries
Deleting a training record from a dataset does not automatically remove information from model weights. Identify affected training artifacts and evaluate whether withdrawal, retraining, validated unlearning or another authorized response is necessary. Do not claim that unlearning is effective without appropriate evidence. Backups and immutable logs may have separate retention and exception policies; prevent access and reintroduction where required, track deadlines and verify restoration behavior. Treat hashes, manifests and deletion markers as potentially sensitive metadata. Avoid keeping the original content as deletion evidence. A deletion receipt should communicate exactly what was checked and what remains pending; distinguish an application-level visibility test from a storage-level erasure verification. Escalate uncertainty to the data owner and privacy or security reviewer.
Practice: remove a fictional FAQ
Using the example graph, identify the affected IDs before cleanup. Simulate removing A@1 from active data and adding its tombstone. Pass stale candidates through the filter and confirm B@1 remains and A@1 is absent. Simulate a restored stale index by including A@1 in the active set; verify that the tombstone still wins. Record index and cache cleanup as separate pending tasks, then mark only the simulated checks complete. Draw a separate branch for a model trained on A and explain why retraining or withdrawal needs separate review. Reference: ref-ai-retention-and-deletion-propagation. Next: MLOps foundations.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Retention and deletion propagation quiz
Assess provenance, rights, manifests, retention and deletion propagation.
Which nodes are affected when A is removed?
What happens to a cached answer derived from A and B?
Which ID wins when active and tombstone sets disagree?
Does deleting a dataset record prove removal from trained weights?
What should a deletion receipt say when backup cleanup is pending?