The Cumulative Sum (CUSUM) control chart is a statistical process control (SPC) method for detecting small, persistent shifts in the mean of a monitored process. It operates by accumulating the sum of deviations between observed values and a target mean, making it highly sensitive to subtle, sustained drifts that other charts like Shewhart charts might miss. This makes it a powerful tool for online concept drift detection in machine learning monitoring.
Glossary
CUSUM (Cumulative Sum Control Chart)

What is CUSUM (Cumulative Sum Control Chart)?
CUSUM (Cumulative Sum) is a sequential analysis technique for online change detection in data streams.
In practice, the algorithm tracks two cumulative sums: one for positive deviations (C+) and one for negative deviations (C-), resetting them when they return to zero. A drift alarm is triggered when either sum exceeds a predefined decision threshold (h). Its key advantage is a minimal detection delay for small shifts, but it requires setting a sensitive reference mean and a permissible slack parameter (k). It is a foundational technique in Statistical Process Control adapted for modern data streams.
Key Mechanisms of the CUSUM Algorithm
CUSUM (Cumulative Sum) is a sequential analysis technique for online change detection. It accumulates small, persistent deviations from a target to signal a shift in a process mean with high sensitivity.
Cumulative Deviation Accumulation
The core mechanism of CUSUM is the cumulative sum of deviations from a target value (μ₀). For each observation Xₜ, it calculates Sₜ = max(0, Sₜ₋₁ + (Xₜ - μ₀ - k)). The drift parameter k (often half the shift size to detect) acts as a slack allowance. Only deviations exceeding k are accumulated, making CUSUM insensitive to small, random noise but highly sensitive to sustained small shifts. This accumulation creates a 'memory' of the process, unlike Shewhart charts which only consider the last observation.
Decision Threshold (h) & Alarm Trigger
CUSUM signals a change when the cumulative sum Sₜ exceeds a predefined decision interval h. Setting h controls the trade-off between:
- Detection Sensitivity: A lower h leads to faster detection but more false alarms.
- False Positive Rate: A higher h increases the Average Run Length (ARL₀) when the process is in-control, reducing false alerts. The threshold h is typically set based on a desired in-control ARL₀ using statistical approximations or Monte Carlo simulation. An alarm triggers an investigation or model adaptation workflow.
Two-Sided CUSUM for Mean Shifts
To detect both increases and decreases in the process mean, two cumulative sums are maintained simultaneously:
- Upper CUSUM (Sₜ⁺): Sₜ⁺ = max(0, Sₜ₋₁⁺ + Xₜ - μ₀ - k⁺) for detecting upward shifts.
- Lower CUSUM (Sₜ⁻): Sₜ⁻ = max(0, Sₜ₋₁⁻ + μ₀ - k⁻ - Xₜ) for detecting downward shifts. Each has its own drift parameter (k⁺, k⁻) and share the decision threshold h. An alarm is raised if either Sₜ⁺ > h or Sₜ⁻ > h. This is essential for monitoring model error rates or prediction scores which can drift in either direction.
Application in Model Monitoring
In ML, CUSUM is applied to streaming model performance metrics or feature statistics:
- Target: Monitor the model's error rate or a loss-derived metric over time, with μ₀ set to the expected stable performance.
- Unsupervised: Monitor the mean of a key input feature (e.g., average transaction amount) for data drift.
- Adaptive Thresholds: The reference mean μ₀ can be updated periodically after a confirmed drift to establish a new baseline, enabling detection of sequential drifts. It is particularly effective for detecting gradual concept drift where the mean performance degrades slowly over thousands of predictions.
Relationship to Page-Hinkley Test
The Page-Hinkley Test is a closely related sequential change detection algorithm. While CUSUM typically uses a constant threshold h, the Page-Hinkley test monitors the difference between the cumulative sum and its minimum (or maximum) observed value: mₜ = ∑(xᵢ - μ₀ - δ) and Mₜ = min(mₜ). An alarm is raised when (mₜ - Mₜ) > λ. The Page-Hinkley test is more sensitive to monotonic gradual drifts, whereas CUSUM with a reset to zero after an alarm is better for detecting sustained level shifts. Both are foundational tools in statistical process control for ML.
Advantages & Limitations
Advantages:
- High Sensitivity: Excellent at detecting small, persistent shifts (as low as 0.5σ-1σ) that other charts miss.
- Memory: The cumulative sum incorporates historical data, providing a powerful test statistic.
- Online & Low-Latency: Computationally cheap per observation, ideal for high-volume data streams.
Limitations:
- Parameter Tuning: Requires careful setting of k (shift magnitude) and h (threshold), often via simulation.
- Assumes IID: Standard CUSUM assumes independent, identically distributed observations; autocorrelated data (common in time series) can cause false alarms.
- Detects Mean Shifts: Primarily designed for shifts in the mean; less sensitive to changes in variance or distribution shape without modification.
How CUSUM Works for Machine Learning Drift Detection
CUSUM (Cumulative Sum Control Chart) is a statistical process control algorithm adapted for online machine learning drift detection by monitoring the cumulative deviation of a monitored statistic from its expected value.
The Cumulative Sum (CUSUM) algorithm is a sequential analysis technique for online change point detection. It works by calculating a running cumulative sum of the differences between observed values (e.g., model error rates or feature statistics) and a target mean. This accumulation amplifies small, persistent mean shifts that might be missed by point-in-time checks. When the cumulative sum exceeds a predefined decision threshold, a drift alert is triggered, signaling a significant change in the process being monitored.
In machine learning monitoring, CUSUM is applied to metrics like prediction error or a feature's mean to detect concept drift or covariate shift. Its key advantage is sensitivity to subtle, sustained deviations, making it effective for early warning. The algorithm requires setting a reference mean and a threshold, often derived from a stable reference window. Variants like the Page-Hinkley test incorporate a forgetting mechanism. CUSUM is a core tool in statistical process control (SPC) for model observability.
CUSUM vs. Other Drift Detection Methods
A technical comparison of the Cumulative Sum Control Chart (CUSUM) against other prominent statistical methods for detecting distributional shifts in data streams.
| Feature / Metric | CUSUM (Cumulative Sum) | ADWIN (Adaptive Windowing) | Page-Hinkley Test | DDM (Drift Detection Method) |
|---|---|---|---|---|
Primary Detection Mechanism | Accumulates deviations from target mean | Adaptively compares sub-window statistics | Monitors cumulative deviation from running mean | Monitors error rate using statistical control limits |
Optimal For Drift Type | Small, persistent mean shifts | Gradual and abrupt shifts | Abrupt mean shifts | Supervised concept drift (error rate shifts) |
Detection Mode | Online, sequential | Online, sequential | Online, sequential | Online, supervised |
Key Parameter(s) | Reference mean (μ₀), allowable shift (δ), decision threshold (h) | Confidence parameter (δ) | Threshold (λ), allowable shift (α) | Warning level, drift level |
Memory & Window Management | Memoryless (uses cumulative sum) | Dynamic window (grows/shrinks based on drift) | Memoryless (uses cumulative sum) | Uses all seen data for error rate calculation |
Detection Sensitivity | High for small, sustained shifts | Adapts sensitivity based on data | High for abrupt shifts | High for changes in classification error |
Detection Delay | Low for designed shifts | Variable, adapts to change speed | Low for abrupt shifts | Depends on error rate change magnitude |
Theoretical Guarantees | Optimal for detecting known mean shift (Lorden's lemma) | Theoretical bounds on false positive rate | Optimal for detecting change in mean (CUSUM variant) | Theoretical bounds on false positives/detection delay |
Typical Use Case | Statistical process control, monitoring model scores/features | Unsupervised feature monitoring in data streams | Signal processing, monitoring KPIs | Supervised monitoring of classifier error rate |
Handles Gradual Drift | Yes, but tuned for specific shift magnitude | Yes, primary strength | Less sensitive | Yes, via error rate trend |
Requires Labels |
Use Cases and Examples in AI/ML
CUSUM (Cumulative Sum Control Chart) is a foundational statistical technique for real-time change detection. Its core mechanism—accumulating small deviations to detect persistent shifts—makes it uniquely suited for several critical monitoring scenarios in machine learning systems.
Real-Time Model Performance Monitoring
CUSUM is deployed to monitor a live model's prediction error rate or loss in real-time. It detects subtle, sustained degradation that might indicate concept drift.
- Mechanism: The algorithm tracks the cumulative sum of the difference between the observed error rate and a target value (e.g., the baseline error from a stable period).
- Example: A fraud detection model's false-negative rate slowly creeps from 2% to 3.5% over several days. CUSUM accumulates these small daily deviations, triggering an alert long before a simple threshold breach would, prompting investigation into new fraudulent tactics.
- Key Benefit: Provides early warning for gradual drift, allowing for proactive model retraining before significant business impact occurs.
Monitoring Input Feature Distributions (Data Drift)
CUSUM charts are applied to individual feature statistics to detect covariate shift in the model's incoming data.
- Implementation: For continuous features, the algorithm monitors the running cumulative sum of deviations of the feature's mean from an expected value. For categorical features, it can monitor proportion changes.
- Example: In a credit scoring model, the average 'debt-to-income ratio' of applicants might slowly increase due to macroeconomic changes. A CUSUM chart on this feature's mean would signal this data drift, indicating the training data's distribution is no longer representative.
- Comparison: Unlike batch methods like PSI or Kolmogorov-Smirnov tests, CUSUM provides a continuous, sequential analysis ideal for high-volume streaming data.
Anomaly Detection in Time-Series Data Streams
Beyond model monitoring, CUSUM is a core algorithm for detecting anomalies in operational telemetry and sensor data, which feeds into AI system health monitoring.
- Process: It establishes a baseline for a normal metric (e.g., API latency, GPU temperature, request volume) and flags when the cumulative deviation suggests a sustained change in level.
- Example: Monitoring the inference latency of a deployed model. A CUSUM chart can detect a slow, persistent increase in p95 latency caused by memory leaks or resource contention, triggering an alert before service-level agreements are violated.
- Integration: This use case is foundational for MLOps observability platforms, where detecting shifts in system metrics is as crucial as detecting shifts in model metrics.
Comparative Analysis with Other Drift Detectors
CUSUM operates on different principles than other common drift detection algorithms, making it suitable for specific scenarios.
- vs. ADWIN (Adaptive Windowing): ADWIN dynamically adjusts its window size. CUSUM uses all historical data via accumulation. CUSUM is often more sensitive to small, persistent mean shifts, while ADWIN may adapt faster to abrupt changes followed by stability.
- vs. Page-Hinkley Test: Very similar to CUSUM, often considered a variant. The Page-Hinkley test includes an adaptive detection threshold and is more commonly cited in ML literature for detecting changes in the mean of a stream.
- vs. DDM (Drift Detection Method): DDM monitors error rate directly with control limits. CUSUM is more general and can be applied to any sequential statistic (error rate, feature mean, etc.). DDM is explicitly designed for supervised learning scenarios.
Implementation in Streaming ML Pipelines
Deploying CUSUM requires integration into a streaming data architecture, often using frameworks like Apache Flink, Kafka Streams, or cloud-native services.
- Key Parameters: Practitioners must set the target value (μ₀), the allowable deviation magnitude (δ), and a decision threshold (h). These are often tuned via simulation on historical data.
- Architecture Pattern: A lightweight service computes the CUSUM statistic for each monitored metric (e.g., model score, key feature) per observation or micro-batch. When the statistic exceeds threshold
h, an alert is sent to a drift adaptation orchestrator. - Challenge: CUSUM assumes the monitored statistic is approximately normally distributed. For heavy-tailed distributions, pre-processing or robust variants are needed.
Limitations and Practical Considerations
Understanding the constraints of CUSUM is vital for effective application in production ML systems.
- Sensitivity to Parameter Tuning: Performance is highly dependent on correctly setting the drift magnitude (δ) and threshold (h). An incorrectly tuned CUSUM can have high false positive rates or long detection delays.
- Assumes IID Data: The classic CUSUM algorithm assumes independent, identically distributed observations before the change point. Auto-correlated data (common in time-series) can violate this assumption, leading to spurious alerts.
- Detects Mean Shifts Primarily: It is optimal for detecting shifts in the mean of a Gaussian distribution. For detecting changes in variance or more complex distributional shapes (data drift), other statistics must be monitored or different tests like EWMA (Exponentially Weighted Moving Average) for variance should be used.
- No Drift Localization: CUSUM signals that a change occurred in a specific metric stream but does not automatically identify which feature is responsible in a multivariate setting. It is often paired with drift localization techniques.
Frequently Asked Questions
CUSUM (Cumulative Sum) is a foundational statistical process control chart used for online change detection in machine learning monitoring. It is designed to detect small, persistent shifts in the mean of a monitored metric by accumulating deviations from a target value.
CUSUM (Cumulative Sum) is a sequential analysis technique for online change detection that works by accumulating the sum of deviations between observed values and a target mean. The core mechanism involves calculating two statistics: the positive cumulative sum $S^+_t$ for detecting upward shifts and the negative cumulative sum $S^-_t$ for detecting downward shifts, defined as $S^+t = \max(0, S^+{t-1} + x_t - (\mu_0 + K))$ and $S^-t = \min(0, S^-{t-1} + x_t - (\mu_0 - K))$, where $x_t$ is the observation at time $t$, $\mu_0$ is the target in-control mean, and $K$ is a sensitivity parameter (often half the shift size one wishes to detect). A drift alarm is triggered when either $S^+_t$ or $|S^-_t|$ exceeds a predefined decision threshold $H$. Its power lies in its memory; unlike Shewhart charts that only consider the last point, CUSUM accumulates evidence over time, making it highly sensitive to small, sustained shifts.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
CUSUM is a foundational technique in statistical process control adapted for online model monitoring. These related terms define the broader ecosystem of methods for identifying when a model's operating environment has changed.
Statistical Process Control (SPC)
Statistical Process Control (SPC) is a method of quality control that uses statistical techniques to monitor and control a process. In machine learning, SPC principles are adapted to monitor model performance and input data streams.
- Core Tool: Uses control charts (like CUSUM) to plot metrics over time against calculated control limits.
- Application: Distinguishes between common cause variation (inherent noise) and special cause variation (indicative of drift or degradation).
- Goal: To provide a statistical framework for determining when a process—such as a model's prediction error rate—has deviated from its stable, in-control state.
Online Drift Detection
Online drift detection is the process of continuously monitoring a model's incoming data stream in real-time to identify statistical changes using sequential analysis.
- Contrast with Batch: Unlike batch methods that compare two static datasets, online detectors like CUSUM and ADWIN process data point-by-point.
- Key Mechanism: Maintains a running statistic (e.g., cumulative sum of deviations) and triggers an alert when it crosses a dynamic threshold.
- Use Case: Essential for high-velocity applications like fraud detection or algorithmic trading, where immediate adaptation is required.
Change Point Detection
Change point detection is the identification of points in time or sequence where the statistical properties of a time series undergo a significant, often abrupt, change.
- Broader Category: CUSUM is a specific algorithm for online change point detection.
- Objective: To partition a sequence of observations into segments where the data-generating process is statistically homogeneous.
- Methods: Includes other sequential tests like the Page-Hinkley test and offline Bayesian methods. It is a core component of identifying the onset of concept or data drift.
Page-Hinkley Test
The Page-Hinkley test is a sequential analysis technique for online change point detection that monitors the cumulative difference between observed values and their running mean.
- Similarity to CUSUM: Like CUSUM, it accumulates deviations to detect small, persistent shifts. However, it uses the observed mean as the target, making it more adaptive to the stream's recent history.
- Mechanism: Calculates a test statistic (m_n) and its minimum value (M_n). A change is detected when the difference (m_n - M_n) exceeds a threshold.
- Application: Commonly used as an alternative to CUSUM for detecting changes in the mean of a data stream, such as a model's error rate.
Detection Delay
Detection delay is the critical time interval between the actual onset of a distributional shift in the data and the moment a drift detection algorithm successfully raises an alert.
- Trade-off: Inversely related to the false positive rate. Aggressive detection (low delay) risks more false alarms, while conservative detection (high delay) allows degraded performance to persist.
- CUSUM Tuning: The threshold (h) and reference value (k) parameters in CUSUM are directly tuned to balance this delay against false positives for a given expected shift size.
- Impact: A long detection delay can lead to significant business cost or model failure before corrective action (e.g., retraining) is triggered.
Drift Adaptation
Drift adaptation refers to the strategies and mechanisms employed to adjust a machine learning model once concept or data drift has been detected.
- Triggered by Detection: Algorithms like CUSUM provide the signal to initiate adaptation workflows.
- Common Strategies: Include triggered retraining (full model update), incremental/online learning, or activating a new model version from a repository.
- System Design: Effective adaptation requires a closed-loop production feedback loop where detection seamlessly integrates with model update pipelines, ensuring the system self-corrects.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us