FullStack AI Hub
Studio
lesson depth
Mastery
not started · 0%

Knowledge Provenance

How origin ownership version and transformation metadata make knowledge auditable.

Freshness: current•15 min read•Retrieval and Knowledge Systems

Key Learning Outcomes

  • ✓Trace evidence through transformations and versions
  • ✓Define provenance metadata for retrieval systems
  • ✓Detect unsupported or stale knowledge
Full Technical Reference Document

Mental model

Every indexed text chunk in an enterprise AI system should operate as an auditable evidence artifact rather than an anonymous string in RAM. Provenance binds each retrievable unit cryptographically and structurally to its authoritative origin (source_id, immutable content_sha256, revision), exact transformation toolchain (parser_version, chunker_version, embedding_model), authorized access group, and retrieval/generation decision trace.

Authoritative entity + SHA digest
Ingestion run + transform manifest
Versioned chunk + ACL coordinates
Retrieved packet snapshot ID
Claim bound to cited revision
Audit replay & revocation invalidation
Conceptual teaching model synthesized from:PROV OverviewArtificial Intelligence Risk Management Framework

Learning outcomes

  • Model complete Entity -> Activity -> Agent lineage chains grounded cleanly in the W3C PROV data model across RAG pipelines.
  • Distinguish mutable public URLs from immutable content-addressed source snapshots and chunk coordinates needed for historical audit replay.
  • Propagate source corrections, revocations, and re-chunking schema upgrades cleanly without leaving silent orphan versions active.

Theory

When a compliance reviewer inspects why an AI assistant cited an outdated HR limit six months ago, pointing vaguely at "https://docs.company.com/hr" fails completely if that webpage updated four times since the answer generated! Applying W3C PROV (Entity: stored document/chunk; Activity: OCR/parse/chunk/embed job; Agent: ingestion pipeline service or owner team) records exact deterministic transformations cleanly end to end:

Lineage LayerMandatory Metadata FieldsWhat Question It Answers During Incident Review
Source Origin (SourceEntity)source_id, canonical_uri, doc_revision, content_sha256, owner_groupExactly which file bytes and revision backed the retrieved quote?
Transformation (TransformActivity)ingestion_run_id, parser_version, chunker_version, embedding_model_idWhich parser/splitter/model version created this index slice?
Indexed Chunk (ChunkEntity)chunk_id, char_offset_span, section_breadcrumb, acl_epoch, verified_atWhere inside the doc did the span originate, and who could read it?
Inference Ledger (ClaimDerivation)prompt_packet_id, retrieved_chunk_ids[], cited_span_ids[], policy_shaWhich exact packet context generated and validated the final user claim?

Crucially, recording only ingestion timestamps leaves regressions untraceable whenever teams swap PDF extractors (pypdf -> unstructured) cleanly without changing document source hashes. Stamping parser_version and ingestion_run_id inside every indexed chunk lets engineers compare search quality cleanly across extraction builds and selectively purge corrupted runs cleanly by ingestion_run_id.

python
import hashlib
from dataclasses import dataclass
​
@dataclass(frozen=True)
class ProvenanceRecord:
chunk_id: str
source_id: str
source_revision: str
source_sha256: str
ingestion_run_id: str
parser_version: str
embedding_model: str
acl_epoch: int
char_start: int
char_end: int
​
def create_prov_chunk_record(
source_id: str,
source_revision: str,
raw_doc_bytes: bytes,
char_start: int,
char_end: int,
ingestion_run_id: str,
parser_version: str,
embedding_model: str,
acl_epoch: int,
) -> ProvenanceRecord:
"""Bind chunk coordinates cryptographically to source digest, toolchain, and ACL epoch."""
source_sha = hashlib.sha256(raw_doc_bytes).hexdigest()
seed = f"{source_id}:{source_revision}:{source_sha[:12]}:{parser_version}:{char_start}:{char_end}"
chunk_id = hashlib.sha256(seed.encode()).hexdigest()[:24]
return ProvenanceRecord(
chunk_id=chunk_id,
source_id=source_id,
source_revision=source_revision,
source_sha256=source_sha,
ingestion_run_id=ingestion_run_id,
parser_version=parser_version,
embedding_model=embedding_model,
acl_epoch=acl_epoch,
char_start=char_start,
char_end=char_end,
)

Trade-offs

Full transformation-level provenance (source digest + parser build + span offsets + packet snapshot) makes regulatory audits, selective re-indexing on PDF bugs, and causal regression tracking nearly effortless across complex enterprises, adding modest metadata storage (~150–300 bytes per chunk + append-only snapshot refs). Lightweight snapshot-only versioning cuts metadata plumbing on small low-risk public FAQ sites, yet fails cleanly under financial, legal, or medical compliance audits where proving exact historical bytes shown to the model months ago is mandatory.

Failure modes and misconceptions

  • Assuming URLs Are Immutable Identifiers: Live corporate docs and external specifications mutate silently at identical URLs without breaking links while changing policy numbers completely.
  • Confusing Metadata Presence With Access Control: Attaching "visibility: restricted" labels onto chunks without filtering queries cleanly before reranking exposes protected text to generators anyway.
  • Overwriting Revisions In-Place Without Lineage History: Deleting old chunk records silently without keeping archived digest manifests breaks post-incident replay completely.
  • Omitting Ingestion Toolchain Versions: Shipping a buggy PDF table parser into production without tagging parser_version forces blind full-corpus wipes instead of targeted run rollbacks.

Decision scenario

A regulatory policy assistant answers audit questions across 12,000 quarterly compliance bulletins. Last month's PDF table parser upgrade silently dropped column headers on multi-page Annexes, and legal auditors now demand exact traceability from historical chat outputs back to exact bulletin revisions. Design W3C-PROV-aligned chunk lineage fields, ingestion_run_id tagging, and non-destructive revision invalidation cleanly.

Reflect before revealing the guide

Which lineage identifiers must travel with a retrieved chunk so an auditor can deterministically reproduce why an AI claim appeared six months later?

Prerequisites & Related Concepts (3)

Private notes

0 words
Included In Free Course
Free · Verifiable Credential

FS-201Production LLM Engineer

Design an observable full-stack LLM product from capability validation through interfaces retrieval evaluation security and operations.

37 concepts~35h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.

Next