Catalog / Healthcare & Clinical / HLTH-029

GMP batch record review & deviation/CAPA assistant

Review-by-exception of electronic and scanned batch records, deviation triage, root-cause drafting and CAPA proposals for pharma, biotech and medtech quality units.

Before a pharmaceutical batch can be released, quality staff read hundreds of pages of batch records line by line, then investigate every deviation by hand. An assistant pre-reads the record, flags only the exceptions, classifies deviations, drafts investigations from similar historical cases and suggests CAPAs. The Qualified Person (QP) keeps the release decision. In the EU this runs under EU GMP Annex 11 and the draft AI-specific Annex 22, which restrict which models may be used where.

Problem & value

  • Today: Quality assurance reviews each batch record for completeness, correct entries, signatures, in-process limits and cross-references to equipment, material and lab data. Paper or hybrid records add transcription and scanning work. Deviation investigations take weeks, and root-cause sections are often copy-pasted or shallow, a recurring theme in regulator inspection findings (repeat deviations, ineffective CAPAs).
  • AI value: shorter record-review lead time (release is on the critical path for working capital and supply), consistent deviation classification, faster retrieval of comparable past events, better trend detection across batches, sites and suppliers, and quality staff time shifted to judgement.
  • Evidence: vendors and pharma companies publish case studies on review-by-exception, but independent, comparable figures are scarce; treat quoted time savings as vendor claims and measure your own baseline.
  • Regulatory context: data must satisfy ALCOA+ (attributable, legible, contemporaneous, original, accurate, complete, consistent, enduring, available). The EMA/PIC/S consultation on revised Annex 11 and a new Annex 22 on AI (July 2025) sets expectations for AI used in GMP-critical applications [1][2].

Variants

  • Small molecule / biologics / cell and gene therapy: biologics and advanced therapies have more process data and shorter shelf life, so review speed matters more.
  • Contract manufacturers (CDMO): many clients, many record formats, client-specific deviation rules.
  • Medtech (ISO 13485, device history record): same pattern for device history records and nonconformance/CAPA under MDR quality systems.
  • Packaging and QC lab record review: analytical data review (LIMS, chromatography data systems) with the same exception logic.
  • Sterile / aseptic: environmental monitoring and media-fill data feed the review.

How it works

  1. sources: eBR/MES export | scanned paper record | historian | LIMS | QMS history
  2. ingestion + OCR/layout parsing (paper) + normalisation to a batch data model
  3. deterministic rule checks (limits, required entries, signatures, time sequence, calculations)
  4. statistical checks (out-of-trend vs. historical batches, multivariate drift)
  5. LLM layer: summarise exceptions, link to SOP clause, retrieve similar deviations (hybrid RAG)
  6. deviation classification (minor/major/critical) + draft investigation + CAPA proposal
  7. QA reviewer confirms/edits
  8. QP certifies release
  9. audit trail of AI output vs. final decision
  • Deterministic first: completeness, limit and signature checks should be coded rules or validated MES logic, not an LLM. This is where Annex 11 validation is simplest.
  • Statistical layer: control charts, process capability and multivariate models on historian data; flags go to the human, not into the record.
  • LLM layer: summarisation, narrative drafting and retrieval over deviation history. Output is an unvalidated suggestion that a qualified person reviews. Draft Annex 22 limits models in critical GMP applications to static, deterministic ones and says generative AI and LLMs should not be used there; LLMs may support non-critical activities under qualified human review [2]. A defensible design keeps the LLM advisory and outside the decision path.
  • Human-in-the-loop: QA reviewer for every exception, QP for release, approval signatures only by humans.

Data preparation

  • Data and location: electronic batch records in MES/eBR, scanned paper records in a DMS or on file shares, deviation/CAPA/change-control history in the QMS, process data in the historian, results in LIMS, SOPs and master batch records in a document system.
  • Typical gaps: scans of mixed quality with handwriting and strike-through corrections, free-text deviation narratives of varying depth, inconsistent classification codes over the years, duplicated or copy-pasted root causes, and no link between a deviation and its batch, equipment and material data.
  • Preparation steps: export QMS history and close the gaps in category schemes (PREP-019); digitise and OCR paper records, with human verification of critical values (PREP-006, DOC-014); normalise MES, historian and LIMS data into one batch data model (PREP-005); harvest labels from QA-approved closed deviations (PREP-020); build a seeded-error test set with QA experts (PREP-018); keep AI output strictly separate from original records for ALCOA+.
  • Tools: Docling or PaddleOCR for parsing, a vector store with per-site access control, and existing QMS exports.
  • Effort share: roughly 50-60 percent of the total project; data lineage and test-set documentation are validation deliverables, not extras. Start with a readiness check (GUIDE-003, PREP-001).

