anomaly detection
Anomaly detection is the task of finding data points, events, or sequences that deviate from a dataset’s established pattern of normal behavior. It’s usually posed as an unsupervised machine learning problem, because labeled examples of failure are scarce and the next anomaly rarely resembles the last one.
A 2009 survey by Chandola, Banerjee, and Kumar sorts anomalies into three kinds:
- A point anomaly is a single instance that stands apart from the rest of the data, such as one unusually large transaction.
- A contextual anomaly is unremarkable on its own but wrong for its context, such as a temperature reading that’s ordinary in winter and extreme in June.
- A collective anomaly is a set of related instances that’s anomalous together even though its members may look unremarkable on their own, such as a burst of routine requests.
The request traffic below carries all three kinds. Switching between them shows how each one slips past the check that caught the kind before it.
Methods differ in what they assume about the training data. Outlier detection fits a model to data that already contains anomalies, while novelty detection learns from clean data and then scores new observations against it.
Isolation Forest separates points by random partitioning, and a one-class support vector machine (SVM) fits a boundary around the region that normal data occupies. Local Outlier Factor instead compares a point’s local density against that of its nearest neighbors.
In LLM systems, the technique surfaces mainly through LLM observability, where it flags latency spikes, cost jumps, or responses whose embeddings fall far from the usual cluster.
Related Resources
Tutorial
K-Means Clustering in Python: A Practical Guide
In this step-by-step tutorial, you'll learn how to perform k-means clustering in Python. You'll review evaluation metrics for choosing an appropriate number of clusters and build an end-to-end k-means clustering pipeline in scikit-learn.
For additional information on related topics, take a look at the following resources:
- Python Statistics Fundamentals: How to Describe Your Data (Tutorial)
- Split Your Dataset With scikit-learn's train_test_split() (Tutorial)
- Splitting Datasets With scikit-learn and train_test_split() (Course)
- NumPy Tutorial: Your First Steps Into Data Science in Python (Tutorial)
- K-Means Clustering in Python: A Practical Guide (Quiz)
- Python Statistics Fundamentals: How to Describe Your Data (Quiz)
- Split Your Dataset With scikit-learn's train_test_split() (Quiz)
- NumPy Tutorial: Your First Steps Into Data Science in Python (Quiz)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Martin Breuss • Updated Oct. 9, 2026