We make one claim about our prediction pipeline that everything else depends on: the same match, run again against the same inputs, produces the same output. It is what lets us investigate a wrong call six weeks later instead of shrugging at it.
That claim has a prerequisite nobody talks about: the row has to tell you which text the model read. Not which model, not which match — which version of the instruction text was handed to the language model when the call was made.
Ours does. Every prediction carries training_word_id and training_word_version. 51,909 of 51,916 rows have the first; 47,032 have the second; 47,027 have both. On paper that is complete provenance. This is the audit of whether it resolves.
Three things a pointer has to do
A provenance pointer is only worth its storage if it is resolvable (the artifact still exists), identifying (the label maps to exactly one artifact, not a family), and immutable (the artifact does not change after the pointer is written). We checked all three against production (ai_predictions 51,916 rows, training_words 43,492). Each fails for a different structural reason, which is why fixing one would not have fixed the others.
Path 1: the table that is literally named "versions"
The obvious resolution target exists. It is called training_word_versions and it has training_word_id, version, content, changelog, is_active, created_at — exactly the table you would design for this.
SELECT count(*) FROM training_word_versions;
-- 82
82 rows for 43,492 words. The answer is already visible, but run the join anyway, because "no match" and "empty table" are different findings:
SELECT count(*) FROM ai_predictions p
WHERE EXISTS (
SELECT 1 FROM training_word_versions v
WHERE v.training_word_id = p.training_word_id
AND v.version = p.training_word_version
);
-- 0
Zero of 51,916. Not 40%. Not 3%. A 82-row ornament sitting beside 47,032 labels that claim to reference it.
A table's existence is not a capability. We had a green checkmark in the schema review for "versions are tracked", satisfied by the presence of a table and never by a join that returned rows. Coverage assertions have to be joins; information_schema queries only tell you about names.
Path 2: fall back to the live row
The prediction says (id=12345, version='V3.0·D1'). Does training_words currently hold that version?
SELECT count(*) AS joined,
count(*) FILTER (WHERE t.version = p.training_word_version) AS label_match
FROM ai_predictions p
JOIN training_words t ON t.id = p.training_word_id;
-- joined 51,680 | label_match 29,024
236 predictions point at a training_word_id that no longer exists (229 with a non-null id) — unresolvable forever, since the row is gone and no foreign key prevented it.
And 29,024 of 51,680 (56.15%) match the current label while 22,656 (43.85%) do not. The naive reading is "44% stale". The real reading is worse — the label was never an identifier:
SELECT count(DISTINCT version) AS labels, max(n) AS max_words_sharing_one_label
FROM (SELECT version, count(*) n FROM training_words GROUP BY 1) x;
-- labels 378 | max_words_sharing_one_label 23,903
378 distinct version strings across 43,492 rows, and one of them — V1 — is shared by 23,903 words, 55% of the table. When a prediction says version = 'V1' it is naming a generation style, not a document. Even when the join succeeds, it tells you the word is still labelled V1; it cannot tell you the word is still the same text, because 23,903 documents have carried that label.
The monthly curve shows this is not legacy debt being paid down. Share of each month's predictions whose label no longer matches their word: June 6.8%, July 6.9%, August 77.4%, September 75.4%, October 40.5%, November 8.9%. September is when mass editing of the corpus began, and 75% of that month's predictions now reference a label their word no longer carries.
Path 3: snapshots — the only path that works, at 50% coverage
A third table, training_word_snapshots (9,616 rows, 5,031 words, 8,877 distinct hashes, first row 2026-08-07), stores training_word_id, full content, content_hash, created_at. No version column.
That omission is the whole problem: the only immutable artifacts we have are not keyed by the label the predictions recorded. You cannot walk from version='V3.0·D1' to a snapshot — only from time, reconstructing the word as of the moment the prediction was written:
WITH asof AS (
SELECT DISTINCT ON (p.id)
p.id AS pid, p.training_word_id AS twid, s.content_hash AS h
FROM ai_predictions p
JOIN training_word_snapshots s
ON s.training_word_id = p.training_word_id
AND s.created_at <= p.created_at
ORDER BY p.id, s.created_at DESC
)
SELECT count(*) AS datable,
count(*) FILTER (WHERE left(a.h,12) = left(md5(t.content),12)) AS still_identical,
count(*) FILTER (WHERE left(a.h,12) <> left(md5(t.content),12)) AS drifted
FROM asof a JOIN training_words t ON t.id = a.twid;
-- datable 25,821 | still_identical 1 | drifted 25,820
Three findings stacked in one line.
Coverage is 49.73%. 25,821 of 51,916 predictions can be dated against a snapshot at all, and that is structural: snapshots begin 2026-08-07, and 2,422 of the 4,605 training words that ever appear in a prediction have zero snapshots. For those, the text the model read is recorded nowhere.
Of the half that can be dated, exactly one still refers to identical content. 25,820 point at text that has since been rewritten. This is not proof the model read the snapshot; it is proof of something narrower and still fatal — the live row cannot serve as the reference, because after the fact it is a different document.
The resolving predicate is itself fragile. content_hash is not one format: 8,811 rows store 12 hex characters (truncated MD5), 805 store the full 32. Only 9,564 of 9,616 (99.46%) equal the first 12 characters of md5(content), so the comparison above needed left(...,12) on both sides. Written the obvious way — content_hash = md5(content) — it silently matches nothing.
Three independent reasons the same audit could return 40%, 0%, or 100% reproducible depending on which two lines of SQL the analyst typed.
What the mutation logs record, and cannot
To be fair to the logging we do have, training_word_evolution_log holds 189,235 rows:
SELECT action, count(*), count(DISTINCT training_word_id)
FROM training_word_evolution_log GROUP BY 1 ORDER BY 2 DESC LIMIT 4;
-- promote 103,992 / demote 66,204 / model_tw_rebind 7,841 / upgrade 2,246
Every one of those events is about weight, status, or binding, not text — promote moves a weight from 1.1 to 1.2. You can reconstruct that a word was promoted 47 times and still not know a single sentence it contained.
The one log that touches content is training_word_scrub_log (11,739 rows, from 2026-10-08), and it stores len_before / len_after:
SELECT count(*), count(*) FILTER (WHERE len_before = len_after) AS same_length
FROM training_word_scrub_log;
-- 11739 | 1
Only one of 11,739 edits preserved length, so length is a usable detector — it says an edit happened and roughly how big — but it is not a fingerprint. It cannot distinguish "removed a duplicated sentence" from "replaced it with a different one of equal length", and it reconstructs nothing. app_name is empty for 11,405 rows, so the log usually cannot even name which component wrote.
The fix: content-address the artifact, refuse to settle without it
All of the above is one design consequence: we recorded a label, and labels are mutable by nature. The fix is not to be more careful with versions. It is to stop pointing at mutable rows and point at immutable content.
CREATE TABLE prediction_provenance (
prediction_id integer PRIMARY KEY REFERENCES ai_predictions(id),
tw_id integer NOT NULL,
content_sha256 char(64) NOT NULL, -- full digest, fixed width, never truncated
content_bytes integer NOT NULL,
captured_at timestamptz NOT NULL DEFAULT now()
);
Two properties matter more than the DDL. One hash function, one width, full digest — the 12-versus-32 split exists because truncation was a storage optimisation nobody documented. And the snapshot side becomes write-once keyed by digest, so "same text" becomes a UNIQUE constraint instead of a convention.
Then the guard, which is the part that changes behaviour:
import hashlib
def assert_provenance(conn, prediction_id: int) -> str:
"""Refuse to settle a prediction whose input text cannot be re-hashed."""
cur = conn.cursor()
cur.execute("""
SELECT pp.content_sha256, t.content
FROM prediction_provenance pp
JOIN training_words t ON t.id = pp.tw_id
WHERE pp.prediction_id = %s
""", (prediction_id,))
row = cur.fetchone()
if row is None:
raise RuntimeError(f"prediction {prediction_id}: no provenance row")
recorded, live = row
actual = hashlib.sha256(live.encode("utf-8")).hexdigest()
if actual != recorded:
# The word was rewritten after the call. That is allowed.
# Grading it against the new text as if nothing happened is not.
raise RuntimeError(
f"prediction {prediction_id}: input changed "
f"({recorded[:12]} -> {actual[:12]}); grade against the snapshot"
)
return recorded
Run that across the table and every settled prediction without a resolvable digest stops counting as evidence — which is the point. Today we have a scoring pipeline that keeps grading rows whose inputs were rewritten underneath them, plus an audit trail that documents the rewrite without preserving the original.
What we can honestly claim today
- 47,032 predictions carry a version label; 0 resolve against the table named for versions.
- 378 distinct labels for 43,492 documents, one covering 23,903 — a generation marker, not a text id.
- 229 predictions point at deleted rows; no foreign key prevented it.
- 49.73% can be dated against a snapshot; of those, 1 still matches the live content.
- 189,235 evolution events record weights; 11,739 scrub events record lengths; none record text.
- 1,817 of 4,031 models produced predictions under more than one
training_word_id(max 29), so "the model's text" is not a single object even per model over time.
We can still say the pipeline is deterministic given its inputs. What we cannot say — yet — is which inputs. That gap is the difference between an audit and a story we tell about an audit, and closing it means storing the things themselves rather than pointers to mutable things.
Analytics and research content. Not betting advice. 18+
本内容仅供数据分析与操作参考,不构成任何决策建议。