This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Week 11 — Nov 23: Process Analytical Technology (PAT) and Automation

How a control strategy is built and held once a product is made for real, read through the models behind it: chemometrics from its 1970s roots to PCA, PLS and class modeling; where a measurement lives and how late it arrives; prediction, feedback and residence-time diversion on a continuous line (ICH Q13); real-time release testing; the model lifecycle; language models held to the same evidence standard; and a capstone investigation. Post-market signals, product complaints and pharmacovigilance, close the loop by reopening a control strategy that looked adequate at the time.
A one-page overview graphic for this week is still to be produced.

(Lecture 10.) Every technique week so far named where a control point sits along some process: a metal catalyst in a synthesis, a blend in a granulator, a charge variant off a bioreactor. This week asks the question underneath all of them: once you know what could go wrong, how do you actually hold the process in a state of control, and how do you know, from the measurement, that it still is? Week 1’s automation section introduced the at-line / on-line / in-line hierarchy at survey depth; this week does the mechanism.

On a modern line, most of those measurements are predictions from a model: an near-infrared (NIR) spectrum turned into a concentration, a feeder signal turned into a diversion window. The models are older than today’s artificial intelligence (AI) tools, and the readings trace that line from 1970s chemometrics to language models, following one recurring question: what evidence makes a model useful for a particular pharmaceutical decision? The page closes the loop backward too: what a complaint or a pharmacovigilance signal tells you about a control strategy that looked adequate at the time.

The one idea

Process analytical technology (PAT) is not “spectroscopy on a pipe.” It is a shift in what a measurement is for: from judging a batch after it is made to understanding and steering the process while it runs, so that quality is designed into the process rather than delivered as a verdict at the end. Because most of those measurements are model predictions, the discipline is chemometric: a model is only as good as the evidence that it applies to this material, at this time, for this decision. And a control strategy is never finished: complaints and pharmacovigilance are how the world tells you where it still had a gap.

The US Food and Drug Administration (FDA)’s 2004 PAT framework put the first half as: design and develop processes that consistently ensure a predefined quality at the end of the manufacturing process. The end-product test becomes confirmation of something you already know.

What we cover this week

Nine readings, one path. The first three build the modeling vocabulary on an incoming-material and a drying case; the next four put it on a continuous direct-compression line; the eighth holds language models to the same standard; the capstone uses all of it on one investigation. Every case and number is constructed or synthetic, and labelled as such.

#ReadingThe one idea
1Before the AI BoomChemometrics has asked “what can we learn from these measurements, and what makes it dependable?” since the 1970s. A lactose identity check shows how a model can learn the wrong distinction, and why identity acceptance is not purity.
2From Pharmaceutical Question to Tested PredictionModel development starts with a decision and ends with evidence on new material. Ten steps on NIR granule moisture, with one synthetic 30-batch dataset computed through them: match X to a Karl Fischer Y, split by batch, tune on whole-batch cross-validation (0.25% w/w, where random scans promise 0.18%), freeze, then test once.
3From One Wavelength to a Whole SpectrumOne spectrum, three questions: principal component analysis (PCA) explores (scores locate samples, loadings describe axes), class modeling decides identity, partial least squares (PLS) predicts a reference value. Each needs different evidence.
4Where the Measurement LivesOff-line, at-line, on-line and in-line describe where the sample is; a soft sensor describes how the value is inferred, not a fifth location. An exact result can still describe the past, and a guided calculation gives the transport delay of a sampling loop.
5From Prediction to Process ControlA prediction is not a controller. Feedback, feedforward and a residence time distribution (RTD) worked on a feeder-refill pulse: shifting by the mean residence time misses the spread, and diversion is not release. A computed feeder refill then runs all five functions on one clock: detected at 123 s, diverted for 118 s, no out-of-limit material collected.
6When a Model Can Support ReleaseReal-time release testing (RTRT) changes the evidence, not the specification. Assay, content uniformity and dissolution each need their own justification; thousands of scans are not thousands of tablets; equipment failure is not an unfavourable result.
7A Model Has a LifecycleA new excipient supplier lights up the diagnostics while predictions look fine. Prediction error and Q answer different questions. A computed investigation works the five steps and ends on a calibration extension, not a moved limit; a hypothetical second supplier fails the same challenge and shows the other branch, containing product; instrument transfer and recalibration are analytical changes.
8From Spectra to LanguageA language model drafting an investigation summary is evaluated like any model: define the task, check each claim against the record it cites, split by investigation, monitor changes. Fluent is not evidence.
9Capstone: One Disturbance, One Defensible DecisionA feeder disturbance, an applicability flag and an AI-written summary on one batch. Reconstruct the timeline, work the 45-second gap and the 0.75 kg screening estimate, and write an interim conclusion that separates known, inferred and unresolved.

How to use the readings

Nine readings is more than one session can work through, so they divide into three roles.

RoleReadingsWhy
Before class1, 2, 3, 4The vocabulary: what a model learns, how it is honestly tested, what PCA and PLS output, and where the measurement sits. Class assumes them.
Worked in class5, 6, 7, 9, and the heparin case belowThe judgment calls: timing a diversion from an RTD, deciding what a release model can claim, reading Q against prediction error, and reaching an interim decision on incomplete evidence.
After class, and into Week 128, and the complaints and pharmacovigilance section belowLanguage models under the same evidence standard; Week 12 widens the modeling from one NIR line to the rest of the field.

Running order in class. Open with the heparin case: a contaminant that passed every test, found because patients were harmed. Ask what reading 1’s last challenge row (“identity acceptance does not establish purity”) would have said about it. Then walk the continuous line in order: reading 5’s RTD pulse (ask for the affected interval before showing the shading), reading 6’s same-mean, different-spread figure, and reading 7’s three scenarios. Close on the capstone: set the three-list task (supported, hypothesis, missing) and let groups work the timeline before showing the worked analysis. If time is short, move reading 7’s instrument-transfer section to after class.

Complaints and pharmacovigilance — the control strategy’s other input

A control strategy is built from what you already know to look for. Two channels tell you when that knowledge was incomplete, after the product has already reached patients:

  • Product complaints: reports from the field (a broken tablet, an unexpected precipitate, a device that didn’t fire) are triaged, investigated and trended. A cluster of complaints against one attribute, one site or one lot range is often the first evidence that a control strategy has a gap, well before it shows up in a batch-release trend.
  • Pharmacovigilance (PV): adverse-event reports collected and analysed under a marketing authorization holder’s PV system (International Council for Harmonisation (ICH) E2E/E2F, periodic safety reports) can surface a safety signal with no obvious link to a release specification at all, until an investigation finds one.

Both feed the same loop as Q9 risk review: a signal reopens the risk assessment, which can add a new attribute to the critical quality attribute (CQA) panel, tighten a specification, or add a method that did not previously exist. A control strategy is never a closed book. Complaint trending and PV signal detection are inputs on the same footing as the in-process data in the readings, not a separate department’s problem.

Worked case — a signal that reopened a control strategy

Heparin is a heterogeneous polysaccharide extracted from pig intestine. Through 2007–2008, batches sourced through the Chinese supply chain were adulterated with oversulfated chondroitin sulfate (OSCS), a cheap semi-synthetic mimic that passed every identity and potency test then in the pharmacopeial specification.

The signal that started the investigation was not a batch-release trend. It was a spike in adverse-event reports — hundreds of severe anaphylactoid reactions and a number of deaths — flowing through the pharmacovigilance systems of hospitals, manufacturers and regulators. Only once that signal triggered an investigation was the contaminant found, using a technique (¹H NMR, with capillary electrophoresis as a second method) that had never been part of the release specification: OSCS produces a distinct, unambiguous methyl resonance that heparin does not. Within months, that technique was written into the United States Pharmacopeia (USP) and Ph. Eur. heparin monographs.

The lesson for a control strategy: no specification controls an attribute nobody thought to look for, and the channel that first reveals the gap is often not the lab. It is the patient. It is also the model lesson in its starkest form: every test in the monograph was a model of “heparin,” and OSCS sat outside every one of their domains.

Where the analyst sits

On the line, the analyst stops producing the number and becomes accountable for the system and the model that produce it: a hypothesis about the process, tested thousands of times an hour, with nobody checking each result. The judgment calls are the ones the readings rehearse. Is this a real excursion or a probe artefact? Has the model drifted out of its domain? Which material, at which time, does this number describe? Is a rise in complaints a coincidence or a signal? That is the STEAM “A” at industrial scale. The refrain: science → evidence → reduced uncertainty → control → regulatory confidence → patient trust.

On the job

  • An in-line model’s diagnostic (T² or Q) creeping toward a limit is a routine daily alert, not an emergency. Knowing the escalation path (who’s paged, at what threshold) is a first-week orientation item, not something you’ll be trusted to decide alone.
  • Complaint trending is often the first place a junior analyst gets pulled into cross-functional work. QA, manufacturing and pharmacovigilance all read the same trend differently, and part of the job is translating between them.
  • On a continuous-manufacturing line, expect “batch record review” to mean reviewing a model’s diagnostics, a diversion log and the timestamps that tie them together, not a stack of paper test results.
  • If your site uses a language model to draft investigation summaries, you will be the reviewer. Check every identifier, time and causal claim against the record it cites.

For discussion

  • RTRT “does not remove the specification.” Explain precisely what it does and does not change, using content uniformity as the example. (Reading 6 is the place to check your answer.)
  • Your in-line NIR model’s Q residual creeps up over three weeks, but predictions still match the reference method. Recalibrate now, or wait? What decides? (Compare reading 7’s input-pattern scenario.)
  • OSCS passed every test in the heparin monograph before 2008. Design the risk assessment that should have caught the gap before patients did. What would have flagged “we cannot see a novel adulterant”?
  • A rise in product complaints about tablet appearance coincides with no change in any release specification. Walk through how you would decide whether the control strategy needs to reopen.

Source note. Anchored in the FDA PAT guidance (PAT — A Framework for Innovative Pharmaceutical Development, Manufacturing, and Quality Assurance, 2004), ICH Q13 (continuous manufacturing), ICH Q8/Q9/Q10, and the Q12/Q14 lifecycle material. RTRT follows ICH Q8(R2) and the European Medicines Agency (EMA) RTRT guideline; the predictive-modeling workflow adapts Kuhn and Johnson, Applied Predictive Modeling (2013); each reading carries its own numbered sources. Pharmacovigilance follows ICH E2E/E2F; the heparin/OSCS case follows the Nature Biotechnology (2008) papers and the subsequent USP/Ph. Eur. monograph revisions. Builds directly on Week 1’s automation section and leads into Week 12’s wider chemometrics. (Instructor: confirm current Q13 implementation status and any new FDA/EMA continuous-manufacturing or RTRT guidance.)

1 - Before the AI Boom — Chemometrics and Learning from Data

An incoming-material identity problem introduces the 1970s roots of chemometrics, its overlap with machine learning, and the evidence needed before a model can be trusted with a pharmaceutical decision.
Overview graphic titled 'Before the AI Boom', subtitled 'Chemists have been learning from data for decades.' Three panels. Left, '1970s: Chemometrics': a vintage computer showing scatter-plot clusters beside an old laboratory instrument, with labels 'Chemical pattern recognition', 'PCA and classification' and '1974: Chemometrics Society'. Centre, 'Learning from measurements': a modern benchtop spectrometer with a powder sample and a spectrum on a monitor, labelled 'Material identity' and 'Moisture and potency'. Right, 'Modern language models': word tokens 'The drug product is a solid …' above a server rack, labelled '2017: Transformer', '2020: GPT-3' and 'Language generation'. A band reads 'Overlapping histories — substantial technical advances', and the footer reads 'Different capabilities. Shared questions: What was learned? Where does it apply? What evidence supports it?'
Chemical pattern recognition predates today's AI boom. The three fields overlap, and they share questions about applicability and evidence. Conceptual teaching illustration.

(Week 11, reading 1 of 9.) Every technique week so far ended with a number: a peak area, a mass loss, a percentage dissolved. This week’s readings ask what happens when the number comes from a model fitted to a measurement, and the module follows one recurring question: what evidence makes a model useful for a particular pharmaceutical decision?

The one idea

Chemists were using computers to learn patterns from measurements decades before today’s generative AI, and chemometrics became an identifiable field in the early 1970s. Its enduring question is still the useful one: what relationship can we learn from these measurements, and what evidence makes that relationship dependable for a particular decision?

Modern machine learning and language models extend this story. They bring substantial advances in architecture, scale and capability, while keeping familiar challenges: representative examples, misleading correlations, independent evaluation and limits on use.

A container arrives at the warehouse

A pharmaceutical manufacturer receives a container labeled lactose monohydrate, an excipient used in tablets. Before the material enters manufacturing, the company needs evidence that the contents have the expected identity.

The label describes what the supplier says is inside. The analytical procedure must produce evidence about what is actually inside.

One possible approach is near-infrared (NIR) spectroscopy, met at survey depth in Week 6. The instrument illuminates the sample and records its response across many wavelengths. That response reflects molecular vibrations, particularly overtones and combinations involving bonds such as O–H, C–H and N–H. In powders, the spectrum is also affected by scattering and physical properties [2, 3].

This is where the solid-state readings from Week 9 return: moisture, particle size and solid form can all change what an instrument sees. A spectral difference might indicate the wrong material, or an expected variation in the right material.

The practical question becomes: can we distinguish acceptable lactose from plausible alternatives despite normal variation in the measurement?

This is an illustrative teaching case, not a validated identification procedure or a claim that one scan establishes every aspect of material quality.

Graphic titled 'Is This Really Lactose?', subtitled 'A spectrum is evidence. An identity decision needs a validated procedure.' Three numbered panels. 1, Measure: a jar labelled 'Lactose?' beside an NIR powder spectrometer with a spectrum on screen, captioned 'Collect the spectrum'. 2, Compare: jars of lactose, mannitol and cellulose above three different schematic spectra, captioned 'Use authenticated reference materials'. 3, Challenge: an analyst holding up a sample in front of jars from suppliers A, B and C plus mannitol and cellulose, captioned 'Test independent lots and relevant alternatives'. Two banners: 'PCA explores variation' and 'Identity requires a decision rule'. Footer: 'Supplier, moisture and particle size can change the spectrum. Identity acceptance does not establish purity.'
Illustrative workflow. The spectral traces are schematic and do not represent measured spectra of the labeled materials. Identity acceptance does not establish purity.

From a fingerprint to a pattern-recognition problem

With a simple calibration, such as Beer–Lambert in Week 6, one absorbance value estimates a concentration. An NIR spectrum offers something different: many measurements that can be interpreted together.

Imagine collecting spectra from authenticated lots of lactose, mannitol and microcrystalline cellulose. Within each material, include the suppliers, grades, physical properties and measurement conditions relevant to the proposed use.

The analyst now has two linked sets of information:

InformationWhat it contributes
SpectraThe measured patterns the procedure will interpret
Independently established identitiesThe reference information used to develop and evaluate the procedure

A computer can compare patterns across the spectral variables. But its ability to separate the training examples does not establish that it will correctly handle tomorrow’s incoming lot.

That distinction, between describing examples already seen and performing dependably on new ones, is central to chemometrics and machine learning.

The 1970s: this problem already had a community

In the early 1970s, Svante Wold and Bruce Kowalski were developing approaches to chemical data that combined chemistry, statistics, computing and pattern recognition. Wold’s firsthand account describes their meeting in 1973 and the formation of the Chemometrics Society in 1974 [1].

Their work included principal component analysis (PCA), nearest-neighbor classification, and methods described at the time as learning machines. Wold also developed soft independent modeling of class analogy (SIMCA), a class-modeling approach built on principal components. These were recognizable attempts to extract useful relationships from chemical measurements long before the current AI boom [1].

The mathematical roots go back further. The 1970s mark the emergence and organization of chemometrics as a field, not the invention of statistics or the first mathematical model in chemistry.

For this course, chemometrics means applying mathematical and statistical methods to obtain useful chemical information from measurements and to design informative experiments. It covers more than prediction: experimental design, exploration of variation, classification, calibration and monitoring all belong in the picture.

Three questions, three different jobs

Return to the incoming-material example. Several tools can work with the same spectra, but they answer different questions.

Tool or approachQuestion it helps answerPharmaceutical use
PCAWhat major patterns of variation are present?Explore grouping among raw-material spectra and investigate unusual lots
Classification or class modeling, such as SIMCADoes the sample satisfy the defined criteria for a material class?Support an identity decision against authenticated materials and relevant challenges
Partial least squares (PLS) regressionWhat numerical reference property can be predicted from the measurements?Predict moisture or active pharmaceutical ingredient (API) concentration using calibration samples with reference results

PCA can produce a score plot in which samples occupy positions along a few principal components. Those positions summarize variation across many original variables. The components themselves do not automatically have chemical names: the analyst must investigate what drives them.

A cluster labeled “lactose” on a PCA plot is an observation to investigate. Turning it into a dependable identification procedure requires a defined decision rule and evidence of performance. Likewise, a PCA score is not automatically a concentration. Reading 3 develops these distinctions.

A model can learn the wrong distinction

Suppose every lactose spectrum in development came from Supplier A and was measured on Monday. Every mannitol spectrum came from Supplier B and was measured on Friday.

