Mental model
Data deletion in AI applications is a multi-hop lineage operation across every derived artifact rather than a single database delete. Prompts, GPU KV-cache pages, semantic caches, HNSW vector shards, tenant LoRA weights, and evaluation snapshots must purge deterministically via tombstones, epoch invalidation, or per-tenant DEK crypto-shredding with immutable W3C-PROV receipts.
Learning outcomes
- Map data retention boundaries across raw inference prompts, GPU KV-cache prefix trees, RAG vector chunks, tenant LoRA adapters, and offline backups.
- Implement crypto-shredding using per-tenant envelope Data Encryption Keys (DEKs) so immutable object backups become unrecoverable without full rewrites.
- Coordinate synchronous vector tombstones with asynchronous HNSW segment compaction to close post-deletion retrieval leakage.
- Emit tamper-evident W3C-PROV lineage logs and hash-chained deletion receipts without copying deleted sensitive payloads into the audit store.
Theory
Under the NIST Privacy Framework and modern enterprise data controls, erasing a customer record requires controlling every downstream representation derived from it. Unlike standard CRUD systems where one primary row owns state, LLM platforms scatter derived state across five layers: transient prompt/completion buffers (governed by zero-data-retention API agreements or bounded 30-day abuse logs), GPU prefix KV-cache blocks, approximate nearest-neighbor (ANN) vector shards, fine-tuned LoRA adapters, and immutable telemetry plus evaluation archives.
To guarantee provable erasure without rewriting multi-terabyte Parquet lakes or immutable backups, platforms pair W3C-PROV provenance graphs with envelope crypto-shredding. Under W3C PROV, every chunk, vector, cache entry, and eval row tracks wasDerivedFrom and wasGeneratedBy links tying it to (tenant_id, doc_id, artifact_version). When encrypting backups and traces at rest, each tenant owns an isolated Data Encryption Key (DEK) wrapped by a KMS Key Encryption Key (KEK). Destroying that tenant's DEK cryptographically shreds every historical backup, trace, and eval dump simultaneously in constant time.
For live vector indexes and caches, key destruction alone leaves decrypted vectors exposed in RAM or HNSW graphs. Erasure therefore executes three bounded operations:
- Vector tombstones and segment compaction: Write an atomic tombstone into the shard bitmap so ANN queries block deleted chunks immediately, then trigger background compaction to rebuild HNSW links and quantized codebooks without deleted nodes.
- Cache and prefix KV invalidation: Bump the tenant cache epoch (
tenant_epoch += 1) and evict prefix-cached KV blocks linked to deleted system or document prefixes. - Model adaptation boundary: Store tenant knowledge in retrievable RAG shards or isolated per-tenant LoRA adapters that can be unmounted and shredded independently; never fold tenant PII into shared base weights.
Formally, the residual exposure window across derived tiers satisfies:
And each purge step appends a hash-chained receipt binding only cryptographic digests—never raw user text:
Worked quantitative example
Suppose an enterprise tenant erases 12,400 documents (49,600 vector chunks across 4 HNSW shards), 180 semantic cache keys, 1 tenant LoRA adapter (140 MB), and 90 immutable daily S3 Parquet backups totaling 4.2 TB across all tenants.
Without crypto-shredding, rewriting 90 Parquet archives to strip 12,400 documents requires scanning and re-uploading 4.2 TB—consuming hours of batch compute. With per-tenant envelope encryption, revoking the tenant's 256-bit KMS DEK completes in < 250 ms across all 90 snapshots at once. On the live serving tier, incrementing the cache/KV epoch invalidates live hits in < 100 ms, vector tombstones hide all 49,600 chunks from ANN recall in < 2 s, async compaction expunges HNSW graph nodes within 18 minutes, and unlinking the LoRA frees 140 MB—bringing live leakage exposure under 2 s and full physical/cryptographic purge under 20 minutes.
Retention boundary and deletion matrix
| AI Artifact Class | Retention Scope | Deletion Mechanism | W3C-PROV Audit Proof |
|---|---|---|---|
| Prompt & Completion Buffers | Zero retention or <= 30d abuse TTL | Memory zeroization / ZDR / short TTL | Policy mode flag + request digest |
| Prefix KV Cache & Semantic Cache | Ephemeral inference window | Epoch version bump & page eviction | Cache epoch transition receipt |
| Vector Index Chunks & ANN Graph | Active tenant corpus lifetime | Synchronous tombstone + shard compaction | Shard compaction Merkle root |
| Per-Tenant LoRA vs Base Weights | Tenant isolation / shared immutable | Adapter unlink + DEK shred (never shared base) | Adapter digest & destroy timestamp |
| Telemetry & Eval Archives | Compliance window (90d–365d) | Per-tenant DEK crypto-shredding | KMS key-destruction event hash |
Trade-offs
Crypto-shredding per-tenant DEKs handles immutable backups cleanly, yet requires strict KMS boundary hygiene: sharing a DEK across tenants causes collateral data loss upon revocation. Per-document DEKs support finer erasure inside immutable archives, at the cost of higher KMS metadata overhead unless keys derive hierarchically via HKDF from a tenant root secret.
Similarly, immediate full HNSW index rebuilds physically purge memory instantly, yet frequent synchronous rebuilds degrade write throughput and search P99 latency. Pairing instant bitmap tombstones (< 2 s logical invisibility) with threshold compaction (rebuilding shards once tombstones pass 10%) balances privacy guarantees against predictable query latency.
Failure modes and misconceptions
- Deleting only the primary SQL row. Leaving chunk embeddings, BM25 inverted terms, and semantic cache hits intact lets future prompts surface erased text.
- Recording deleted user content inside audit receipts. Writing raw prompts or filenames into an append-only ledger violates the erasure mandate itself. Log only salted SHA-256 digests, counts, provenance IDs, and timestamps.
- Training multi-tenant PII into shared base weights. Dense weights entangle training tokens globally, making deterministic single-tenant unlearning unreliable compared with RAG deletion or isolated LoRA weights.
- Leaving soft-delete tombstones uncompacted indefinitely. Uncompacted tombstones linger inside disk segments and quantized codebooks, inflating memory footprint and forensic recovery risk.
- Overlooking upstream inference provider retention settings. Sending prompts without verified Zero Data Retention (ZDR) endpoints leaves sensitive payloads in provider 30-day abuse logs.
Decision scenario
A healthcare customer triggers GDPR Article 17 erasure after indexing 3,200 manuals into HNSW vector shards, Redis semantic caches, weekly S3 Parquet eval dumps, and a cloud LLM gateway. Auditors require tamper-evident proof within 24 hours that erased records cannot resurface.
Verify all upstream LLM endpoints enforce Zero Data Retention headers so zero provider logs retain tenant text. Next, query the W3C-PROV lineage graph by tenant_hash to bump the Redis/KV epoch, apply vector shard tombstones, and force immediate shard compaction because erased vectors exceed 5% of shard volume. Revoke and destroy the tenant's KMS DEK so every historical Parquet eval archive becomes unreadable, run a canary retrieval probe verifying zero top- matches, and append the hash-chained deletion receipt.
Implementation example
This Python purge coordinator models W3C-PROV lineage propagation across cache epochs, vector tombstones, and envelope DEK crypto-shredding while emitting a hash-chained SHA-256 audit receipt without storing deleted text.
pythonfrom dataclasses import dataclass, fieldfrom hashlib import sha256import time@dataclassclass ProvDeletionLedger:chain_head: str = "0" * 64receipts: list[dict[str, str]] = field(default_factory=list)def record(self, tenant_digest: str, activity: str, artifact_digest: str) -> str:ts = f"{time.time():.6f}"next_hash = sha256(f"{self.chain_head}|{tenant_digest}|{activity}|{artifact_digest}|{ts}".encode()).hexdigest()self.receipts.append({"prev": self.chain_head, "hash": next_hash, "activity": activity, "artifact": artifact_digest})self.chain_head = next_hashreturn next_hashclass RetentionPurgeCoordinator:def __init__(self) -> None:self.tenant_deks = {"ten-7": "dek-live-v1"}self.cache_epoch = {"ten-7": 1}self.tombstones: set[str] = set()self.ledger = ProvDeletionLedger()def execute_erasure(self, tenant_id: str, chunk_ids: list[str]) -> str:t_hash = sha256(f"tenant:{tenant_id}".encode()).hexdigest()self.cache_epoch[tenant_id] = self.cache_epoch.get(tenant_id, 0) + 1self.ledger.record(t_hash, "prov:InvalidateCacheEpoch", f"epoch:{self.cache_epoch[tenant_id]}")self.tombstones.update(chunk_ids)self.ledger.record(t_hash, "prov:TombstoneVectorChunks", sha256(",".join(sorted(chunk_ids)).encode()).hexdigest())self.tenant_deks.pop(tenant_id, None) # Crypto-shred backups & eval Parquet archivesreturn self.ledger.record(t_hash, "prov:DestroyTenantDEK", "kms:dek-revoked")coord = RetentionPurgeCoordinator()head = coord.execute_erasure("ten-7", ["chk-101", "chk-102"])assert "ten-7" not in coord.tenant_deks and len(coord.ledger.receipts) == 3 and len(head) == 64
Why must immutable backups and vector indexes combine per-tenant DEK crypto-shredding with tombstone compaction and hash-chained receipts without storing deleted payloads?