Implementation paths

Which path for whom

  • Enterprise: Path C. Batch records and deviation history are core, proprietary GxP data, and draft Annex 22 favours frozen, version-pinned models that you control; use vendor MES/QMS (Path A) for the deterministic review-by-exception layer.
  • Developer: Path C. Open-weight models and Docling/PaddleOCR let you build and validate the advisory layer with full change control.

Path A — Buy (off-the-shelf)

  • MES / eBR with review-by-exception: Körber PAS-X (DE, EU), Siemens Opcenter Pharma, Apprentice.io Tulip-based eBR, Rockwell PharmaSuite, Emerson Syncade.
  • QMS with AI features: Veeva Vault QMS, Sparta Systems TrackWise Digital (Honeywell), MasterControl, ComplianceQuest, Qualio (small biotech). Check built-in deviation similarity search, drafting and the vendor's validation package.
  • Choose A when: you already run one of these platforms. Vendor-validated features reduce your CSV burden and keep data inside the GxP system.

Path B — Build on cloud APIs

  • Use frontier LLMs via EU regions (Azure OpenAI EU, Google Vertex EU, AWS Bedrock Frankfurt, Mistral) or document AI (Azure Document Intelligence, Mistral OCR) for paper-record digitisation.
  • Orchestrate with a workflow engine; retrieval over QMS exports via a vector database with access control per site.
  • Needs a GxP supplier assessment of the cloud and model provider, change control on model versions (pin versions), and a validation plan. Best for investigation drafting and summaries, not for release-relevant checks.

Path C — Self-host (open source)

  • Open-weight LLMs (Mistral, Qwen, Llama-class, gpt-oss) served by vLLM; embeddings such as BGE-M3 or multilingual-e5; parsing with Docling or PaddleOCR; pgvector, OpenSearch or Qdrant for retrieval.
  • A frozen, version-pinned model fits the Annex 22 demand for controlled, static models and keeps proprietary process data on-premise.
  • Hardware: HW3 for 70B-class models; HW2 for 8-30B models with retrieval. Operations effort is substantial because every model or prompt change is a change-control event.

Path D — Custom training

Fine-tune encoder classifiers for deviation categories or a small LLM on your own deviation narratives when volumes justify it (thousands of closed, QA-approved deviations). Predictive models on historian data need many batches; rare-event models stay weak. Training and test data lineage, acceptance criteria and independent test sets are central in Annex 22 [2].

State of the art (2026)

  • Review-by-exception on structured eBR data is established; the newer step is AI triage and drafting on top of it, offered by MES and QMS vendors.
  • LLM retrieval over deviation history works well for finding comparable events and proposing investigation checklists; weaker at true root-cause reasoning, where models produce plausible but unsupported causes.
  • Paper records remain common: handwriting, corrections (single-line strike-through with initials) and stamps are error-prone for OCR. Keep human verification of critical values.
  • Regulation is moving: the revised Annex 11 and new Annex 22 drafts, ISPE GAMP 5 second edition and the ISPE GAMP guidance on AI shape validation approaches [1][2][3]. The US FDA published a draft guidance on AI to support regulatory decision-making for drugs in 2025 [4].
  • Limits: hallucinated references to SOPs, missed context not in the record, automation bias of reviewers, and non-reproducible output from non-deterministic models.

Shared resources & combinations

  • Document stack (ocr-docparse, embedding-text, vector-db): DOC-014 parsing for RAG, DOC-019 certificate verification, DOC-016 rule-based compliance checking.
  • Process data: ANOM-005 sensor anomaly detection and PRED-014 soft sensors supply the out-of-trend signals.
  • Quality engineering: SCI-025 FMEA and 8D/CAPA assistant shares root-cause methods.
  • Pharma processes: HLTH-010 pharmacovigilance (product complaints and adverse events feed deviations), HLTH-017 regulatory writing (batch data in submissions).