The groups separate beautifully. Have we learned chemical identity, supplier-specific particle size, a change in humidity, an instrument difference, or some combination?

The plot alone cannot settle the question.

This is confounding: factors vary together, so it is hard to tell which relationship supports the prediction. A model may use a correlation that performs well in development but fails when the circumstances change.

Consider this deliberately invented challenge set. These are teaching outcomes, not experimental data or recommended acceptance limits.

New sampleIllustrative model outcomeInterpretation
Authenticated lactose from a represented supplierAccepted as lactoseExpected performance, but only one part of the evidence
Authenticated lactose from a new supplierRejectedInvestigate whether a relevant source of acceptable variation was omitted
Authenticated mannitolAccepted as lactoseA serious specificity failure against this challenge material
Lactose containing a small amount of another materialAccepted as lactoseIdentity acceptance does not establish purity or mixture-detection capability

The last row matters particularly in pharmaceutical quality. A procedure developed for identity cannot be assumed to control low-level contamination, adulteration or any other quality attribute. The heparin case on the Week 11 page is what that gap costs when it is real.

To evaluate the intended identity decision, challenge the procedure with independent samples and relevant alternatives. Include expected variation and define what happens when a sample falls outside the supported conditions. Repeated scans of one lot cannot substitute for evidence across independent lots [2, 3].

Where machine learning and AI fit

Chemometrics is organized around chemical problems. Machine learning (ML) is organized around computational methods that learn useful relationships from data. Artificial intelligence (AI) is a broader field covering approaches to tasks associated with intelligent behavior.

These areas overlap. A classification algorithm can be described as machine learning and used within a chemometric analytical procedure. Chemometrics also includes activities not usually presented as AI, and AI includes approaches beyond statistical learning.

So a simple sequence, “chemometrics became machine learning, which became AI”, would misrepresent the history. The stronger lesson is that chemical scientists have long taken part in learning from data, while methods and capabilities have kept evolving.

Later developments include the Transformer architecture introduced in 2017 and large-scale language-model work such as GPT-3 in 2020. These are substantial technical developments, not a change in terminology [4, 5].

From a spectrum to a sentence

An NIR identification procedure interprets a measured spectrum to support a defined material decision. An autoregressive language model learns relationships in token sequences and generates tokens conditioned on the preceding context. Next-token prediction is a foundational training objective; many deployed assistants receive additional training to improve instruction following and other behavior. Language modeling also extends beyond English [5].

The outputs need different kinds of evaluation. A material model needs evidence against independently established material identities. A generated investigation summary needs checking against the underlying records and the requirements of that task. Reading 8 works that second case.

The shared discipline is to ask what was learned, where it applies, and what independent evidence supports its use. A model’s apparent confidence or fluent explanation cannot supply that evidence by itself.

Where the analyst sits

The analyst connects measurements, chemistry and decisions. In the warehouse example, that means knowing why particle size might change a spectrum, which materials could be confused, how reference identities were established, and when a result needs investigation.

Chemometrics makes more information accessible from complex measurements. Pharmaceutical analysis is responsible for establishing when that information is adequate for the decision being made.

For discussion

  1. A PCA plot separates three excipients perfectly. What additional evidence would you need before using a procedure based on these spectra for incoming-material identification?
  2. Why might twenty lots be more informative than twenty scans of one lot? What could repeated scans still help you assess?
  3. A new supplier’s lactose is rejected by the model but confirmed by an independent identity procedure. What would you investigate before changing the model?
  4. Why does accepting a sample as lactose fail to establish that it is free from all contaminants?

Bridge back to the week

Next: From Pharmaceutical Question to Tested Prediction, which turns the identity question into a moisture prediction and walks the full development workflow. Return to Week 11.

Sources

[1] S. Wold, “Chemometrics and Bruce: Some Fond Memories,” in 40 Years of Chemometrics — From Bruce Kowalski to the Future, ACS Symposium Series 1199 (2015). A firsthand account of early chemical pattern recognition and the formation of the chemometrics community; read the historical opening. Publisher access may need an institutional subscription. ACS chapter.

[2] US Food and Drug Administration (FDA), Development and Submission of Near Infrared Analytical Procedures (guidance, 2021). NIR analytical procedures using chemometric models. Its historical Q2(R1) references should be read alongside current Q2(R2) and Q14. FDA guidance.

[3] European Medicines Agency (EMA), Guideline on the Use of Near Infrared Spectroscopy by the Pharmaceutical Industry and the Data Requirements for New Submissions and Variations (2014). Qualitative and quantitative applications, development and validation. EMA guideline.

[4] A. Vaswani et al., “Attention Is All You Need” (2017). Optional: the abstract and introduction, for the Transformer milestone. arXiv.

[5] T. Brown et al., “Language Models are Few-Shot Learners” (2020). Optional: the abstract and introduction, for autoregressive language modeling and the effects of scale. This historical example does not describe every current assistant’s architecture or training. arXiv.

The warehouse case and the challenge-set outcomes are constructed teaching examples, not experimental data or recommended acceptance criteria.

2 - From Pharmaceutical Question to Tested Prediction

A stepwise pharmaceutical adaptation of Kuhn and Johnson’s predictive-modeling framework, using NIR prediction of granule water content: define the decision, match X and Y, split by batch, preprocess inside resampling, tune, freeze and test.
Graphic titled 'From Pharmaceutical Question to Tested Prediction', with the example 'predicting granule moisture from NIR'. Six numbered panels. 1, Define the decision: granules on a dryer tray, 'What will the prediction support?'. 2, Match X and Y: an NIR instrument beside a Karl Fischer titrator, 'Spectrum + reference water result'. 3, Check and split: jars labelled Batch A, Batch B and Batch C, 'Keep independent batches together'. 4, Develop and tune: an analyst at a computer, 'Preprocessing belongs inside resampling'. 5, Freeze and test: a clipboard with a padlock, 'Evaluate on untouched test data'. 6, Use and monitor: an in-line probe over moving granules, 'Watch error, drift and applicability'. Footer: 'A good fit is the beginning. Performance on new material is the test.'
Teaching overview using an illustrative NIR moisture application. Instrument and process scenes are conceptual; they do not specify a particular drying system or instrument configuration.

The one idea

Model development begins with a decision and ends with evidence about performance on new material. Choosing an algorithm is one step in that process.

This reading adapts the framework in Max Kuhn and Kjell Johnson’s Applied Predictive Modeling (Springer, 2013), particularly Chapters 2–4. The pharmaceutical case and lifecycle discussion are teaching additions, not a reproduction of the authors’ exact sequence [1, 2].

In reading 1, near-infrared (NIR) spectroscopy posed a material-identity question. Here the task changes: can an NIR measurement estimate water content in granules during drying? Identity is a classification or class-membership problem. Water content is a numerical prediction problem, also called regression.

One synthetic dataset runs through the steps. Thirty drying batches, eight samples per batch taken across the drying curve, three replicate NIR scans per sample, and one Karl Fischer result per sample: 720 spectra in all. The simulation builds in what makes the steps matter. Particle size scatters whole spectra; each batch’s excipient lot leaves a small spectral signature; the probe zone and the sampling point differ by a batch-specific offset; and the water response flattens as the bed gets wetter. The figures at steps 3, 5, 7 and 9 are computed from it, and the spectra and references are there to download. Week 12’s R readings apply the same preprocessing logic in code.

1. Define the decision

Imagine a wet-granulation process followed by drying (the solids-manufacturing train from Week 2). The team wants frequent estimates of granule water content to support assessment of the drying endpoint.

Before collecting spectra, write down the intended use. Which formulation, equipment, moisture range and operating conditions are covered? How quickly is a result needed? What prediction error is acceptable near the endpoint? What happens if the result is wrong?

A useful monitoring model is not automatically adequate for automatic process control or release. Those decisions may need different evidence and controls. State the proposed role before deciding whether the results are good enough.

For the synthetic case, the team writes the requirement down now, before any data exist: the endpoint is judged at 2.0% w/w water, and predictions on new batches must have a root mean square error of prediction (RMSEP) of no more than 0.30% w/w for samples below 3% w/w. Both numbers are illustrative teaching choices, not recommended criteria. The point is that step 9 is checked against them, not against whatever the model happens to achieve.

Output of this step: a prediction objective and performance requirements tied to the intended decision.

2. Define Y: what are we trying to predict?

The outcome, Y, is water content measured by an appropriate reference procedure, such as Karl Fischer titration. Specify the units and reporting basis. Water content and loss on drying are not interchangeable labels: loss on drying counts every volatile, not only water.

Match each NIR measurement to a reference sample representing the same material and the same time. A spectrum from the dryer bed paired with an unrelated sample from another location creates a mismatch that no algorithm can fix.

Assess the reference procedure’s suitability and uncertainty. The model learns against those results, including their limitations.

Output: a defined outcome and a defensible way to establish its reference value.

3. Define X and what one observation means

The predictors, X, are the inputs available when making a future prediction. They might include the NIR spectrum and, if justified, process temperature.

Data elementRole
NIR response at each retained wavelengthCandidate predictors
Matched Karl Fischer water resultReference outcome
Batch and sample identifiersTraceability and grouping
Timestamp, location, instrument, temperatureMeasurement context; some may also be justified predictors
Supplier, particle size, formulationContext for coverage, confounding and applicability

One row might represent one matched spectrum/reference sample pair. Repeated scans of that sample are related observations. They help characterize repeatability but do not create independent material examples.

Avoid predictors that will not be available at the moment of use. Including the final laboratory water result as an input would make development look excellent while defeating the purpose of the prediction.

Figure titled 'Steps 2–3: every spectrum needs a matched reference', two panels coloured by Karl Fischer water on a scale from about 0.5% (yellow) to 9% w/w (dark purple). Left, 'Raw, 5 batches: scatter shifts whole spectra': one scan per sample from five synthetic batches, absorbance 0.25 to 0.61 from 1100 to 2500 nanometres, with bands near 1210, 1450, 1730, 1940, 2100 and 2310 nanometres; the spectra fall into two groups offset by about 0.06 absorbance from batch to batch, a larger shift than the water band at 1940 nanometres itself. Right, 'After SNV, one batch: the water band carries Y': all 24 scans of one batch after standard normal variate correction, 1840 to 2020 nanometres; the 1940 nanometre water band rises in order of Karl Fischer water, from about −0.1 for the driest samples to about 1.3 for the wettest, and replicate scans of each sample lie on top of one another.
Synthetic NIR spectra (X), each coloured by the Karl Fischer water (Y) of the sample it was paired with. Batch-to-batch scatter moves whole spectra by more than the water does; after SNV, the 1940 nm band orders the samples by water. Replicate scans overlap: three scans are one sample, not three.

Output: a data dictionary, a sampling unit, and a clear separation of predictors, outcome and contextual metadata.

4. Check integrity and scientific coverage

Resolve mismatched identifiers, inconsistent units, duplicated records, missing reference results and documented acquisition failures. Retain original records and document corrections and exclusions.

Then ask whether the data represent the intended application. Include relevant variation in batches, moisture, temperature, raw materials and physical properties. Temperature and particle size can change the NIR response even when water content is unchanged.

An unusual observation is a reason to investigate. Removing it only because it worsens the fit can hide exactly the situation the model will face later.

Basic record checks can come before splitting. Choices learned from distributions or performance, such as outlier thresholds, transformations and variable selection, belong within development, with the test data protected from them.

Output: traceable data and an assessment of what the available examples do and do not cover.

5. Protect a final test set

Divide the available examples into development data and held-out test data. Within development, use resampling to select preprocessing, algorithms and tuning settings [1, 2].

PartitionWhat it is used forWhat it must not become
Training/development setFit and compare candidate pipelines using resamplingEvidence based only on fitting its own examples
Assessment folds within developmentEvaluate candidates during tuningA claim of untouched final testing
Held-out test setAssess the selected, frozen pipelineA repeated guide to model revision

Splitting should reflect the future prediction task. If the goal is performance on new batches, keep all observations from a batch together. Otherwise neighboring measurements from the same drying run land in both training and assessment, and the task becomes artificially easy. Week 12, reading 1 shows what that leakage looks like in production.

A concrete splitting example

Suppose a teaching dataset contains 30 independent drying batches. An illustrative plan reserves 6 complete batches for final testing and uses the remaining 24 for development. Inside development, grouped cross-validation holds out subsets of whole batches in turn.

Figure titled 'Step 5: split the way the model will be used', two grids of 30 columns (batches) by 24 cells (scans). Top, batch-grouped: the first six columns, batches B10, B12, B14, B27, B28 and B30, are entirely orange (held-out test); the other 24 columns are each a single shade of blue, six columns per shade, one shade per development fold. Bottom, random scans: every column is a speckle of the four blue shades, so the replicate scans of each sample, and the samples of each batch, are scattered across all four folds. Notes beneath: orange marks the six test batches, untouched until step 9; at 5 latent variables, cross-validation gives RMSECV 0.18% w/w with random scans and 0.25% w/w with whole batches.
The same 24 development batches cross-validated two ways. Holding out whole batches asks the question the model will face, a batch it has never seen; random scans let replicate scans and batch-mates of every assessment scan sit in training.

These counts illustrate the structure; they are not a recommended sample size or a universal 80/20 rule. The actual allocation depends on the number of independent units, coverage, and the uncertainty in the performance estimates. A future-time or supplier challenge may be appropriate when that matches the intended use.

6. Fit preprocessing inside resampling

Preprocessing can include centering, scaling, scatter correction, spectral derivatives, missing-value handling or wavelength selection. Its suitability depends on the measurement and the model.

For each cross-validation split:

  1. Use only that split’s training portion to estimate data-dependent preprocessing.
  2. Fit the candidate model to the transformed training portion.
  3. Apply the fitted preprocessing and model to the assessment portion.
  4. Record prediction performance.

Centering illustrates the rule. Calculate the training means, then subtract those same means from the assessment samples. Do not calculate the means from the combined training and assessment data.

Principal component analysis (PCA) also learns from data. If it is part of a predictive pipeline, fit it inside the resampling. Computing principal components from the full dataset before evaluation leaks information about the assessment samples into development.

The object being evaluated is the entire pipeline: preprocessing plus prediction.

7. Compare models and tune their complexity

Start with a simple benchmark, such as predicting the training mean water content for every sample. Then consider scientifically appropriate alternatives, including partial least squares (PLS) regression for the spectral example.

PLS relates spectral variation to the reference outcome through components. The number of components is a tuning choice. Too few may miss relevant relationships; too many may capture noise or incidental features of the development samples.

Figure titled 'Steps 6–7: tune on honest resampling', root-mean-square error in percent w/w against PLS latent variables from 1 to 12. Grey circles, RMSEC (error on the calibration data itself), fall steadily from 0.29 to 0.15. Orange squares, RMSECV with random scans, fall from 0.30 to a minimum near 0.18 at 5 to 6 latent variables and then drift up to 0.20. Teal diamonds, RMSECV with whole batches held out, fall from 0.31 to a minimum of 0.25 at 5 latent variables, then rise to 0.29 by 12. A dotted line marks the choice, 5. A side note reads: benchmark, predicting the training mean, 1.88% w/w; at 5 latent variables RMSEC 0.16, random scans 0.18, whole batches 0.25% w/w; the untouched test set (step 9) gave 0.26% w/w; only the whole-batch estimate saw it coming.
PLS on SNV spectra with mean-centring refitted inside every fold. Errors are reported to 0.01% w/w, the resolution of the Karl Fischer reference. The choice rule, fixed in advance, is the minimum whole-batch RMSECV.

Read the three curves together. RMSEC always falls as latent variables are added, because each one fits more of the development data, noise included; it can never tell you when to stop. Random-scan cross-validation promises 0.18% w/w at 5 latent variables, because the assessment scans’ replicates and batch-mates are in training and the model has partly memorised each batch’s offset through its excipient-lot signature. Whole-batch cross-validation is the only curve that turns upward, at 0.25% w/w, and that is the error new batches actually produce at step 9. Every candidate beats the benchmark of predicting the mean (1.88% w/w) by a wide margin, so the useful question is not whether PLS works but how many latent variables the evidence supports.

Compare candidate pipelines using the same resampling partitions and predefined performance measures. Preprocessing choices and selected variables count as development choices too. Repeatedly trying options can overfit the development assessment results, which is another reason to protect the final test set.

8. Judge performance where the decision matters

A high R² does not establish suitability. Examine:

  • Prediction error: how far predictions fall from reference values.
  • Bias: whether the model tends to overpredict or underpredict.
  • Residual patterns: whether errors vary with moisture, batch, temperature or supplier.
  • Endpoint performance: whether the error is acceptable where the drying decision is made.
  • Applicability: whether the procedure can flag unsupported samples or conditions.

A model can perform well over the broad drying range while being inadequate near the endpoint. Aggregate performance can hide the weakness that matters operationally.

Choose a pipeline that meets the intended need and can be maintained. Complexity is useful when it delivers dependable improvement.

9. Freeze, refit and test

Lock the selected preprocessing, variables, algorithm, tuning settings and decision rules. Fit the selected pipeline to the development set. Then apply it to the untouched test batches.

