Skip to content
mentoor

Topic 3 of 5 · 4 min read

Audit logs for AI-assisted decisions

Goal: Design an audit-log record that lets a reviewer reconstruct any AI output without keeping raw sensitive data.

Log enough that a reviewer can explain any AI output months later, and log it by reference and hash so the log itself does not become a second copy of the sensitive data. The test is simple: given a record id, can someone tell what produced this output and who acted on it?

Check yourself · 1 of 3

Which field lets you reconstruct which model wrote an output six months later?

Choose one answer

Why it matters

When a patient, a client or an auditor asks why the system said something, "the model decided" is not an answer. Regulations for high-risk systems expect automatic event logging, and security guidance for AI systems, such as the NCSC guidelines, treats logging and monitoring as part of operation. Plain request logs fall short because prompts change, models update and tools return live data that no longer exists.

How to do it

Write one append-only record per AI-assisted action with these parts:

  1. Identity of the run: request id, timestamp, user or service, feature name.
  2. What produced it: provider, exact model version, prompt template id and version, key parameters such as temperature.
  3. What went in: references and hashes of the inputs (record ids, document versions), not the raw text. Keep the raw text only where policy allows, in the system of record.
  4. What came out: the output, or a hash plus the location of the stored output.
  5. Tool calls: tool name, arguments by reference, result status.
  6. Human action: reviewer id, decision (approved, edited, rejected), time, and a hash of the final text.
  7. Retention class: how long this record must live and who may read it.

Protect the log: write-once or tamper-evident storage, restricted read access, and its own retention rule. Redact free text before it enters the log.

Before and after

{
  "requestId": "r_8841",
  "feature": "discharge-summary-draft",
  "model": "provider-x/model-2026-10-14",
  "promptTemplate": "dsd@v12",
  "inputRefs": [{"type": "encounter", "id": "enc_551", "rev": 7}],
  "inputHash": "sha256:9c1f...",
  "outputRef": "drafts/d_3392",
  "toolCalls": [{"name": "get_labs", "status": "ok"}],
  "review": {"by": "u_204", "decision": "edited", "finalHash": "sha256:77ab..."}
}

The weak version logs "prompt": "Patient John Smith, 54, ..." in full. That fails privacy review, and it still omits the model version.

What goes wrong

  • A raw-text log. It copies patient or client data into a store with weaker controls.
  • A missing version. "gpt" or "latest" cannot be reconstructed after an update.
  • Editable logs. If staff can alter records, the trail proves nothing.

Examples

Reconstructing a complaint

A client says the system gave wrong advice in March. The log gives the model version, prompt template v9, and a reference to the document revision that was used. The team re-runs it, finds the template cut off the last page, and shows the reviewer had edited the text before sending.

The alias trap

A record stores model: "latest". After two provider updates nobody can say which model wrote the March output. The fix is to log the pinned version string returned in the API response, not the alias requested.

Key points

  • Test every log design with one question: can a reviewer explain this output months later from the record alone?
  • Record the exact model version, prompt template version and key parameters on every run.
  • Store inputs by reference and hash, not raw sensitive text, so the log is not a second copy of the data.
  • Log tool calls and the reviewer's decision, including edits, with a hash of the final text.
  • Make the log append-only or tamper-evident, with restricted access and its own retention rule.

Common mistakes

  • Logging raw prompts that contain names, diagnoses or account numbers.
  • Logging a model alias instead of the exact version.
  • Skipping the human action, so the trail ends at the model.
  • Letting application admins edit or delete audit records.

Check yourself · 2 of 3

How should an audit record refer to a patient's source document?

Choose one answer

Check yourself · 3 of 3

What makes an audit log trustworthy as evidence?

Choose one answer

Practice items, not counted towards your mastery.

Start here

Where to go in your country