Pharmaceutical Inspections and Compliance Essentials: AI Audit Trails

Pharmaceutical inspections and compliance essentials for AI-assisted batch release: what inspectors examine and the minimum tamper-evident audit trail.

Pharmaceutical Inspections and Compliance Essentials: AI Audit Trails
Written by TechnoLynx Published on 27 Nov 2025

Pharmaceutical inspections and compliance essentials come down to one question an inspector keeps asking: can this site show, from its own records, that every batch was made and released under control? EU inspections examine the quality system, documentation, production and quality control, plus the batch records of specific products. FDA CGMP inspections cover systems, with the quality system one of them. When an AI model’s output feeds a release decision, that output becomes part of the CGMP record, and every CGMP record is open to inspection. So we would have the audit trail capture five things: what triggered the model, the confidence it reported, the model version and configuration in use, any human override with the reason for it, and the final disposition. We would keep that trail, tamper-evident, inside the validated electronic batch record (EBR) or manufacturing execution system (MES) that the quality unit and the Qualified Person (QP) review before release.

The rest of this article covers each part of that answer: what inspectors examine, which fields an AI-assisted decision needs, how to make the trail tamper-evident, when it gets reviewed, and where the regulations are firmer or softer than people tend to assume.

Pharmaceutical Inspection and Compliance Essentials at a GMP Site

The European Commission’s guideline on conducting inspections says the inspector’s primary goal is to decide whether the elements of the quality assurance system are effective and suitable for achieving GMP compliance, and whether products comply with their marketing authorisation. A general GMP inspection normally covers quality management, personnel, premises and equipment, documentation, production, quality control, contract manufacture and analysis, and complaints and recalls. A product-related inspection goes further into one or more completed batches. It looks at SOPs, the product quality review, manufacturing formulae, records and instructions, and specifications and methods of analysis. Inspectors carry identification that refers to their powers of entry, their access to data and their right to collect samples and documents.

The FDA frames the same work in terms of systems. Compliance Program 7356.002 (issued September 2022) audits a quality system, facilities and equipment, materials, production, packaging and labelling, and laboratory controls. The quality system includes the quality unit’s review and approval duties, batch release among them. Under the programme’s state-of-control test, an establishment is out of control if any one system is, and a system is out of control when the quality, identity, strength and purity of its products cannot be adequately ensured. Documented CGMP deficiencies are enough to support regulatory action even without a violative physical sample.

Several items in the programme matter directly to anyone running software on the line:

  • qualification, validation and security of computerised or automated processes, listed under production, packaging and laboratory systems;
  • contemporaneous and complete batch production documentation;
  • quality and retention of raw data, correlation of result summaries to raw data, and the presence of unused data;
  • documented approval of computer revalidation.

Which sites get visited is also decided by risk. The FDA weighs facility type, compliance history (including whether the site has been inspected in the last four years), hazard signals such as recalls, the inherent risk of the product and inspections by foreign partners. The agency can also request records remotely under section 704(a)(4) of the FD&C Act. For an AI system, that means its records may be read away from the shop floor, with nobody present to explain them.

What Audit Trail Do We Need When AI Helps Decide Batch Release?

At minimum, we would keep a record per decision event that links the input, the model’s output and confidence, the exact model version and configuration, the human reviewer’s accept, edit or reject (with identity, timestamp and rationale), and the final disposition. A secondary Part 11 guide from siareg.ai describes a “minimum viable AI audit trail” in almost these terms. Each AI suggestion is timestamped with its model and prompt-template version, the reviewer’s accept, edit or reject is recorded with identity, timestamp and rationale, and the difference between the AI proposal and the accepted version is stored. The chain from source data through suggestion, human edit and final record to electronic signature stays intact and queryable. The AI Security and Safety glossary lists a similar scope: input data, model version and configuration, feature values, confidence scores, any human overrides, and the outcome. An arXiv paper on deep learning visual inspection for Class III medical devices adds that AI inspection outputs such as classifications and confidence levels must be traceable to a model version. That paper is about devices, but the traceability logic carries over to drug-product visual inspection.

What anchors these three sources in GxP is the regulators’ definition of an audit trail. The WHO’s 2021 data integrity guideline says an audit trail must let you reconstruct the “who, what, when and why” of an action on a GxP record. The MHRA’s 2018 guidance says the same and adds that the items included should be the ones relevant to reconstructing the process. For a release decision shaped by a model, reconstructing the “what” and the “why” is impossible without the model’s output and the version that produced it.

