GAMP 5 and AI: A Practical Guide to Validating Intelligent Systems
GAMP 5 categories don't map cleanly to AI/ML systems. Here's the practical framework pharmaceutical companies are using to validate AI while satisfying FDA and EMA expectations.
David Blewitt
VP Cloud & Part 11 Architecture, GxP Agents ·
ISPE GAMP 5 (Good Automated Manufacturing Practice, 2nd Edition) — including Appendix D11 on AI and machine learning — alongside the FDA Computer Software Assurance (CSA) guidance, forms the modern baseline for computer system validation across pharmaceutical manufacturing, QMS, LIMS, MES, and ERP platforms.
However, legacy GAMP 5 templates were originally written around deterministic software — systems that produce the exact same output for the same input every time.
AI/ML systems don't work that way. They're probabilistic, adaptive, and non-deterministic. And that creates a validation challenge.
Here's the uncomfortable truth: most pharmaceutical companies are validating AI systems using GAMP 5 frameworks that weren't designed for AI — and creating compliance risk in the process.
This guide provides a practical, risk-based approach to AI validation that satisfies regulatory expectations while actually being operationally feasible.
Why Traditional GAMP 5 Categories Don't Fit AI
GAMP 5 classifies software into categories based on complexity and risk:
- Category 1: Infrastructure software (operating systems, databases)
- Category 3: Non-configured products (commercial off-the-shelf with no user configuration)
- Category 4: Configured products (COTS with user configuration, like QMS or ERP)
- Category 5: Custom software (bespoke applications developed specifically for your needs)
The problem: AI/ML systems don't fit cleanly into any of these categories.
Why AI Breaks the GAMP 5 Model
1. AI isn't deterministic
- Traditional software: Same input → same output (always)
- AI software: Same input → probabilistic output (confidence intervals, variability)
2. AI behavior changes over time
- Traditional software: Behavior is fixed until code is updated (change control applies)
- AI software: Model performance can drift as data distributions shift (even without code changes)
3. AI outputs aren't fully explainable
- Traditional software: Every output can be traced to specific code logic
- AI software: Complex models (deep learning, ensemble methods) produce outputs that can't be fully explained through code inspection
4. AI validation requires different testing approaches
- Traditional software: Test all execution paths, verify requirements coverage
- AI software: Test across representative data distributions, measure statistical performance, evaluate edge cases
Translation: If you try to force AI into GAMP 5 Category 4 or 5 and validate it like traditional software, you'll either:
- Over-validate (waste time trying to test deterministic behavior that doesn't exist)
- Under-validate (miss AI-specific risks like bias, drift, opacity)
- Create audit risk (inspectors will ask questions your validation documentation can't answer)
The Proposed AI Classification: Extending GAMP 5
Here's a pragmatic AI classification framework that pharmaceutical companies are using (aligned with GAMP 5 principles but adapted for AI):
AI Category A: Deterministic Rule-Based Systems (Low Complexity)
Description: "AI" systems that use fixed, human-defined rules with no machine learning
Examples:
- Rule-based classification ("If temperature >30°C, flag as out-of-spec")
- Decision trees with fixed thresholds
- Expert systems with predefined logic
Validation approach: Treat like GAMP 5 Category 4 (configured product)
- Test all rule paths
- Verify outputs match expected logic
- Document rule definitions and rationale
Key point: These aren't really "AI" in the modern sense — they're configurable logic engines. Standard GAMP 5 validation works fine.
AI Category B: Fixed ML Models (Medium Complexity)
Description: Machine learning models that are trained once, then deployed in a fixed state (no continuous learning)
Examples:
- Classification models (deviation triage, AE causality suggestion)
- Regression models (batch yield prediction, stability forecasting)
- Natural language processing (extract data from unstructured text)
Validation approach: Risk-based validation with AI-specific testing
- Training phase validation: Qualify training data, document model development, test on validation dataset
- Deployment validation: Test on independent test dataset, measure performance metrics (accuracy, precision, recall), evaluate across subgroups
- Change control: Model retraining or updates trigger validation impact assessment
- Monitoring: Periodic performance review to detect drift
Key point: This is where most pharmaceutical AI lives today. The model is static between retraining cycles. Validation focuses on demonstrating fitness-for-use at the time of deployment.
AI Category C: Continuously Learning Models (High Complexity)
Description: AI systems that update their behavior based on new data without explicit retraining or revalidation
Examples:
- Adaptive process control (manufacturing optimization that adjusts parameters based on real-time data)
- Continuous learning fraud detection
- Reinforcement learning systems
Validation approach: Highest rigor + continuous monitoring
- Initial validation: Same as Category B, but with additional focus on learning mechanisms and convergence behavior
- Continuous monitoring: Real-time performance tracking with defined triggers for intervention or revalidation
- Constraints: Define boundaries within which the AI can adapt autonomously; changes beyond those boundaries require human review
- Regulatory risk: Highest — continuous learning in GxP environments is rare because it's difficult to maintain a validated state
Key point: Most pharmaceutical companies avoid Category C AI in GxP-critical applications because maintaining validation is extremely challenging. If you're considering it, expect intense regulatory scrutiny.
Risk-Based Validation: Match Rigor to Impact
Not every AI system needs the same validation rigor. Use a risk-based approach aligned with ICH Q9.
Validation Rigor by GxP Impact
High-Risk AI (Directly affects patient safety, product quality, or regulatory submissions)
- Examples: Batch release decision support, clinical trial safety monitoring, pharmacovigilance signal detection
- Validation level: Formal validation protocol with defined acceptance criteria, independent review, ongoing monitoring
- Documentation: Full validation package (VMP, requirements, design specs, test protocols, test results, validation report)
Medium-Risk AI (Supports GxP decisions but doesn't make them autonomously)
- Examples: Deviation classification suggestions, CAPA recommendations, investigation template generation
- Validation level: Validation summary with fitness-for-use demonstration, documented testing, human oversight
- Documentation: Validation summary report (lighter than full protocol, but demonstrates performance and limitations)
Low-Risk AI (No GxP impact, used for efficiency or convenience)
- Examples: Meeting transcription, email summarization, internal document search
- Validation level: Basic qualification (fit for intended use), user training, feedback mechanism
- Documentation: Qualification memo or fitness-for-use statement
Key insight: Don't waste validation effort on low-risk AI. Save rigor for high-risk applications where validation actually mitigates regulatory and quality risk.
The AI Validation Protocol: What It Actually Looks Like
Here's what a practical AI validation protocol includes (for a Category B, Medium-High Risk AI):
1. System Description and Intended Use
Document:
- Intended use: What GxP process does this AI support? What decisions does it inform?
- User population: Who will use this AI? What training do they need?
- GxP risk classification: High/medium/low risk based on patient safety and product quality impact
- Model type: Classification, regression, NLP, generative AI, etc.
Example:
"This AI system classifies incoming deviation reports as major or minor based on regulatory seriousness criteria. It suggests classification to QA reviewers, who retain final decision authority. Intended users: QA associates and managers (trained per SOP-QA-015). GxP risk: Medium (influences quality decisions but does not make them autonomously)."
2. Training Data Qualification
Document:
- Data sources: Where did training data come from? (historical deviation reports, validated QMS exports, etc.)
- Data quality: How was data quality assessed? (completeness, accuracy, representativeness)
- Data representativeness: Does training data match the real-world data the AI will see? (same product types, same deviation categories, same time period)
- Data volume: How much training data was used? Is it statistically sufficient?
- Data bias assessment: Does the training data contain systematic biases? (e.g., overrepresentation of certain deviation types)
Example:
"Training dataset: 5,847 historical deviation reports from 2021-2025, extracted from Trackwise QMS (validated system). Data quality: 98.7% complete (72 records excluded due to missing seriousness classification). Representativeness: Training data includes all product types and deviation categories. Bias assessment: No significant underrepresentation of any deviation category (chi-square test, p=0.23)."
3. Model Development and Architecture
Document:
- Model type: Logistic regression, random forest, neural network, large language model, etc.
- Architecture details: Number of layers, features used, hyperparameters
- Development methodology: How was the model trained? What validation approach was used (k-fold cross-validation, holdout test set)?
- Performance metrics: Accuracy, precision, recall, F1 score, AUC — whichever metrics align with intended use
Example:
"Model type: Random forest classifier (100 trees, max depth 10). Features: Deviation description text (TF-IDF embeddings), product type, process area, historical recurrence patterns. Development: 80/20 train-test split with 5-fold cross-validation. Training set performance: 92.3% accuracy, 89.7% precision, 90.1% recall."
4. Validation Testing (The Critical Part)
Test on independent test dataset:
- Test set: Data NOT used during model training (truly unseen by the AI)
- Test set size: Statistically sufficient (typically 200-500+ cases for classification models)
- Test execution: Run AI on test set, compare AI predictions to human gold standard
Performance metrics:
- Overall accuracy: % of correct classifications
- Precision: Of all cases the AI flagged as major, what % were actually major? (false positive rate)
- Recall: Of all actual major cases, what % did the AI correctly identify? (false negative rate)
- Confusion matrix: Show all four outcomes (true positive, true negative, false positive, false negative)
Subgroup analysis:
- Performance by deviation type: Does the AI perform equally well across equipment, process, material, documentation deviations?
- Performance by product type: Does the AI work for all product lines, or does it favor certain products?
- Edge case performance: How does the AI handle rare or unusual cases?
Acceptance criteria:
- Define upfront: "AI must achieve ≥90% accuracy, ≥85% precision, ≥85% recall on independent test set"
- If AI doesn't meet acceptance criteria → do not deploy (or retrain and retest)
Example test results:
"Test set: 587 deviation reports (not included in training data). Overall accuracy: 91.2%. Precision: 87.4%. Recall: 88.9%. Confusion matrix: [show 2x2 table]. Subgroup analysis: Accuracy ranges from 88.1% (documentation deviations) to 93.7% (equipment deviations). All subgroups meet acceptance criteria (≥85%)."
5. Explainability and Limitations
Document:
- How does the AI make decisions? (high-level logic, key features, decision boundaries)
- What are the known limitations? (cases where the AI struggles, out-of-scope scenarios)
- When should humans override the AI? (guidance for users on when to trust AI vs. use human judgment)
Example:
"The AI classifies deviations based on keyword patterns, historical similarity, and regulatory seriousness indicators. Known limitations: AI struggles with ambiguous descriptions (accuracy drops to 78% when description is <50 words). AI does not assess regulatory reportability (this requires human judgment). Users should override AI when: (1) deviation involves novel product or process, (2) description is ambiguous or incomplete, (3) regulatory context has changed since training data."
6. Human Oversight and Audit Trail
Document:
- Human-in-the-loop workflow: AI suggests, human reviews and approves
- Override capability: Humans can disagree with AI and document rationale
- Audit trail: System logs AI recommendation, human decision, and rationale for overrides
Example:
"Workflow: AI analyzes deviation report and suggests classification (major/minor) with confidence score. QA reviewer sees AI suggestion, reviews deviation details, makes final classification decision, and records it in QMS. QA reviewer can override AI at any time. Audit trail: QMS captures AI suggestion, QA reviewer ID, final classification, timestamp, and override rationale (if applicable)."
7. Post-Deployment Monitoring and Revalidation Triggers
Document:
- Performance monitoring: How often will AI performance be reviewed? (monthly, quarterly, annually)
- Drift detection: What signals indicate the AI is degrading? (accuracy drops >5%, precision drops >10%, user override rate >30%)
- Revalidation triggers: What changes require revalidation? (model retraining, new product types, regulatory guidance changes)
Example:
"Performance monitoring: QA supervisor reviews AI performance monthly (accuracy, precision, recall, override rate). Revalidation triggers: (1) Accuracy drops below 85% for 2 consecutive months, (2) Model is retrained on new data, (3) New deviation categories are added, (4) FDA or EMA guidance changes affect deviation classification criteria."
The "Non-Deterministic Output" Challenge
Here's the hardest validation question for AI: "How do you validate a system that doesn't produce the same output every time?"
Why This Matters
Traditional GAMP 5 validation assumes: If you run the same test twice, you should get the same result.
But some AI systems (especially generative AI like LLMs) are non-deterministic:
- Same input → slightly different output each time (due to randomness in the generation process)
Example:
- Input: "Summarize this deviation report"
- AI Output (Run 1): "Operator A failed to record temperature at 14:00. No product impact."
- AI Output (Run 2): "Temperature reading was missed by Operator A at 14:00. Batch not affected."
Both outputs are correct. But they're not identical.
How to Validate Non-Deterministic AI
Option 1: Test for Semantic Equivalence (Not Exact Match)
- Approach: Define acceptance criteria based on meaning, not exact wording
- Test method: Human reviewers assess whether AI outputs are "substantially correct" (not whether they match word-for-word)
- Acceptance criteria: "AI-generated summaries must be rated ≥4/5 for accuracy and completeness by qualified reviewers (n=3 reviewers, consensus required)"
Option 2: Constrain the AI to Reduce Variability
- Approach: Use structured output formats, fixed templates, or low/zero temperature settings (for LLMs) to make outputs more deterministic
- Example: Instead of free-form narrative generation, use template-based generation ("Fill in these 5 fields: [product], [deviation type], [root cause], [impact], [CAPA]")
- Benefit: Easier to validate because outputs are more consistent
Option 3: Focus Validation on Decision Correctness (Not Output Text)
- Approach: Validate the AI's decision (classification, recommendation, flag/no flag), not the exact wording of its explanation
- Example: For a deviation classifier, validate that the AI correctly identifies major vs. minor (binary outcome) — don't validate the exact text of the AI's rationale
- Benefit: Removes variability in natural language generation from the validation scope
Bottom line: Non-deterministic AI requires validation approaches that assess correctness and usefulness — not exact reproducibility.
Change Control for AI: When Models Update
One of the trickiest aspects of AI validation: What happens when you retrain the model?
Traditional software: Code changes trigger change control. New version → revalidation (or change impact assessment).
AI systems: Model retraining happens regularly (monthly, quarterly, annually) as new data becomes available. Do you need full revalidation every time?
The Pragmatic Answer: Risk-Based Change Control
Minor model updates (no revalidation required):
- Model retrained on new data, but architecture and intended use unchanged
- Performance metrics remain within validated range (e.g., accuracy doesn't drop >5%)
- No new features, no new data sources, no new user workflows
Change control: Document retraining, test on holdout dataset, verify performance is maintained, update version control, communicate to users.
Major model updates (revalidation required):
- Model architecture changes (e.g., switch from logistic regression to neural network)
- Intended use expands (e.g., add new deviation categories)
- New data sources introduced
- Performance degrades below acceptance criteria
Change control: Full validation impact assessment. If impact is significant → revalidation protocol.
The key: Define upfront (in your validation protocol) what constitutes a "minor" vs. "major" change. This gives you a clear path for ongoing model maintenance without re-validating from scratch every time.
The FDA/EMA Perspective: What Inspectors Are Looking For
FDA and EMA inspectors are asking about AI. Here's what they want to see:
1. "How do you know the AI works?"
What they're really asking: Show me your validation evidence.
What satisfies them:
- Validation protocol with defined acceptance criteria
- Independent test results showing AI meets acceptance criteria
- Subgroup performance analysis (doesn't just work on average — works across all relevant populations)
2. "How do you know the AI is still working?"
What they're really asking: Show me your post-deployment monitoring.
What satisfies them:
- Periodic performance reviews (monthly, quarterly, annually)
- Defined triggers for revalidation
- Evidence that you're actually monitoring (not just a policy that says you will)
3. "What happens when the AI makes a mistake?"
What they're really asking: Show me your risk mitigation and human oversight.
What satisfies them:
- Human-in-the-loop workflows (AI suggests, human decides)
- Override capability (humans can disagree with AI)
- Error handling procedures (what happens when AI output is obviously wrong?)
4. "Can you explain how the AI reached this decision?"
What they're really asking: Show me explainability and audit trail.
What satisfies them:
- Explainability features (AI shows key factors that drove its recommendation)
- Audit trail (input, output, model version, timestamp, user decision)
- Known limitations documented (cases where AI struggles)
Inside the GxP Agents Pre-Validated Architecture
Every workflow in the GxP Agents Platform ships with a pre-engineered GAMP 5 (Second Edition, Appendix D11) and FDA CSA validation package:
- Pre-built URS & Functional Risk Assessments (FRA) mapped to Assistive, Generative, and Predictive autonomy tiers
- Locked Gold-Standard Evaluation Datasets for OQ/PQ precision, recall, and zero-suppression verification
- Built-in 21 CFR Part 11 (§ 11.10(e) & § 11.50) Telemetry capturing prompt hashes, source citations, model versions, and human electronic signatures
- Automated Regression Gate for model weight or prompt-template change control
When you deploy a GxP Agent, you don't start validation from a blank page—you start with 80% of the IQ/OQ/PQ protocol and traceability matrix pre-populated.
Start Here
If you're validating AI for GxP use, start with three questions:
- What Context of Use (CoU) does this AI agent support, and what is the human decision gate?
- Can you prove ≥ 99% exception recall and zero hallucinated citations against a locked independent test dataset?
- Are model weights and prompt templates locked under configuration management?
Ready to inspect a pre-validated GxP Agent package? Explore our 6 Validated Workflow Solutions.
David Blewitt · VP Cloud & Part 11 Architecture, GxP Agents
Architected for the GxP Agents multi-agent orchestration platform—with built-in 21 CFR Part 11 signature gates, EU GMP Annex 11/22 telemetry, and GAMP 5 / CSA validation packages.