Report performance against the predefined requirements, including relevant batch-level results and uncertainty. Do not adjust the model repeatedly while inspecting the test results and still call that evaluation independent.

Figure titled 'Steps 8–9: freeze, test once, judge where the decision is', for the 5-latent-variable model refitted on all 24 development batches and applied once to the 6 held-out batches, one point per sample (mean of 3 scans). Left, predicted water against Karl Fischer water, 0 to 9.5% w/w, points coloured by test batch B10, B12, B14, B27, B28 and B30 along the 1:1 line, with dotted lines at the 2% endpoint; title 'Overall RMSEP 0.26% w/w'; a note reads: below 3% w/w (26 samples), RMSEP 0.24, mean error −0.06% w/w, meets the illustrative step-1 requirement of RMSEP at most 0.30% w/w. Right, predicted minus reference against Karl Fischer water, from about −0.65 to +0.45% w/w, with the region below 3% shaded as the endpoint window and a pale band at ±0.30 inside it. Short horizontal lines mark each batch's mean error: four batches sit near +0.03 to +0.08, while B10 and B14 sit near −0.40 and −0.35. A note reads: errors cluster by batch, which is why step 5 splits by batch.
One look at the held-out batches, judged against the requirement written at step 1. Overall RMSEP 0.26% w/w; in the endpoint window (26 samples below 3% w/w) RMSEP 0.24% w/w with a mean error of −0.06% w/w, which meets the illustrative 0.30% w/w requirement. The errors are not random scatter: two of the six batches read about 0.4% w/w low throughout.

The figure answers step 8’s questions in order. The prediction error in the endpoint window meets the step-1 requirement. The bias there is small overall, −0.06% w/w. But the residual pattern says more than either number: errors cluster by batch, and B10 and B14 read about 0.4% w/w drier than their Karl Fischer results across the whole drying curve. A model that reads drier than the reference stops drying early, so that is the finding to take into step 10. Before anyone recalibrates, it is a step-4 question: what was different about where the probe sat, or which excipient lot those batches used?

If testing reveals an inadequacy, investigate and revise as needed. Recognize that the inspected test set has now influenced development; a revised procedure needs a new independent assessment.

10. Establish suitability for use and monitor it

Predictive testing is part of the evidence for an analytical procedure. Pharmaceutical implementation also needs an appropriate sampling procedure, reference-method support, intended-use validation, operating instructions, exception handling and change control. Current Q14 and Q2(R2) provide the development and validation context [3, 4].

Deploy the versioned pipeline, including preprocessing parameters, not only the model coefficients. Define responses to missing spectra, probe fouling, out-of-domain samples and unavailable predictions.

Monitor reference-check errors and relevant diagnostics over time. A supplier change or altered process environment may need investigation, additional samples or controlled redevelopment. An automatic model update is not a substitute for deciding whether the change is scientifically and operationally justified. Reading 7 works that case.

Where the analyst sits

The analyst asks whether X represents the material, whether Y is trustworthy, whether the test resembles future use, and whether an error is acceptable for the decision.

That is the link to analytical procedure development: the intended purpose decides what evidence the complete measurement system must supply.

For discussion

  1. Why is a random split of individual scans potentially misleading when many scans come from the same batch?
  2. Which preprocessing steps learn parameters from data? Where must they be fitted during cross-validation?
  3. A model has excellent overall error but systematic bias near the drying endpoint. Is it suitable for endpoint control? What additional evidence is needed?
  4. A team changes its model after reviewing the test results. What has changed about the role of that test set?

Bridge back to the week

Next: From One Wavelength to a Whole Spectrum, which looks inside PCA, class modeling and PLS. Return to Week 11.

Data and sources

The synthetic moisture dataset: spectra and Karl Fischer references (720 scans × 141 wavelengths, with each scan’s batch, sample, drying time, reference and split role), split plan, tuning curves, test predictions, test summary, simulation assumptions, reproduction script and requirements. Figures: 3840 × 2160 pixels, computed with fixed seeds. PLS is a plain NIPALS PLS1 in NumPy, so the script shows every step rather than hiding it in a library call.

[1] M. Kuhn and K. Johnson, Applied Predictive Modeling (Springer, 2013). Chapters 2–4 introduce the modeling workflow, preprocessing, splitting, resampling, overfitting and tuning. This reading is an original pharmaceutical adaptation. DOI.

[2] Authors’ chapter guide: Chapter 2 for the overview, Chapter 3 for preparation, Chapter 4 for tuning and evaluation. Detailed contents.

[3] International Council for Harmonisation (ICH) Q14, Analytical Procedure Development. Development and lifecycle context for model-based analytical procedures. Guidance page.

[4] ICH Q2(R2), Validation of Analytical Procedures. Validation in relation to the intended purpose. Guidance page.

The drying case, the 30-batch dataset, the endpoint and the step-1 requirement are constructed teaching examples, not a recommended sample size, acceptance criterion or validated procedure.

3 - From One Wavelength to a Whole Spectrum

Explore pharmaceutical NIR spectra with PCA, tell scores from loadings, and see how class modeling and PLS turn the same spectra into an identity decision or a water-content prediction, each needing different evidence.
Graphic titled 'One Spectrum, Three Different Questions'. Three panels. PCA: Explore, with dishes of differently coloured powders beside a spectrometer, asking 'What varies among samples?', with 'Scores describe samples' and 'Loadings describe variables'. Class modeling: Identify, with an analyst inspecting a jar in front of four sample jars, asking 'Does this sample fit the material class?', with 'Defined rules + independent challenges'. PLS: Predict, with a spectrometer beside a titrator and a dish of granules, asking 'How much water is present?', with 'Spectra linked to reference results'. Footer: 'Same measurements. Different objectives. Different evidence. A separated cluster is not a validated identity test.'
Three uses of the same spectral data: PCA explores variation, class modeling supports identity decisions, and PLS predicts a reference property. Sample colours and instrument scenes are illustrative and do not represent measured excipient properties.

The one idea

A spectrum can support several different questions. The question determines the model and the evidence it needs.

Principal component analysis (PCA) helps explore what varies. Class modeling can help assess whether a sample fits an established material class. Partial least squares (PLS) regression can predict a numerical property from measurements linked to reference results. These approaches can use the same spectral data, but their outputs are not interchangeable.

Reading 2 set out the development workflow. Here we look inside three tools, using incoming-material identity and granule water content as the pharmaceutical examples. The treatment is introductory; Week 12 takes the methods further, including curve resolution and batch monitoring, and implementation needs more detailed study still [1–3].

Start with the spectrum, not the algorithm

Imagine scanning authenticated lots of lactose monohydrate, mannitol and microcrystalline cellulose by near-infrared (NIR) spectroscopy. Each spectrum contains responses at many wavelengths. Broad, overlapping features make it difficult to find a single wavelength that resolves every relevant difference.

Measurements at neighboring wavelengths often move together. Meanwhile moisture, particle size, temperature, solid form and sample presentation can change the spectrum. Some changes reflect chemical identity; others reflect physical differences within the same acceptable material [2].

Arrange the measurements in a matrix, X:

Matrix elementMeaning in this example
One rowOne sample measurement
One columnResponse at one wavelength
Metadata alongside XMaterial identity, lot, supplier, moisture, instrument and other context

Preprocessing changes the geometry of this matrix. Centering, scaling, derivatives and scatter corrections are scientific and modeling choices. Applied automatically, they can remove useful information or emphasize noise. Development has to establish that they suit the measurement.

PCA: find directions of variation

PCA constructs new axes from weighted combinations of the original variables. The first principal component captures the greatest available variance in the preprocessed X data. The second captures the greatest remaining variance while staying orthogonal to the first. Further components continue the pattern.

PCA is unsupervised: material labels and reference moisture values do not define the axes. Colouring a plot by identity afterward does not change how the components were calculated.

Think of a cloud of points viewed from different angles. PCA finds the directions along which the cloud spreads most. It gives a compact representation when much of the variation lies in relatively few directions.

But the widest direction need not be the most useful one. If particle-size effects dominate the spectra, the first component may reflect them more strongly than identity or water content.

Scores locate samples; loadings describe the axes

Three terms make PCA plots much easier to read:

TermWhat it describesQuestion it helps answer
ScoreA sample’s coordinate on a componentWhere does this sample sit relative to other samples?
LoadingA variable’s contribution to a component directionWhich measured variables contribute to that pattern?
ResidualVariation left outside the retained component modelWhat does the reduced representation fail to describe?

In a score plot, nearby points have similar retained scores. That does not guarantee their full spectra are similar: they can differ in omitted components or residual structure.

In a loading plot, a large loading magnitude means a strong contribution to that component under the chosen preprocessing. It does not by itself prove a molecular assignment or a causal mechanism. Interpret it with spectroscopy, materials knowledge and supporting experiments.

The sign of a component is arbitrary: reversing both its scores and its loadings describes the same model. A sample on the positive side of PC1 is not inherently better, purer or wetter.

A calculated example: rotate the view

Figure titled 'PCA changes the coordinates, not the samples', two panels of the same 40 synthetic observations. Left, 'Original measurement coordinates': response B against response A in arbitrary units, the points lying along a rising diagonal from about (−0.5, 1.5) to (3.4, 4.0), with an orange line marking the PC1 direction along the diagonal and a purple line marking the PC2 direction across it. Two highlighted points: A, orange, at the upper right end, and B, purple, at the lower left. Right, 'Same observations in PCA coordinates': PC2 score against PC1 score, the points now spread horizontally from about −2.6 to 2.0 along PC1 (96.9% of variance) and only about ±0.45 along PC2 (3.1% of variance); point A sits at about PC1 = 2.0, PC2 = −0.2, and point B at about PC1 = −2.6, PC2 = 0.45. Both panels are drawn with equal axis scales, so the PC1 and PC2 lines cross at a right angle. Subtitle: 40 synthetic observations, mean-centred, not variance-scaled; percent variance is not predictive accuracy.
Calculated from 40 synthetic observations, not pharmaceutical measurements. The same samples appear in both panels, mean-centred without variance scaling; with only two variables, keeping both components preserves all the variation.

Download the synthetic example data.

The left panel shows two correlated instrument responses. The right panel shows the same observations after centering and rotation onto principal components. The long direction becomes PC1, carrying 96.9% of the variance; the short perpendicular direction becomes PC2, carrying 3.1%.

Nothing about the samples changed. Only the coordinates used to describe their measurements did.

A spectrum works the same way in many dimensions. Keeping only a few components gives a reduced representation. The explained-variance percentage says how much variation in the preprocessed X data is kept; it is not an identity-test accuracy or a concentration-prediction accuracy.

Pharmaceutical case: three excipients on a score plot

Suppose a development PCA plot shows three groups. Coloured by reference identity, one group is lactose, one mannitol and one cellulose.

That is encouraging exploratory evidence. Now ask:

  • Were the labels established independently?
  • Does each group span multiple lots and relevant suppliers?
  • Were the materials measured under comparable conditions?
  • Could acquisition day, instrument, moisture or particle size explain the grouping?
  • Does a third component reveal differences hidden by the first two?

A useful follow-up experiment deliberately varies the likely confounders. For example, measure relevant particle-size grades of each material under controlled conditions. If the apparent identity grouping collapses, the original model was leaning on physical differences that happened to come with the development set.

PCA helps formulate this investigation. It does not replace it.

From exploration to an identity decision

An operational identity procedure needs more than coloured clusters. It needs a defined way to evaluate a new sample and a response to an unacceptable or unsupported result.

Soft independent modeling of class analogy (SIMCA) is one class-modeling approach built on PCA. A separate model describes the variation within each material class. A new spectrum is evaluated for compatibility with a class model using the chosen implementation’s diagnostics and decision limits.

One useful distinction is between distance within the modeled score space and distance from the modeled subspace. A sample may be extreme along a familiar direction, or carry a spectral pattern the retained components describe poorly. Both can matter to class compatibility. Reading 7 names them: Hotelling’s T² and the Q residual.

Unlike a rule that always assigns the nearest label, class modeling can let a sample fit no class or more than one. Ambiguity needs a defined operational response. These outcomes depend on how the model was built and on its thresholds; they are not guarantees of any particular software.

Challenge sampleWhat the identity procedure should establish
Independent authentic lactose lotCan expected target variation be accepted?
Relevant non-target excipientCan the procedure reject a plausible alternative?
Authentic lactose from a new supplierDoes the supported domain cover this variation?
Mixture or adulterated sampleWhat can be detected, and at what level, if this is part of the intended purpose?

Performance has to be demonstrated with independent samples and relevant challenges. Accepting a spectrum as lactose does not establish freedom from low-level contamination [2, 3].

PLS: connect spectra to a reference quantity

Now return to the drying granules. The question is numerical: what is the water content?

Pair each spectrum with a suitable reference result, such as matched Karl Fischer water content. X holds the spectral measurements; Y holds the reference water values.

PLS regression builds components from the relationship between X and Y. Where PCA follows X variance alone, PLS uses the outcome to seek components that are useful for modeling that relationship. That makes PLS supervised.

It does not make PLS immune to confounding. If wetter samples also happen to be hotter, a model can exploit temperature-associated spectral changes, then fail when temperature and moisture vary independently.

Use the workflow from reading 2: representative matched samples, batch-aware splitting, preprocessing inside resampling, tuned complexity and a final independent assessment. Judge prediction error and bias where the drying decision is made, rather than assuming that a strong fit or a large explained-variance percentage establishes suitability.

One measurement, three different outputs

ApproachInformation used to develop itTypical outputEvidence needed for the proposed use
PCA explorationX; labels can inform interpretation afterwardScores, loadings, explained variance and residualsStability of patterns, measurement understanding and investigation of confounding
Material class modelX and authenticated membership informationCompatibility with a defined classIndependent target lots, non-target challenges and justified decision rules
PLS regressionX paired with a numerical reference YPredicted quantityIndependent error and bias assessment, reference-method support and applicability controls

PCA can also sit inside a predictive pipeline, as in principal component regression (PCR). That is a further modeling choice; a PCA score plot alone does not perform regression or establish identity.

Where the analyst sits

The analyst translates geometry into chemical questions. If samples move on a score plot, what changed? If a lot fails a class model, is it the wrong material, or acceptable variation outside the calibration’s experience? If a moisture prediction looks plausible, is the spectrum inside the supported domain?

The tools make patterns visible and predictions possible. Pharmaceutical judgment establishes what those outputs mean for the material and the decision.

For discussion

  1. PC1 explains most of the variance. Why might it still be a poor predictor of water content?
  2. Two samples overlap in a PC1–PC2 plot. What differences could remain hidden?
  3. Why does colouring a PCA plot by material name not make the PCA calculation supervised?
  4. A sample fits two material class models. What should the procedure specify before such a sample arrives?
  5. Design a development experiment that separates moisture effects from temperature effects in an NIR calibration.

Bridge back to the week

Next: Where the Measurement Lives, which asks where these spectra come from and which material they describe. Return to Week 11.

Data and sources

Synthetic PCA data: the 40 two-variable observations behind the rotation figure, with their PC1 and PC2 scores; PCA summary: explained variance and loadings; reproduction script and requirements. Figure: 3840 × 2160 pixels, computed with a fixed seed.

[1] M. Kuhn and K. Johnson, Applied Predictive Modeling (Springer, 2013). Chapter 3 for preprocessing and dimensionality reduction, Chapter 4 for evaluation and tuning, Chapter 6 for regression approaches including PLS and principal component regression. DOI.

[2] US Food and Drug Administration (FDA), Development and Submission of Near Infrared Analytical Procedures (guidance, 2021). Qualitative and quantitative NIR model development and use. Read its historical Q2 references alongside current Q2(R2) and Q14. Guidance.

[3] United States Pharmacopeia (USP) ⟨1039⟩ Chemometrics. Compendial context for multivariate analysis, qualitative and quantitative applications, and lifecycle practice. Licensed compendial text; the public preview describes the scope, and the full chapter may not have been consulted. USP chapter.

[4] International Council for Harmonisation (ICH) Q14 and Q2(R2): development and intended-use validation context. Q14 guidance · Q2(R2) guidance.

The excipient score-plot case is a constructed teaching example; the rotation data are synthetic.

4 - Where the Measurement Lives

Off-line, at-line, on-line and in-line measurements on a granule dryer: sampling representativeness, transport delay and latency, soft sensors as inference rather than a location, and the evidence a process decision needs.
Graphic titled 'Where the Measurement Lives', subtitled 'Location changes sampling, delay and the evidence behind a result.' Four panels. Off-line: a sealed sample jar in a laboratory, 'Remove sample; analyze in the lab'. At-line: an analyst holding a sample cup beside an analyzer next to process vessels, 'Remove sample; analyze nearby'. On-line: a pipe loop from a stainless vessel through a wall-mounted analyzer, 'Divert material through an analyzer'. In-line: a probe through the window of a vessel full of granules, 'Measure without removing material'. A line reads 'Soft sensors describe inference, not sensor location', and the footer reads 'Fast does not guarantee representative.'
Four measurement locations. Conceptual instrument and process scenes, not installation drawings; the on-line example depicts a liquid sidestream, not a proposed powder sampling-loop design.

The one idea

A result describes material measured at a particular place and time. Its usefulness depends on how that material relates to the process decision.

