Dataset Lineage and Provenance › Training and Model Provenance
Language AI HandbookAll chapters We now "train" a bigram model from the packed sequences. This is a toy, but it demonstrates the relationship between data lineage and model lineage. The model artifact hash covers the bigram counts, tokenizer name, sequence length, and seed. The training run record ties that model hash to the mixture manifest, configuration hash, code commit, seed, and checkpoint.
PythonIn [24]Expand
bigram_counts = Counter()
bigram_sources = defaultdict(set)
boundary_bigrams = set()
for seq in packed:
for i in range(len(seq["tokens"]) - 1):
left, right = seq["tokens"][i], seq["tokens"][i + 1]
if left == "<pad>" or right == "<pad>":
continue
bigram = (left, right)
left_owner, right_owner = seq["owners"][i : i + 2]
bigram_counts[bigram] += 1
bigram_sources[bigram].update((left_owner, right_owner))
if left_owner != right_owner:
boundary_bigrams.add(bigram)
model_payload = {
"tokenizer": "regex-word-punct-v1",
"sequence_length": SEQ_LEN,
"seed": 13,
"bigrams": sorted(
[[left, right, count] for (left, right), count in bigram_counts.items()]
),
}
model_hash = sha256_text(canonical_json(model_payload))
training_run = {
"run_id": "run-demo-001",
"model_hash": model_hash,
"manifest_root": manifest_root,
"config_hash": config_hash,
"code_commit": "demo-abc123",
"seed": 13,
"checkpoint": "ckpt-demo-0001",
}
training_run_hash = sha256_text(canonical_json(training_run))ConsoleOut [25]Expand
Distinct bigrams: 84 Model artifact hash: 10284620907afae6 Training run hash: fe9194e63363e1ea
The model hash commits to the serialized payload of bigram counts, tokenizer name, sequence length, and seed. The training-run hash commits to the run record, which includes the model hash, manifest root, configuration hash, code commit, seed, checkpoint, and run identifier.
If the code commit or run identifier changes while the model payload stays the same, only the training-run hash changes. A different recorded seed changes both serialized records. Changes to raw inputs can leave the model hash unchanged. For example, inputs with different whitespace can produce the same canonical text and bigram counts. Compare the payloads and the upstream records to find which fields changed.
The owner map lets us inspect where the two tokens of a bigram came from. We show the first five distinct pairs encountered, then any remaining pairs that occur across document boundaries.
ConsoleOut [26]Expand
'The' 'city': count=1, docs=['doc-6bd4bf650451'] 'city' 'council': count=1, docs=['doc-6bd4bf650451'] 'council' 'approved': count=1, docs=['doc-6bd4bf650451'] 'approved' 'the': count=1, docs=['doc-6bd4bf650451'] 'the' 'new': count=1, docs=['doc-6bd4bf650451'] '.' 'Section': count=1, docs=['doc-90510a22cf34', 'doc-a86ae901cca2'] '.' 'def': count=1, docs=['doc-bcb940d2e6f2', 'doc-dd10f119f2fb'] 'b' 'Contact': count=1, docs=['doc-90510a22cf34', 'doc-bcb940d2e6f2']
All 84 distinct bigrams in the toy have count one. The first five shown come from the transit document, and the three boundary examples show two document IDs each. A neural training pipeline can choose to record which shards each step consumed and which checkpoints follow those steps. Such links trace recorded dependencies. Estimating a document's causal influence on a parameter update requires separate evidence.
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!