COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.
Tom: I'm Tom.
Jane: And I'm Jane, here with Lu, Meng and our in-house large language model, Lalam.
Tom: We're looking at the paper: "COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection".
Jane: Here's the gist of the paper. Time series anomaly detection is addressed by COMET, which captures temporal dependencies and multivariate correlations across diverse temporal scales through Multi-scale Patch Encoding and learns representative normal patterns via Vector-Quantized Coreset, enabling anomaly detection by combining memory distance and quantization error The overall framework and its algorithmic procedure are provided in Appendix A, with an overview illustrated in Figure 1.
Tom: Pruning redundant reasoning tokens COMET consists of three key components designed to overcome limitations in existing unsupervised methods (1) Multi-scale Patch Encoding captures temporal dependencies and inter-variable correlations across multiple patch scales, (2) VectorQuantized Coreset learns representative normal patterns via codebook and detects anomalies with a dual-score combining quantization error and memory distance, and (3) Online Codebook Adaptation generates pseudo-labels based on codebook entries and dynamically adapts the model at inference through contrastive learning.
Jane: The main contributions of this work are summarized as follows • We propose Multi-scale Patch Encoding, which captures temporal dependencies and multivariate correlations by combining variable-wise encoders with a shared core encoder across multiple patch scales • We introduce Vector-Quantized Coreset, which learns representative normal patterns through codebook quantization and detects anomalies using a dual scoring scheme combining quantization error and memory distance • We propose Online Codebook Adaptation, which dynamically adapts to distribution shifts at inference time while preventing model contamination through codebook activation–based pseudo-labeling and contrastive learning.
Tom: How the training signal is built The training process involves two main phases: Model Training and Coreset Construction Phase 1 focuses on model optimization, where the overall training objective combines reconstruction loss with VQ losses Ltotal = Lrec + αLcb + βLcm.
Title and authors: Tom: So we're looking at the paper called "COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection." It’s tackling a big problem where you need to find weird stuff in time series data, but your model learns the wrong normal patterns because things keep changing over time.
Jane: Exactly. So, we’re talking about how this system handles those shifts and how it captures all the different ways things move over time simultaneously. It seems like they are proposing a whole framework to fix those two issues at once, which is pretty ambitious.
Lu: The core idea here is that they address the fact that time series data are inherently non-stationary, meaning the statistical properties change as time goes on, which violates the standard assumption that training and testing data come from the same distribution
Kim et al., 2022b: <ref:2602.01635#pg2>. This causes normal patterns learned during training to drift away from reality.
Meng: I’m curious about how they handle that drift because in my deployment pipeline, dealing with unknown shifts at inference time is a constant headache. If your model is trained on one set of data and then you feed it something slightly different, the anomaly score becomes meaningless fast.
Lalam: What's interesting here is that instead of just trying to adapt after seeing the new data, they have this online adaptation mechanism built right into the inference step itself to handle distribution shifts without contaminating the model with bad samples
Kim et al., two thousand twenty-four: <ref:2602.01635#pg2>.
Tom: Right, so what’s this COMET system actually doing mechanically? It seems like it’s trying to get better at seeing patterns across different time scales and different variables all at once.
Jane: The first component they introduce is Multi-scale Patch Encoding, which is designed to capture temporal dependencies and inter-variable correlations across multiple patch sizes, which means you’re looking at short patterns, medium patterns, and long patterns all in one go.
Lu: That part lets the system look at how different variables interact with each other across various time windows using a shared core encoder across these different patch scales
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: If it captures those interactions, does that mean it can spot an anomaly that only looks weird on a single variable but is normal when you look at the relationship between two variables? Because that’s where I usually hit roadblocks.
Title and authors: Tom: That’s exactly what they aim for. And then there's the second component, VectorQuantized Coreset, which is where they learn those representative normal patterns using a codebook and use a dual-score to detect anomalies
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: They don't just rely on one metric for the score; they combine two things: quantization error and memory distance, which gives them that explicit distance-based modeling of what is normal.
Lalam: That dual scoring scheme is smart because it captures both how far a point is from the learned normal space and how poorly that point fits into the quantized codebook
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Lu: The training signal construction involves a loss function combining reconstruction loss, which measures how well it reconstructs the data, with Vector Quantization losses that enforce structure on the embedding space
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: Okay, let's talk about the adaptation part. They have this Online Codebook Adaptation that generates pseudo labels based on whether a codebook entry was seen during training, and then it uses contrastive learning to dynamically adjust the model at inference time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: That sounds like they’re trying to create a system that doesn't just flag things as abnormal, but actively learns what’s normal in real time while ignoring the noise of the shift. It's like giving the model a temporary, adaptive understanding of the current distribution.
Tom: And they use this contrastive learning loss to encourage separation between normal and anomalous representations using a specific loss function where X n is normal and X p is anomalous
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Lu: They also employ deviation-based variable selection, which means at each time position, the system only keeps the variables that are behaving stably, so it doesn't get confused by a sudden spike in one channel while others stay consistent
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: From a deployment standpoint, variable selection makes sense. If you’re running on real traffic, you don't want the model trying to process a channel that’s completely broken or behaving erratically just because it was present in the training data.
Jane: So the final anomaly score is computed by averaging these scores over only those selected variables, which keeps the signal cleaner and more focused on what matters at that moment
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Title and authors: Tom: The results are pretty impressive. Experiments on five benchmark datasets show that COMET achieved the best performance in thirty-nine out of forty-five evaluation metrics, and when they add test time adaptation, it improves performance in thirty-five out of forty-five metrics
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: That’s a lot of wins. But the ablation studies are important because they show that taking away either the multi-scale encoding or the test time adaptation really hurts performance, which means you can’t just strip parts out randomly
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Lu: The hyperparameter sensitivity analysis suggests that using patch sizes like two, four, and six with strides one, two, and three consistently gives the best or near best performance across all datasets
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: And for the number of nearest neighbors they use for memory retrieval and test time adaptation, values like five and ten seem to be the sweet spot without needing a lot of tuning per dataset
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Lalam: The paper itself flags that this approach is designed to overcome the limitation where existing methods rely on post hoc filtering strategies, like just using an anomaly score threshold, without explicitly identifying normal samples during adaptation
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: So, to wrap up this paper on COMET: it’s a system that uses multi-scale encoding and a dual scoring mechanism combining memory distance and quantization error to find anomalies, while using online adaptation based on codebook activation to handle distribution shifts at inference time.
Jane: The implication for us is that we can finally have anomaly detection systems that are more robust when the underlying data stream isn't perfectly stationary, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Lu: For future work, they mention that the adaptation process uses pseudo labels based on codebook entries and contrastive learning to ensure separation between normal and anomalous representations
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: If we were deploying this today, I’d want to see the real traffic stress tests. Right now, it’s hard to trust these metrics when you don't know how it performs under heavy load and unexpected noise
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Title and authors: Lalam: I’m fairly sure the performance gains they report are solid because they are compared against existing TTA methods like M2N2, which relies on threshold selection, and COMET avoids that reliance
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg3>: .
Tom: So the big picture here is that we’re moving towards anomaly detection models that aren't just static detectors but are actively learning and adapting to the real world as it evolves, which is exactly what we need in complex monitoring environments
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: Yeah, it gives us a way to build systems that can stay reliable even when they encounter unexpected changes in the data stream, which is a huge win for industrial and cyber systems
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Lu: The system achieves this by combining those different scales of temporal information with a method that learns representative normal patterns through quantization, all while adapting its internal representation dynamically at inference
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: It’s still computationally intensive, though. We need to keep an eye on the parameter count, which they say is relatively efficient with only 567K parameters on the PSM dataset
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: So it’s efficient enough that we can actually deploy this kind of adaptive detection, and I think that makes a real difference in how we handle operational failures.
Jane: It's a solid piece of work because it tackles the non-stationarity problem directly with an online adaptation mechanism, which is exactly what the real world throws at us every day
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Lu: And I think this direction of using codebook quantization combined with memory distance is a really strong way to model the geometry of normal behavior in this high dimensional space
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: It’s definitely something we should keep an eye on as we look at scaling these types of models beyond benchmark datasets to see how they hold up in production environments
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Lalam: I’m confident this paper provides a solid framework for making time series monitoring much more reliable by explicitly accounting for the dynamics of the data distribution
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
The paper's summary: Tom: So, to summarize this COMET paper, it’s about building an anomaly detection system that doesn't just look at one single time scale or variable at a time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: Right. It takes those complex temporal dependencies and the different types of variables moving together, across various patch sizes, and it combines that with learning a compact representation of what is normal
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: And the real kicker is this online adaptation part. They’ve designed a way to dynamically update the model at inference time so it can handle shifts in the data distribution without getting contaminated by bad samples
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It’s clever because instead of just flagging something as an anomaly after the fact, it's actively learning what normal looks like in the moment using pseudo labels from the codebook and contrastive learning
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: They use a dual scoring system to find those anomalies. One score measures how far the data point is from the normal patterns stored in the memory bank, and another score captures how poorly it fits into the quantization codebook itself
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: That dual scoring is smart because it lets you measure both explicit distance to known normal behavior and the compressibility of the data into that learned normal space
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: The results are strong. They found that COMET hits top performance in almost half the evaluation metrics, and when they add that test time adaptation, it boosts performance even further
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: And they showed that this isn't just a theoretical exercise. They have ablation studies proving that taking away the multi-scale encoding or the test time adaptation really hurts performance
COMET: Codebook-based Online Patch Encoding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: The efficiency numbers are also good. They managed to get this whole system running with only about five hundred sixty-seven thousand parameters on a specific dataset, which is pretty tight for something this complex
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: So what does this mean for real systems? It means we can finally build monitoring tools that are robust when the data stream isn't perfectly stationary, which is exactly how things move in industrial monitoring or cybersecurity environments
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: Exactly. It’s moving us away from those old methods that just rely on a simple score threshold, and toward systems that are actually learning and adapting to the real world as it evolves
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It's a big step because it gives us a way to build systems that stay reliable even when they encounter those unexpected changes in the data stream, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: Yeah, so it’s about combining different ways of looking at time and variables with an active adaptation mechanism that handles distribution shifts during real deployment.
Jane: It really is a solid framework because it accounts for the dynamics of the data distribution in a way that existing methods didn't before
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: So, next up, we’re going to look at how they specifically set those patch sizes and strides. Because the paper suggests there are specific configurations that give the best results across different datasets
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
The paper's improvements: Tom: So, looking at how they improve things, the biggest shift is definitely in that online adaptation strategy
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: They are moving beyond just adapting the codebook at inference time. Instead, they use pseudo labels based on whether a codebook entry was used during training, and then they use contrastive learning to refine those representations
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: That means the model gets smarter about what's normal by actively separating normal and anomalous data during that update process, rather than just relying on a simple threshold
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: That’s important because it prevents the model from getting contaminated by weird data when it sees a distribution shift in real time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: They also refined the scoring mechanism itself. The memory score now uses an exponential moving average based min max normalization for comparison over time, which makes that distance metric much more stable
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It’s about making sure that when you compare the distance to the memory bank against the quantization error, those scores are comparable consistently across different time steps
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: And they have this deviation based variable selection. It means at every single time position, they only keep the variables that are behaving stably, which keeps the anomaly score focused on reliable signals
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: That’s a practical improvement because in a real system with lots of sensors, you don't want the model getting confused by one channel that’s totally broken while the rest of your system is fine
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: It’s about improving robustness against noisy channels while still capturing informative anomaly signals during the score aggregation, which is a key thing for production
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: So what does this mean for the end user? It means when they’re monitoring something complex, like industrial machinery or network traffic, the system will be more stable and less likely to throw a false alarm just because of temporary noise
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: It also addresses that issue of post hoc filtering. They’re not just saying "if the score is high, it’s an anomaly"; they are actively using the adaptation process to refine what normal looks like while things are happening
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Jane: It’s a big win because it moves the system from being a passive detector to an active learner that keeps up with the changing reality of the data
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: And they did get really good on those benchmarks, hitting top performance in thirty-nine out of forty-five metrics even with test time adaptation, which shows this isn't just theoretical work
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It’s solid work because they show how to combine those different elements—multi-scale input, dual scoring, and online adaptation—into one cohesive system
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: So, the paper is proving that you can build time series anomaly detectors that are more adaptive and robust when the underlying data distribution isn't perfectly stationary at all
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It’s a big step because it gives us a way to build systems that can stay reliable even when they encounter those unexpected changes in the data stream, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: For future work, they mention focusing on making that adaptation process even more refined to handle very rapid or extreme distribution shifts
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Conclusion: Tom: So to wrap up on COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection, this system is fundamentally about building an AI that can actually adapt to the real world as it changes
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: Exactly. It combines capturing time across different scales with learning what normal looks like through a codebook, and then it actively updates itself during operation to keep up with distribution shifts
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Tom: The big implication here is that we can finally deploy anomaly detection on systems that aren't perfectly static, which is something we’ve struggled with for a long time in industrial monitoring or cyber infrastructure
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Jane: It moves us away from just setting a score threshold and toward models that are actively learning and refining what is normal in real time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: And the efficiency is decent. They managed to keep the parameter count relatively low with about five hundred sixty-seven thousand parameters on a dataset, which shows it’s something you can actually think about deploying
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It's a solid piece of work because it shows how to combine those different elements—multi-scale input, dual scoring, and online adaptation—into one cohesive system
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: The results are strong. They hit top performance in thirty nine out of forty five metrics even with that test time adaptation, which shows this isn't just theoretical work
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It’s a big step because it gives us a way to build systems that stay reliable even when they encounter those unexpected changes in the data stream, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: It’s about moving toward anomaly detection models that are actually learning and adapting to the real world as it evolves
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: And it’s a big win because it shows how to build systems that stay reliable even when they encounter those unexpected changes in the data stream, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: It’s about combining different ways of looking at time and variables with an active adaptation mechanism that handles distribution shifts during real deployment
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: Yeah, it gives us a way to build systems that can stay reliable even when they encounter those unexpected changes in the data stream, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: For future work, they mention focusing on making that adaptation process even more refined to handle very rapid or extreme distribution shifts
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It’s a big step because it shows how to build systems that stay reliable even when they encounter those unexpected changes in the data stream, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: So, the paper COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection is proving that you can build time series anomaly detectors that are more adaptive and robust when the underlying data distribution isn't perfectly stationary
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jane: It’s a big win because it shows how to build systems that stay reliable even when they encounter those unexpected changes in the data stream, which is something we’ve struggled with for a long time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg2>: .
Tom: For future work, they mention focusing on making that adaptation process even more refined to handle very rapid or extreme distribution shifts
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Lu: I think the core idea of using that contrastive learning loss to encourage separation between normal and anomalous representations is really powerful, especially when you’re dealing with complex, high dimensional time series data
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Meng: From a production standpoint, I'm still worried about the computational cost of that online adaptation at scale. If that process adds too much latency to the inference pipeline, it just won't work in real time
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Lalam: I'm sure this approach is solid because it directly addresses the non-stationarity problem by explicitly modeling the geometry of normal behavior in that embedding space
COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection <ref:2602.01635#pg1>: .
Jinwoo Park, Hyeongwon Kang, Seung Hun Han, Pilsung Kang
Seoul National University · Korea University · LG CNS
cs.LG
Submitted: 2026-02-02
Updated: 2026-11-09
Comments: Accepted at NeurIPS 2026 (poster). 31 pages, 5 figures, 23 tables. Code: https://github.com/JINU6497/COMET
License: http://creativecommons.org/licenses/by/4.0/
Importance score: 98/100
The gist: Time series anomaly detection is addressed by COMET, which captures temporal dependencies and multivariate correlations across diverse temporal scales through Multi-scale Patch Encoding and learns…
Key concepts
- Multi-scale Patch Encoding
- This technique captures temporal dependencies and correlations across different time scales by using multiple patch sizes. It combines variable-wise encoders with a shared core encoder to comprehensively understand how patterns evolve over various lengths of time, helping the system recognize complex normal behaviors.
- Vector-Quantized Coreset
- This component learns a compact representation of normal data using a codebook. Anomalies are detected by measuring how far new data points are from these learned normal representations. It uses dual scoring—quantization error and memory distance—to provide a robust measure of abnormality.
- Online Codebook Adaptation
- This mechanism allows the model to adapt its codebook at inference time when encountering distribution shifts. It uses pseudo-labels derived from whether a codebook entry was seen during training, combined with contrastive learning on normal samples. This prevents model contamination while ensuring the system remains effective for new data distributions.
Terminology
Summary
Time series anomaly detection is addressed by COMET, which captures temporal dependencies and multivariate correlations across diverse temporal scales through Multi-scale Patch Encoding and learns representative normal patterns via Vector-Quantized Coreset, enabling anomaly detection by combining memory distance and quantization error The overall framework and its algorithmic procedure are provided in Appendix A, with an overview illustrated in Figure 1. p. 7 Conclusion
In this paper, we propose COMET for time series anomaly
detection. COMET captures temporal dependencies and
multivariate correlations across diverse temporal scales
through Multi-scale Patch Encoding and learns representative normal patterns via Vector-Quantized Coreset, enabling anomaly detection by combining memory distance
and quantization error.Where the paper says it
Pruning redundant reasoning tokens
COMET consists of three key components designed to overcome limitations in existing unsupervised methods (1) Multi-scale Patch Encoding captures temporal dependencies and inter-variable correlations across multiple patch scales, (2) VectorQuantized Coreset learns representative normal patterns via codebook and detects anomalies with a dual-score combining quantization error and memory distance, and (3) Online Codebook Adaptation generates pseudo-labels based on codebook entries and dynamically adapts the model at inference through contrastive learning. The main contributions of this work are summarized as follows • We propose Multi-scale Patch Encoding, which captures temporal dependencies and multivariate correlations by combining variable-wise encoders with a shared core encoder across multiple patch scales • We introduce Vector-Quantized Coreset, which learns representative normal patterns through codebook quantization and detects anomalies using a dual scoring scheme combining quantization error and memory distance • We propose Online Codebook Adaptation, which dynamically adapts to distribution shifts at inference time while preventing model contamination through codebook activation–based pseudo-labeling and contrastive learning. p. 1 The main contributions of this
work are summarized as follows:
• We propose Multi-scale Patch Encoding, which captures temporal dependencies and multivariate correlations by combining variable-wise encoders with a
shared core encoder across multiple patch scales. • We introduce Vector-Quantized Coreset, which learns
representative normal patterns through codebook quantization and detects anomalies using a dual scoring
scheme combining quantization error and memory distance.Where the paper says it
How the training signal is built
The training process involves two main phases: Model Training and Coreset Construction Phase 1 focuses on model optimization, where the overall training objective combines reconstruction loss with VQ losses Ltotal = Lrec + αLcb + βLcm. The reconstruction loss is defined as P(i,j)k − hk(z(i,j)q,k) squared The VQ losses are Lcb = z(i,j)q,k − sg[z(i,j)e,k] squared and Lcm = sg[z(i,j)q,k] − z(i,j)e squared. p. 3 Training Objective. To train the vector quantization module, we employ a codebook loss and a commitment loss:
Lcb =
z
(i,j)
q,k − sg[z
(i,j)
e,k ]
2
2
(8)
Lcm =
sg[z
(i,j)
q,k ] − z
(i,j)
e,k
2
2
(9)
where sg[·] denotes the stop-gradient operator. Coreset Memory Bank. After training, we construct a coreset memory bank M by collecting the codebook entries that
are activated by the training data:
M =
[
K
k=1
{cm | m ∈ Ak} (12)
where Ak ⊆ {1, .Where the paper says it
Where the paper says it
Where the gains come from
Anomaly scoring at inference time is achieved using two complementary scores: a memory score measuring distances to the memory bank and a quantization score capturing codebook quantization error The memory score introduces a local scaling distance that jointly accounts for distance and local density, defined as dlocal(zq, mj) = zq − mj squared / (σq + σj) / 2 + ε. The quantization score is computed as S(t)quant = z(t)e,k − z(t)q,k squared. p. 4 The final anomaly score is
computed as a weighted combination of the two normalized
scores:
S
(t) = (1 − λ) · S˜(t)
mem + λ · S˜
(t)
quant (20)
where λ is a weighting hyperparameter. The memory score
captures the explicit distance to learned normal patterns,
while the quantization score measures compressibility into
the normal pattern space, allowing the two scores to complement each other in detecting anomalies. Anomaly Score Aggregation. The final anomaly score is
computed as a weighted combination of the two normalized
scores:
S
(t) = (1 − λ) · S˜(t)
mem + λ · S˜
(t)
quant (20)
where λ is a weighting hyperparameter.Where the paper says it
Where the paper says it
Efficiency and adaptation mechanisms
The system incorporates deviation-based variable selection to retain variables with stable behavior at each temporal position The final anomaly score is computed by averaging the scores over the selected variables, S˜t = 1 / Vt Σ X i∈Vt S(i)t. Online Codebook Adaptation dynamically updates the codebook at inference time to handle distribution shifts This adaptation uses pseudo-labels based on whether the codebook entry corresponding to the quantization index was activated during training, y˜(i,j)k = (0 if c qˆ(i,j)k ∈ Cseen (Normal) 1 otherwise (Abnormal). p. 5 We define the set of activated
codebook entries as:
Cseen =
n
cm | ∃(i, j, k) ∈ Dtrain : q
(i,j)
k = m
o
(21)
Activation-based Pseudo-labeling. At inference time, we
generate pseudo-labels based on whether the codebook entry corresponding to the quantization index qˆ
(i,j)
k
of a test
sample was activated during training:
y˜
(i,j)
k =
(
0 if c
qˆ
(i,j)
k
∈ Cseen (Normal)
1 otherwise (Abnormal)
(22)
This enables normal sample identification without threshold
tuning. To encourage separation between normal and anomalous representations using
pseudo-labels, we employ supervised contrastive learning. Given encoder outputs {z
(n)
e } and pseudo-labels {y˜
(n)}
from a test batch, the contrastive loss is defined as:
Lcon = −
X
n
1
|P(n)|
X
p∈P (n)
log e
snp/τ
P
a̸=n
e
sna/τ (23)
where snp = sim(z
(n)
e , z
(p)
e ) denotes cosine similarity,
P(n) = {p | y˜
(p) = ˜y
(n)
, p ̸= n} is the positive set with
the same pseudo-label, and τ is a temperature parameter.Where the paper says it
Where the paper says it
Performance validation
Experiments on five benchmark datasets demonstrate that COMET achieves the best performance in 39 out of 45 evaluation metrics Applying test-time adaptation (TTA) further improves performance in 35 out of 45 evaluation metrics. The ablation study confirms the importance of each component, showing that removing multi-scale patch encoding leads to performance degradation and that removing test-time adaptation causes overall performance degradation. p. 6 Ablation Study
To analyze the contribution of each component, we conduct
an ablation study reported in Table 2. Removing multi-scale
patch encoding and using a single scale with patch size 6 and
stride 3 leads to performance degradation, highlighting the
importance of capturing temporal patterns at multiple resolutions. Circle size indicates the number of model parameters. COMET achieves the highest performance with the smallest
parameter count, highlighting its parameter efficiency.Where the paper says it
Where the paper says it
Hyperparameter sensitivity
The analysis of hyperparameter sensitivity indicates that multi-scale patch configurations, specifically using patch sizes and strides such as P = [2, 4, 6] with S = [1, 2, 3], consistently achieves the best or near-best performance across all datasets. Similarly, for the number of nearest neighbors used in memory-based retrieval and test-time adaptation, intermediate values such as k = 5 and k = 10 consistently provide the best performance without requiring dataset-specific tuning. p. 5 Compared against baseline methods without test-time adaptation,
COMET (w/o TTA) achieves the best performance in 39
out of 45 evaluation metrics, demonstrating its effectiveness
across diverse settings. Notably, COMET shows consistent
gains on range-based metrics, which are considered more
robust for time series anomaly detection. Furthermore, COMET dynamically
adapts to distribution shifts at inference time through Online Codebook Adaptation, which leverages pseudo-labeling
based on codebook activation and contrastive learning. Experimental results on five benchmark datasets demonstrate
that COMET achieves the best performance in 39 out of 45
evaluation metrics while exhibiting strong efficiency with a
small number of parameters.Where the paper says it
Where the paper says it
Conclusion
In summary, COMET captures temporal dependencies and multivariate correlations across diverse temporal scales through Multi-scale Patch Encoding and learns representative normal patterns via Vector-Quantized Coreset, enabling anomaly detection by combining memory distance and quantization error. Furthermore, COMET dynamically adapts to distribution shifts at inference time through Online Codebook Adaptation, which leverages pseudo-labeling based on codebook activation and contrastive learning. p. 7 COMET captures temporal dependencies and
multivariate correlations across diverse temporal scales
through Multi-scale Patch Encoding and learns representative normal patterns via Vector-Quantized Coreset, enabling anomaly detection by combining memory distance
and quantization error. Furthermore, COMET dynamically
adapts to distribution shifts at inference time through Online Codebook Adaptation, which leverages pseudo-labeling
based on codebook activation and contrastive learning. Furthermore, COMET dynamically
adapts to distribution shifts at inference time through Online Codebook Adaptation, which leverages pseudo-labeling
based on codebook activation and contrastive learning. Experimental results on five benchmark datasets demonstrate
that COMET achieves the best performance in 39 out of 45
evaluation metrics while exhibiting strong efficiency with a
small number of parameters.Where the paper says it
Where the paper says it
Impact Statement
Reliable identification of anomalous patterns is essential in large-scale information systems, where undetected or mischaracterized abnormal behaviors can lead to operational failures or significant economic losses. Advances in timeseries anomaly detection can contribute to improving the stability, safety, and reliability of real-world systems, including industrial monitoring environments, cyber-physical infrastructures, and other data-driven operational settings. p. 8 COMET: Codebook-based Online-adaptive Multi-scale Embedding for Time-series Anomaly Detection
Impact Statement
Reliable identification of anomalous patterns is essential in
large-scale information systems, where undetected or mischaracterized abnormal behaviors can lead to operational
failures or significant economic losses. Advances in timeseries anomaly detection can contribute to improving the
stability, safety, and reliability of real-world systems, including industrial monitoring environments, cyber-physical
infrastructures, and other data-driven operational settings. This work is intended to support the development of more reliable monitoring and analysis capabilities in such domains. The proposed research is not designed to disadvantage or
target any specific institution, organization, or group, and
it does not raise ethical concerns beyond those commonly
associated with data-driven monitoring and analytical systems. This work is intended to support the development of more reliable monitoring and analysis capabilities in such domains. The proposed research is not designed to disadvantage or
target any specific institution, organization, or group, and
it does not raise ethical concerns beyond those commonly
associated with data-driven monitoring and analytical systems.Where the paper says it
Where the paper says it
Where the paper says it
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Multi-scale Patch Encoding captures temporal dependencies and inter-variable correlations across multiple patch scales by combining variable-wise encoders with a shared core encoder to learn inter-variable interaction information. This allows the system to comprehensively capture normal and anomalous patterns that manifest across diverse temporal scales.
-
Vector Quantized Coreset learns representative normal patterns via codebook quantization and detects anomalies using a dual scoring scheme combining quantization error and memory distance. This provides an explicit distance-based modeling of normal patterns, enabling robust anomaly detection even when training data are assumed to be normal.
-
Online Codebook Adaptation dynamically adapts to distribution shifts at inference time through codebook activation based pseudo-labeling and contrastive learning. This mechanism prevents model contamination by identifying reliable normal samples without requiring explicit thresholds, which is crucial for handling non-stationary time series data.
-
Anomaly Scoring combines a memory score measuring distances to the memory bank with a quantization score capturing codebook quantization error, using exponential moving average based min-max normalization for consistent comparison over time. This dual scoring approach complements each other in detecting anomalies by capturing both explicit distance and compressibility into the normal pattern space.
-
Deviation-based Variable Selection performs temporal position-wise variable selection based on standardized temporal deviations to select reliable variables at each time step, ensuring that anomaly scores are computed from variables exhibiting consistent temporal behavior. This improves robustness against noisy channels while preserving informative anomaly signals during score aggregation.
-
The system can perform real-time adaptation by computing memory distance and quantization error before adaptation, followed by dynamic updating of the codebook using contrastive learning on normal samples to refine representations for subsequent test batches. This inference-then-train strategy ensures that the adapted model affects only future data, enabling fair evaluation under distribution shifts.
Abstract
Multivariate time-series anomaly detection aims to identify abnormal temporal patterns in complex real-world systems. However, robust unsupervised time-series anomaly detection remains challenging because anomalies can manifest over different temporal ranges and emerge from interactions among variables, while distribution shifts can cause normal patterns to drift over time. To address these challenges, we propose Codebook-based Online-adaptive Multi-scale Embedding for Time-series anomaly detection (COMET), a unified framework with three tightly coupled components. First, Multi-scale Patch Encoder learns correlation-aware patch embeddings by combining variable-specific temporal dynamics with shared inter-variable structure across multiple patch scales. Second, Vector-Quantized Coreset quantizes these embeddings into representative normal prototypes, which are used to detect anomalies through a dual score combining quantization error and density-aware memory distance. Third, Online Codebook Adaptation leverages the same codebook structure to identify reliable normal samples from training-activated codebook entries, and then updates the prototypes through contrastive learning at inference time. Experiments on five benchmark datasets demonstrate that COMET achieves the best performance on 39 out of 45 evaluation metrics compared to seven baselines, showing robust performance across diverse evaluation protocols.
Sources
Related papers
- FlexMoE: Learning One-for-All Multi-Budget Expert Pruning for Flexible MoE Deployment
- OptiMind: Improving Small Language Models for Optimization Modeling through Formulation Guidance and Multi-Turn Learning
- Staying in the Sweet Spot: Boost Reasoning Evolution via Responsive Rollout Difficulty Manipulation
- Examining the Impact of Data and Training Methods on Emergent and Subliminal Misalignment
- Rethinking Black-Box On-Policy Distillation: A Rubric-based Analysis
- (Mis)generalization of Helpful-Only Fine-tuning