Moving an instrument closer to a process can reduce delay and sample handling. It also changes how the sample is presented, its exposure to the process environment, and the evidence needed to show that the measurement is representative.

Week 1’s automation section introduced the at-line / on-line / in-line hierarchy at survey depth, and readings 2 and 3 introduced model development and spectral interpretation. Now we ask where those spectra come from, how quickly the results arrive, and which material the results actually describe.

One dryer, several ways to measure water

Imagine granules drying after wet granulation. The team needs water-content information to support an endpoint decision. Too much or too little residual water may affect downstream performance, depending on the formulation and process.

One option is to remove a sample and measure water by Karl Fischer in a laboratory. Another is to scan a removed sample with a near-infrared (NIR) instrument beside the dryer. A third is to acquire spectra through an in-line probe.

These arrangements do not simply rank from bad to good. The laboratory result can provide an important reference value. The nearby instrument can make timely operator decisions simpler. The in-line probe can give frequent measurements, but may interrogate only a local region of the bed.

Choose the arrangement for the decision, then establish its performance.

Four location terms

The US Food and Drug Administration (FDA) process analytical technology (PAT) framework distinguishes at-line, on-line and in-line measurements by the relationship between the sample and the process. Off-line is included here as the conventional laboratory comparison [1].

ModeRelationship to the processPharmaceutical exampleMain question to investigate
Off-lineMaterial is removed and taken to a separate laboratory workflowKarl Fischer water testing of a granule sampleDoes the sample stay representative through sampling, transport and analysis?
At-lineMaterial is removed and measured close to the processNIR scanning of granules beside a dryerIs the sampling and cup presentation reproducible and timely?
On-lineMaterial is diverted from the process through an analyzer; it may be returnedA bioprocess liquid sidestream sent to an analyzerDoes transport through the sampling system preserve the relevant property and timing?
In-lineMaterial is measured without removal; the arrangement may be invasive or noninvasiveNIR measurement through a probe or window at a dryerDoes the interrogated material represent what the decision concerns?

These definitions do not fix response times. A slow on-line separation can take longer than a rapid at-line scan. An in-line acquisition can include substantial averaging, calculation or communication delay.

Off-line: preserve the sample and its history

For our dryer, a laboratory water result might need sampling, sealing, labeling, transport, queue time, preparation, measurement and review.

The result can be accurate for the submitted sample and still be poorly matched to the current dryer state. Two different issues need considering:

  • Sample change: did the removed granules gain or lose water before testing?
  • Process change: did the dryer keep running while the result was being generated?

Record the sampling time and location, not only the time the result was reported. Establish suitable containers, handling and holding conditions. A sealed sample can preserve a historical state; it does not make that state current.

Off-line testing stays valuable for reference measurements, independent checks, investigations, and attributes the process analyzer does not adequately cover. Its usefulness depends on its defined role.

At-line: shorten the journey, control the presentation

An at-line NIR instrument shortens the transport distance and may give a rapid result. An operator still removes and presents a sample.

Cup fill, powder packing, surface condition, temperature, container optics and the material actually picked can all change the response. NIR guidance addresses sample presentation specifically, because the analyzer sees an optical interaction with one particular sample configuration [2].

A calibration developed on carefully prepared laboratory cups cannot simply be assumed to cover every production-floor presentation. Establish how the sample is collected, how much is used, how it is presented, and whether repeat measurements need repositioning or a fresh sample.

The operator is part of the measurement procedure. Training and usable instructions make that contribution reproducible.

On-line: the sampling system is part of the method

Consider a liquid sidestream from a bioprocess sent to an analyzer. The analyzer may run automatically, but the sample has to reach it first.

Tubing volume, flow rate, dead zones, settling, adsorption, bubbles, filtration and cleaning can all affect the sampled material or its timing. Returning material to the process also raises contamination and compatibility questions specific to that process.

In an idealized plug-flow calculation, the transport delay is approximately

ttransport=VpathQsamplet_{transport}=\frac{V_{path}}{Q_{sample}}
Interactive worked example

Transport delay through a sampling loop

Problem: An illustrative on-line sampling loop has a flow-path volume of 20 mL and a sample flow of 10 mL/min. Assuming ideal plug flow, how long does material take to travel from the process to the analyzer?

Significant-figure rule: this is one division and one unit conversion, so the answer keeps the fewest significant figures among the measured inputs. Read both illustrative inputs as two significant figures: 20 mL (two) and 10 mL/min (two). The conversion 1 min = 60 s is exact and does not limit anything. The answer has two significant figures.

  1. Write the relation. t = V ÷ Q, with V the flow-path volume and Q the volumetric flow rate.
  2. Substitute and cancel units. t = 20 mL ÷ 10 mL/min = 20 mL × (1 min ÷ 10 mL). The millilitres cancel, leaving minutes.
  3. Divide. t = 2 min exactly in the arithmetic; to two significant figures that is written 2.0 min, so that the trailing zero shows the precision.
  4. Convert to seconds. 2.0 min × 60 s/min = 120 s. The trailing zero here is not significant, so write it as 1.2 × 10² s (two significant figures).
  5. Interpret. Transport alone takes about 2.0 min. The analyzer’s cycle time and the reporting time come on top. Real loops mix and disperse the sample, so this is a starting estimate, not a validated residence-time characterization.
  6. Rules used. Division keeps the fewest significant figures of the measured inputs (two); the exact minute-to-second conversion doesn’t limit; scientific notation shows that only two figures of 120 s are significant.

Timestamp alignment has to account for that delay. An analyzer value reported at 14:05 may describe material that left the process minutes earlier.

In-line: frequent measurements of a local interaction

An in-line NIR probe interrogates material without removing it. That can give frequent spectra while avoiding some manual handling.

It also raises questions about what the probe actually encounters. Does mixing repeatedly bring representative material past the window? Is the probe facing a moving bed, a stagnant pocket, or intermittent contact? Does fouling change the optical path? Are temperature and physical-property effects covered by the calibration?

Many scans at one location do not automatically substitute for spatial coverage. Highly correlated scans also do not carry the same independent information as the same number of independent samples.

Probe location, acquisition interval and averaging therefore belong in the analytical procedure and its development evidence. A probe installation is a sampling decision as well as an engineering one.

A delayed result can be right about the past

Figure titled 'An accurate result can describe an earlier process state'. Water content in percent, from 1 to 8, against elapsed process or result-availability time from 0 to 45 minutes. A teal curve, the underlying process water content, falls smoothly from 8% at 0 minutes and crosses a dashed purple illustrative decision level at 3% at 20 minutes, reaching about 1.4% at 45 minutes. An orange curve, the exact result available 6 minutes later, is the same curve shifted 6 minutes to the right: it starts at 6 minutes and crosses 3% at 26 minutes. A double-headed arrow between the two crossings is labelled '6-minute reporting delay'. Footer: synthetic teaching example, pure delay only, no noise or model error; the decision level is illustrative and not an endpoint specification.
Calculated teaching example, not production data. The orange trace is an otherwise exact measurement delayed by 6 minutes: no model error, noise, averaging or spatial variation. The horizontal line is an illustrative decision level, not a recommended endpoint specification.

In this example, water content falls continuously. The delayed trace looks wetter because each reported value describes an earlier point in the process: the process crosses the illustrative 3% level at 20 minutes, but the reported value crosses it at 26 minutes.

If the operator waits for the delayed trace to cross the decision level while drying continues, the process crossed it 6 minutes earlier. That does not mean the analytical measurement is biased. It means the value is being used at a different time from the state it describes.

The right operational response depends on process dynamics, the decision rule, safety margins and the validated strategy. Stopping or holding the process pending a result changes the scenario and has to be considered explicitly.

Download the synthetic timing data.

Separate four ideas about time

TermMeaningExample question
Sampling intervalTime between observationsCould a brief disturbance occur between samples?
Acquisition or averaging windowPeriod a measurement representsCould averaging hide a short excursion?
LatencyDelay from the represented process state to the result being availableIs this value recent enough for the intended action?
Response dynamicsHow the measurement system responds when the process changesDoes the sample path or sensor smooth the change?

A display that updates every second can still show a delayed or heavily averaged value. Process understanding decides whether the information arrives soon enough to support the proposed action.

Soft sensors: inference is a separate dimension

A soft sensor estimates a hard-to-measure property from other measurements using a model. A drying model might estimate water content from inlet and outlet conditions, airflow and other process variables, with suitable reference support.

The physical sensors supplying those inputs still have locations, delays and failure modes. Soft sensing describes how the property is inferred; it is not a fifth location after in-line.

An NIR calibration is also model-based inference from a measured spectrum, though terminology varies between disciplines. The useful habit is to state both the physical measurement arrangement and the inference used to obtain the reported property.

If a temperature sensor drifts, the moisture estimate can change even though the model coefficients have not. Evaluating a soft sensor therefore covers the input measurement system, data alignment, the model and the operational response.

Build evidence across the whole measurement chain

For the dryer example, development should establish:

  1. Which process state and material the measurement represents.
  2. How reference samples are matched in place and time.
  3. Which sources of sampling and presentation variation are covered.
  4. Whether the total latency and response are adequate for the intended decision.
  5. How invalid, stale, missing or out-of-domain results are detected and handled.

Good diagnostic questions separate sampling, instrument, model and process effects. A high prediction error might come from an unsuitable model, but also from poor reference matching or a changed sampling environment.

An invalid current result must never quietly become a valid-looking old value. If a display holds the last result, its age and validity have to stay visible to the user or downstream controller.

Where the analyst sits

The analyst connects an instrument reading to the material’s history. The question to keep asking is: which material, at which time, does this number describe?

That question turns a fast analyzer into a defensible measurement system. It also sets up the next reading, where process measurements drive control actions and material diversion.

For discussion

  1. Why can an accurate laboratory result be unsuitable for a current endpoint decision?
  2. An in-line probe and an at-line sample disagree. How would you investigate spatial variation, sample handling, temperature and model applicability before deciding which is wrong?
  3. An analyzer updates every second but reports a rolling five-minute average. What kinds of events could it hide?
  4. Why is soft sensing a different category from on-line or in-line measurement?
  5. Which timestamps would you keep to reconstruct the relationship between a sidestream result and the process it came from?

Bridge back to the week

Next: From Prediction to Process Control, where these measurements feed control actions and diversion on a continuous line. Return to Week 11.

Data and sources

Synthetic delay data: the underlying drying curve and its 6-minute-delayed copy at 0.1-minute steps, from water = 1 + 7·exp(−0.0625 t) % w/w; reproduction script and requirements. Figure: 3840 × 2160 pixels.

[1] FDA, PAT — A Framework for Innovative Pharmaceutical Development, Manufacturing, and Quality Assurance (guidance, 2004). Source of the at-line, on-line and in-line distinctions and the process-understanding framework. Guidance.

[2] FDA, Development and Submission of Near Infrared Analytical Procedures (guidance, 2021). Sample presentation, sources of variability and model-based analytical procedures. Guidance.

[3] International Council for Harmonisation (ICH) Q14 and Q2(R2): development, control strategy and intended-use validation context. Q14 guidance · Q2(R2) guidance.

The dryer case, the sampling-loop numbers and the drying curve are constructed teaching examples, not production data or a validated design.

5 - From Prediction to Process Control

A continuous direct-compression line connects measurements and predictions to feedback, feedforward, residence-time distribution and material diversion, and separates detecting, inferring, deciding, acting and confirming.
Graphic titled 'From Prediction to Process Control', subtitled 'Detect the disturbance. Act on the process. Track affected material.' Three panels. Measure and predict: a loss-in-weight feeder with a probe beside the powder stream, 'Feeder signals + spectral evidence'. Choose the response: an operator at a screen of control settings beside a feeder, with 'Feedback: respond to measured output' and 'Feedforward: act on an upstream disturbance'. Protect the collected output: a tablet press discharging into two bins labelled Collect and Divert, 'Residence-time distribution supports timing'. A line reads 'Defined rules, valid measurements and verified actions', and the footer reads 'A prediction is not a controller. Diversion is not batch release.'
Measure and predict, choose a response, and use residence-time information to protect collected output. Conceptual teaching illustration, not equipment or control-system design; the collect and divert bins show alternative routing, not simultaneous collection and diversion of the same material.

The one idea

A prediction describes a process attribute. A control strategy defines what to do with that information, and how to establish that the action worked.

A model estimating blend concentration does not itself adjust a feeder. A good concentration result does not establish every tablet quality attribute. Diverting an affected segment does not, by itself, authorize release of the retained batch.

This reading follows an illustrative continuous direct-compression line. International Council for Harmonisation (ICH) Q13 supplies the framework for process dynamics, material traceability and control in continuous manufacturing (CM). The example and synthetic calculations explain principles; they are not a validated manufacturing recipe [1].

Follow the material through the line

Active pharmaceutical ingredient (API) and excipients enter through loss-in-weight feeders. The powders pass through a continuous blender, then the tablet press feed system and compression. A downstream device routes tablets to collection or diversion.

Different instruments answer different questions along this path:

MeasurementInformation suppliedWhat it does not establish alone
Feeder mass-flow signalDelivered mass rate and its variationDownstream concentration after mixing, losses or segregation
near-infrared (NIR) blend measurementA model-based estimate of local blend concentration under supported conditionsIndividual tablet content or every finished-product attribute
Press force, displacement or thickness signalInformation about compression and tablet formationA universally valid dissolution prediction
Diverter position feedbackEvidence about the routing device’s positionComplete proof that every affected tablet reached the intended destination

Together, measurements and process understanding can support a control strategy. Each signal needs a defined role, suitable performance, timing and a failure response.

Continuous manufacturing still produces defined batches. A batch can be defined by a justified quantity or production interval, with material traceability maintained across the process. Continuous operation does not remove batch disposition or the quality system [1].

The disturbance: a feeder refill

Suppose an API feeder refill causes a short delivery disturbance. Its mass-flow signal leaves the expected range. That could change the API-to-excipient ratio entering the blender.

The downstream effect depends on the size and duration of the disturbance, the process mixing, material properties and operating conditions. Some disturbances are attenuated without harming product quality. Others need adjustment, diversion, a stop or an investigation.

Do not treat every process alarm as a specification failure. Equally, do not assume a brief event is harmless because the next displayed average looks normal.

Separate detection, inference, decision and action

FunctionExampleEvidence needed
DetectFeeder rate departs from its expected behaviorSignal validity, suitable sampling and event detection
InferPredict how blend concentration will change downstreamAn appropriate process or analytical model, and an applicability assessment
DecideAdjust feed, divert material, stop or escalatePredefined rules justified for the process and the quality risk
ActChange a feeder setpoint or move a diverterVerified command execution and equipment response
ConfirmEstablish recovery and identify affected materialSuitable measurements, timing, traceability and review

Keeping these functions explicit helps locate a failure. A model may predict correctly while an actuator fails. An actuator may work correctly after a decision arrives too late.

One refill, all five functions

Figure titled 'Detect, infer, decide, act, confirm: one feeder refill', four stacked panels on one time axis from 0 to 420 seconds, for a synthetic line at 30.0 kg/h with API at 10.0% w/w. Panel 1, Detect: the measured API feeder rate runs at 3.0 kg/h inside a ±10% band, jumps to about 3.9 kg/h at the refill at 120 s, holds there for about 18 s and decays back by about 170 s; a dashed line marks detection at 123 s. Panel 2, Infer: the model's predicted concentration at the NIR (from the feeder signal) rises from 100% of target at about 150 s to a peak of 112% near 188 s and returns by about 260 s; NIR results every 5 s follow the same curve a few seconds behind. Panel 3, Decide and Act: the predicted concentration at the diverter rises later and lower, peaking near 109% at about 233 s; the action band 97–103% is shaded; a pale orange block shows diversion commanded from 180 to 298 s and a solid orange bar shows diverter position confirmed from 185 to 303 s. Panel 4, Confirm: the true concentration at the diverter, teal where collected and orange where diverted; it exceeds the 105% quality limit from 204 to 269 s, entirely inside the orange section. A note reads: out of limit 204–269 s, none collected; diverted 118 s = 0.983 kg, of which 0.43 kg was within the limit, the cost of the margin.
Synthetic teaching example: the RTDs, rules, limits and delays are illustrative, not a validated control strategy. The simulated process follows its own RTD model exactly; on a real line the two differ, which is what the confirm step exists to catch.

Read the figure one panel at a time, against the table above.

  1. Detect. The refill starts at 120 s. The rule is that the measured API rate must sit more than 10% from setpoint for two consecutive seconds, so it fires at 123 s. Detection says only that the feeder misbehaved; it says nothing yet about the product.
  2. Infer. The same RTD models used for diversion turn the feeder signal into a predicted concentration at the NIR probe and at the diverter. The NIR results, a 5 s average reported 3 s later, follow the prediction a few seconds behind and peak near 112% of target. Here the measurement confirms the model; on another day it might contradict it, and that disagreement is itself evidence.
  3. Decide. The model predicts that material at the diverter leaves the 97–103% action band from 195 s to 285 s. The rule commands diversion 15 s ahead, at 180 s. That is almost a minute after detection: feedforward lets the decision wait for the material, instead of reacting the moment the alarm sounds.
  4. Act. The diverter confirms its position 5 s after the command, at 185 s. The record keeps both times, because the gap between them is material that was commanded away but not yet shown to have moved.
  5. Confirm. Collection may resume only when both conditions hold. The model’s prediction must have been back in band for 10 s, which happens at 295 s. Three consecutive NIR results must also be in band, which happens at 253 s at the probe and becomes 298 s once carried forward by the 45 s NIR-to-diverter delay. The later time governs, so collection is commanded at 298 s and confirmed at 303 s. The true concentration at the diverter exceeded the 105% quality limit from 204 to 269 s, all of it inside the diverted window, and none of it reached collection.
