Pharma IT

Your Deviations Are Talking: AI in CAPA and Deviation Management

An FDA warning letter on AI use put quality teams on notice. Here is where AI helps in deviation trending, CAPA and complaints, and what must stay human.

Mrudula Kulkarni
By Mrudula Kulkarni
Managing Editor - Pharma Now
Nov 19, 202611 min read
Your Deviations Are Talking: AI in CAPA and Deviation Management

Introduction

On April 2, 2026, FDA did something it had never done before. It issued a warning letter with a dedicated section on the inappropriate use of artificial intelligence in pharmaceutical manufacturing.

The firm, Purolea Cosmetics Lab, told investigators it had used AI agents to draft drug product specifications, procedures and master production records. When asked why process validation was never done before distribution, the answer became the line every quality leader now remembers:

"The AI never told us it was required."

The lesson is not that AI for quality is dangerous. Legal analysts were clear that FDA does not prohibit AI in cGMP work, and that the manufacturer stays responsible for understanding and meeting its obligations. The lesson is that AI without governance fails the same way a poorly trained analyst does, only faster.

This guide shows where AI genuinely helps inside a pharmaceutical quality management system: deviation trending, CAPA support and complaint triage. It also shows the guardrails that keep each use defensible.

Why Quality Leaders Are Under Pressure Right Now

Enforcement is rising and the same weaknesses keep appearing. Drug and biologics warning letters climbed 59 percent in fiscal year 2025, from 190 to 303. Medical device letters stayed high, and most of them traced back to the quality system itself.

The weak points are the exact processes this article covers. Investigation of discrepancies, CAPA and complaint files all sit near the top of the citation lists.

FDA enforcement signal (FY2025)

Figure

Drug and biologics warning letters, FY2024 to FY2025

190 to 303 (up 59%)

Device warning letters in FY2025

44 (47 in FY2024)

Device letters citing the quality system regulation

38 (27 in FY2024)

Device letters citing CAPA deficiencies

26

Device letters citing complaint files

23, or about 52% of 44

Drug Form 483 citations under 21 CFR 211.192 (investigations)

164 observations, 5.8%, ranked 2nd

Device Form 483 citations under 21 CFR 820.100(a) (CAPA)

279 observations, 10.5%, ranked 1st

A separate review of 85 drug warning letters found 21 CFR 211.192, which covers production record review and investigation of unexplained discrepancies, cited 22 times. Investigation quality is a recurring theme, not a one-off.

Device makers face a new inspection lens as well. The Quality Management System Regulation took effect on February 2, 2026, and inspectors now assess complaint handling, trending and escalation alongside CAPA effectiveness and timeliness.

Where AI Earns Its Place: Three Jobs, One Principle

The principle is simple: AI assists, people decide. Each of the three use cases below follows it, because the quality unit's accountability cannot be delegated to software.

Use case

What AI does well

What stays human

Common regulatory anchor

Deviation trending

Reads free text, groups similar events, flags recurrence

Classifying risk, deciding systemic impact

21 CFR 211.192, ICH Q10

CAPA support

Finds similar past events, prompts root cause hypotheses, checks plan completeness

Approving root cause, defining effectiveness criteria

21 CFR 820.100(a), ICH Q10

Complaint triage

Routes intake, detects duplicates, flags potential reportability

Final severity, reportability and closure decisions

21 CFR 820.198, 21 CFR 211.198

Deviation Trending: From Lagging Reports to Early Signals

Most sites trend deviations by counting them. Counts by month, by area, by category. The trouble is that the real story lives in the free-text narrative, where the operator describes what actually happened.

Deviation trending with AI starts there. Text mining models read narratives, assign consistent categories and surface clusters that a monthly pivot table never shows: the same gasket, the same shift handover, the same supplier lot.

What the evidence says

Peer-reviewed work on pharmaceutical manufacturing deviations is still thin, so the best published evidence comes from a close cousin: safety event reports. Boxley and colleagues, writing in Scientific Reports in 2023, trained models on 3,861 medication-related event reports and tested three algorithms.

The gradient-boosting model (XGBoost) performed best, with an average F1 score of 0.72, against 0.54 for logistic regression and 0.59 for elastic net. The authors noted that most organizations manually review only the most serious cases, which leaves the majority of reports unanalyzed.

A separate Frontiers in Drug Safety and Regulation report from FDA-affiliated researchers noted that FAERS receives more than 100,000 reports a year tied to suspected medication errors. It explored AI-supported categorization built around human and machine collaboration rather than full automation.

The trap hidden in the numbers

The same study contains a warning every quality head should read. Models were strong on common categories and weak on rare ones, and the rare ones are often the dangerous ones.

Category (XGBoost)

Reports in test set

Recall

F1 score

Wrong drug

611

0.91

0.92

Wrong dosage form, technique or route

348

0.79

0.86

Wrong rate

104

0.63

0.73

Wrong patient

48

0.35

0.51

Monitoring error

45

0.36

0.51

Notice that the rarest categories still posted accuracy of 0.97. Accuracy flatters a model when events are rare. A leader who approves a tool on accuracy alone could miss two out of three of the events that matter most.

How to apply it

  • Judge any trending model on recall for high-risk categories, not overall accuracy.

  • Keep a person reviewing every event the model labels low risk until performance is proven on your own data.

  • Trend by cluster and recurrence, not only by category count.

  • Link every trend signal to an investigation or a documented decision not to act.

CAPA Support: Draft Less, Learn More

