In the world of artificial intelligence (AI), one major challenge is teaching models to recognise when they encounter something they’ve never seen before—known as out-of-distribution (OOD) data. Imagine training a model to identify everyday objects like cats, but when it encounters a rhinoceros, it fails spectacularly. Traditional methods require a separate model for each type of data, which is inefficient and time-consuming. But researchers at NUS Computing have developed a new approach called DiffPath, which uses a single AI model to spot these outliers efficiently across different data types.
In the rapidly evolving field of artificial intelligence (AI), detecting out-of-distribution (OOD) data is critical for ensuring the reliability and safety of AI models in real-world applications. OOD data refers to input that an AI model has never encountered during training, and if not correctly identified, it can lead to inaccurate predictions. Imagine training a model to identify everyday objects like cats, but when it encounters a rhinoceros, it may fail spectacularly.
Detecting OOD data is extremely important as failure to do so effectively may lead to potentially dangerous outcomes. For example, in autonomous driving, if a car’s AI model is trained to recognise typical road elements—such as other vehicles, pedestrians, and traffic signs—but suddenly encounters an unusual object like a large fallen tree or construction equipment, it must quickly determine that this new object is outside its training scope. Failing to do so could result in an accident. Similarly, in medical diagnostics, AI models are often trained on specific medical images like X-rays or MRI scans. If a model encounters an image with unusual patterns or anomalies not covered in its training data—say, a rare tumour or an unexpected artifact—it should flag the data as OOD rather than attempting a diagnosis based on insufficient information. In these scenarios, OOD detection isn’t just a feature; it’s a safeguard against misinformation and error.
Despite its importance, traditional methods for detecting OOD data, such as relying on the AI model’s confidence score, often fall short. This is where a novel approach called DiffPath, developed by Alvin Heng, Alexandre Thiery and Harold Soh, researchers at the National University of Singapore, comes into play. DiffPath utilises a single AI model to identify OOD data across various scenarios and datasets without needing to retrain for every new situation, making it a powerful tool for building more adaptable and robust AI systems.
The Problem with Traditional Confidence Scores
The most straightforward way to spot OOD data might seem to be checking how confident the AI model is in its prediction. If the model was trained to recognise cats, a picture of a cat would receive a high confidence score, while an unfamiliar object, like a rhinoceros, should theoretically receive a low score. However, this method isn’t as reliable as it sounds.
Research shows that these confidence scores can often be misleading. Sometimes, OOD images receive even higher scores than the images the model was originally trained on. For instance, a model trained to recognise dogs and airplanes might actually assign a higher score to house numbers—images it was never trained on. This happens because the model’s confidence can be influenced by factors like visual complexity or how familiar an image might seem within its own category. This reveals the need for a more robust approach to identifying outliers.
Introducing DiffPath: A New Approach to OOD Detection
To tackle this problem, researchers have introduced DiffPath, a method that examines the entire process the model goes through to make its prediction, rather than just the final confidence score. This method leverages diffusion models, which are typically used to generate images by reversing the process of adding noise to a clear picture until it becomes blurry. Diffusion models learn how to take this noisy image and reconstruct it back to its original state.
DiffPath utilises these models differently. During the denoising process, the model generates scores that act as guideposts, helping it remove noise effectively. These scores, originally intended for image generation, can also be used to detect OOD data. The researchers apply a mathematical concept called KL divergence to compare the scores, effectively measuring how different two data sets are.
The Diffusion Path: Mapping the Model’s Journey
DiffPath goes beyond just using these scores; it examines the trajectory the model follows from the noisy image back to the clear image. This trajectory, or diffusion path, offers a detailed look into the model’s decision-making process. It’s like following the model’s “thought process” step by step, rather than just looking at the final outcome.
The researchers identified two key features of these paths: rate of change and curvature. The rate of change measures how quickly the model adjusts its predictions, while curvature indicates how much the trajectory bends—similar to the difference between driving on a straight highway versus a winding mountain road. By analysing these features, DiffPath provides a more accurate assessment of whether the input data is truly out-of-distribution.
Two Versions of DiffPath: 1D and 6D
The researchers developed two main versions of DiffPath: DiffPath 1D and DiffPath 6D. DiffPath 1D simplifies the rate of change into a single value, offering a quick snapshot of the diffusion path. Meanwhile, DiffPath 6D provides a more comprehensive view by measuring multiple aspects of the path, such as the scores themselves and how they evolve over time, and combining them into a six-dimensional vector. This detailed analysis allows DiffPath 6D to create a “high-resolution scan” of the path, making it more robust and accurate.
Testing DiffPath: How Does It Perform?
To test the effectiveness of DiffPath, researchers used a variety of datasets, including images of everyday objects, faces, and complex textures. They trained a single DiffPath model and compared it against several specialised models tailored to each dataset. Despite being trained on just one dataset, DiffPath performed as well as, or even better than, the specialised models across multiple tests—even when faced with new, unfamiliar data.
However, the researchers noted one critical aspect: image resizing. Resizing images haphazardly can alter their quality, making them appear as outliers when they aren’t. For example, if a model trained on high-resolution images is shown a blurry, upscaled version of an image, it might incorrectly identify it as OOD due to the distortion. This highlights the importance of maintaining consistency in image quality for accurate OOD detection.
What’s Next for DiffPath?
DiffPath shows the potential for creating versatile AI models capable of handling diverse tasks without needing to be retrained for every new dataset. This would mark a significant advancement in AI, making models more efficient and adaptable. The idea of using diffusion paths, originally developed for image generation, as unique “fingerprints” of data sets opens up new possibilities for AI research.
For those interested in diving deeper into this research, the original paper, presented at the Thirty-Eighth Annual Conference on Neural Information Processing Systems (NeurIPS 2024), provides a detailed explanation of the mathematical foundations and experiments conducted. The researchers have also shared their code, allowing hands-on exploration of DiffPath and its capabilities. Who knows? You might be the one to develop the next breakthrough in outlier detection.
The Future of AI Models: Expanding the Possibilities
The potential applications of DiffPath go beyond outlier detection. If diffusion paths act as fingerprints, they could help identify finer categories within datasets or even track how data evolves over time. For instance, a model trained on images from the 1950s could reveal how cultural and visual patterns shift as it processes images from later decades, offering a new way to study societal changes.
As we continue to explore the capabilities of these advanced AI models, we’re only beginning to grasp their full potential. DiffPath opens the door to a future where AI systems are not only powerful and adaptable but also capable of providing a deeper understanding of the information they process. With further development, these models could transform how we interact with data, helping us navigate and understand the complexities of our world in entirely new ways.