Interactive worked example

How much material did the event divert?

Problem: The line runs at 30.0 kg/h. The diverter was confirmed in the divert position from 185 s to 303 s, and the out-of-limit material occupied 66 s of that window. How much material was diverted, and how much of it was within the quality limit?

Significant-figure rule: the times are subtracted first, which keeps whole seconds (no decimal places). The masses then come from multiplication and division, which keep the fewest significant figures among the measured inputs: 30.0 kg/h (three), 118 s (three) and 52 s (two). The conversion 1 h = 3600 s is exact. So the diverted mass has three significant figures and the within-limit part has two.

  1. Diverted time. 303 s − 185 s = 118 s, to the whole second.
  2. Rate in kilograms per second. 30.0 kg/h ÷ 3600 s/h = 0.0083333… kg/s. The hours cancel; carry all the digits.
  3. Diverted mass. 118 s × 0.0083333… kg/s = 0.98333… kg → 0.983 kg to three significant figures (the dropped 3 rounds down).
  4. Within-limit time. 118 s − 66 s = 52 s of diverted material that was inside the 95–105% limit.
  5. Within-limit mass. 52 s × 0.0083333… kg/s = 0.43333… kg → 0.43 kg to two significant figures, limited by 52 s.
  6. Interpret. Of 0.983 kg diverted, about 0.55 kg was out of limit and 0.43 kg was good material, thrown away because the rule acts early (the 97–103% action band and the 15 s lead) and waits for confirmation. That margin is a deliberate cost: it is what bought “none collected”.
  7. Rules used. Subtraction kept whole seconds; multiplication and division kept the fewest significant figures of the measured inputs; the exact hour-to-second conversion didn’t limit.

Feedback: respond to the measured result

Feedback uses a measured or estimated controlled variable to respond to a deviation from its target. A downstream blend-concentration estimate might, for example, support adjusting an upstream feeder ratio within an established strategy.

The effect of that adjustment takes time to reach the downstream measurement. Changing the feeder repeatedly before earlier changes arrive can cause overcorrection or oscillation.

A suitable controller therefore accounts for process dynamics, measurement delay, noise, actuator constraints and interactions with other operating variables. Speeding up one feeder without considering total throughput and the other feed rates can introduce new disturbances.

An NIR calibration predicts concentration. The controller decides an action. The two may be integrated in software, but each needs its own development and evaluation evidence.

Feedforward: respond to an upstream disturbance

Feedforward uses information about an upstream disturbance to choose an action before its full downstream effect is observed. Here, feeder measurements and a process model might support timing a diversion in advance, or a justified compensating adjustment.

The advantage is earlier action. The limitation is dependence on the disturbance measurement and on the model linking it to downstream behavior. An unmeasured disturbance or a wrong model defeats the intended response.

Feedforward and feedback can be combined: the upstream signal supports anticipation, and downstream measurements show what actually happened. The choice depends on the process and the control function, not on a rule that one approach is always better.

Residence time is a distribution

Material entering a blender at one moment does not leave as a single sharply bounded packet. Mixing and flow create a range of transit times. The residence time distribution (RTD) describes that spread for a specified path and operating condition [1, 2].

A mean transit time is useful but incomplete. Shifting an event by the mean alone ignores the material that arrives early and the tail that leaves late.

RTD characterization can use a suitable tracer, or other justified experiments and models, relevant to the materials, operating conditions and units of interest. A tracer that segregates differently from the API may misrepresent the movement we need to understand.

RTDs change with throughput, hold-up, equipment settings and material properties. A single curve is not automatically valid across every operating condition.

A worked timing example

Figure titled 'A short disturbance becomes a spread of downstream effects', two stacked panels against time from 0 to 8 minutes. Top: the normalized input concentration deviation, a rectangular pulse of height 1.0 from 2.0 to 2.5 minutes, annotated 'Input event: 2.0–2.5 min; RTD mean: 1.0 min; no corrective controller simulated'. Bottom: the downstream deviation, the input convolved with the RTD, a smooth skewed peak that starts rising just after 2 minutes, peaks at about 0.42 near 3.0 minutes and tails off to near zero by about 5.5 minutes. Two dashed orange lines at 3.0 and 3.5 minutes mark the event shifted by the mean only; a light purple band from about 2.2 to 5.2 minutes marks an illustrative RTD percentile-based timing interval. Footer: synthetic teaching example, ideal linear mixing with a gamma RTD (shape 4, mean 1 min); shading does not establish safe collection boundaries.
Calculated teaching example: a normalized gamma RTD (shape 4, mean 1.0 min) under an ideal linear, time-invariant mixing assumption. The upper signal is a normalized concentration deviation, not a measured feeder rate; the lower signal is its convolution with the RTD. No corrective controller is simulated, and the shading is an illustrative timing interval, not a validated diversion rule.

The input disturbance lasts from 2.0 to 2.5 minutes, and the RTD has a mean residence time of 1.0 minute. A simple mean-delay shift would suggest the affected output is confined to 3.0–3.5 minutes.

The calculated response tells a different story: the effect is delayed, broadened and smaller at its peak (about 0.42 of the input deviation). It begins before the mean-shift interval and continues well after it.

For the shading, the start of the input event is combined with the RTD’s 0.5th-percentile time (0.17 min) and the end with its 99.5th-percentile time (2.74 min), giving an interval of about 2.2 to 5.2 minutes. This construction shows the timing spread. It does not guarantee acceptable output outside the shaded region, because the mathematical tails remain, and the quality impact also depends on the event’s size, the limits and the uncertainty.

Download the synthetic input and output data.

Translate process understanding into diversion

Diversion keeps defined material out of the accepted collection stream. The strategy needs a justified trigger and defensible start and end times. The RTD and process dynamics support that timing; they do not choose the quality criteria [1].

For the feeder event, investigate:

  1. When the disturbance started and ended at its source.
  2. How it propagates to the relevant quality measurement and to the diversion point.
  3. Whether detection, computation, communication and actuator delays allow the intended routing.
  4. Which uncertainties need additional coverage or a different response.
  5. What evidence supports ending diversion and resuming collection.

The RTD has to cover the right path. A feeder-to-NIR model is not automatically a feeder-to-diverter model; intermediate hold-up and further flow behavior matter.

If a disturbance is recognized only after affected tablets have passed the diverter, moving the gate now cannot retrieve them. The strategy has to identify and manage potentially affected collected material.

Recovery is more than one good number

A single normal NIR prediction may not establish recovery. It may reflect averaging, a local sample, or a temporary return while affected material is still elsewhere in the system.

Predefined recovery criteria can combine valid analytical results, process conditions, diagnostics and a justified timing or material-clearance requirement. Their form is process-specific.

Likewise, a constant output trend is not proof of control. Steady state describes behavior over time; a state of control concerns assurance of continued process performance and product quality. A process can be stable at an unsuitable condition, while an understood and controlled transition can involve changing signals [1].

What if the measurement fails?

Imagine the NIR predictions stop updating while the feeder values stay normal. A previous acceptable prediction must not silently stand in for current evidence.

The established response might be diversion, a stop, an investigation, or a justified alternative measurement strategy, depending on what evidence remains and on the approved operating strategy. There is no universal rule that every analyzer failure calls for the same action.

Record signal validity, result age, model version, alarms, commands, actual device states and the material-routing history. An investigation needs evidence of what the system actually did, not only what the software requested.

Diversion and release answer different questions

Diversion asks which material should be kept out of a defined collection stream. Release asks whether the retained batch meets the applicable requirements and whether the complete evidence supports disposition.

Handling an API-feeder disturbance well does not establish dissolution, impurity control, tablet strength or any other required attribute. Real-time release testing (RTRT), where justified, needs its own strategy for the attributes it covers. That is the subject of the next reading.

Where the analyst sits

The analyst connects chemistry, signals and material history. Is a concentration excursion real or a probe artefact? Does the RTD describe this throughput and this material? Did the control action happen in time? Which collected output is potentially affected?

Those questions turn a numerical prediction into evidence that can support process decisions. Control comes from the coordinated system of measurements, models, rules, actions and verification.

For discussion

  1. Why can an accurate concentration model coexist with an ineffective control loop?
  2. Explain how feedback delay can cause overcorrection in the tablet-line example.
  3. Why is shifting an input event by the mean residence time insufficient for diversion timing?
  4. An upstream alarm is recognized after potentially affected tablets were collected. What evidence would you need to identify and manage that material?
  5. Why does successful diversion not establish that the retained batch can be released?

Bridge back to the week

Next: When a Model Can Support Release, on the evidence that lets process data stand in for a finished-product test. Return to Week 11.

Data and sources

Synthetic RTD response: the input pulse, the gamma RTD density and the convolved output at 0.005-minute steps; RTD summary: the percentiles, shaded interval and output peak quoted above. Feeder event: time series at 1 s steps (measured feeder rate, predicted and true concentration at the NIR and at the diverter, route), NIR results, event summary (every time and mass quoted above) and the rules used; reproduction script and requirements. Figures: 3840 × 2160 pixels, computed with fixed seeds.

[1] ICH Q13, Continuous Manufacturing of Drug Substances and Drug Products. Read the control-strategy and material-traceability discussions and the illustrative oral-solid-dose annex. Guidance page.

[2] US Food and Drug Administration (FDA), Predictive Residence Time Distribution Models for Continuous Powder Blending. Research summary connecting RTD, process conditions and material traceability. FDA research.

[3] ICH Q13 training materials, particularly Modules 3–6 on control and process dynamics, Module 8 on diversion, Module 9 on monitoring and control, and Module 10 on models. ICH quality guidelines and training.

The line, the feeder event and the RTD are constructed teaching examples, not a validated manufacturing strategy.

6 - When a Model Can Support Release

Tablet assay, content uniformity and dissolution show what evidence connects process measurements to real-time release testing: each attribute needs its own justification, equipment failure differs from an unfavourable result, and the specification stays.
Graphic titled 'When a Model Can Support Release', subtitled 'Connect the measurement to the quality attribute and the release decision.' Three panels. Assay: tablets on a sample tray inside an analyzer, 'How much API on average?'. Content uniformity: single tablets in separate wells, 'How much API in each dosage unit?'. Dissolution: tablets in dissolution vessels with paddles, 'How does the dosage form release drug?'. A banner reads 'Each attribute needs its own justified evidence', with 'Valid measurements • Representative sampling • Defined rules • Lifecycle controls'. Footer: 'Real-time release testing supports batch disposition. It does not remove the specification.'
Assay, content uniformity and dissolution ask different questions and need attribute-specific evidence for real-time release testing. Conceptual illustration: the instruments shown do not define a validated sampling arrangement or a compendial apparatus configuration.

The one idea

Real-time release testing (RTRT) changes the evidence used to establish conformity. The product still has to meet its specification.

A rapid analyzer or a strong prediction model does not automatically become a release procedure. The connection between measurements, material attributes, process controls, acceptance criteria and finished-product quality has to be established for the proposed use.

Reading 5 covered control and material diversion. Here the question is different: when can the resulting evidence support batch disposition without routinely repeating a particular finished-product test?

Begin with the attribute, not the instrument

Consider tablets from the same continuous direct-compression line. The team has feeder data, near-infrared (NIR) spectra, tablet-mass information, compression signals, model diagnostics and material-routing records.

Those records may be useful for several quality questions, but the questions differ:

AttributePharmaceutical questionWhat needs to be connected
AssayDoes the product contain the required amount of active pharmaceutical ingredient (API)?Representative measurements and controls to the specified assay result
Content uniformityIs API content sufficiently uniform among dosage units?Evidence about unit-level content and its distribution
DissolutionDoes the dosage form release drug as required under the specified test conditions?Relevant material and process factors to the dissolution response
Degradation productsAre specified and other relevant degradants controlled?Suitable specificity and sensitivity for those impurities

One spectral dataset may contribute to more than one attribute, but each conclusion needs its own justification. An assay calibration cannot be assumed to detect trace degradants or predict dissolution just because it fits concentration well.

What RTRT means

RTRT uses process information, including appropriate measured material attributes and process controls, to evaluate product quality. It may combine direct measurements, predictive models and demonstrated control of the relevant process conditions. It does not need a separate machine-learning model for every attribute [1, 2].

Its ancestor is parametric release of terminally sterilised products: release on the validated sterilisation-cycle record rather than a sterility test, because the cycle data are a better guarantee than a small sample.

RTRT can apply to selected attributes while others keep conventional testing. It can also be used in batch manufacturing; it is not exclusive to continuous manufacturing.

The term does not mean tablets are commercially releasable the instant they leave the press. Review of the complete applicable evidence, deviations and other requirements still supports disposition by the responsible quality function or authorized person under the relevant regional system.

Process analytical technology (PAT) is a broader process-understanding and control framework. A PAT measurement can be valuable for monitoring without being part of an approved RTRT strategy.

Assay: connect the measurement to the retained material

Suppose an NIR calibration estimates the API mass fraction in the blend entering the press. Development establishes its performance against suitable reference results across the intended formulation and process conditions.

For release use, more questions remain. Which material does each observation represent? How are valid observations linked to the retained output after diversion? How are throughput changes handled? Does segregation between the measurement point and dosage-unit formation affect the conclusion?

For an idealized uniform blend, the API amount in one tablet is

mAPI=wAPI mtabletm_{API}=w_{API}\,m_{tablet}
Interactive worked example

API per tablet from a blend mass fraction

Problem: The blend’s API mass fraction is 0.10 and the tablet mass is 200 mg. Assuming a perfectly uniform blend, how much API does one tablet contain?

Significant-figure rule: this is a single multiplication, so the answer keeps the fewest significant figures among the measured inputs: w = 0.10 (two; the leading zero only places the decimal) and m = 200 mg (read here as a measured tablet mass to three). The answer has two significant figures.

  1. Check the units. w is a mass fraction, mg API per mg blend, so it is dimensionless. Multiplying by a tablet mass in mg gives mg API.
  2. Substitute. m_API = 0.10 (mg API/mg tablet) × 200 mg tablet. The “mg tablet” cancels, leaving mg API.
  3. Multiply. 0.10 × 200 = 20 in the arithmetic.
  4. Round and write the precision. Two significant figures: written as 20 mg, the trailing zero would be ambiguous, so write 2.0 × 10¹ mg API.
  5. Interpret. About 20 mg API per tablet, if the blend measurement represents the material in that tablet. The arithmetic says nothing about whether it does: that is the evidence the rest of this section asks for.
  6. Rules used. Multiplication keeps the fewest significant figures among the measured inputs (two, from 0.10); scientific notation shows that the trailing zero is significant.

A batch summary also needs appropriate weighting. When throughput varies, a simple average of equally spaced concentration observations can differ from a material-mass-weighted average. The statistical procedure has to match the attribute and the output it represents.

Content uniformity: the mean is not the distribution

Two batches can have the same average API content but very different unit-to-unit variation.

Figure titled 'Same average content. Different dosage-unit variation.', two panels of API content in percent of nominal, from 80 to 120, against 20 illustrative dosage units. Left, synthetic set A, narrower spread: all 20 points lie between 98% and 102%, scattered close to a dashed line marking the mean of 100%. Right, synthetic set B, wider spread: the points climb from 82% to 118% over units 1 to 9, return to 100% at unit 10, then climb again from 84% to 116% over units 11 to 18 before two final points at 100%; the dashed mean line is again at 100%. Footer: invented teaching data, 20 units per set, no acceptance limits or pass/fail decisions; not a compendial uniformity calculation, sampling recommendation or product dataset.
Invented teaching values for 20 units per set. Both means are exactly 100% of nominal; the sample standard deviations are about 1.5% (set A) and 10% (set B). No compendial acceptance limits or pass/fail decisions are shown: this is not a USP ⟨905⟩ calculation or a validated sampling plan.

Comparing the two means cannot separate these sets. A procedure supporting uniformity needs evidence about the relevant variation among dosage units and an appropriate statistical decision rule.

Thousands of NIR scans are not necessarily thousands of independently measured tablets. Consecutive observations can be correlated, optical measurements can average material, and blend observations do not automatically resolve individual tablet contents.

The sampling strategy has to connect measurement location, sampling frequency, measurement volume, process dynamics and dosage-unit formation to the uniformity conclusion. Where an alternative statistical acceptance procedure is proposed, its ability to protect product quality has to be justified rather than assuming the conventional United States Pharmacopeia (USP) ⟨905⟩ calculation transfers unchanged [1].

Download the synthetic unit-content values.

A published tablet example

Goodwin and colleagues published “Real time release testing of tablet content and content uniformity” in the International Journal of Pharmaceutics in 2018. Their paper describes an approach using compaction-force weight control and a parametric tolerance-interval test. It is a useful example of RTRT development built around the pharmaceutical question and the statistical evidence, rather than the assumption that release always means an NIR prediction [5].

