Data Characteristics
Deviation and Corrective and Preventive Action (CAPA) data typically originates from a pharmaceutical company's internal Quality Management System (QMS). Sources include incident reporting systems, Laboratory Information Management Systems (LIMS), or Manufacturing Execution Systems (MES). Data updates are infrequent, occurring primarily at key stages: deviation occurrence, investigation, CAPA planning and execution, and effectiveness verification.
Document formats vary. Common types include structured reports (e.g., deviation reports, CAPA plans, investigation reports), unstructured text (e.g., investigation interview records, root cause analysis documents), and scanned images. Key fields include deviation number, occurrence date, affected product batch, deviation description, investigation results, root cause, CAPA measures, responsible person, planned completion date, actual completion date, and effectiveness verification results. Units primarily involve time (hours, days), quantity (batches, units), and status (approved, in progress, completed).
Constraints from These Characteristics on Model Integration and Configuration
Infrequent updates of Deviation and CAPA data mean that model training and knowledge base synchronization do not require high frequency. A periodic full or incremental update strategy can be adopted to avoid unnecessary computational resource consumption.
Diverse document structures require the model to handle mixed document types. For example, it must extract key fields from structured reports and understand complex semantics in unstructured text. This may require combining Retrieval-Augmented Generation (RAG) with text extraction techniques.
The specificity of key fields and standardization of units demand accurate identification and referencing of this information during question answering. For instance, when answering "What is the root cause of deviation X?", the model must precisely locate the relevant paragraph in the report. When answering "What is the CAPA planned completion date?", it must correctly identify the date format.
The accumulation of historical deviation and CAPA data enables the model to reference past cases when processing new deviations, providing more insightful suggestions.
Configuration Settings
| Configuration Item | Recommended Value | Rationale |
|---|---|---|
Chunk size (Segment Length) | 500–800 characters | Paragraphs in deviation and CAPA reports typically contain complete information. This range avoids splitting critical context. |
Recall count (Recall Count) | 8–12 items | Ensures enough relevant historical deviation or CAPA records are recalled for complex queries. |
Similarity threshold (Similarity Threshold) | 0.7–0.8 | Balances recall precision and coverage, reducing interference from irrelevant documents. |
maxContext | 4096 tokens | Accommodates the contextual needs of lengthy deviation investigation reports and CAPA plans. |
PARSE_FILE_TIMEOUT_SECONDS | 600 seconds | Handles the parsing time for large PDF or scanned documents, preventing timeout failures. |
Rerank result count (Reranked Return Count) | 5 items | Prioritizes displaying the most relevant CAPA measures or deviation analysis results to the user's question. |
Common Pitfalls
- The model returns an empty list of CAPA measures. This may occur if the knowledge base segmentation strategy is inadequate, leading to critical information being truncated or dispersed.
- The model fails to recognize fields like "batch number" or "production date" in user queries. This is due to a lack of reinforced learning for specific business terminology and units during model training.
- After connecting to a local
ollamainstance, the platform interface does not display the expected model list. This could be caused by an incorrectbaseURLconfiguration orAPI Keyvalidation failure.
Verification Steps
- Upload a typical deviation report PDF file. Check if knowledge base segmentation is reasonable and if key information, such as deviation number and root cause, is correctly extracted.
- Ask questions about historical CAPA cases, for example, "What are the CAPA measures for number XYZ?". Verify if the model can accurately recall and answer.
- Try asking questions involving time or quantity units, such as "How long did the investigation for deviation X take?". Confirm that the model's output units match the original document.
- Use an
APIcall with a query containing specific business fields. Check the accuracy and completeness of these fields in the returned results.
Note: The values provided are common starting points. Measure them against your own samples for optimal performance.
Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-09-21.