Think about the next situation: you and a crew of cyber specialists have been tasked with defending your group from cyberattacks. You’ve developed a machine studying (ML) mannequin to display incoming and outgoing visitors. You’re feeling you possibly can relaxation simple, as your mannequin achieves near-perfect efficiency throughout check and analysis. Sooner or later, you might be woke up by a frantic name out of your CEO—your prospects’ non-public knowledge have been leaked. How may this occur? you assume to your self, as you start investigating why your mannequin did not cease this assault.
This case isn’t merely hypothetical. Research have discovered that fashions that have been as soon as extremely efficient at detecting malicious exercise change into considerably much less efficient as assault patterns evolve (in Android functions, encrypted visitors, and malware). As ML and different synthetic intelligence (AI) fashions change into pervasive, it’s more and more vital to make sure these fashions proceed to carry out properly when deployed. For cybersecurity fashions, this implies they need to have the ability to adapt to counter clever adversaries as they evolve their methods. Repeatedly monitoring efficiency for indicators of drift and retraining, when essential, could be important to keep away from vital and expensive losses.
On the Software program Engineering Institute (SEI), we now have a protracted historical past of labor on the forefront of cybersecurity and machine studying, from establishing C/C++ safe coding requirements to founding the primary AI safety incident response crew. Whereas ML is a doubtlessly transformative expertise for securing data techniques, the cyber panorama is ever altering as a result of the behaviors of customers, attackers, and data techniques evolve over time. If not addressed, these modifications can degrade the efficiency of even the perfect ML-based defenses. Measures must be in place to detect and reply to drift earlier than real-world harms are enacted.
On this submit, we describe what causes drift, focus on the right way to detect it, and supply a case research.
What Is Drift?
Issues change over time. {Hardware} and software program techniques are up to date, people undertake new behaviors, and environments shift. Adversaries adapt their techniques. Adjustments that have an effect on knowledge used or predicted by an ML mannequin are known as drift. There are three main sorts of drift: knowledge drift, idea drift, and label drift. We illustrate these utilizing an ML-based electronic mail classifier for instance:

Idea drift is outlined by modifications within the relationships between options and outcomes. Idea drift could be significantly problematic as a result of the discovered relationship between options and outcomes might not maintain. Idea drift is very related in settings the place adversarial actions are frequent. When adversaries goal to evade detection, they might modify their behaviors, for instance to higher mimic benign customers. For instance, adversaries sending phishing emails might uncover emails containing hyperlinks are blocked by our phishing classifier mannequin. To bypass this, adversaries might cease together with hyperlinks in phishing emails, altering the connection between hyperlink-containing textual content and the chance an electronic mail is a phishing try (Determine 1, Panel A).
Information drift—generally known as characteristic or covariate drift—refers to modifications within the distributions of a number of options over time. Information drift alone doesn’t have an effect on relationships between options and outcomes. For a classifier, knowledge drift happens when one thing impacts all courses equally. For our electronic mail classifier, benign and phishing emails incorporating textual content written by giant language fashions (LLMs) may trigger knowledge drift by lowering the typical variety of typos within the textual content (Determine 1, Panel B).
Label drift refers to modifications within the distribution of outcomes. For classifier fashions, label drift signifies the proportion of observations in every class has modified. Label drift can negatively impression classification fashions which might be delicate to class imbalances. For the phishing electronic mail classifier, a change within the proportion of emails which might be phishing makes an attempt can be an instance of label drift (Determine 1, Panel C).

Determine 1: Three main sorts of drift: knowledge drift, idea drift, and label drift illustrated utilizing the instance of a phishing electronic mail classifier.
These kinds of drift typically co-occur. For instance, a change in consumer conduct may have an effect on the general distribution of a characteristic (characteristic drift) in addition to the connection between that characteristic and the end result class (idea drift). As a result of these completely different drift varieties can have various impacts on production-level ML fashions, it is very important perceive what sorts of drift are occurring.
How Can We Detect Drift?
Whereas drift may cause mannequin efficiency degradation, there are methods to establish and cut back degradation. One step to safe ML fashions in opposition to drift is to implement drift detectors. These strategies establish when the working atmosphere has modified and situation alerts, enabling well timed mannequin retraining. Drift detection has been famous as a CISA expertise of curiosity and is listed as a required step within the lifecycle of AI techniques within the DoD handbook Operational Check and Analysis and Dwell Hearth Check and Analysis of Synthetic Intelligence-Enabled and Autonomous Programs.
Drift could be detected in two methods: (1) by monitoring for modifications in efficiency metrics or (2) by monitoring for modifications in knowledge distributions. Adjustments in efficiency metrics, similar to accuracy or root imply squared error (RMSE), point out a discrepancy between coaching and deployment environments. Monitoring for modifications in ML mannequin efficiency metrics immediately is interesting as a result of mannequin efficiency is what an analyst goals to optimize; drift that doesn’t negatively impression mannequin efficiency could be safely ignored. Determine 2 illustrates drift that doesn’t have an effect on the classifier (Panel A) and drift that degrades classifier efficiency (Panel B).
In lots of functions, labeled manufacturing knowledge isn’t obtainable. In these circumstances, drift can solely be detected by monitoring for modifications within the distributions of the options. A easy methodology of monitoring for drift in unlabeled knowledge is to watch every characteristic individually. A big distributional change in a characteristic can point out the manufacturing atmosphere has drifted from the coaching atmosphere.
A limitation of this method, significantly with high-dimensional cyber knowledge, is that drift in uninformative options that doesn’t negatively impression ML mannequin efficiency might however set off an alert.
To keep away from these false alarms, drift detection strategies have been developed to particularly goal drift that impacts mannequin predictions. One such methodology, a method known as margin density drift detection (MD3), defines a margin round a classifier’s determination boundary. The margin corresponds to a area the place the classifier has low confidence in its class predictions. By establishing a baseline % of observations falling throughout the margin, a drift alarm could be triggered when a big proportion of observations drift in or out of this margin. In different phrases, MD3 triggers an alert when the mannequin encounters an unexpectedly excessive variety of circumstances which might be troublesome (or simple) to categorise. For the reason that determination boundary determines how a classifier assigns labels, MD3 solely alerts an alarm for drift that might have an effect on mannequin predictions.