Read it by asking: what was measured, what assumptions connected those measurements to tablet content, and how did the proposed statistical test address the batch? Do not read a published application as blanket authorization to use its approach on a different formulation or line.

Dissolution: another relationship must be established

Tablet dissolution can depend on API particle size and solid form, formulation, disintegrant properties, lubrication, porosity, compression and more. Which factors matter depends on the product.

A model using hardness or compression force alone can miss a change in API properties or formulation behavior. Good prediction within a narrow development dataset may reflect factors that happened to vary together.

Develop an appropriate reference dissolution procedure and challenge the proposed surrogate with relevant material and process variations, including conditions that could change dissolution without strongly moving the other monitored attributes. That is the discrimination-by-design exercise from Week 9, applied to a model instead of a medium. Assess prediction performance where the dissolution decision matters.

This connects to the solid-state thread: a solid-form change can affect performance while leaving the nominal API content unchanged, as in When a Batch Fails. An assay result cannot establish that the same amount of API will release in the same way.

The development and validation evidence

The workflow from reading 2 still applies, with added attention to the release decision:

  1. Define the attribute, intended use, applicable specification and decision rule.
  2. Establish suitable reference measurements and representative matched samples.
  3. Cover the relevant material, process, instrument and environmental variation.
  4. Develop and independently evaluate the analytical and process relationships.
  5. Justify sampling, statistical aggregation, uncertainty and acceptance criteria.
  6. Demonstrate the complete procedure under intended manufacturing conditions.
  7. Establish monitoring, change control and predefined exception handling.

International Council for Harmonisation (ICH) Q14 addresses analytical development and control strategy; Q2(R2) addresses validation for the intended purpose; Q13 adds continuous-manufacturing considerations such as process dynamics, sampling and traceability. Their roles complement one another, and a good calibration fit does not satisfy all of them [2–4]. The validation burden goes up under RTRT, not down.

A real product example: a hybrid strategy

The European Medicines Agency (EMA) public assessment report for Symkevi (tezacaftor/ivacaftor) lists conventional/RTRT routes for several finished-product attributes alongside conventional tests for others. It describes comparative testing and a contingency strategy for equipment failure [6].

That is the practical pattern: RTRT can be one part of a hybrid control and release strategy. A product-specific assessment does not imply that every listed attribute uses the same measurement, or that the approach transfers unchanged to another product.

Equipment failure and unfavourable results are different

These situations need different reasoning:

SituationWhat it meansAppropriate principle
Analyzer or data-system failureRequired information may be unavailable or invalidInvestigate under the quality system and use only a justified, applicable contingency strategy
Valid RTRT result fails or trends toward failureEvidence may indicate a product or process problemInvestigate; do not replace unfavourable evidence with a passing end-product result
Model diagnostics indicate unsupported conditionsPrediction applicability is uncertainFollow predefined exception handling and establish what evidence remains valid

EMA’s RTRT guideline explicitly separates equipment-failure contingency arrangements from failures or adverse trends in RTRT results. It allows justified temporary alternative testing or monitoring in an equipment-failure plan, while rejecting simple substitution of end-product testing for unfavourable RTRT results [1]. It is the same rule as the out-of-specification procedure under Q7: retesting into compliance is not acceptable.

So “run the conventional test if the model fails” is too ambiguous to be a useful instruction. Does “fails” mean a broken instrument, an out-of-domain spectrum, or evidence of nonconforming material? The procedure has to tell these apart.

Approval, specifications and ongoing evidence

The applicable regulatory authorization and quality system decide how the strategy is implemented. In the EU framework described by the EMA guideline, RTRT needs authorization, the covered attributes stay in the specification, and reverting routinely to end-product testing needs the appropriate regulatory change. Regional requirements and the product’s authorization govern the operational details [1].

Conventional procedures remain relevant for stability, independent comparisons, investigations and justified contingencies. How often comparative testing continues, and in what role, depends on the established strategy; a universal reduced-testing schedule cannot be assumed.

Lifecycle monitoring should detect loss of predictive performance or applicability. A new supplier, an instrument transfer, a revised formulation or a process change can challenge relationships that were dependable during development. The next reading takes those changes in detail.

Where the analyst sits

The analyst connects a reported value to a quality claim. What attribute does it establish? Which retained material does it represent? Are the sampling and statistical assumptions defensible? Is the evidence complete and valid for this batch?

RTRT makes those connections explicit. It moves analytical responsibility into the integrated measurement and control strategy, while keeping the need for a justified disposition decision.

For discussion

  1. Why can two batches have the same assay mean but different content uniformity?
  2. What additional evidence connects blend NIR observations to a dosage-unit uniformity conclusion?
  3. Which material changes could affect dissolution without strongly changing an assay prediction?
  4. Contrast an analyzer breakdown with a valid unfavourable RTRT result. Why are the responses different?
  5. What evidence remains to be reviewed after a known disturbance has been successfully diverted?

Bridge back to the week

Next: A Model Has a Lifecycle, where a new excipient supplier challenges the calibration behind these release decisions. Return to Week 11.

Data and sources

Synthetic unit content: the 20 invented unit values for each set; reproduction script and requirements. Figure: 3840 × 2160 pixels.

[1] EMA, Guideline on Real Time Release Testing, Revision 1 (2012). Particularly Sections 5.1–5.2 on specifications, comparative evidence, contingency arrangements and unfavourable results. Guideline and current-version page.

[2] ICH Q8/Q9/Q10 questions and answers and points to consider: context for models, RTRT and control strategy. Guidance page.

[3] ICH Q14 and Q2(R2). Analytical development · Validation.

[4] ICH Q13, Continuous Manufacturing of Drug Substances and Drug Products. Guidance page.

[5] D. J. Goodwin, S. van den Ban, M. Denham and I. Barylski, “Real time release testing of tablet content and content uniformity,” Int. J. Pharm. 537 (2018) 183–192. Publisher full text may need institutional access. DOI.

[6] EMA, Symkevi: EPAR — public assessment report (2018). A product-specific illustration of RTRT and conventional testing within one strategy. Assessment report.

USP ⟨905⟩ Uniformity of Dosage Units is cited by number only; licensed compendial text, not consulted for this reading.

The tablet, blend fraction and unit-content sets are constructed teaching examples.

7 - A Model Has a Lifecycle

An NIR supplier-change case connects prediction errors, Hotelling’s T² and Q diagnostics, instrument transfer and controlled model maintenance: validation establishes evidence for an intended use, and monitoring asks whether it still applies.
Graphic titled 'A Model Has a Lifecycle', subtitled 'Establish evidence. Monitor performance. Investigate change.' Three panels. Establish: an analyst loading a sample into a benchtop NIR instrument beside sample vials, with 'Representative samples' and 'Independent evaluation'. Use and monitor: an analyst reviewing a data table on screen beside an in-line probe on a process vessel, with 'Prediction error + model diagnostics' and 'Valid measurements and traceability'. Maintain: jars of excipient beside an instrument and a checklist on a clipboard, with 'Investigate before updating' and 'Verify the revised procedure'. A line reads 'Preserve versions, evidence and the intended purpose', and the footer reads 'A new supplier is a question to investigate, not an automatic reason to retrain.'
Establish evidence, monitor performance during use, and investigate changes before controlled maintenance. Conceptual teaching illustration; the supplier-change case and numerical examples below are invented for instruction.

The one idea

Validation establishes evidence for an intended use under defined conditions. Monitoring asks whether that evidence continues to apply.

A frozen model does not change its coefficients by itself, but the world supplying its inputs does. Raw materials, instruments, sampling, software, temperature and process conditions can all challenge performance. The model is the method, and it has a validation and a lifecycle exactly as an high-performance liquid chromatography (HPLC) method does.

International Council for Harmonisation (ICH) Q14 explicitly addresses multivariate model establishment, routine use and maintenance, including monitoring that can trigger rebuilding. A model-maintenance plan connects these activities, rather than treating calibration as a one-time event [1].

The case: an approved supplier, an unfamiliar spectrum

Our near-infrared (NIR) procedure predicts active pharmaceutical ingredient (API) concentration in a powder blend. The formulation, reference procedure and operating range are defined, and independent evaluation supported the procedure’s intended role in the control strategy.

A newly qualified excipient supplier is introduced. The material meets its incoming requirements, but the NIR spectra begin to differ from historical spectra. Model diagnostics rise. The concentration predictions stay plausible.

Several explanations are possible. The new excipient may have a different particle-size distribution, moisture level, physical form or scattering behavior. The probe might be fouled. The reference samples might not match the measured process material. A coincident instrument problem might be responsible.

Supplier qualification and model applicability answer different questions. A material can be acceptable under its purchasing specification while presenting variation the calibration never saw.

Do not assume a plausible prediction proves applicability, or that an unusual spectrum proves the material is defective.

Monitor performance and applicability separately

These kinds of evidence complement each other:

EvidenceWhat it can revealImportant limitation
Matched reference comparisonsActual prediction error and systematic bias for the checked samplesCoverage and reference uncertainty limit the conclusion
Spectral and model diagnosticsUnusual input patterns or departure from the represented variationAn unusual input does not automatically mean the prediction has failed
Instrument and acquisition checksChanges in hardware response or measurement qualityPassing checks do not establish complete model suitability
Process and material recordsContext for causes, timing and potentially affected outputA temporal association alone does not prove causation

The maintenance plan should say what is checked, how often, by whom, and what triggers investigation or action. Reference-check frequency and update triggers should reflect the model’s impact and risk. ICH’s Q8/Q9/Q10 implementation material discusses these elements [2].

Prediction error is not the same as a spectral residual

For a quantitative model, define the prediction error consistently. In this reading:

ei=y^i−yreference,ie_i=\widehat{y}_i-y_{reference,i}

A positive error means overprediction. The mean error estimates bias in the evaluated set; an error-magnitude summary such as the root mean square error of prediction (RMSEP) describes disagreement for that set. Both depend on the samples and reference results used.

In a principal component analysis (PCA)-based spectral diagnostic, the residual means something different: the part of the measured X spectrum the retained components do not reconstruct. It can be large even when a checked Y prediction stays close to its reference value.

Calling both quantities “residuals” without naming their space confuses an investigation. Say whether you mean a prediction error in concentration units or a spectral reconstruction diagnostic.

T² and Q ask different questions

For a retained PCA representation, two commonly used diagnostics are:

  • Hotelling’s T²: a distance within the retained score space, accounting for the variation along each component.
  • Q residual, or squared prediction error in X: a measure of variation outside the retained component subspace.

An extreme but familiar spectral pattern can give a high T². A new spectral feature that the retained components describe poorly can give a high Q. Both can rise together. These are the same two distances that SIMCA uses to decide class membership.

Thresholds depend on the model, the data, the statistical assumptions and the intended response. There is no universal T² or Q limit for every instrument, preprocessing method or product. A diagnostic limit is not a product specification.

In partial least squares (PLS) applications, understand exactly which diagnostics the deployed system calculates; do not assume every software package calculates or labels them the same way.

A calculated example: three different situations

Figure titled 'Model diagnostics and prediction error answer different questions', two panels each showing three groups of 30 synthetic observations with short bars at the means. Left, 'Q: unexplained variation in X', squared reconstruction residual on a log scale from 10⁻⁶ to 10⁰: the baseline group (teal) is scattered from about 10⁻⁶ to 3 × 10⁻² with a mean near 3 × 10⁻³; the input-pattern change group (orange) sits tightly near 2, about three orders of magnitude higher; the outcome-relationship change group (purple) matches the baseline. Right, 'Prediction error against reference Y', predicted minus reference: baseline and input-pattern change both cluster around 0 within about ±0.07; the outcome-relationship change group sits near −0.8. Footer: synthetic contrasts, same fixed PCA diagnostic and prediction equation in all scenarios, 30 observations per scenario, no alert limits or acceptance criteria.
Synthetic example: a one-component PCA model fitted to 200 development observations of two variables, plus a simple fixed prediction equation, ŷ = x₁. The three scenarios are constructed contrasts, not successive events in one production run, and no statistical alert limits or acceptance criteria are shown.

In the baseline scenario, new observations follow the development relationship. In the input-pattern change, the second input variable shifts while the first stays the same. Q rises (its mean goes from about 0.003 to about 2.0, in arbitrary units) because the joint input pattern has changed, but the prediction equation uses only the first variable, so the prediction error does not change.

In the outcome-relationship change, X stays like the baseline while the relationship to the reference outcome shifts. Q is unchanged, while the prediction error moves to about −0.8.

The demonstration is deliberately simple. It shows that input diagnostics and reference comparisons are not substitutes for each other. It does not claim that a particular diagnostic will always catch or always miss a real pharmaceutical change.

Download the synthetic scenario data.

Investigate the supplier-change signal

Before changing the calibration, follow a structured investigation:

  1. Establish validity. Check timestamps, sample matching, acquisition conditions, model version, preprocessing and reference results.
  2. Check the measurement system. Examine instrument checks, window cleanliness, probe contact, temperature and sample presentation.
  3. Compare the material. Review supplier information and the relevant physical or chemical characterization against the old supplier’s material.
  4. Assess current performance. Obtain suitable independent matched references across relevant conditions, including the decision-critical range.
  5. Assess impact. Determine which results and material could be affected, and apply the established operating and quality-system response.

An elevated diagnostic may need action before the root cause is resolved. Follow the predefined controls for unsupported results, rather than carrying on because the displayed concentration looks reasonable.

Agreement with the reference in a few samples is reassuring but does not establish coverage across the full new variation. Design the follow-up work around the scientific question.

The investigation, worked on synthetic data

Figure titled 'Investigate the signal before you touch the model', six panels for a synthetic NIR blend-assay model calibrated on excipient supplier E1, with supplier E2 entering on day 21 of 40. Trigger: bars of the percentage of spectra over the diagnostic limits each day; Q flags 0 to 4% of spectra on E1 days and 100% on every E2 day, while T² flags none until a few late E2 days, at most 8%. Steps 1–2, validity and the instrument: a daily wavelength check stays within ±0.1 nm of 1680.0 nm against a ±0.5 nm band on all 40 days, with a note that the model version, preprocessing and sample pairing were unchanged. Step 3, compare the material: the fitted centre of the excipient band near 2270 nm for 12 E1 lots clusters between 2270.83 and 2270.97 nm inside an E1 mean ±3 SD band, while 3 E2 lots sit at 2272.95 to 2273.01 nm. Step 4, assess current performance: predicted minus HPLC at challenge levels 90, 95, 100, 105 and 110% of label claim, three blends each per supplier, inside a pale ±1.0% band; E1 RMSEP 0.5%, E2 RMSEP 0.6%; the E2 level means run from −0.93 to +0.11%, closest to the band edge at 95%. Step 5, assess impact: routine reference-check errors by day, scattered around 0 for E1 and slightly below 0 for E2, with a note that 20 production days on E2 need assessment. A summary panel lists the evidence and the response: accuracy holds, but a diagnostic that flags every result has stopped working, so extend the calibration with E2 under change control.
Synthetic teaching data. Diagnostic limits are the 99th percentiles of an independent set of 60 E1 validation blends, not the calibration set; the ±1.0% requirement is illustrative. The figure follows the five steps above in order.

The figure works the five steps on one constructed case: an NIR blend-assay model (SNV and PLS with 4 latent variables), calibrated on 60 E1 blends at 85–115% of label claim and run for 40 production days. The only thing that differs between the suppliers is one excipient band near 2270 nm: E2’s sits 2 nm higher.

  • The trigger. Q flags every E2 spectrum from day 21. T² flags none for two weeks and at most 8% on any later day. This is a new spectral pattern, not an extreme version of a familiar one. Meanwhile the predicted assay stays near 100% of label claim, exactly the “plausible prediction” this reading warns about.
  • Steps 1–2, validity and the measurement system. The model version, preprocessing and sample pairing are unchanged, and the daily wavelength check stays within ±0.1 nm of its target on every day. The signal is not the instrument and not the data handling.
  • Step 3, the material. The band position is measured on pure excipient from each lot. Twelve E1 lots agree to within 0.15 nm; all three E2 lots sit 2.1 nm higher, far outside E1’s lot-to-lot range. E2 passed its incoming tests, but the spectrometer can tell it apart.
  • Step 4, current performance. Routine checks near 100% of label claim can’t answer whether accuracy holds across the range, so the team makes E2 blends at five levels and assays them by HPLC. Every E2 level mean is inside the illustrative ±1.0% requirement, but the margin is thin at 95% (−0.93% from three blends). A careful team would add replicates there before leaning on the result.
  • Step 5, impact. Twenty production days ran on E2. Their routine reference checks average −0.28%, so there is no sign of out-of-specification product. But every release decision in that period was made while the applicability flag was on, and each needs assessing under the site’s procedure.

How can a 2 nm shift be measured when the spectrometer reads every 10 nm? The band is about 75 nm wide, so it spans many readings. Fitting the band’s shape through all of them locates its centre to a few hundredths of a nanometre, much finer than the spacing between readings, in the same way a fitted chromatographic peak has a retention time finer than the detector’s sampling interval. The fit used here is a Gaussian band on a gently curved baseline over 2180–2380 nm. Neighbouring bands offset every lot’s absolute centre by the same amount (about 0.9 nm), so the absolute value isn’t meaningful, but the difference between lots is, and it recovers the 2 nm that was built into the simulation.