Effort, cost & KPIs

  • Path A: months for rollout and validation if the platform already exists; licence uplift per site or user.
  • Path B/C: 6-12 months including supplier assessment, validation, SOPs and training; ongoing change control.
  • Cost drivers: computerised system validation, data cleanup, integration with MES/LIMS/QMS, model monitoring.
  • KPIs: batch record review lead time, right-first-time rate of records, deviation cycle time, repeat-deviation rate, CAPA effectiveness, share of AI suggestions accepted vs. corrected, false-negative rate on seeded errors, time to QP release.

People & change

  • Involve early: management (budget, AI policy), the head of QA as process owner, the QP, IT and IT security (validation, access), legal/compliance, and data owners of MES, LIMS and QMS from day one. QA reviewers are the end users and should co-design the exception views.
  • Works council: yes, co-determination is likely. Review logs and acceptance rates show per-reviewer behaviour, so the system is objectively suited to monitor performance (§87(1) no. 6 BetrVG, BAG case law); also inform it when work processes are planned with AI (§90(1) no. 3) and consider an AI expert (§80(3)). Agree a works agreement that excludes individual performance evaluation (GUIDE-004).
  • Data protection: operator names and signatures are personal data; involve the DPO, check AVV with every processor, and run a DPIA if reviewer-level analytics are planned (GUIDE-005).
  • AI literacy: take measures to support staff AI literacy (Art. 4): what the tool can and cannot do, automation bias, how to correct suggestions (GUIDE-006).
  • Pilot and communication: pilot with one product line and volunteer reviewers on closed historical data first (GUIDE-009). Typical concerns are job loss and inspection risk; address them by stating that the tool removes reading effort, not responsibility, and that QA and the QP keep every decision (GUIDE-008).

Risks, regulation & compliance

  • EU AI Act: typically minimal risk, since a GMP quality tool is neither a medical device nor in Annex III. Reclassify if outputs feed a device's safety function. AI literacy (Art. 4) applies.
  • GMP: EU GMP Annex 11 (computerised systems), Annex 15 (qualification and validation), Chapter 4 (documentation), Chapter 1 (quality system) and the draft Annex 22. PIC/S PI 041 and MHRA/FDA data-integrity guidance apply. Manufacturers of devices follow ISO 13485 and 21 CFR Part 820/QMSR where relevant [1][5].
  • Data integrity: AI must not alter original records; keep its output separate with an audit trail, user attribution and version of model and prompt.
  • GDPR: operator names and signatures are personal data; keep staff data minimal and respect works-council agreements (Germany: BetrVG).
  • Mitigations: advisory-only LLM, deterministic checks for critical steps, pinned model versions, sampling-based performance monitoring, defined fallback to manual review.

Getting started

  1. Baseline: review hours per batch, lead time, common record errors, and deviation cycle time.
  2. Classify each planned AI function as critical or non-critical under draft Annex 22 and document the intended use.
  3. Start with non-critical support: similar-deviation search and investigation drafting on closed historical data.
  4. Build a seeded-error test set of past batch records and measure recall of exception detection before any release use.
  5. Run a supplier assessment, a validation plan under change control, and involve QA, IT and the QP from day one.

Sources

  1. European Commission / EMA — Public consultation on revised Annex 11 and new Annex 22 (July 2025) — https://health.ec.europa.eu/medicinal-products/eudralex/eudralex-volume-4_en
  2. EMA — GMP Annex 22 Artificial Intelligence, draft for consultation — https://www.ema.europa.eu/en/human-regulatory-overview/research-development/compliance-research-development/good-manufacturing-practice
  3. ISPE — GAMP 5 Guide, Second Edition — https://ispe.org/publications/guidance-documents/gamp-5-guide-2nd-edition
  4. US FDA — AI to support regulatory decision-making for drug and biological products (draft guidance, Jan 2025) — https://www.fda.gov/regulatory-information/search-fda-guidance-documents/considerations-use-artificial-intelligence-support-regulatory-decision-making-drug-and-biological
  5. PIC/S — PI 041-1 Good practices for data management and integrity — https://picscheme.org/en/publications
  6. Körber — Werum PAS-X MES (life sciences MES) — https://www.koerber.com/en/solutions/software-and-ai/life-sciences-mes
  7. Veeva — Vault QMS — https://www.veeva.com/products/vault-qms/
  8. Regulation (EU) 2024/1689 (AI Act) — https://eur-lex.europa.eu/eli/reg/2024/1689/oj