Determine 2: Drift impacts classifier efficiency provided that it shifts observations throughout the classifier boundary.
Case Research: DNS Information Exfiltration
On the SEI, we carried out a case research utilizing a DNS exfiltration dataset. We chosen DNS knowledge exfiltration as a result of it gives a practical cybersecurity use-case for ML-based detection with an adversary making an attempt to evade detection.
Information exfiltration poses a severe risk for organizations coping with confidential or proprietary data. For instance, in 2024, hackers executed a large-scale ransomware assault on Change Healthcare, a subsidiary of UnitedHealth Group. The assault compromised delicate knowledge—together with names, Social Safety numbers, and well being data—of greater than 129 million people, with a price to UnitedHealth Group of over $2.8 billion. Different notable latest knowledge leaks embody the software program firm Purple Hat’s inner GitLab, the U.S. federal courts case administration and digital case submitting system, and TransUnion’s Salesforce account.
Whereas there are lots of strategies of information exfiltration obtainable to adversaries, an often-overlooked route is by way of DNS. DNS, or Area Title System, is the protocol used to translate human-readable domains into IP addresses. Sometimes, DNS requests are handed from a consumer’s machine by a firewall to DNS servers, which return a vacation spot IP handle. Adversaries who’ve established a foothold on a consumer’s machine can reap the benefits of this course of to covertly encode knowledge within the DNS request and get well this knowledge on a DNS server they management. Whereas recognized malicious servers could be simply blocked by a firewall, it’s troublesome to pre-emptively block novel ones.
ML classifiers can defend from knowledge exfiltration over DNS to novel DNS servers. Such a classifier could be educated on labeled DNS requests to establish traits predictive of information exfiltration. To exfiltrate knowledge over DNS, adversaries encode knowledge in DNS requests despatched to adversary-controlled domains. To maximise the quantity of information despatched, these requests typically are lengthy and include a number of ranges of domains, similar to “123abc.3xf2z.instance.com.” Due to the distinctive traits of malicious DNS visitors, options similar to request size and variety of subdomains can be utilized to coach a classifier. Whereas a classifier educated on these options might carry out properly at first, what occurs when an adversary discovers their exfiltration makes an attempt are being thwarted?
Simulation Description
The dataset comprises benign DNS requests in addition to malicious DNS requests exfiltrating knowledge. Of the malicious requests, some have been unobfuscated—the DNS requests have been created with none try to cover the malicious exercise—and the remainder have been obfuscated. The obfuscation strategies embody shortening the DNS request size, lowering the entropy of the DNS request, and growing the time between subsequent requests. We sampled from these knowledge to create two datasets: a pre-drift dataset containing labeled benign and unobfuscated exfiltration DNS requests and a post-drift dataset containing benign and obfuscated exfiltration DNS requests. We educated a random forest classifier on a subset of the pre-drift dataset and calibrated an MD3 detector. We then sampled the rest of the pre-drift dataset, simulating 40 days of pre-drift knowledge, and sampled from the post-drift dataset, simulating 40 days of post-drift knowledge.
Outcomes
We first checked the random forest classifier’s efficiency on the pre-drift knowledge. It carried out very properly, precisely detecting practically all exfiltration makes an attempt (the dashed line in Determine 3, Panel A earlier than day 40).
Subsequent, we checked the classifier’s efficiency on the post-drift knowledge. The efficiency plummeted: exfiltration makes an attempt have been not detectable (dashed line Determine 3, Panel A after day 40).
We carried out an MD3 detector to check whether or not it may correctly detect the drift. The detector triggered a small variety of false positives earlier than drift started (the purple factors earlier than day 40 in Determine 3, Panel B) and instantly detected drift as soon as it occurred (the purple level at day 40 in Determine 3, Panel B).
The efficiency of the exfiltration detector assorted enormously when implementing a drift detector with retraining. Following the onset and detection of drift, the classifier was retrained and regained its excessive efficiency on the post-drift knowledge (see the stable line in Determine 3, Panel A, after day 40).

Determine 3: Case research outcomes demonstrating drift detection with retraining is efficient at sustaining classifier efficiency within the presence of drift.
This case research demonstrates that drift detectors accompanied with mannequin retraining could be an efficient option to preserve well-performing ML fashions in dynamic environments.
Deploying ML Options within the Presence of Change
ML-powered applied sciences are invaluable within the protection in opposition to cyber attackers. By studying patterns, ML fashions may also help defend in opposition to novel attackers. Nevertheless, ML cyber defenses are inclined to adversaries who modify their behaviors to imitate benign customers.
One option to safe ML fashions in opposition to drift is thru deployment monitoring. When drift is detected, an ML mannequin could be retrained on the brand new knowledge, updating the discovered patterns and enhancing mannequin efficiency. We discovered that MD3 is an efficient drift detection method for cyber knowledge as a result of it may be adopted for a spread of ML fashions, doesn’t require labeled knowledge, and isn’t useful resource intensive.