Minimum Fields for an AI-Assisted Release Record

Field What it records Why an inspector needs it
Trigger event and input The unit, image or data set the model evaluated, linked to batch and time Data and the metadata about it must be recorded together, and the source capture must be available to reconstruct the activity
Model output and confidence Classification, score and any alternatives AI audit-trail guidance counts confidence scores and alternatives as part of the decision record
Model version and configuration Identifier of the validated model and its runtime settings at decision time Retention must cover configuration settings specific to each record
Human review and override Accept, edit or reject, with user identity, role, timestamp and reason Changes must be traceable to a person, with date, time and reason, and the original value must stay visible
Final disposition and signature The release or reject decision, signed by an identified person Where a computerised system records certification and batch release, Annex 11 says it should allow only Qualified Persons to certify and should record who did

The siareg.ai guide is blunt that autonomous AI decisions on lot disposition should not happen, because the signatory has to be an identified, accountable person. The FDA’s data integrity Q&A adds a related rule: if a result is invalidated, the full batch record given to the quality unit still includes the original data and the investigation that justifies invalidating it. When a model flags a unit and a reviewer overrides it, we would treat the flag the same way. It stays in the record next to the reason it was overruled.

Why the Model Version Has to Be Logged per Event

We would not rely on logging the model version once in a validation report. The record should show which model version produced each individual output. An arXiv paper on audit trails for large language models argues that the trail should bind the approved model version to a specific deployment instance and capture the runtime configuration that shapes behaviour. The aim is to keep enough to tell whether a change in configuration explains a change in outcomes. The WHO applies the same principle to analytical processing: each version of a processing method must be recorded so that all data processing can be reconstructed. We would treat a model that classifies a vial as a processing method in this sense.

The medical-device paper limits itself to locked models, which must be fully validated before use and revalidated after changes. It expects any change to inspection software, acceptance limits or configuration to go through change control and revalidation, and it calls for audit trails of every updated model version. The draft Annex 22 on AI, now at consultation stage, also expects change control for models used in medicines manufacturing. It sets requirements for the selection, training and validation of AI models and expects continuous oversight, including model performance monitoring and procedures for human review. If the batch record names the model version, an inspector can check that every decision was made by a version that had passed change control. Without it, nobody can.

Making the Trail Tamper-Evident Inside the Validated System

Tamper evidence means three things in practice: the audit trail is always on, no user can edit it, and any attempt to disable or change it leaves its own entry. The WHO expects GxP audit trails to be enabled at installation, to stay enabled at all times, and to be checked periodically. Where a trail can be disabled, the disabling must itself appear in the trail. The MHRA says users should not be able to amend or switch off the audit trail, and an administrator’s change must be retained as a record. The draft revision of EU Annex 11 goes further. It asks that audit trail functionality be enabled and locked at all times, that no user can edit audit trail data, and that only a system administrator not involved in GMP activities can change the settings. The draft also asks that entries be recorded at the time of the event rather than at the end of a process, and that the system prompt for a reason whenever a value changes.

In the US, Part 11 §11.10(e) calls for secure, computer-generated, time-stamped audit trails that independently record operator entries and actions that create, modify or delete electronic records. The siareg.ai guide notes that an AI suggestion a reviewer accepts is exactly such an action, and it describes this as the area where AI integration is most often done badly.

How you build tamper evidence is an engineering choice. The LLM audit-trail paper uses an append-only log in which each record carries a SHA-256 hash over its payload and the previous hash, so auditors can replay the chain to detect modification or truncation. In a GxP plant, though, we would not stand up a separate ledger next to the EBR. The record an inspector reviews is the one in the validated system, and a parallel log nobody reviews adds a reconciliation problem without adding evidence. Once a batch is released, the draft Annex 11 expects GMP data and audit trails to be protected from change for the whole retention period, either as read-only in place or moved to a validated archive.

Audit Trail Review Belongs with the Batch Record, Before Release

Reviewing the AI audit trail is part of reviewing the batch, not a separate exercise run afterwards. The FDA’s data integrity Q&A compares audit trail review to checking cross-outs on paper and expects the people who review a record to review its audit trails at the same time. Because §211.22 requires data review before batch release, the audit trail review follows the same timing. One practice review quotes the MHRA’s wording that audit trail review is “performed as part of the review of the record and not as a separate exercise”.

