Abstract: Given a stream of entries over time in a multi-dimensional data setting where concept drift is present, how can we detect anomalous activities? Most of the existing unsupervised anomaly detection approaches seek to detect anomalous events in an offline fashion and require a large amount of data for training. This is not practical in real-life scenarios where we receive the data in a streaming manner and do not know the size of the stream beforehand. Thus, we need a data-efficient method that can detect and adapt to changing data trends, or concept drift, in an online manner. In this work, we propose MemStream, a streaming anomaly detection framework, allowing us to detect unusual events as they occur while being resilient to concept drift. We leverage the power of a denoising autoencoder to learn representations and a memory module to learn the dynamically changing trend in data without the need for labels. We prove the optimum memory size required for effective drift handling. Furthermore, MemStream makes use of two architecture design choices to be robust to memory poisoning. Experimental results show the effectiveness of our approach compared to state-of-the-art streaming baselines using $2$ synthetic datasets and $11$ real-world datasets.
1. Introduction
In the fast-paced world of streaming data—such as network traffic, financial transactions, or sensor feeds—the only constant is change. What was considered "normal" behavior an hour ago might be an anomaly now, a phenomenon known as concept drift. Traditional anomaly detection tools often struggle in these environments because they typically require massive offline training or fail to adapt when the data's underlying distribution shifts.
Existing deep learning approaches, like standard autoencoders, often suffer from over-generalization; if they encounter enough anomalies, they eventually learn to reconstruct them, failing to flag them as outliers. Furthermore, streaming models are vulnerable to "memory poisoning," where an attacker slowly introduces slightly deviant data until the model accepts a full-blown attack as normal. MemStream addresses these challenges by combining a robust feature extractor with an adaptive, guarded memory module.
2. The MemStream Framework
MemStream is designed to be a data-efficient, "always-on" detector that learns on the fly while remaining resistant to poisoning. The architecture consists of two main components:
- The Feature Extractor: MemStream uses a Denoising Autoencoder (DAE). Unlike standard autoencoders, a DAE intentionally adds noise to the input before reconstruction. This forces the network to learn the robust underlying structure of the data rather than simply memorizing it, resulting in more reliable embeddings ($z^t$).
- The Memory Module ($M$): This module stores a collection of recent "normal" data embeddings.
- Scoring: When a new record arrives, MemStream calculates its anomaly score based on the distance to its $K$-nearest neighbors in memory. A high distance indicates a potential anomaly.
- FIFO Update: To handle concept drift, the memory uses a First-In-First-Out (FIFO) policy. As new normal data is accepted, the oldest entries are evicted, ensuring the baseline for "normal" reflects the most recent trends.
- The Guardrail: To prevent memory poisoning, a new data point is only added to the memory if its anomaly score is below a threshold ($eta$). If it looks like an outlier, it is excluded from the memory update.
3. Experimental Evaluation
The authors evaluated MemStream against 11 real-world datasets (spanning cybersecurity and general anomaly detection) and two synthetic datasets designed to simulate complex drifts.
Performance and Efficiency
MemStream consistently outperformed 11 state-of-the-art baselines, including xStream and Kitsune. On the NSL-KDD dataset, it achieved a superior AUC-ROC of 0.978. Beyond accuracy, MemStream is remarkably efficient; it processed the NSL-KDD benchmark in just 55 seconds, whereas the iForestASD baseline required over five hours (19,000 seconds).
Resilience to Concept Drift
Qualitative tests on synthetic data demonstrate MemStream's ability to adapt to shifting trends. When a trend changes abruptly, anomaly scores spike immediately, signaling the shift. However, as the FIFO memory incorporates the new patterns (provided they pass the guardrail), the scores settle back down, effectively learning the "new normal."
4. Discussion and Conclusion
MemStream's design offers several key advantages. By keeping the embedding dimension small relative to the input dimension, the framework is theoretically more secure against "undetectable" anomalies. The use of a simple FIFO policy preserves temporal locality, which the authors found superior to more complex replacement strategies for handling drift. Even if an anomaly occasionally bypasses the guardrail, the $K$-nearest neighbor approach provides a buffer, preventing a single bad entry from significantly degrading system accuracy.
While MemStream requires some initial hyperparameter tuning (e.g., memory size $N$ and threshold $eta$), it provides a robust and scalable solution for real-time anomaly detection. Future work may explore weighted memory elements or periodic retraining of the neural network to handle massive, long-term shifts in data distribution.
Summary updated