Guide: what the draft Annex 22 requires of AI in GMPRead the guide

Deviation investigation and CAPA

AI finds the deviations in the history that describe the same problem, even in different words, and proposes a draft investigation with every source cited. Quality assurance decides.

How it would work

A new deviation, from its record to the draft reviewed by quality assurance.

  • AI prepares
  • A person decides
  • Recorded in the trail
Illustrative example, not a real case

The process, documents and data in this walkthrough are fictitious. They show how the AI would work; your actual process may be different, and the system is designed around yours.

A new deviation

It is opened in the quality system like any other. AI receives its description and read access to the history.

What comes in

Fluid bed 2

New deviation

Area
Wet granulation
Description
Granule moisture out of range at fluid bed discharge
Product
Sample tablet
Detected in
In-process control

DV-A, closed

Fluid bed 2: wet granules at discharge. Drying was repeated.

DV-B, closed

Fluid bed 2: incomplete drying. Cause: moisture sensor out of calibration.

CAPA-B

Action: increase the sensor's calibration frequency. Effectiveness not yet verified.

Today and with AI

Where the investigator's time goes today, and what changes.

TodayWith AI

TodayThe history is searched by hand, and the same problem is described in different words in each record

With AISearch by meaning finds similar deviations even when they use other words

TodayIf earlier CAPAs aren't reviewed together, a recurring cause is treated as an isolated case each time

With AIDeviations that describe the same problem appear together, with their CAPAs

TodayThe draft investigation is written from scratch

With AIThe draft comes with the structure of your procedure and the source of every statement

TodayThe investigator decides the root cause and the CAPA

With AIThe same: quality assurance decides, and the audit trail keeps what it accepted, corrected or rejected

Which AI it uses and why

Two parts: one searches and the other drafts.

Search by meaning
Each deviation becomes a vector (an embedding) so the ones that mean the same can be found even in different words.
Drafting with sources
A large language model (LLM) with retrieval-augmented generation (RAG): it only drafts from what the search hands it and cites every source.
Generative
Its output is probabilistic. That is why it doesn't classify criticality or close anything: it prepares a draft.
What it doesn't do
It doesn't decide the root cause or the CAPA, and it doesn't change quality system records.

Regulatory fit

Where it sits in the draft Annex 22 and which regulations apply.

  1. CriticalIt decides something GMP: only with a static, deterministic model
  2. Non-criticalAI prepares and a person decides
  3. Outside GMPAnnex 22 doesn't apply directly

The draft Annex 22 keeps generative AI out of critical applications. Here the model makes no GMP decision: it proposes, and personnel with adequate qualification and training are responsible for the result, which is what the draft requires for non-critical uses.

EU GMP Chapter 1, 1.4 (xiv)
An appropriate level of root cause analysis; where the true root cause can't be found, address the most likely one; justify human error; CAPAs and monitoring of their effectiveness.
Draft Annex 22
Generative AI only in non-critical uses, with qualified personnel responsible for the result.
Annex 11
The computerized system is validated under Annex 11; the model adds what Annex 22 requires.

See the Annex 22 guide

The seven pieces of evidence for this case

What we would deliver for this model.

01Intended use

Find similar deviations and CAPAs and draft the investigation. It doesn't classify criticality or approve.

02Level of autonomy

Drafts. Nothing leaves the draft without quality assurance's approval.

03Test data

Closed deviations from your history, with the approved investigation as the reference, kept apart from the ones used to tune the instructions.

04Sources for every proposal

Every statement links to the deviation or CAPA it comes from; anything without a source is marked as pending.

05Version under change control

The model, its version, the instructions and the search configuration.

06Recorded oversight

The proposal and what quality assurance accepted, corrected or rejected.

07Monitoring in production

How many proposals are corrected or rejected; if the figure rises, the system flags it.

See what the seven pieces of evidence are

Frequently asked questions

About this use case.

  • Under the draft Annex 22, generative AI is kept out of critical applications, but it can be used in non-critical tasks if personnel with adequate qualification and training are responsible for the result. Preparing a draft investigation fits there: AI proposes and quality assurance decides the cause and the CAPA.

  • AI only drafts from the deviations and CAPAs the search hands it, and every statement cites its source. Anything without a source is shown as pending verification, and the reviewer sees the draft next to its sources.

  • What the model proposed, with which version and instructions, and what the person accepted, corrected or rejected. Those corrections are also the measure of how the model performs in production.

Other use cases

The same way of working in other processes.

Automated visual inspection of injectables

A vision model checks every filled container, separates the defective ones and sends the ones it isn't sure about to a person.

GMPManufacturingComputer visionCritical

Pharmacovigilance case intake

AI extracts the data from the report, checks whether the case is valid, proposes the MedDRA coding and looks for duplicates.

GVPPharmacovigilanceExtraction and codingOutside GMP

Laboratory equipment qualification

AI drafts the OQ protocol from the URS and the manufacturer's manual, with one test per requirement and the source of every criterion.

GMPQuality controlExtraction and draftingNon-critical

Process validation and ongoing verification

AI gathers batch data against the protocol's criteria, flags what drifts from the trend and drafts the report with its sources.

GMPQuality assuranceExtraction and trendsNon-critical

Tablet and blister inspection

A vision model checks every blister on the packaging line and separates incomplete ones or those with damaged tablets.

GMPManufacturingComputer visionCritical

Laboratory audit trail review

AI ranks the events of the chromatography data system's audit trail by priority, hiding none; the reviewer decides.

GMPQuality controlRules and anomaliesNon-critical

Inspection readiness

For a question from the inspector or a self inspection, AI finds the records that answer it and proposes a reply with its sources.

GMPQuality assuranceSearch with sourcesNon-critical

Material receipt

At each receipt, AI compares the delivery note, the purchase order, the supplier's labels and its certificate of analysis, and flags what doesn't match.

GMPSupply chainExtraction and comparisonNon-critical

What we need from you

To plan the system with real data.

  • An export of the deviation and CAPA history from your quality system
  • Your investigation procedure and its template
  • A set of closed deviations for testing
  • Who in quality assurance will review the drafts during validation

Does it look like your process?

Tell us how you do it today and we'll tell you whether AI adds enough to justify validating it.