Imagine a car traveling at 5 miles per hour. Is this behavior anomalous? On an open highway, it indicates a severe issue; in a driveway at the start of a journey, it is completely normal.
Traditional anomaly detection methods often evaluate data points in a vacuum, relying on static thresholds or global templates of "normality." In complex, real-world systems, however, normality is rarely an absolute property. Instead, it is highly conditional, shifting dynamically based on temporal, spatial, or situational context. Context-dependent anomaly detection addresses this challenge by explicitly modeling how the baseline of normal behavior changes across different environments and operational states.
The Failure of Global Baselines
When an anomaly detection system assumes a single, global pattern of normality, it inevitably encounters a trade-off between high false-positive rates and missed detections. This is because normal environmental fluctuations frequently mimic failure patterns.
As Levi et al. observe in connected vehicles, a car's internal network behavior is highly dependent on its temporal journey phase; the sequence of operating system and network events at startup looks fundamentally different from steady-state driving. Applying a static threshold across the entire trip leads to severe misclassifications.
A similar problem occurs in urban computing and infrastructure monitoring:
- Traffic Dynamics: Anantharam et al. and Sun et al. point out that a sharp drop in traffic speed is expected during rush hour but represents a major anomaly at midnight. Conversely, as Kong et al. argue, high traffic volume alone is insufficient to flag an anomaly unless it is evaluated relative to a specific time and location.
- Microservice Architectures: In large-scale cloud systems, Liu et al. note that periodic spikes in user traffic during peak hours routinely mimic system failures, causing simple threshold-based detectors to trigger frequent false alarms.
- Industrial Operations: In concentrated solar power plants, Patra et al. show that highly volatile thermal patterns during daily startup and shutdown cycles are entirely benign, yet they easily trigger standard image-based anomaly detectors that lack temporal awareness.
Shifting to Relative Normality
To overcome these limitations, recent frameworks redefine normality as a relative concept. Rather than asking "Is this data point unusual compared to all data we have ever seen?", these models ask "Is this data point unusual given its current context?"
Lan et al. formalize this shift through the Relative Context Discrepancy (RCD) paradigm for time series. Traditional deep learning methods typically train a model to reconstruct a global "normal" shape template, flagging high reconstruction errors as anomalies. The RCD paradigm, by contrast, trains models to evaluate deviations in the relationships between a time series segment and its immediate surrounding context. Normality is thus treated as a contextual fit rather than an intrinsic geometric property.
Global Baseline Approach (Fails on context shifts):
[ All Historical Data ] ---> Compute Global Mean/Boundaries ---> Check if New Point Fits
Context-Dependent Approach (Adapts dynamically):
[ Current Context (e.g., Time, Phase) ] ---> Generate Conditional Baseline ---> Check if New Point Fits
This contextual conditioning is equally vital outside of time series. In heterogeneous tabular datasets, King et al. demonstrate that normal behavior shifts based on situational factors, such as a user's activity varying by device type. By isolating and conditioning on these specific contextual features, models avoid blending distinct behavioral regimes into a single, inaccurate global average.
Architectural Mechanisms for Conditioning
To operationalize context-dependent detection, researchers utilize several distinct architectural strategies to inject context into the modeling process.
Explicit Partitioning
One intuitive approach is to segment the problem space into discrete contextual regimes. Anantharam et al. implement this using Restricted Switching Linear Dynamical Systems (RSLDS), which partition a year's worth of city traffic data into 168 distinct "normalcy" models—one for each hour of the week. This allows the system to seamlessly switch baselines as the city moves from Tuesday morning rush hour to Sunday night.
Local Window Conditioning
In continuous time series, the immediate past often serves as the most informative context for the present. Carmona et al. introduced Neural Contextual Anomaly Detection (NCAD), a framework that explicitly ingests a local temporal window alongside the target sequence to dynamically bound normal variations. To achieve this in constrained computational environments, Kalfon et al. leverage a Successive Data Injection (SuDaI) scheme in conditional Quantum GANs, repeatedly re-uploading preceding temporal data into the quantum state to ensure the model's predictions remain strictly relative to the local window.
Operational Phase Tracking
For physical and industrial processes, context is often dictated by elapsed time within a cycle. The ForecastAD framework by Patra et al. explicitly feeds the time elapsed since the start of a daily operational cycle into a deep recurrent network. This allows the model to anticipate non-stationary transitions, successfully distinguishing between the expected turbulence of an equipment startup and a genuine operational fault.
Why It Works: A Intuitive View
The mathematical power of context-dependent anomaly detection lies in its ability to drastically reduce the variance of the "normal" reference distribution.
If we attempt to model normality globally, our probability distribution $P(X)$ must encompass every valid state of the system. For a city's traffic or a factory's throughput, $P(X)$ becomes a broad, high-variance distribution with fat tails. In this global view, a subtle anomaly (such as a minor traffic accident at midnight) easily hides inside the main body of the distribution because that specific low speed is highly common during afternoon rush hour.
$$\text{Global Modeling: } P(X) \implies \text{High Variance, Broad Boundaries}$$
By conditioning the model on the context $C$, we instead estimate the conditional probability $P(X \mid C)$. When $C$ is fixed to a specific context—such as "Sunday at 3:00 AM" or "System Startup Phase"—the variance of normal behavior collapses.
$$\text{Contextual Modeling: } P(X \mid C = \text{Sunday 3AM}) \implies \text{Low Variance, Tight Boundaries}$$
Because the context-specific distribution is tightly bounded, deviations that would be completely invisible in the global distribution become glaringly obvious. By evaluating data through the lens of its immediate situation, context-aware models eliminate the background noise of natural system cycles, uncovering true anomalies with significantly higher precision.
Key Foundational Work
Understanding City Traffic Dynamics Utilizing Sensor and Textual Observations (2016) — contributed 1 concept elements to this direction.
Advanced Analytics for Connected Cars Cyber Security (2017) — contributed 1 concept elements to this direction.