CAPA is where weak investigations become visible. FDA's own warning letters show the pattern: in one April 2026 letter, the agency said a quality system had not ensured that systemic problems were addressed by a comprehensive CAPA, and it asked the firm for an independent assessment of how it investigates deviations, discrepancies and failures.

That is the opportunity for CAPA support tools. The value is rarely in writing the CAPA. It is in the quality of thinking before and after it.

Five practical roles for AI in CAPA

  1. Similar-event retrieval: surface past deviations, complaints and audit findings that resemble the current event, so teams see recurrence before they declare a root cause.

  2. Root cause prompts: suggest hypotheses and untested questions, clearly labeled as prompts and never as conclusions.

  3. Plan completeness checks: compare a draft CAPA against your own procedure and flag missing owners, dates or verification steps.

  4. Effectiveness monitoring: watch the data after closure and alert when the original failure mode reappears.

  5. Management review summaries: consolidate open CAPA status for leadership, with source records linked.

What AI must never do in CAPA

The Purolea letter is the clearest boundary. FDA's position, as summarized by legal analysts, is that output from an AI agent must be reviewed by qualified people, and the quality unit remains fully accountable. An AI tool that cannot tell you a requirement exists will never tell you it is missing.

That is why root cause approval, risk assessment and effectiveness criteria should always carry a named human owner and a documented review.

Named owners and documented reviews are the core of AI governance. See why pharma is starting to treat that governance like GMP, with validation, monitoring and audits.
Read:
AI Governance In Pharma | Is It Becoming The New GMP?

Complaint Triage: Speed With Defensibility

A complaint inbox is a race against time. Every message could be noise, or it could be the first signal of a patient safety problem that triggers a reporting clock.

Complaint triage is the most natural fit for classification AI because the task is repetitive, the categories are defined and the cost of delay is real. For device makers, the stakes are visible: complaint files appeared in 23 of the 44 FY2025 device warning letters.

A safer triage design

  • Intake classification: route each complaint to the right team using product, failure mode and symptom language.

  • Duplicate and cluster detection: group related complaints so one lot problem is not treated as ten separate events.

  • Potential reportability flag: raise a visible alert for a human to assess. Do not let a model decide that something is not reportable.

  • Complaint to CAPA linkage: connect complaints, nonconformances and investigations, which regulators now expect to see as a closed loop.

The Boxley study found that 754 of 1,159 test reports (65.1 percent) belonged to two or more categories. Real complaints are messy and overlapping, so design triage as a set of flags that a person confirms rather than a single label that closes the case.

The Guardrails Regulators Are Building

Three developments define the rules of the road for AI for quality as of this writing.

Development

Date

What it signals

FDA and EMA joint Guiding Principles of Good AI Practice

January 14, 2026

Ten principles, including risk-based approach, clear context of use, lifecycle management and scheduled monitoring for data drift

FDA warning letter citing overreliance on AI

April 2, 2026

Existing cGMP rules already apply to AI output, and human review is expected

EU draft Annex 22 on AI

Consultation July 7 to October 7, 2025

Static, deterministic models only in critical GMP uses. Generative AI and large language models excluded from critical uses

Annex 22 is still a draft and not yet in force, and an EMA workshop in mid-2026 did not amend the exclusion of generative AI from critical use. The draft does not prohibit generative AI in non-critical GMP applications.

Whether a specific use is critical is a documented, risk-based judgment for your quality unit. A reasonable design pattern, though not a regulatory requirement, is to use a frozen classifier for routing and trending, and to confine any large language model to summarizing and searching with a person checking the output.

Annex 22 is still a draft, but it already draws a clear line for AI in GMP-critical work. See what static, deterministic and explainable models mean, and which uses stay out of bounds.
Read:
Draft Annex 22 | Rules On AI Model Choice In GMP

The Bottom Line

The Purolea story is not a reason to avoid AI. It is a reminder that tools do not carry accountability, people do. The leaders who win the next inspection will be the ones who can show where AI helped, where a person decided and how performance was checked.

Start with one use case, measure it against your own baseline and keep the human in the loop. That is how AI for quality becomes a competitive advantage instead of a citation.

FAQs

What is deviation trending in pharma?

Deviation trending is the systematic analysis of deviations over time to find recurring causes, hotspots and early warning signals. Done well, it moves a site from reacting to single events to preventing repeat failures. AI adds the ability to analyze free-text narratives at scale.

Can AI be used for CAPA in GMP environments?

Yes, as support. FDA has said that it does not prohibit AI in cGMP activities, but the manufacturer stays responsible and AI output needs qualified human review. Use AI for retrieval, prompts and monitoring, and keep root cause approval with people.

How does AI help with complaint handling?

AI can classify incoming complaints, detect duplicates, group related events and flag potential reportability for human assessment. It speeds up routing and reveals patterns across large volumes. A person should confirm severity, reportability and closure.

Is generative AI allowed under EU GMP Annex 22?

The current draft excludes generative AI and large language models from critical GMP applications and limits critical uses to static, deterministic models. It does not prohibit them in non-critical uses, and the draft is not yet in force.

What is the difference between a deviation and a CAPA?

A deviation is any departure from an approved procedure, specification or expected condition. A CAPA is the corrective and preventive action taken to fix the cause and stop recurrence. Deviations often feed CAPAs, and weak investigations undermine both.

TopicsPharma ITArticle
Mrudula Kulkarni
Written by
Mrudula Kulkarni
Managing Editor - Pharma Now

Reporting on the science, business and regulation shaping the pharmaceutical industry.

Discussion

Loading discussion…

More in Pharma IT

All articles →