Clear Sky Science · en

Hierarchical multi-attention neural networks for sensor fault diagnosis and mitigation in digital twins

· Back to index

Why smart factories need trustworthy senses

As factories, power grids, and water networks become smarter, they rely on thousands of tiny electronic “eyes and ears” to feed data into their digital twins—virtual replicas used to monitor and control real-world equipment. But when even a few sensors start lying because of wear, interference, or failure, the digital twin can be badly misled, causing wrong decisions and, in extreme cases, cascading breakdowns. This paper presents a new way to continuously spot bad sensor readings and quietly replace them with trustworthy virtual estimates, keeping the digital twin—and the physical system behind it—on track.

Figure 1
Figure 1.

From physical machines to their virtual mirror

Digital twins act like live, high-fidelity mirrors of physical systems such as transformers or water tank networks. They depend on streams of measurements—temperatures, pressures, flows—to test what-if scenarios, schedule maintenance, and adjust controls. Traditional ways of protecting against faulty sensors often involve installing three physical sensors in parallel and taking a majority vote, a simple but expensive strategy. Recent work instead uses data-driven methods: models learn how sensors ought to behave from past data and flag deviations. However, many of these approaches struggle when data are complex, when faults are subtle, or when many sensors interact in intricate ways. The authors argue that smarter use of modern neural network attention mechanisms can overcome these limits.

Teaching a virtual sensor to “expect” reality

The first building block of the proposed architecture is a virtual sensor module—a software stand‑in for each physical sensor. It learns to predict what each sensor should read by looking at recent data from all sensors over a short time window. To do this well, the module uses two different neural branches in parallel. One is based on a Transformer encoder, which excels at spotting long-term patterns over time. The other is a bidirectional recurrent network that looks both forward and backward along the sequence to capture how different sensors relate to each other at each instant. A cross-attention mechanism then lets these branches exchange information, emphasizing features that agree and downplaying noise. The result is a highly accurate expectation of what each healthy sensor ought to report at every moment.

Turning discrepancies into clear warning signs

Once the virtual sensor has made its predictions, the system compares them to the actual measurements. The absolute difference between the two—the residual—is the raw material for fault detection. Small residuals suggest normal behaviour, while larger ones may signal trouble. But real-world data are messy, and even good sensors rarely match the virtual model perfectly. To separate harmless wiggles from genuine faults, the authors feed sequences of residuals into a second major module: a fault diagnosis block built from convolutional neural networks. Here again, two parallel branches specialize in different aspects. One uses a technique called squeeze-and-excitation to automatically reweight channels and focus on the most informative patterns. The other applies global attention to highlight important regions across the whole residual map. Cross-attention fuses these global and local clues, enabling the classifier to distinguish among normal operation and three fault types: constant bias, gradual drift, and amplified (gain) errors.

Figure 2
Figure 2.

Automatically swapping out bad sensors

Detection alone is not enough; the system must also keep the digital twin running smoothly while faults occur. To this end, the architecture includes a decision block that acts like an automatic traffic controller. For every sensor, it receives both the real reading and the virtual prediction, along with the diagnosis result indicating whether a fault is present. If a sensor is judged healthy, its real reading passes through to the digital twin. If it is flagged as faulty, the block instantly switches over to the virtual reading instead. This dynamic substitution happens for many sensors in parallel, without human intervention, preventing bad data from spreading through the wider control and optimization algorithms.

How well the new approach works in practice

The researchers tested their method on two public datasets: one recording power transformer temperatures and another capturing pressures in a network of 100 interconnected water tanks. They injected realistic artificial faults of different kinds and durations into real measurement data, then trained and evaluated their system. The virtual sensor produced more accurate predictions than several strong alternatives, including standard recurrent networks and pure Transformer models. The diagnosis module also outperformed competing classifiers and autoencoders, especially in difficult cases where different fault types overlapped or multiple faults occurred together. Accuracy gains were particularly strong for complex multi-fault scenarios, where traditional single-branch models often become confused.

What this means for future smart systems

In simple terms, the study shows that a carefully designed “watchdog” based on multi-attention neural networks can both spot and correct faulty sensor readings in real time, greatly improving the robustness of digital twins. By combining complementary views of time patterns and sensor relationships, and by automatically switching to virtual measurements when needed, the proposed architecture helps ensure that the digital mirror remains faithful even when some of its physical eyes fail. This, in turn, supports safer, more reliable operation of critical infrastructures such as power grids and water networks as they move deeper into the era of Industry 5.0.

Citation: Pan, L., Li, H., Li, X. et al. Hierarchical multi-attention neural networks for sensor fault diagnosis and mitigation in digital twins. Sci Rep 16, 8665 (2026). https://doi.org/10.1038/s41598-026-42046-5

Keywords: digital twin, sensor fault diagnosis, industrial IoT, neural networks, attention mechanism