What Article 12 requires, and what it does not
Article 12(1) of the AI Act: high-risk AI systems “shall technically allow for the automatic recording of events (logs) over the lifetime of the system”. With the word automatic, 12(1) requires the system itself to do the logging. If an engineer can export a transcript on request, a person is logging, and a record that exists only because someone chose to produce it does not satisfy 12(1).
Article 12(2) sets a purpose test, not a field list. Logging must ensure “a level of traceability of the functioning of a high-risk AI system that is appropriate to the intended purpose”, and must enable recording of events relevant for: “identifying situations that may result in the high-risk AI system presenting a risk within the meaning of Article 79(1) or in a substantial modification”; facilitating post-market monitoring under Article 72; and monitoring the operation of the system by the deployer under Article 26(5). The first limb reaches far, because it covers situations that may result in a risk and not only those that already are one.
Article 12 prescribes nothing more, with one exception. Paragraph 3 does contain a field list: the period of each use, the reference database checked against, the input data that produced a match, and the natural persons involved in verification. It applies only to point 1(a) of Annex III, remote biometric identification. It does not bind a claims-triage assistant or a document-review RAG system, and anyone who copies it anyway gets a schema for a face-recognition system and not for their own.
The Act gives a number for retention. Providers keep the Article 12(1) logs under Article 19, deployers under Article 26(6), and both provisions require the same: a period appropriate to the intended purpose, at least six months, unless other Union or national law provides otherwise; both name data protection law explicitly as a possible exception. Both also qualify the duty “to the extent such logs are under their control”. The Act thus attaches to control and not to proximity, and the ownership question I return to in “Where you write it” hangs on that. The duties run in parallel: whoever builds a system and also runs it is provider and deployer at once. Whether your system is high-risk at all is a prior question, covered in the piece on high-risk classification.
Standards for logging are being drafted, and none is finished. CEN-CENELEC is working on the standard meant to support Article 12, which as a harmonised standard would give you a presumption of conformity; it is still in development and unpublished. I deliberately cite no work-item number, because scope and numbering have both changed more than once and a stale identifier is worse than none. ISO/IEC 24970 (“AI system logging”) is stable enough to name: it reached FDIS in 2026, the last stage before publication; whether it has been published since is best checked with ISO directly. Until the Official Journal cites a harmonised standard, you have none to rely on. You define the schema yourself and document why it satisfies 12(2). That is the task between now and December 2027.
Why prompt plus response explains nothing
The field lists in circulation go wrong here. A deterministic function can be retraced from its input and output. An LLM in a RAG system is not such a function, because its answer depends on the corpus at that instant, and the corpus is not in the prompt.
Suppose you re-index on Tuesday night with the same code, the same model and the same seed. On Wednesday the identical prompt retrieves different chunks and produces a different answer, and a prompt-and-response log does not record the change. When a regulator, a customer or your own incident review asks why the system answered as it did in March, you hand over a prompt and a response and cannot demonstrate the link between them.
index_snapshot_id. Every other entry on the usual list (prompt, response, timestamp, user, model name) can be identical across two runs that produced contradictory answers. Without this field you cannot establish which corpus answered. That is where I see the floor of the 12(2) purpose test for a RAG system, and not at replay. That reading is mine, because the Act sets a purpose test and names no field. Without the snapshot, your record acknowledges a call and does not explain it.For the same reason three fields that usually count as extras belong in the record: embedder_version, because re-embedding the same text with a new model reorders every neighbour; system_prompt_version, because the system prompt is code that ships without a deploy and changes behaviour silently; and the decoding parameters including the seed, because a temperature above zero makes the output a sample rather than a value. The failure mode behind this is corpus drift.
Verification is not replay
People expect two things from an audit record that quietly exclude each other: it should keep no cleartext, and it should be able to re-derive the output. Because both cannot hold at once, I separate the goals.
Verification and traceability come from a hashed record. With the fields below you establish which corpus, which model weights, which prompt version and which chunks produced a given answer. You recompute the HMAC of a prompt someone hands you later, compare it, and so prove that this prompt ran. And you show the decision path, including whether a human accepted the output or overrode it. The purpose test in 12(2) asks for that, and a record of this shape meets it.
Replay, meaning re-deriving the output, demands much more, and by construction this schema does not deliver it. If the cleartext for a prompt_hmac sits in a short-TTL vault, you can test a candidate prompt that someone supplies; once the vault expires, the HMAC does not give the prompt back. A hash is one-way, and that is the reason to use one. The same holds for the corpus: chunk_id plus index_snapshot_id tells you which chunks were retrieved. You can show what the model read only while the snapshot, the source documents, the preprocessing and the chunk content all still exist.
So choose deliberately, and write the choice down. Replay means retaining the cleartext inputs and the corpus behind them for the whole retention period, which collides with the minimisation duty in “The conflict with GDPR”. That is defensible for some systems and a bad choice for most. This design does not keep the content and confines itself to verification.
The seed is evidence, not a guarantee
Even those who retain every input cannot reliably repeat a run. PyTorch's documentation says: “Completely reproducible results are not guaranteed across PyTorch releases, individual commits, or different platforms”, and results “may not be reproducible between CPU and GPU executions, even when using identical seeds”. vLLM states that it “does not guarantee the reproducibility of the results by default, for the sake of performance”, and its reproducibility notes spell out the conditions: scheduling under multiprocessing and batching both perturb results, so offline runs need deterministic scheduling or batch invariance, and online serving gains little from a seed without batch invariance. Hardware, drivers, CUDA versions, the tokenizer and quantisation add to this. Regenerating an answer from last March token for token is therefore very expensive or not possible at all.
Article 12(2), however, asks for traceability appropriate to the intended purpose and not for deterministic regeneration. Whoever pursues bit-exact replay solves a hard problem no regulator set and neglects the task the regulator did set. The seed still belongs in the record, as evidence of intent and configuration: it documents what the system was set up to do when it ran and does not promise that you can repeat the run.
The record schema, field by field
The schema describes one record per call. Every field can be derived at request time or already sits in your deployment metadata. The markers say how binding a field is: required means I consider the field necessary to meet the Article 12(2) purpose test for a RAG system. It does not mean the Act names the field, because the Act names fields only in 12(3), and only for biometrics. prudent means the field costs a few bytes and saves you a week during an incident. The record closes with two signatures rather than one; the section “Where you write it” gives the reason.
{
"record_id": "01KXJJDZJ69XW3PBN4TRVC6H8D", // required · ULID, write-once
"ts_start": "2026-07-15T09:41:22.118Z", // required · period of use
"ts_end": "2026-07-15T09:41:26.902Z", // required
"system": {
"ai_system_id": "claims-triage", // required
"risk_class": "high_risk", // required · legal & compliance own this call
"role": "deployer", // required · Art. 19 vs Art. 26(6)
"instructions_version": "2.4.0" // required · Art. 26(1) conformance
},
"actor": {
"subject_pseudonym": "hmac:4f9c1a...e7", // required · keyed, never the name
"operator_id": "u-4471", // required · who ran it
"session_id": "s-9d20d1" // prudent · groups a conversation
},
"input": {
"prompt_hmac": "hmac:9f2c8b...31", // required · tests a supplied prompt, cannot recover one
"prompt_ref": "vault://p/2026-07-15/01KXJJDZ", // prudent · short-TTL cleartext
"prompt_chars": 812, // prudent
"pii_classes": ["name", "policy_number"] // prudent · drives your Art. 30 entry
},
"provenance": { // app-attested · what produced the answer — not a replay bundle
"model_id": "llama-3.3-70b-instruct", // required
"weights_sha256": "b71e0c...aa", // required · the name is not the weights
"serving_stack": "vllm-0.8.2", // prudent · kernels change numerics
"decoding": {
"temperature": 0.2, // required
"top_p": 0.9, // required
"seed": 42, // required · config evidence, not a replay guarantee
"max_tokens": 800 // prudent
},
"system_prompt_version": "sp-2026-06-30-r3", // required · code that ships silently
"system_prompt_sha256": "3ac910...5f", // required · version strings lie
"index_snapshot_id": "idx-2026-07-14T02:00Z-a91f", // required · THE omitted field
"embedder_version": "bge-m3@2024-06", // required
"retrieval": {
"top_k": 8, // required
"reranker": "bge-reranker-v2@2025-01", // required if present
"filter": "tenant=ACME AND lang=de" // required · scope changes results
},
"retrieved": [ // required · the real context window
{"chunk_id": "doc-8842#c17", "score": 0.8123, "rank": 1},
{"chunk_id": "doc-1190#c03", "score": 0.7440, "rank": 2}
]
},
"output": {
"response_hmac": "hmac:7d10ff...92", // required
"response_ref": "vault://r/2026-07-15/01KXJJDZ", // prudent
"finish_reason": "stop", // prudent · truncation explains a lot
"refusal": false // prudent
},
"oversight": { // app-attested · a decision after ts_end lands as a linked follow-up record
"human_review": "mandatory", // required · Art. 14
"reviewer_id": "u-2210", // required when review happened
"decision": "overridden", // required · accepted | overridden | none
"override_reason_code": "OR-07" // prudent · codes beat free text
},
"attestations": [ // required · two signers, because no one party witnesses all of this
{
"signer": "gateway", // signs only what it terminates first-hand
"key_id": "gw-signing-2026-q3",
"covers": ["record_id", "ts_start", "ts_end", "system", "actor", "input", "output"],
"payload_sha256": "9c41d7...a8", // JCS digest over exactly the fields named in "covers"
"signature": "ed25519:9a01...bb"
},
{
"signer": "app:claims-triage", // the gateway cannot witness these — the application asserts them
"key_id": "app-triage-2026-q3", // its own key, its own trust domain
"covers": ["record_id", "provenance", "oversight"],
"payload_sha256": "3fb0ac...5d", // record_id is in both, so neither half can be spliced onto another call
"signature": "ed25519:4c88...02"
}
],
"integrity": { // the collector writes this; it signs neither claim
"canon": "JCS/RFC8785", // required · pins key order and float form, or no two parties agree
"seq": 88213, // required · collector-assigned; gaps are evidence
"prev_sha256": "5c2ab8...0d", // required · the previous entry_sha256 — the chain
"entry_sha256": "e1907a...c4" // required · JCS digest over every field above this block
}
}
What I would cut, and what I would not
If you want to trim, cut prompt_chars, session_id and finish_reason, which serve diagnosis and prove nothing. Keep the scores in retrieved: whether an answer was “answered from a 0.81 match” or “answered from a 0.31 match” separates a system that works from one that guesses. Article 12(2)(a) requires that distinction when it asks for identifying situations that may present a risk. Do not add a natural-language “explanation” generated by a second LLM call either. It proves only that a second model wrote plausible text, it cannot be validated, and in an audit record a reader easily takes it for a finding.
Where you write it
Two placements are candidates, and each has a flaw. Independence speaks for the gateway. The application is the thing under audit: if the code path that produces the decision also writes the record of it, one deploy changes both and the system audits itself. A gateway forms a separate trust domain with the resolved request, the response and its own signing key, and it is where you already terminate auth and enforce input controls.
A gateway cannot see most of what this article is about, though: which documents your application retrieved, which index snapshot was queried, how the prompt was assembled before it arrived, and what a human reviewer decided ten minutes later. The application has to assert those fields, index_snapshot_id above all. The gateway therefore does not independently witness the fields the argument rests on and only passes them along.
The design therefore splits the job, and the schema above has an attestations array rather than a single writer's signature. The gateway signs what it observes first-hand, and the application signs its attestation of the provenance and oversight fields with its own key. Both go to an append-only collector that signs neither and cannot rewrite either. Each covers list names what that key vouches for; record_id sits in both, so neither half can be attached to a different call. You get attribution instead of independence: a record of who claimed what, in which later changes show. “Always log at the gateway” is architecture opinion, mine included, not a requirement of the Act. Article 12 says nothing about where the writer sits.
seq plus prev_sha256 binds each record to the previous one, and WORM storage stops even the writing account from deleting early. First make the digests reproducible: JSON keys have no inherent order, and 0.8123 has more than one valid encoding. The canon field therefore fixes the serialisation, and JCS/RFC 8785 is the obvious choice for it: unless every party serialises the same way, your auditor computes a different hash and learns nothing. A chain proves nothing against an attacker who controls the writer, though, because they recompute it from the tampered record onwards. It becomes evidence only once the head hash sits somewhere you cannot quietly overwrite it, as a daily digest that your auditor countersigns or that you send to a second organisation. Without a published head the chain proves nothing.The conflict with GDPR, and how it resolves
Article 19 and Article 26(6) require you to keep logs for at least six months, and keeping six months of prompts is itself a processing activity, because prompts to a claims system are full of names, health details and grievances. Article 5(1)(c) GDPR requires data minimisation. Whoever retains cleartext prompts because “the AI Act said to log” complies with one regulation by breaching another.
The schema above resolves the conflict with one rule: the audit record must let you verify the decision without retaining the personal data. It stores identity and no content: prompt_hmac instead of the prompt, subject_pseudonym instead of the name, and chunk_id instead of the chunk text. That is the trade-off from “Verification is not replay”, and the GDPR supports it.
Use an HMAC with a secret key and not an unkeyed SHA-256. A hash of a short prompt can be brute-forced: whoever knows the template enumerates candidates until the digest matches, and the hash then reveals the prompt. Neither method anonymises, because keyed or not, the values remain pseudonymised personal data under Article 4(5) GDPR. The key does give you leverage: destroy it and the digests become far harder to tie back to an individual.
Destroying the key is, however, not automatically erasure and not automatically anonymisation. The EDPB's Guidelines 01/2025 on Pseudonymisation (version for public consultation) are explicit that deleting the additional information does not by itself make pseudonymised data anonymous; that yields anonymity only if the overall anonymisation test is met. Your record also still contains operator_id, session_id, timestamps, chunk references and a distinctive shape of interaction, and any of these, alone or combined, may still permit singling someone out. Key destruction mitigates strongly but does not turn personal data into non-personal data, and your DPIA has to assess whether it holds.
The Article 30 record, and the erasure question
The log is a processing activity, so it belongs in your record of processing activities under Article 30 GDPR, though not necessarily as its own line. GDPR does not require a separate entry per technical log stream, and many controllers document audit logging inside the processing activity it serves. The entry must name, as purpose, traceability of a high-risk AI system under Art. 19 / Art. 26(6) AI Act; as categories, pseudonymised identifiers and technical metadata; as retention, the defined period, with a shorter period for the cleartext vault; and as recipients, your auditor and the market surveillance authority.
Article 6(1)(c), compliance with a legal obligation, fits as the legal basis once the AI Act duty applies to you, but it does not complete the analysis. A claims-triage assistant processes health data, and special-category data needs a condition under Article 9 in addition to the Article 6 basis. As long as nobody has identified which Article 9 condition you rely on, your legal basis analysis is unfinished, even if the Article 30 entry looks complete.
The last question is what happens on an erasure request under Article 17. You delete the cleartext vault; the audit record is harder. Article 17(3)(b) disapplies erasure only to the extent that processing is necessary for compliance with a legal obligation under Union law. The provision is not a blanket exemption for anything labelled “audit”, it does not license indefinite retention, and it does not automatically cover every field. The test is necessity field by field: Art. 19 / Art. 26(6) plausibly carries the traceability fields for the retention period, and rather obviously does not carry prompt_chars or a session ID you kept because it was convenient. The two-store design lets you pass that analysis but does not replace it.