An AI audit trail: logging what the model saw and decided
An AI audit trail logs each model call's input hash, model version, output and reviewer, so any past decision can be traced and shown to an auditor.
Updated
An AI audit trail is a log of every model call: what went in, which model and version ran, what came out, and who reviewed the result and what they decided. With that log, you can show an auditor what the model saw and decided on a specific date, without relying on memory or on running the model again.
Most teams log the request and the response and stop there. That misses the parts an auditor asks about first: the exact model version, the settings used, and whether a person approved the result.
What to record for every model call
Write one record per call, with these fields:
- Call ID and timestamp in UTC, so every decision has a key you can search by.
- Input hash. A SHA-256 hash of the exact input: the system prompt, the user text, tool definitions and any retrieved passages. If you can keep the full input in your own storage, keep it too. The hash shows later that the saved input is the one that was sent.
- Model name and exact version string, plus settings such as temperature, top-p, seed and maximum output tokens.
- The raw output, stored as returned, before any parsing or cleanup.
- Prompt template version and source IDs for any documents the call used.
- Reviewer ID, review time and decision: accepted, edited or rejected. If a person edited the output, store the edited text in a separate field.
How do you audit an AI decision after the fact?
Start from the decision, not from the model. Find the call ID attached to the outcome, such as a flagged clause or an approved claim. Check the input hash against the saved input. If they match, the input has not changed since the call. Then read the model version and settings, the raw output, and the reviewer’s decision.
If any field is missing, fix that first. An auditor will likely ask about the gap before anything else, and a missing field is hard to explain after the fact.
Why stored outputs beat rerunning the model
It is tempting to answer an audit question by running the same input through the model again. That shows what the model does today, not what it did then. The same prompt can give different answers, as explained in why the same prompt gives different answers. Hosted models can also change behind a version name, and providers retire models on their own schedule. Keeping the exact model you tested is its own job, covered in version control for AI.
Keep the original output as the record. Use a rerun as a second check, and describe it as a check, not as proof.
An open-weight model gives you more control. You can pin the weights file by its hash and keep that exact file for as long as you need it. Even then, results can differ across hardware and software setups, so the stored output still comes first.
How do you prove to an auditor what the model did?
Show the record for the specific call: the input hash, the model version, the raw output and the reviewer’s decision. Then show the controls around the log:
- The log is append-only, so records cannot be edited or deleted quietly. Write-once storage or hash-chaining both work.
- Access to the log is limited to named people, and reads are recorded.
- The log covers the full period. Check that its call count matches your system’s own call count for the same dates.
- Human review is recorded wherever your process requires it, with the reviewer’s name and the time.
An audit trail records what happened. It does not make a system compliant on its own. Whether the record meets a rule is a question for your legal or compliance team. The record also supports your team’s review of the model’s output. It is not legal, medical, tax or financial advice.
How long should you keep LLM logs for compliance?
Retention depends on your obligations and your sector, so set it with your legal or compliance team. Do not copy a number from a blog post, this one included.
The logs hold the inputs the model saw, which is often customer or employee data. Keep them under the same access rules as the source data. Strip API keys and passwords before writing. Consider redacting personal data before the model call, so the log holds less data you have to protect.
When is a full audit trail too much?
A full log costs storage, adds a write to every call, and creates a set of sensitive records you now have to protect. For a low-stakes feature, such as drafting internal summaries that nobody relies on, a hash plus a sample of outputs may be enough. If your calls are few and low-risk, a hosted API with good logging on your side is the simpler choice, and a private model is not worth the work yet.
Hypothetical example: a team makes 1,000 calls a day, and each record is about 10 KB. The log grows by about 10 MB a day. That is small, and the cost of the log is mostly in access control and retention, not disk space.
If nobody reviews the model’s output, the trail still records that fact. Auditors ask that question early, so the answer belongs in the log.
Own Weights can design the trail in from the start, with the model served in your own cloud account or on-prem. Our free AI cost audit maps your AI calls from the code, a useful first step before you decide what to log. Ask us for a call if you want to talk it through.
Questions
How to audit AI decisions?
Start from the call ID attached to the decision, then pull the saved input, the model version, the raw output and the reviewer's sign-off. Check that the input hash still matches the saved input. Each step answers one question: what went in, which model produced the output, and who approved it.
LLM logging for compliance: what do I need to keep?
Keep the request time, a hash of the full input, the exact model version and settings, the raw output, and the reviewer's decision. Set retention with your legal or compliance team, because the right period depends on your own obligations. Treat the logs as sensitive, since they hold the inputs the model saw.
Is AI auditability possible with a hosted API?
Partly. You can log every call on your side, but a hosted provider can change a model behind a version name or retire it, so the log has to hold the output and not just the request. A model you run on weights you pin in your own environment gives you more control over what can change.
Can I reproduce AI outputs for an audit?
Sometimes, and only under tight conditions: the same input, the same model artifact and the same settings. Hosted APIs do not promise identical outputs from one call to the next, so do not promise one to an auditor. Store the original output and treat any rerun as a check.