The draft Annex 11 then says who must see it: audit trail reviews with direct impact on product release should be available to the QP at the time of batch release. The Annex 11 currently in force already expects that records supporting batch release can be printed in a form showing whether any data changed since the original entry. For an AI-assisted inspection step, we would show the QP on the release screen which units the model flagged, which flags were overridden, by whom and why. A reviewer should not have to dig for that later.

Data Audit Trails Are Not System Logs

A data audit trail records actions on GxP-relevant data, such as creating or changing a result or a manufacturing entry. A system log records logins, password changes, configuration adjustments and role management. ISPE (2026) notes that only the first kind is expected in routine record review, while system logs are managed through separate, risk-based processes. For AI, we treat the per-decision fields in the table above as data audit trail. Inference latency, GPU utilisation and container restarts are system telemetry: useful to engineering, but not what the QP reviews. Mixing the two buries the signal reviewers need under noise they do not.

Review should also stay inside the validated system. ISPE describes exported audit trails annotated on spreadsheets or printouts as error-prone, highly vulnerable to manipulation and out of line with PIC/S PI 041-1. Once exported, the relational link between an entry and its record is lost. PIC/S adds that, for true copies, PDF versions of electronic data should be prohibited where metadata could be lost. An MLOps dashboard outside the EBR fails for the same reason: the trail an inspector relies on has to be the one linked to the batch.

How Much of This Is Legally Required?

The FDA’s Part 11 scope and application guidance says the agency does not intend to enforce Part 11’s validation, audit trail, record retention and copying requirements as explained in that guidance. Records must still meet the underlying predicate rules, though, and the agency can act on those. The FDA does still enforce access limits, operational and authority checks, accountability policies for electronic signatures and the signature requirements themselves. The FDA recommends deciding on audit trails from predicate rule needs, a documented risk assessment and the potential effect on product quality and record integrity. It adds that audit trails are particularly appropriate where users create, modify or delete regulated records during normal operation. A model whose output a reviewer accepts into a batch record fits that description, which is why we treat the audit trail as needed in practice rather than optional.

The EU text currently in force is also framed in terms of risk. Annex 11 asks that “consideration should be given, based on a risk assessment,” to a system-generated audit trail, with reasons for GMP-relevant changes documented and trails regularly reviewed. The stricter “enabled and locked at all times” wording comes from the 2025 Annex 11 consultation draft, and Annex 22 is also at consultation stage. Neither should be described as final law, though both are clear signals of where inspectors’ expectations are heading. Where an AI system also counts as high-risk under the EU AI Act, that Act adds its own logging obligations. Our EU AI Act playbook for GxP teams covers that overlap.

Recording AI-Assisted Decisions in the EBR

The FDA notes that an EBR can be designed to save automatically after each entry, like indelible contemporaneous entries on paper. The approach we would take treats the model as one more attributed source within that existing validated system. PIC/S already expects records to identify “the individual or computerised system” that performed a task. In concrete terms:

  1. Define the model’s intended use and acceptance criteria in the validated system’s requirements, so the release role of the AI is written down before anything runs.
  2. Write each inference into the EBR or MES as a contemporaneous entry attributed to the model by its version identifier, carrying input reference, output and confidence.
  3. Require the human review step as a separate attributed entry, with a reason captured whenever the reviewer departs from the model’s output.
  4. Let only a Qualified Person certify disposition, with the system recording who certified it.
  5. Route every model update through change control, so a new version cannot appear in batch records before it is approved.

Building the harness, regression suite, drift monitoring and release gates that keep such a model inside its validated envelope is reliability engineering, and it is a different job from improving the model’s accuracy. Our AI governance and trust work covers that engineering side. For the wider validation question, see what GxP compliance actually requires for AI software in pharmaceutical manufacturing. For the vision-specific case, see our guide to AI visual inspections.

One limit is worth stating plainly. An audit trail shows that events happened in a verifiable order, but it does not explain why the model behaved as it did. Whether a model’s call on a borderline vial was right is a question for validation evidence and performance monitoring. A complete trail only lets you ask that question about the right model version.

FAQ

What Is Pharma Compliance?

In the US, the core rules are the CGMP regulations in 21 CFR Parts 210 and 211, which set minimum requirements for the methods, facilities and controls used in manufacturing. In the EU, inspectors check adherence to GMP and to the marketing authorisation. For a broader introduction, see what GxP means in pharma.