When the algorithm knows before the experts do

Abstract geometric shapes representing artificial intelligence, machine learning, predictive analytics, and digital transformation in pharmaceutical manufacturing.

By Enric Domingo and Alberto Martín Gómez (ERNI Spain)

When a process deviation occurs in pharmaceutical manufacturing, the cost is rarely limited to the batch itself. Teams must investigate the issue, document findings for regulatory compliance, manage release delays and occasionally discard materials. The resulting effort can consume considerable time and resources across the organisation.

For decades, the response to this challenge has been human vigilance: experienced process engineers monitoring equipment in real time, drawing on years of pattern recognition to spot the early signals of a drift before it becomes a deviation. It works until the expert is unavailable, or the signal is too subtle, or the production line is running at a pace that makes continuous oversight genuinely unsustainable.

A paper we co-authored with Boehringer Ingelheim, recently published in the International Journal of Pharmaceutics, offers a more durable answer: a machine learning model capable of anticipating process deviations before they occur, recommending corrective action and doing so without requiring an expert to be watching every moment.

How the model works

The research focuses on a pharmaceutical manufacturing process where multiple sensor streams generate continuous time-series data. The machine learning model is trained on historical runs – both normal and deviant – to recognise the temporal signatures that precede a deviation. Crucially, it does not simply flag risk; it couples the prediction with an action recommendation, translating a data-driven forecast into an operationally actionable instruction.

A distinction that matters

This distinction matters more than it might appear. In continuous manufacturing, the value of a prediction is bounded by what a production operator can do with it. A risk score without a recommended response places the interpretive burden back on the human, which re-introduces precisely the expertise dependency the system was designed to reduce. By closing that loop – from prediction to recommendation – the system becomes genuinely operational rather than merely informational.

The broader industry context reinforces how timely this is. According to the European Medicines Agency, manufacturing failures and quality defects remain one of the primary causes of medicine shortages across Europe. Pharmaceutical manufacturing, with its uniquely high stakes and regulatory complexity, stands to benefit more than most.

The software engineering challenge

Research papers necessarily focus on what was discovered. What they cannot fully capture is what it takes to turn a validated model into a system that runs reliably in a production environment – one that integrates with existing manufacturing infrastructure, handles edge cases gracefully, produces audit-compliant outputs, and performs predictably under the operational conditions of a GMP facility.

The gap between a proof-of-concept model and a production-ready software solution is not a gap of additional research – it is a gap of engineering. In a regulated pharmaceutical environment, that gap widens. Every component must be validated. Every data flow must be documented. Every decision the system makes must be traceable. A model that achieves high accuracy in the notebook can still fail comprehensively as a deployed system if the surrounding software infrastructure is not built to the same standard of rigour.

Our role is to navigate this translation – from research artefact to deployable, maintainable, audit-ready application. That means designing data pipelines that are robust to real-world sensor noise and missing values. It means building interfaces that production operators can actually use under time pressure. It means implementing logging and monitoring that satisfies both operational and regulatory requirements. And it means doing all of this within the constraints of an enterprise environment that was not designed with machine learning in mind.

A model for Pharma 4.0

Pharma 4.0, the application of Industry 4.0 principles to pharmaceutical manufacturing, has been the subject of extensive discussion since the International Society for Pharmaceutical Engineering formalised the concept. The aspiration is clear: connected, data-driven, continuously improving manufacturing processes. The implementation reality is considerably more complicated, not because the technology is unavailable, but because turning technology into reliable, compliant, operationally embedded software is a different discipline from developing the technology itself.

Deep familiarity with machine learning methods, particularly time-series modelling and predictive analytics, needs to be paired with an understanding of pharmaceutical manufacturing processes, GMP regulatory requirements and enterprise software engineering. No single one of those competencies is sufficient. The value comes from their integration.

This is the pattern we see repeatedly across our engagements in pharma and life sciences: organisations with strong scientific research capabilities and equally strong manufacturing expertise, navigating a translation challenge that requires a different kind of partner – one who can speak the language of both the data scientist and the validation engineer, and who has the software delivery infrastructure to turn research outcomes into production-grade systems.

If you’re curious about how we implement AI-assisted solutions in other industries – for example, in finance and insurance – click the banner below.

¿Estás preparado para el futuro digital?
better ask ERNI

Empoderamos a las personas y a las empresas mediante la innovación en productos y servicios basados en software.