The finding matches the fourth row of the table below: acceptable new variation that the model does not cover. Accuracy holds for now. But a Q limit that flags every result no longer separates the unusual from the routine, so a real problem would hide inside the alarm that is already on. The response is a controlled calibration extension that adds E2 lots and is re-evaluated on both E1 and E2 material. Silencing Q by moving its limit would be the wrong response.

Same signal, two outcomes

Step 4 is where the investigation forks. To show both branches, the figure below runs a second, hypothetical supplier, E3, through the identical model, limits and steps. E3’s band sits 10 nm higher instead of 2 nm.

Figure titled 'Same signal, two outcomes: step 4 decides the response', three panels. Left, 'Step 3: how far each band moved': fitted band centres near 2270 nm for 12 E1 lots at about 2270.9 nm, 3 E2 lots at about 2273.0 nm labelled +2.1 nm, and 3 E3 lots at about 2280.9 nm labelled +10.0 nm. Centre, 'Step 4, E2: passes': predicted minus HPLC at challenge levels 90 to 110% of label claim, three blends per level, level means between −0.93 and +0.11%, all inside a pale ±1.0% band; over 20 days Q flags 100% of E2 spectra and T² 1%; beneath, worst level mean −0.93% at 95%, accuracy holds, the diagnostic no longer works, extend the calibration with E2 under change control. Right, 'Step 4, E3: fails': level means between −1.94 and −0.87%, four of the five levels below the −1.0% edge; Q flags 100% of spectra and T² 100%; beneath, worst level mean −1.94% at 105%, accuracy fails, contain the output made while the flag was on and do not use the model for release until it is rebuilt.
Synthetic teaching data; E3 is hypothetical, for comparison only. Both suppliers trip Q on every spectrum. Only the designed challenge separates a model that still works from one that doesn't.
E2 (arrived)E3 (hypothetical)
Band shift, built in → measured2 nm → 2.1 nm10 nm → 10.0 nm
Q flags (share of spectra over 20 days)100%100%
T² flags1%100%
Challenge level means−0.93 to +0.11%−1.94 to −0.87%
Against the illustrative ±1.0% requirementPasses at every levelFails at four of five levels
ResponseExtend the calibration under change controlContain the output made while flagged; rebuild before release use

Three lessons sit in that table. Q alone cannot tell the two cases apart: both flag every spectrum. T² is no help either, since it flags E3 but barely E2, and nothing about “T² is quiet” means the predictions are right. The designed challenge across the decision range is what separates “the model still works but its diagnostic doesn’t” from “the model no longer works”, and that difference decides between a planned calibration update and containing product. The predicted assay looked plausible for both.

Choose the response that addresses the cause

FindingPossible response, subject to the established strategy
Fouled probe windowRestore the measurement condition and verify performance
Incorrect sample pairing or reference resultCorrect the data issue and assess the affected conclusions
New acceptable variation already handled adequatelyDocument the evidence; consider justified monitoring or applicability updates
Acceptable new material variation not adequately modeledDevelop a controlled calibration extension or rebuild, and evaluate it
Material or process is unsuitableAddress the material or process issue; do not train the problem into acceptability

Adding every flagged sample to the calibration can normalize a failure rather than improve the procedure. First establish what the sample represents and whether it belongs within the intended use.

Likewise, moving a diagnostic threshold until the alarm stops is a model change that needs justification. The goal is continued suitability, not a quiet dashboard.

Instrument transfer is an analytical change

The team now wants to run the procedure on another NIR instrument. Copying the coefficient file is easy. Demonstrating equivalent performance is the real task.

Instruments can differ in wavelength response, resolution, detector characteristics, optics and sample presentation. Transfer may involve instrument matching, a suitable standardization technique (piecewise direct standardization is a common one) or redevelopment, followed by appropriate evaluation on the receiving system.

Use samples relevant to the intended range and sources of variation. Check bias and error against suitable references, not only the average spectra. Keep the full pipeline, including preprocessing and diagnostic calculations, under control.

An instructive pharmaceutical paper by Cogdill, Anderson and Drennen examined NIR calibration monitoring and transfer across instruments and maintenance events. It compared several transfer techniques and combined instrument measures with T² and Q diagnostics. Its findings show why transfer has to be evaluated experimentally, rather than assuming one technique or sample count works everywhere [3].

Updating the model returns us to development

If recalibration is justified, define what is changing: the intended population, calibration samples, variables, preprocessing, algorithm, number of components, decision thresholds or instrument domain.

Keep development and independent assessment separate. New lots used to update the calibration cannot also serve as untouched evidence of its performance. Re-evaluate the relevant historical conditions as well as the new variation; improving the new-supplier fit can worsen old-supplier performance.

Document why samples are added or removed. Keep earlier models, their supported scope, and the evidence behind each version. Verification or revalidation should match the nature and impact of the change. Regulatory reporting depends on the applicable authorization, the Q12 established conditions and regional requirements; it is not settled by the analyst’s label “minor update” [1, 4].

The deployable object is the full procedure

A versioned model package should identify the calibration data and references, preprocessing parameters, variable selection, coefficients, diagnostic definitions and limits, software dependencies, intended scope, validation evidence and operating instructions.

Deployment includes verifying that the correct version reaches the correct instrument or process system. Keep a controlled recovery or rollback route where appropriate. Reverting the software does not automatically settle the disposition of material made during a questionable period.

Routine monitoring then resumes under the updated plan. A controlled update is another evidence-supported state of the procedure, not the end of its lifecycle.

Where the analyst sits

The analyst interprets change. Is it real material variation, a measurement artefact, an unsupported domain, or a changed relationship to quality? Which evidence is still valid, and which conclusions need reassessing?

A lifecycle approach keeps useful models useful by keeping their purpose, assumptions, performance and changes visible. It also sets up the language-model reading, where version changes and task-specific evaluation raise related questions.

For discussion

  1. Why can Q rise while concentration predictions still agree with reference results?
  2. Why can prediction error rise without a corresponding shift in the measured X distribution?
  3. A new supplier’s excipient passes incoming tests but produces unusual spectra. What would you investigate before extending the calibration?
  4. What evidence would support transfer to a second instrument, beyond copying the model file?
  5. Why should an updated model be challenged on both historical and newly introduced variation?

Bridge back to the week

Next: From Spectra to Language, which asks the same questions of a language model drafting an investigation summary. Return to Week 11.

Data and sources

Synthetic monitoring data: three scenarios of 30 observations, with inputs, reference and predicted Y, Q and prediction error; scenario means. Supplier investigation: daily diagnostics, routine reference checks, instrument checks, band centres by lot, challenge results and summary; hypothetical E3: band centres, challenge and pass/fail comparison; reproduction script and requirements. Figures: 3840 × 2160 pixels, computed with fixed seeds.

[1] ICH Q14, Analytical Procedure Development, Section 8, particularly recalibration and model maintenance and Figure 3 on the multivariate lifecycle. Final guidance (PDF).

[2] ICH Q8/Q9/Q10 questions and answers and points to consider: model verification, reference comparisons, update triggers and recalibration planning. Guidance page.

[3] R. P. Cogdill, C. A. Anderson and J. K. Drennen, “Process analytical technology case study, part III: Calibration monitoring and transfer,” AAPS PharmSciTech 6 (2005) E284–E297. A pharmaceutical NIR example from well before the current artificial intelligence (AI) boom. Open-access article.

[4] ICH Q2(R2), Validation of Analytical Procedures: intended-use validation context. Guidance page.

The supplier-change case is a constructed teaching example; the monitoring scenarios are synthetic.

8 - From Spectra to Language

Connect chemometrics to language models through a fictional investigation-summary exercise: tokens, training, retrieval, claims checked against records, task-specific evaluation and lifecycle controls.
Graphic titled 'From Spectra to Language', subtitled 'Different models. Shared questions about purpose, evidence and control.' Three panels. Learn from examples: an NIR powder analyzer beside a stack of documents, with 'Spectra and reference results' and 'Tokens and context'. Define the task: an analyst looking at a screen titled Manufacturing Records, with 'Draft an investigation summary' and 'Separate facts from hypotheses'. Verify the output: an analyst comparing a sheet labelled Source Records with one labelled Draft Investigation Summary, with 'Check identifiers, numbers and claims' and 'Preserve source traceability'. A line reads 'A useful draft still needs evaluation for its intended purpose', and the footer reads 'Fluent language is not independent evidence.'
Learn from examples, define the task, and verify the output against source records. Conceptual teaching illustration; the worked investigation and candidate responses below are invented teaching material, not manufacturing records or measured model performance.

The one idea

A language model can produce a useful explanation or draft. Whether that output is dependable for a pharmaceutical task needs evidence specific to the task.

Reading 1 established that learning patterns from data has a long history in chemistry. The readings since connected measurements to predictions, process control, release and lifecycle management. This one applies the same questions to language: what is learned, what is supplied at use, what is generated, and how do we evaluate it?

The connection is a discipline of evidence. A language model is not partial least squares (PLS) applied to words, and next-token generation is not the same objective as predicting active pharmaceutical ingredient (API) concentration. Week 12 returns to the regulatory principle behind all of them: credibility proportionate to consequence.

From measurements to tokens

An near-infrared (NIR) model begins with instrument responses at selected wavelengths. A text-based large language model (LLM) typically begins with tokens: encoded units that may be words, word fragments, punctuation or other character sequences. Tokens are not necessarily whole words, and their boundaries depend on the tokenizer.

For autoregressive language modeling, a foundational objective is to predict a token from the preceding context. During training, the system adjusts many numerical parameters to improve that objective across examples. At generation time, it repeatedly produces tokens conditioned on the available context [2].

Conceptually:

P(next token∣preceding context)P(\text{next token}\mid\text{preceding context})

That expression describes a conditional distribution, not the probability that the resulting sentence is scientifically correct. Nor does it imply that a system always picks the single most probable next token.

Language modeling is not confined to English. Depending on training, systems can work with multiple languages, code and other structured text, and some also process other modalities. This reading focuses on text.

The Transformer changed what could be built

The Transformer architecture, introduced in 2017, used attention mechanisms to model relationships within sequences. Attention lets each token’s representation depend on relevant context instead of treating each token in isolation [1].

The 2020 GPT-3 paper showed how large-scale autoregressive language modeling could support many tasks through instructions and examples supplied in text, without updating the model’s parameters for each task in that study [2].

These were substantive technical developments. The link to chemometrics should help you recognize familiar modeling questions while appreciating the differences in architecture, scale and capability.

An attention pattern is not, by itself, proof that a model has found a scientifically valid cause or a reliable explanation for its answer.

Training, instructions and retrieved evidence are different

ActivityWhat changes or is supplied?Pharmaceutical analogy or example
PretrainingParameters are learned from a broad training corpusGeneral language capabilities and learned background relationships
Additional training or fine-tuningParameters are adjusted with further training objectives or examplesTeaching a desired response style or task behavior
Prompting and in-context examplesInstructions and examples are supplied for the current interactionRequesting a source-linked investigation summary in a defined format
RetrievalDocuments or passages are selected and added to the contextSupplying the relevant event log, deviation record and controlled procedure

Research on instruction following used additional supervised training and human-feedback training to improve behavior, and reported the mistakes that remained [3]. Do not infer the exact training recipe of every deployed assistant from one historical paper.

Retrieval-augmented generation (RAG) connects a generator to retrieved information; the 2020 RAG paper is an early research example [4]. Retrieval can improve access to relevant evidence, but it does not guarantee that the right record was retrieved, that it was current, or that the generated claim faithfully reflects it.

Providing a document in a conversation generally supplies context for that interaction; it is not a parameter update. A product’s retention or training policies are a separate question.

The pharmaceutical task: draft a factual event summary

Define a narrow intended use: draft a factual chronology from supplied records for a scientist to review. The task does not authorize the system to decide root cause, close the deviation or release a batch.

Use this invented source packet:

RecordSupplied evidence
R1, event logBatch B-241; API feeder F-02 refill at 10:02; delivery-rate alarm at 10:03
R2, routing recordDiversion started at 10:04 and ended at 10:09
R3, analytical noteReference samples S1 and S2 met their stated assay criteria; no finished-product dissolution results are included
R4, investigation statusRoot cause unconfirmed; potentially affected material and batch disposition remain under review

Ask the model to identify the sequence, cite record identifiers, separate facts from hypotheses and list unresolved questions. In real organizational work, use only approved systems and permitted records; this exercise uses fictional data.

The packet supports a limited chronology. It does not establish that the feeder refill caused the alarm, that diversion captured all affected material, or that the batch is releasable.

Evaluate statements, not just the paragraph’s polish

Table figure titled 'Does the claim follow from the supplied record?', subtitled 'A citation is useful only when the cited evidence supports the statement.' Three columns: source evidence, candidate statement, assessment. Row 1, green: R1, F-02 delivery-rate alarm at 10:03; 'Batch B-241 had an API feeder F-02 delivery-rate alarm at 10:03'; SUPPORTED, preserves the recorded fact. Row 2, orange: R1, refill at 10:02 and alarm at 10:03, and R4, root cause unconfirmed; 'The refill caused the concentration excursion'; UNSUPPORTED, neither cause nor concentration excursion is established. Row 3, purple: R3, S1 and S2 met assay criteria and no dissolution results supplied, and R4, disposition under review; 'All tests passed, so the batch can be released'; UNSUPPORTED, sample results do not establish all tests or disposition. Footer: fictional teaching case; candidate statements were written for this exercise; no real batch, model output or measured model performance is represented.
Three statements compared with the source packet: a supported fact, an unsupported causal claim and an unsupported release conclusion. The statements were constructed by hand for this exercise; this is not a comparison of outputs from named language models.

Consider these candidate statements:

Candidate statementAssessment against the packet
“Batch B-241 had an API feeder F-02 delivery-rate alarm at 10:03.”Supported by R1
“The refill caused the concentration excursion.”Unsupported: the cause is unconfirmed, and the alarm record does not establish a concentration excursion
“All tests passed, so the batch can be released.”Unsupported: two sample assay results do not establish all required testing or batch disposition

A draft can keep the correct batch number while adding an incorrect cause. A citation to R1 does not repair a causal claim R1 doesn’t support. Check the relationship between each claim and its cited evidence.

An acceptable bounded draft

For batch B-241, API feeder F-02 was refilled at 10:02 and a delivery-rate alarm was recorded at 10:03 [R1]. Diversion was recorded from 10:04 to 10:09 [R2]. Samples S1 and S2 met their stated assay criteria; the packet contains no finished-product dissolution results [R3]. Root cause, potentially affected material and batch disposition remain under review [R4].

This is a teaching answer written for the exercise. It reports the record sequence without turning a temporal association into causation. “Not supplied” is different from “not performed” or “failed.”

Download the fictional source packet and exercise.

Why fluent errors occur

Training rewards useful regularities across many examples. Those regularities can produce a plausible investigation narrative even when the current records do not support it. Additional training and prompting can improve behavior without guaranteeing factual correctness.

A likely-looking continuation might supply the missing cause, smooth over conflicting records, or turn “under review” into a conclusion. These are task failures, however polished the prose.

A model’s statement that it is confident is generated text, not an independently calibrated probability of being right. Asking for an explanation can help review, but the explanation also needs checking against the evidence.

Reuse the model-development workflow

We are not training a foundation model here. We are evaluating a configured workflow: model version, instructions, retrieval, source handling, output requirements and review. The steps are those of reading 2:

  1. Define the task. Specify the permitted output and the excluded decisions.
  2. Define reference expectations. Establish the facts, acceptable interpretations and unresolved questions in each case.
  3. Build representative cases. Include different event types, missing records, conflicting timestamps, unusual identifiers and adverse findings.
  4. Separate development from testing. Use one set to improve prompts and workflow; reserve independent investigations for final evaluation.
  5. Evaluate the whole system. Check retrieval as well as generated claims, citations, omissions and required formatting.
  6. Establish operating controls. Define review, escalation, and responses to insufficient or conflicting evidence.
  7. Monitor changes. Reassess the relevant performance when models, prompts, retrieval sources or tools change.

Keep records from the same investigation together when splitting cases. Putting near-duplicate summaries of one event in both development and testing creates the same kind of leakage as repeated scans from one batch.

Choose performance measures that match the task

For the source-summary example, check whether identifiers, numbers, units and chronology are preserved; whether required facts are left out; whether unsupported claims are added; and whether citations actually support their statements.

Report important error categories separately. An overall quality score can hide a rare but consequential invented release conclusion. Set acceptance criteria before the final evaluation, based on intended use and impact.

Repeat trials where output variability matters, and use enough independent cases to characterize the relevant uncertainty. One successful demonstration is not evidence of dependable performance across the intended workload.

Human review is part of the system when the intended use includes it. Evaluate whether reviewers can catch important errors with the interface, source access, time and workload they actually have. Writing “human in the loop” does not establish that the control works.

Connect to Q14 and Q2 without claiming automatic equivalence

