
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:
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
| Activity | What changes or is supplied? | Pharmaceutical analogy or example |
|---|---|---|
| Pretraining | Parameters are learned from a broad training corpus | General language capabilities and learned background relationships |
| Additional training or fine-tuning | Parameters are adjusted with further training objectives or examples | Teaching a desired response style or task behavior |
| Prompting and in-context examples | Instructions and examples are supplied for the current interaction | Requesting a source-linked investigation summary in a defined format |
| Retrieval | Documents or passages are selected and added to the context | Supplying 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:
| Record | Supplied evidence |
|---|---|
| R1, event log | Batch B-241; API feeder F-02 refill at 10:02; delivery-rate alarm at 10:03 |
| R2, routing record | Diversion started at 10:04 and ended at 10:09 |
| R3, analytical note | Reference samples S1 and S2 met their stated assay criteria; no finished-product dissolution results are included |
| R4, investigation status | Root 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

Consider these candidate statements:
| Candidate statement | Assessment 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:
- Define the task. Specify the permitted output and the excluded decisions.
- Define reference expectations. Establish the facts, acceptable interpretations and unresolved questions in each case.
- Build representative cases. Include different event types, missing records, conflicting timestamps, unusual identifiers and adverse findings.
- Separate development from testing. Use one set to improve prompts and workflow; reserve independent investigations for final evaluation.
- Evaluate the whole system. Check retrieval as well as generated claims, citations, omissions and required formatting.
- Establish operating controls. Define review, escalation, and responses to insufficient or conflicting evidence.
- 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
- How does next-token probability differ from the probability that a scientific claim is true?
- Why does supplying a source document not guarantee that every generated statement is supported?
- Which claims in the fictional case need evidence beyond the supplied packet?
- How would you split a collection of investigation records to avoid leakage?
- 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.