Intended purpose, reference expectations, independent evaluation, control strategy and lifecycle evidence give a useful analogy to analytical procedure development and validation under International Council for Harmonisation (ICH) Q14 and Q2(R2).

The analogy does not mean Q14 or Q2(R2) automatically classifies every language-model workflow as an analytical procedure, or that the model has regulatory approval. Determine the applicable requirements from the actual use; Week 12 covers the emerging AI-specific guidance and the data-integrity floor beneath it. The teaching benefit is a disciplined way to ask what evidence and controls are needed.

From a draft to an agentic workflow

A language-model system may also retrieve records, calculate values or call other tools. Each added capability changes what needs evaluating.

For an investigation assistant, permitted actions might include reading a supplied packet and preparing a draft. Closing a deviation, changing an approved record or authorizing material disposition are different actions that need their own authorization and controls.

Treat retrieved documents as evidence, not as instructions that can override the workflow. Track tool inputs and outputs, restrict permitted actions, and keep reviewable evidence of what happened.

Where the analyst sits

The analyst supplies purpose, an understanding of the sources, and judgment about evidence. A language model can help organize records and draft explanations; the evaluation has to establish how reliable that help is for the chosen task.

The module began with learning patterns from chemical measurements. It ends with the same practical questions applied to language: what is represented, what is inferred, what remains uncertain, and which decision does the evidence support?

For discussion

  1. How does next-token probability differ from the probability that a scientific claim is true?
  2. Why does supplying a source document not guarantee that every generated statement is supported?
  3. Which claims in the fictional case need evidence beyond the supplied packet?
  4. How would you split a collection of investigation records to avoid leakage?
  5. What would you re-evaluate after changing the retrieval system while keeping the language model fixed?

Bridge back to the week

Next: the capstone, One Disturbance, One Defensible Decision, which puts all eight readings to work on one investigation. Return to Week 11.

Data and sources

Fictional investigation exercise: the source packet, the task, a reviewer checklist and the additional evidence to request. Claims and evidence: the three statements in the figure; reproduction script and requirements. Figure: 3840 × 2160 pixels.

[1] A. Vaswani et al., “Attention Is All You Need” (2017). The abstract and introduction, for the Transformer milestone. arXiv.

[2] T. Brown et al., “Language Models are Few-Shot Learners” (2020). The abstract and introduction, for autoregressive modeling and in-context task examples. arXiv.

[3] L. Ouyang et al., “Training language models to follow instructions with human feedback” (2022). A historical example of additional training and its limits. arXiv.

[4] P. Lewis et al., “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks” (2020). A research example connecting generation with retrieved information. arXiv.

Batch B-241, its records and the candidate statements are fictional teaching material.

9 - Capstone — One Disturbance, One Defensible Decision

A fictional capstone investigation on a continuous tablet line connects model applicability, event timing, material diversion, release evidence and review of an AI-written investigation summary, and ends on an interim conclusion rather than a verdict.
Graphic titled 'One Disturbance, One Defensible Decision', subtitled 'A capstone investigation on a continuous tablet line.' Three panels. Reconstruct: an analyst studying data tables on two monitors beside a powder feeder, 'What happened, where and when?'. Challenge: an analyst comparing laptops labelled Source Records and AI-Written Draft beside an in-line probe on a pipe, 'Which signals and claims are supported?'. Decide what follows: an analyst reading a document beside three containers of tablets, 'Contain uncertainty and request evidence'. A band reads 'Process dynamics • Model applicability • Traceability • Quality review', and the footer reads 'A plausible story is not a completed investigation.'
Reconstruct events, challenge signals and claims, and decide what the evidence supports. Entirely fictional teaching case; the equipment scenes are conceptual, and none of the records, limits, timings or outcomes describes a real product or validated manufacturing strategy.

The one idea

A defensible decision separates what is known, what is inferred and what remains unresolved.

The eight readings before this one introduced chemometrics, predictive-model development, spectral interpretation, sampling, process control, release, maintenance and language models. This capstone brings them together in one investigation.

The aim is not to find a predetermined root cause or to authorize release. It is to reconstruct the evidence, identify the gaps, and specify the next actions needed to support a decision.

The setting

A continuous direct-compression line makes tablets. Active pharmaceutical ingredient (API) and excipients pass through loss-in-weight feeders, a blender and a tablet press. A downstream diverter sends tablets either to collection or to a separate diverted-material container.

Near-infrared (NIR) spectroscopy at the press feed system estimates blend API concentration using a fixed, versioned model. A separate spectral diagnostic checks applicability. A newly qualified excipient supplier is being used for the first time on this line.

The fictional site procedure says that an active model-applicability flag makes the NIR prediction unsupported for its release role, with escalation and material management under the deviation procedure. It does not say the product is automatically out of specification.

That procedural requirement is a case assumption, not a universal regulatory rule or a prescribed numerical diagnostic threshold.

The evidence packet

All times are on the same day. The logs share a nominal clock basis; timing uncertainty is handled separately below.

RecordInformation supplied
R1, material recordExcipient supplier E2 introduced for batch C-309; incoming requirements met; supplier E2 was not represented in the documented NIR calibration population
R2, feeder logAPI feeder F-02 refill at 10:02:00; delivery-rate disturbance recorded from 10:03:00 to 10:03:20
R3, NIR recordPredictions stay near target; Q applicability flag active from 10:02:40 until 10:06:20; a broad-range concentration average stays near target
R4, routing logDiversion command at 10:04:00; diversion-position confirmation at 10:04:05; collection-position confirmation at 10:06:00
R5, preliminary timing worksheetFor this exercise only, feeder-to-diverter arrival offsets of 25–110 seconds are used for screening; add 5 seconds at each end for combined timing uncertainty
R6, collection recordBin C17 receives output until confirmed diversion at 10:04:05; bin C18 receives output from the confirmed return to collection at 10:06:00; reported output rate is 60 kg/h
R7, laboratory recordS1 sampled at 10:06:00 and S2 at 10:08:00; both meet their stated assay criteria; their sampling locations and the material intervals they represent are not supplied
R8, investigation statusComplete routing verification, supplier-impact assessment, other required quality results and batch disposition remain under review

R5 is deliberately a preliminary screening tool. It is not a complete residence time distribution (RTD), an established diversion boundary, or proof that material outside its interval is acceptable. Its offsets have not been shown to suit supplier E2 or current conditions.

Download the student worksheet and source packet.

First pass: facts, hypotheses and missing evidence

Some facts are directly supported: the feeder signal changed, a model flag was active, routing commands and position confirmations have recorded times, and two later samples met their assay criteria.

Several causal stories are possible. The refill may have affected delivery. The new supplier may have affected the spectral response. Probe conditions may have changed. More than one mechanism may be at work.

The packet does not establish any of these as root cause. Nor does it establish a concentration excursion from the feeder-rate event alone. Separate the measured signal from the quality attribute inferred from it.

Before reading the worked analysis, write three lists: supported observations, hypotheses that need testing, and missing evidence that could change the decision.

Put the records on a common timeline

Gantt-style figure titled 'Put the event, applicability and routing on one clock', recorded time on the case clock from 10:02:00 to 10:07:00. Four bars. Feeder disturbance (R2), orange: 10:03:00 to 10:03:20. Preliminary arrival screening (R5), purple: 10:03:20 to 10:05:15. Confirmed diversion position (R4), teal: 10:04:05 to 10:06:00. NIR applicability flag (R3), red: 10:02:40 to 10:06:20. Dotted vertical lines at 10:03:20 and 10:04:05 bracket a double-headed arrow labelled '45 s before confirmed diversion'. Footer: fictional teaching records; the screening interval is not a validated collection boundary; position confirmation does not establish complete physical routing; the model flag creates a separate impact question.
Exact rendering of the invented case timings. The shaded screening interval uses R5's assumed offsets and uncertainty allowance. Position feedback is shown as recorded and does not prove complete physical routing; no curve represents actual API concentration or product compliance.

Download the fictional timeline data.

The figure exposes two separate questions. Was diversion early enough to cover the feeder event, under the screening assumptions? And what output needs assessing because the NIR applicability flag stayed active?

Answering one does not settle the other.

Work the preliminary arrival calculation

For the feeder event, the worksheet gives

tscreen,start=tevent,start+25 s−5 st_{screen,start}=t_{event,start}+25\text{ s}-5\text{ s} tscreen,end=tevent,end+110 s+5 st_{screen,end}=t_{event,end}+110\text{ s}+5\text{ s}
Interactive worked example

Screening interval and the uncovered gap

Problem: The feeder disturbance runs from 10:03:00 to 10:03:20 (R2). R5 gives arrival offsets of 25–110 s with a 5 s allowance at each end. Find the screening interval at the diverter, and how long it ran before diversion was confirmed at 10:04:05 (R4).

Significant-figure rule: this is addition and subtraction only, so the answer keeps the fewest decimal places among the inputs, here whole seconds. Every log time and offset is stated to the whole second, so every result is reported to the whole second too. The offsets are case assumptions, not measurements, and carry no more precision than that.

  1. Start of the interval. Earliest arrival, widened by the allowance: 10:03:00 + 25 s − 5 s = 10:03:00 + 20 s = 10:03:20.
  2. End of the interval. Latest arrival, widened by the allowance: 10:03:20 + 110 s + 5 s = 10:03:20 + 115 s. 115 s is 1 min 55 s, so the end is 10:05:15.
  3. Compare with routing. Diversion position was confirmed at 10:04:05. The uncovered gap is 10:04:05 − 10:03:20 = 45 s, to the whole second.
  4. Use confirmation, not the command. The command at 10:04:00 would give a 40 s gap. The 5 s between command and confirmation is time when the gate had been told to move but had not been shown to have moved, so the 45 s figure is the one the evidence supports.
  5. Rules used. Addition and subtraction keep the fewest decimal places; every input is to the whole second, so every answer is too.

The screening interval is 10:03:20 to 10:05:15. Confirmed diversion begins 45 seconds after it starts, so the packet does not show diversion covering the whole interval. Bin C17 received output during that overlap and needs containment and assessment under the case procedure.

Interactive worked example

Output collected during the 45-second gap

Problem: At the reported output rate of 60 kg/h (R6), how much output reached bin C17 during the 45 s gap, assuming constant throughput?

Significant-figure rule: this is multiplication and division, so the answer keeps the fewest significant figures among the measured inputs: 60 kg/h (read as two) and 45 s (two). The conversion 1 h = 3600 s is exact and does not limit anything. The answer has two significant figures.

  1. Put the time in hours. 45 s ÷ 3600 s/h = 0.0125 h. The seconds cancel; carry all the digits for now.
  2. Multiply by the rate. 60 kg/h × 0.0125 h = 0.750 kg. The hours cancel, leaving kilograms.
  3. Round once. Two significant figures: 0.750 → 0.75 kg (the dropped digit is 0, so nothing rounds).
  4. Interpret. About 0.75 kg of output reached C17 during the gap. This is a screening estimate of the quantity collected in an interval, not a finding that 0.75 kg is nonconforming. Actual material accounting needs the mass-flow and collection records, and it does not bound the whole investigation, because the applicability flag covers a different period.
  5. Rules used. Multiplication and division keep the fewest significant figures among the measured inputs (two); the exact hour-to-second conversion doesn’t limit.

The five-second gap between command and position confirmation matters. Using the command time alone would make the diversion coverage look better than the equipment feedback supports.

The model flag creates a second material question

Q flags from 10:02:40 to 10:06:20. Under the site procedure, the prediction is unsupported for its release role for that whole period.

A near-target predicted concentration does not cancel that requirement. Nor does Q establish that the product itself is defective: it signals a model-applicability problem that needs investigating (reading 7).

Collection resumes into C18 at 10:06:00, twenty seconds before the flag clears at the NIR measurement point. That raises a further concern about whether the recovery criteria were met. But do not equate those twenty seconds at the probe with twenty seconds of tablets at the diverter: the downstream transit path, timing, averaging and actual routing all have to be established.

The material-impact assessment may extend beyond the feeder-event screening interval. It has to address the unsupported analytical period and its relationship to collected material, including earlier and later output where relevant.

Two passing samples answer a limited question

S1 and S2 met their stated assay criteria. That is useful evidence about those samples.

Their times alone don’t establish which process material they represent. A reference sample might have come from a particular container, location or output interval, and those details are missing. Request the sampling records before matching the results to the event.

Even well-matched assay results do not establish every required attribute. Content uniformity concerns the dosage-unit distribution, and dissolution concerns drug release under specified conditions (reading 6). A broad-range average can hide local variation.

Do not use “two samples passed” in place of an assessment of the measurement system, the affected-material history or the complete disposition evidence.

Challenge the AI-written summary

Suppose a draft says:

The new supplier caused a brief concentration excursion after feeder refill. Diversion captured all affected tablets, the NIR average remained acceptable, and two laboratory samples passed. The batch can therefore be released without recalibration.

This paragraph was written for the exercise; it is not an observed output from a named model. Its fluency hides several unsupported conclusions.

Draft claimWhat the packet supports instead
New supplier caused the eventThe supplier change is a hypothesis to investigate; causation is unresolved
Concentration excursion occurredA delivery-rate disturbance is recorded; concentration impact is not established
Diversion captured everything affectedPreliminary timing shows incomplete coverage, and complete routing verification is pending
NIR average establishes acceptabilityThe applicability flag makes the prediction unsupported for the specified release role
Passing samples establish batch releaseSampling representation, other attributes and disposition review remain unresolved
No recalibration is neededA maintenance decision needs investigation and suitable performance evidence

The right correction is to narrow each claim to the evidence, not to add citations to the original paragraph (reading 8).

A defensible interim conclusion

An appropriate teaching conclusion is:

Batch C-309 has a recorded feeder disturbance and a separate NIR applicability flag [R2, R3]. Preliminary screening identifies an arrival interval beginning before confirmed diversion [R4, R5]. C17 and potentially additional collected material require containment and assessment under the case procedure [R3, R6]. Passing assay results for S1 and S2 cannot yet be assigned to the relevant output intervals because sampling details are missing [R7]. Root cause, full material impact, maintenance needs and disposition remain unresolved [R8].

This is an interim assessment. It says why the evidence is insufficient without inventing a product failure or directing a final batch decision.

Design the next evidence-gathering steps

Prioritize the work by the decision it could change:

  1. Preserve the original signals, spectra, model and preprocessing versions, logs and records.
  2. Establish the clock relationships, acquisition delays and actual diverter performance.
  3. Reconstruct the collection history and manage potentially affected containers under the case procedure.
  4. Confirm the relevant RTD and its applicability to the current material and conditions.
  5. Investigate probe condition, sample presentation, supplier variation and reference-method matching.
  6. Obtain independent, representative evidence for the affected material and the relevant quality attributes.
  7. Decide whether hardware correction, operating changes, model maintenance or other action is justified.

Testing and model updates have to answer these questions, not erase unfavourable evidence. In particular, reading 6 separates a justified equipment-failure contingency from substituting end-product testing for an unfavourable real-time release testing (RTRT) result [2].

Connect the case to the whole module

Earlier readingIts role in this investigation
1. Chemometrics and material variationSupplier properties can change the spectra
2. Model developmentNew material may lie outside the represented population
3. PCA and diagnosticsUnusual X does not automatically mean a Y failure
4. Sampling and latencySample times and report times need material context
5. Process control and RTDMaterial spreads through the line; a command is not a confirmed action
6. RTRTAttribute-specific evidence and complete review support disposition
7. Lifecycle maintenanceInvestigate before changing the calibration or its limits
8. Language modelsEvaluate each generated claim against the underlying records

Where the analyst sits

The analyst makes uncertainty actionable: identifying which result is valid, which material it represents, which claim it supports, and what evidence is needed next.

The value of an investigation is not the confidence of its narrative. It is the defensibility of its observations, inferences and decisions.

For discussion or a short group exercise

  1. Identify three supported facts and three unsupported claims in the proposed summary.
  2. Reproduce the screening interval and quantity estimate. State every assumption.
  3. Explain why 0.75 kg cannot be called the total nonconforming quantity.
  4. What additional evidence is needed to evaluate C18 after collection resumes?
  5. Draft a five-sentence interim summary with record references and unresolved questions.

Bridge back to the week

This completes the Week 11 reading path. Week 12 widens the view from this one line to the rest of the field: process tables, chromatograms, bioreactor batches and cell therapy. Return to Week 11.

Data and sources

Capstone worksheet: the source packet, the fictional procedure assumption, the candidate summary, eight student tasks and the review criteria. Timeline data: the four case intervals. Screening calculation: the interval, the 45 s gap and the 0.75 kg estimate, recomputed from the records; reproduction script and requirements. Figure: 3840 × 2160 pixels.

[1] International Council for Harmonisation (ICH) Q13, Continuous Manufacturing of Drug Substances and Drug Products: process dynamics, traceability and control-strategy context. The invented offsets here are not taken from the guideline. Guidance page.

[2] European Medicines Agency (EMA), Guideline on Real Time Release Testing, Revision 1: specifications, investigation and contingency context. Guideline.

[3] ICH Q14, Analytical Procedure Development: model applicability and maintenance context. Guidance page.

Batch C-309, its records, the site procedure, the timing offsets and the output rate are entirely fictional teaching material.