1. Introduction
The Internet of Medical Things (IoMT) extends wireless sensor network (WSN) and body-area-network technology into clinical settings, integrating connected medical devices (patient monitors, infusion pumps, wearable sensors, and imaging equipment) into hospital networks, and has become a primary surface through which cyber-attacks reach clinical care [
1,
2]. Because compromised medical-device telemetry can directly affect patient safety, network intrusion detection for the IoMT sensor subnet is an operational priority rather than a purely academic one.
IoMT and wearable-health systems increasingly rely on cloud-edge AI architectures that distribute intelligence across sensing devices, gateway nodes, and cloud services to balance responsiveness, communication cost, privacy, and scalability [
3]. Within this architecture, the line of work on resource-efficient inference shows that constrained edge devices benefit from lightweight deployment strategies such as model compression and quantization [
4] and edge-cloud partitioning of inference [
5]. Our detector sits at the gateway end of this spectrum: it is a 1206-parameter model (
KB, sub-millisecond inference per thousand flows;
Table 1) that runs entirely on-premises, so it inherits the latency, energy, and privacy advantages those strategies’ target without an offloading step. The footprint is at or below that of prior lightweight gateway-resident IoMT/IoT IDS such as Passban [
6], which we treat as the reference class for edge-deployable detection. Unlike general deployment-optimization studies, the present work focuses on whether such an on-gateway detector should be obtained by importing and adapting an external public-corpus model or by training a fresh local model, and on keeping it reliable under distribution drift.
The workflow targets resource-constrained IoMT gateways, where flow-level telemetry must be processed locally with a compact model, limited labeling, and no cross-institutional telemetry export [
6]. Machine learning network intrusion-detection systems (IDSs) for IoMT report within-corpus
on public benchmarks [
7,
8,
9], implicitly assuming that within-corpus performance predicts deployment performance. This assumption has not been measured systematically, because IoMT IDSs evaluation is, with few exceptions, single-corpus: a model is trained and tested on splits of the same capture, so the reported number reflects in-distribution generalization rather than the cross-environment generalization a real deployment demands.
A hospital deploying an IoMT IDS realistically chooses between two options: use a public-corpus pretrained model (possibly adapted with standard domain-adaptation tooling) or have the local IT team label a small batch of in-house flows and train a model from scratch. Intuition favors the first option: pretraining on hundreds of thousands of labeled flows ought to dominate hand-labeling fifty. However, if public IoMT corpora differ enough in capture methodology, attack taxonomy, and feature schema, a small from-scratch model trained on in-distribution labels may suffice, and the operational and regulatory cost of importing an external model may not be repaid by any accuracy gain. We measure this question across four public IDSs corpora-harmonized onto a common nine-feature flow schema, using cross-corpus shift as a publicly reproducible proxy for cross-hospital deployment shift. Three are sensor-network captures: WUSTL-EHMS-2020 [
7] and CIC-IoMT-2024 [
8] for medical IoMT, and TON-IoT [
10] for broader IoT/IIoT traffic. The fourth, CSE-CIC-IDS-2018 [
11], is an enterprise-network corpus from an unrelated capture that carries the audit beyond the medical domain and rules out any dependence on a single capture lineage. The gap between this cross-corpus proxy and true cross-hospital deployment is examined in
Section 9. We organize the study around three research questions:
RQ1. How large is the distribution shift across the evaluated corpus pairs, especially the primary WUSTL ↔ CIC IoMT pair? We measure it directly with the
H-divergence proxy [
12] and a kernel maximum mean discrepancy (MMD) [
13].
RQ2. To what extent do canonical cross-corpus adaptation methods recover target-domain under severe shift? We evaluate eight adaptation methods spanning labeled, unlabeled, and source-free regimes.
RQ3. How does direct local-supervised training, a tiny model trained from scratch on a small in-house labeling budget, compare with cross-corpus adaptation across target-label budgets N?
With the transfer question settled, we turn to deployment and characterize how the recommended workflow behaves under alternative model classes, feature masking, white-box evasion, targeted label poisoning, and competing drift triggers (
Section 7 and
Section 8).
Findings. (RQ1) The shift is essentially maximal on every pair: a domain classifier tells the corpora apart perfectly, and the
H-divergence proxy saturates while the kernel MMD stays consistently large (
Section 6). (RQ2) On the directions whose target is the medical-telemetry corpus, every unlabeled method (DANN, Deep CORAL, TENT, pseudo-labeling, and plain source-only transfer) stays below an
of
, consistent with the theoretical lower bound on marginal-alignment adaptation under conditional shift [
14]; easier directions retain partial utility. (RQ3) Once fine-tuning schedules are matched, source pretraining is statistically indistinguishable from training the same model from scratch on the local labels. In this severe-shift setting, training the tiny model from scratch on representative target labels provides the same practical benefit as importing and adapting an external source model.
This paper is a deployment audit of a constrained edge AI-agent workflow: the tiny model avoids dependence on source labels and source model weights, cross-institutional data sharing, and adaptation-pipeline complexity while matching the target-domain performance of more complex alternatives.
The novelty is not a new learning algorithm; the components (a small MLP, k-medoids selection, MMD drift detection, and detect-then-retrain looping) are individually standard. Three elements distinguish this work from prior human-in-the-loop and edge-AI IDS research. First, existing human-in-the-loop and active-learning IDS studies assume a single corpus and ask how few labels recover within-corpus accuracy; we instead measure the deployment decision itself, quantifying when a small local labeling round is preferable to importing and adapting an external model under measured cross-environment shift. Second, prior edge-AI IDS work optimizes the on-device model in isolation; we tie the model to a closed loop in which a calibrated, label-free drift trigger decides when the human-in-the-loop step is re-invoked, and we validate that loop end-to-end on drifting streams against standard drift detectors. Third, we connect the empirical outcome to domain-adaptation theory, showing that the measured separability drives the transfer bound to a vacuous value, which explains rather than merely reports the negative transfer result. The contribution is therefore this audit, the closed-loop workflow, and the theoretical framing, not a new adaptation mechanism. The contributions of this paper are as follows:
A reproducible cross-corpus deployment audit for lightweight IDS over four public corpora that span medical IoMT (WUSTL-EHMS-2020 [
7], CIC-IoMT-2024 [
8]), general IoT/IIoT (TON-IoT [
10]), and enterprise networks (CSE-CIC-IDS-2018 [
11]), all harmonized onto a common nine-feature flow schema. Across the twelve ordered transfer directions, the measured shift sits near its theoretical maximum, and the negative-transfer pattern is uniform across medical and non-medical captures.
Evidence that standard cross-corpus transfer and adaptation methods do not reliably survive this shift: unlabeled domain adaptation (source-only, DANN, Deep CORAL, TENT, pseudo-labeling, and the recent source-free method SHOT) is unstable across directions and collapses on WUSTL-target settings, while source pretraining followed by matched-schedule fine-tuning gives no measurable advantage over from-scratch target training. Every primary comparison is backed by paired, multiplicity-corrected tests over fifteen runs and a hyperparameter-fairness ablation.
A theoretical interpretation of the empirical collapse: the measured domain separability drives the domain-adaptation target-error bound to a vacuous value, which explains why marginal-alignment methods have little room to recover target-domain accuracy under the observed conditional shift.
A constrained human-in-the-loop edge-agent workflow for IoMT IDS deployment, in which the agent observes recent local flows, summarizes them with k-medoids, requests analyst labels for representative medoids, trains a 1206-parameter classifier on-premises, monitors drift, and triggers retraining while keeping labeling authority with the human analyst.
A deployment-validation study of that workflow (architecture and feature ablations, analyst label-noise tolerance, targeted label poisoning, white-box evasion, and a comparison of drift triggers in closed loop on simulated drifting streams) that identifies the operating conditions under which the compact local model remains reliable and those under which the deployed agent remains vulnerable.
The remainder of this paper is organized as follows.
Section 2 reviews single-corpus IoMT IDS evaluation, cross-dataset generalization, and domain-adaptation theory.
Section 3 defines the constrained edge AI-agent deployment model, and
Section 4 states the threat model and deployment scenario.
Section 5 describes the corpora, harmonization, architecture, and statistical protocol.
Section 6 quantifies the cross-corpus shift and interprets it through the domain-adaptation target-error bound.
Section 7 reports the empirical results—the primary six-direction audit, budget curves, the full twelve-direction matrix over the four corpora, operational precision/recall trade-offs, architecture and feature ablations, active labeling, analyst label-noise tolerance, and adversarial robustness.
Section 8 assembles the findings into the drift-aware agent workflow and compares drift-trigger alternatives in closed loop on simulated drifting streams.
Section 9 discusses implications and limitations,
Section 10 outlines future work, and
Section 11 concludes.
3. AI Agent Deployment Model
We model the deployed IDS as a constrained human-in-the-loop edge AI agent operating at the hospital IoMT gateway. The agent is constrained because it does not independently assign ground-truth security labels or autonomously change the hospital security policy. Instead, it automates four bounded functions: observing recent flow-level traffic, selecting representative flows for analyst labeling, training a compact local classifier, and monitoring post-deployment drift.
This framing separates automation from authority. The agent summarizes traffic, recommends which flows should be labeled, trains and deploys a tiny IDS model, and triggers a retraining request when drift is detected. The analyst, however, remains responsible for security-critical labeling decisions. This design is appropriate for smart-health environments, where medical-device telemetry is sensitive, cross-institutional data sharing is restricted, and fully autonomous adaptation may introduce unsafe model updates. The agent therefore occupies a middle ground between fully manual IDS maintenance, which scales poorly, and fully autonomous adaptation, which removes the human oversight that security-critical and safety-critical clinical environments require.
6. Measuring Cross-Corpus Shift
We characterize the gap between corpora with three measurements. First, a Random Forest trained to predict “which corpus did this row come from” on the harmonized nine-feature schema reaches
accuracy on every pair. Equivalently, the
H-divergence proxy [
12], defined as
for domain-classifier error rate
, saturates at
on every pair. Second, a quadratic-time kernel MMD [
13] computed between 1500-row subsamples of source and target standardized features ranges over
across the primary sensor-network pairs (
for WUSTL ↔ CIC,
for WUSTL ↔ TON-IoT, and
for CIC ↔ TON-IoT; the theoretical ceiling on the unit ball is
), and the per-direction divergence for the complete four-corpus matrix is reported with the twelve-direction results in
Section 7.4. We report the square-rooted unbiased kernel MMD estimate using an RBF kernel with median-heuristic bandwidth. Combined with the qualitative differences in attacks, threat models, and capture tools, these measurements place the evaluation in the severe-shift regime on every pair, and—through the
H-divergence bound [
12]—predict that marginal-alignment adaptation has little headroom.
6.1. Theoretical Interpretation via the Target-Error Bound
The measured divergence has a direct consequence in domain-adaptation theory. The bound of Ben-David et al. [
12] states that for any hypothesis
h the target risk obeys
where
is the error of the best joint hypothesis and
is the symmetric-difference divergence. Treating the measured domain-classifier separability as an empirical proxy for the divergence term, the proxy saturates at
on every genuinely cross-corpus direction; the divergence contribution alone is therefore approximately
, so Equation (
1) reads
and is
vacuous for practical target-risk prediction: it already exceeds the trivial error ceiling of
. Unlabeled methods that align marginals (DANN, Deep CORAL, TENT) minimize
and attempt to shrink the divergence term, but when the two corpora are near-perfectly separable in the harmonized space that term offers little purchase, and the conditional shift in attack semantics is absorbed into
, which marginal alignment alone cannot be relied on to reduce. This is exactly the regime our empirical collapse occupies. Direct local-supervised training sidesteps Equation (
1) altogether: by minimizing an empirical estimate of
on a small target-labeled sample it optimizes the quantity that the transfer bound can only loosely cap. This explains why, under the measured severe shift, a small target-labeled sample can outperform unlabeled source alignment.
6.2. Feature-Information Loss Versus Domain Shift
Mapping four native schemas onto a common nine-feature space discards information, so a fair reading of the transfer collapse must separate two distinct effects: the accuracy lost by
compressing the feature space (feature-information loss) and the accuracy lost by
moving between corpora (domain shift). We isolate the first effect by measuring within-corpus
on the same corpus at three schema resolutions, holding the model and protocol fixed (
Table 5). On WUSTL, the corpus that loses the most features, within-corpus
falls from
on the full 30-feature native schema to
when the eight biometric columns are removed (22 flow-only features) and to
on the harmonized nine-feature schema. The harmonization step proper (from 22 flow features to 9) costs about one
point; the larger part of the
-point total comes from dropping the biometric columns, not from harmonization. On the other corpora, the harmonized within-corpus references stay high (
for CIC,
for CSE-IDS2018,
for TON-IoT), so the nine-feature interface is not the bottleneck.
The two effects differ by an order of magnitude. Feature compression costs at most about five points within a corpus, whereas moving to a different corpus on the same nine-feature schema costs 40 to 90 points (CIC → WUSTL source-only reaches ). The transfer collapse is therefore a property of the shift between corpora, not an artifact of the harmonized representation; a richer per-corpus schema could recover a few points of within-corpus accuracy but would not close the cross-corpus gap, and it would also break the cross-corpus comparability that the audit requires. This is why the audit bounds, rather than measures, the best achievable transfer.
8. Drift-Aware Human-in-the-Loop Agent Workflow
The empirical results translate into a concrete drift-aware agent loop (
Figure 9 and Algorithm 1), an instance of the detect-then-retrain pattern from the concept-drift literature [
27,
28] placed at the IoMT gateway. The agent collects a recent-traffic sample (
K rows), clusters the standardized features with
k-medoids at
so that each medoid is a representative flow, and asks the IT analyst to label those medoids. In deployment, the analyst would label each selected medoid from its flow metadata, alert context, device identity, and available local logs; the public-corpus experiments approximate this step with oracle labels, and
Section 7.9 bounds the cost of analyst error through controlled noise injection. At 30 s per flow, 10 labels take roughly five minutes and 50 labels roughly 25 min; at 60 s per flow, the same budgets take ten and fifty minutes. The agent then trains the 1206-parameter MLP from scratch on those labels (
s on CPU;
Table 3 reports the stratified analysis-grid result and
Section 7.8 the deployed
k-medoids selection result at
), deploys the local IDS on the on-premises gateway (
Table 1), and monitors drift on incoming traffic via a moving-window MMD on the harmonized features, retraining weekly or monthly or whenever drift exceeds a calibrated threshold. The procedure needs no cross-institutional data sharing; because labels and telemetry stay on-premises, it reduces the need to export medical-device telemetry to third parties and thereby lowers privacy and governance exposure under regimes such as HIPAA and GDPR Article 9.
8.1. Closed-Loop Validation of the Drift Trigger
The loop in Algorithm 1 is only useful if the MMD trigger actually fires when the traffic distribution moves and stays quiet when it does not. We validate the loop end-to-end on simulated gateway streams with injected drift. Each stream consists of 40 windows of 500 flows; window t is an i.i.d. draw from the mixture of two corpora on the harmonized schema, with for the first 20 windows and then either an abrupt jump to 1 or a linear ramp over 10 windows. Cross-corpus substitution is the same severe-shift proxy used throughout the paper, so these streams represent a worst-case distribution change. The agent is deployed exactly as in Algorithm 1: it bootstraps from medoid labels on initial traffic, computes a moving-window MMD (fixed median-heuristic bandwidth) between each incoming window and the training-time reference, and retrains from scratch on 50 fresh medoid labels whenever the statistic exceeds , where is the q-quantile of a null distribution obtained from disjoint random splits of the reference window. A static agent (identical initial model, no retraining) runs on the same stream as the comparison. We use 5 seeds per configuration and sweep .
Figure 10 shows the gradual-drift traces at the
operating point, and
Table 9 reports the threshold sweep. Three observations summarize the outcome. First, detection is fast and specific: at
, the trigger fires within at most two windows of drift onset (at most 1000 flows) on every gradual stream and immediately on every abrupt stream, with
zero false triggers across the 200 stationary gradual windows and 3 across the 200 stationary abrupt windows (
of the 400 stationary windows overall). Second, retraining restores the local reference level: on CIC-drifts-to-WUSTL, where the static agent collapses to
, the monitored agent recovers to
(
abrupt), the within-corpus level achievable from 50 medoid labels on WUSTL (
Section 7.8), and on WUSTL-drifts-to-CIC it reaches
versus
–
for the static agent. Third, the threshold controls a sensible tradeoff: lowering
q to
gains at most one window of earlier detection but doubles the false-trigger count, and each unnecessary trigger costs one 50-label analyst round;
balances the two. Gradual drift naturally produces
retrains as the mixture keeps moving away from each new reference (roughly one labeling round per ramp stage, about 25 analyst-minutes each at 30 s per flow), while abrupt drift settles after 1–2.
8.2. Justification of the MMD Drift Trigger
The trigger uses a moving-window MMD;
Table 10 asks whether that choice is justified against four standard concept-drift detectors on identical WUSTL ↔ CIC streams (gradual and abrupt profiles, five seeds), all observing the same non-adapting deployed model so that the comparison isolates detector quality. The two distribution-based detectors that watch the covariate stream directly—the MMD trigger and a per-feature Kolmogorov–Smirnov test, both null-calibrated at
—detect drift within half a window on average, with zero false alarms in the stationary prefix and
detection. The error-based detectors are uniformly worse: DDM [
35] fires constantly on the fluctuating per-flow error signal (32 false alarms per stream), while Page–Hinkley [
36] and ADWIN [
37] are slower (
and
windows) and miss 20–
of drift episodes, because a rise in label-error must accumulate before it is visible, and at test time the labels needed to compute that error are exactly what the gateway lacks. Watching the input distribution rather than the unavailable error is therefore the right signal for an unsupervised retraining trigger; MMD matches the simpler KS statistic on this binary task while extending naturally to the full multivariate feature vector and to higher-order shift that per-feature tests miss.
9. Discussion
The contribution is a deployment audit of a constrained edge AI agent showing that modest human feedback can outperform or match cross-corpus adaptation under severe shift. Practically, the results favor labeling a small representative sample of recent local traffic and training the compact model on-premises, rather than deploying a public-corpus IDS as-is or adding an adaptation pipeline whose matched-schedule benefit is negligible. The near-saturated single-corpus values reported throughout the IoMT IDS literature should be read as within-corpus references, not as predictions of cross-environment performance. The negative transfer result follows from conditional shift between corpora that differ in attack semantics and capture methodology, the regime in which marginal-alignment adaptation is fundamentally limited.
9.1. Validity and Scope of the Cross-Corpus Proxy
The audit uses cross-corpus shift as a stand-in for cross-hospital deployment shift, and the two are not identical. Public corpora differ in collection environment, attack taxonomy, and feature-construction toolchain, while two hospitals running similar equipment may differ far less. The most likely direction of the mismatch is that the cross-corpus proxy over-states the shift a typical hospital pair would see, because different capture pipelines and attack catalogs are more dissimilar than two deployments of the same clinical technology. Read that way, the proxy is a conservative, near-worst-case setting for the transfer question. Where local labeling already matches or beats transfer under maximal separability, it should remain competitive under the milder shift of two similar hospitals. Where a target instead resembles an available public corpus closely, transfer may do better, and the drift monitor is what flags the in-between case. The proxy is therefore informative about the deployment decision (label locally versus import and adapt) rather than a numerical predictor of any specific hospital’s . Its applicable scope is the common situation in which the target environment is not known in advance to match a public corpus; it does not cover the case where a vendor has a corpus drawn from the same device population as the target, which would warrant a direct transfer test.
The simulated drift streams inherit this proxy character. Cross-corpus substitution is a strong, fast distribution change, whereas real IoMT drift is usually slower and subtler: firmware and device-population turnover, shifting clinical workflows, and gradually evolving attacks rather than a wholesale corpus swap. The reported detection delays are therefore a best case for signal strength. What does carry over is the threshold calibration, which is distribution-free (the trigger fires on a null quantile estimated from the reference window itself), so the false-alarm control transfers even though sensitivity to gentler drift is not established here. Stressing the trigger on subtler profiles is left to future work.
9.2. Scalability to Larger and Heterogeneous IoMT Deployments
The workflow scales by replication rather than by growing a single model. Each gateway trains and monitors its own 1206-parameter detector on its own traffic, so a larger or more heterogeneous deployment adds independent per-gateway instances rather than a centralized model that must fit every device population at once. The per-gateway cost is fixed and small: a analyst-labeling round (about 5 to 25 min), sub-second CPU training, and a moving-window MMD computed on fixed-size windows and subsamples, so its per-window cost is bounded regardless of the total traffic volume. Heterogeneity is handled locally: each instance learns the distribution of the subnet it sits on, and the drift monitor triggers a fresh local round when that subnet changes. This avoids asking one model to generalize across heterogeneous subnets, which is precisely the cross-environment transfer that this paper shows is unreliable. The main coordination cost of scale is human: more gateways mean more occasional labeling rounds, which the calibrated trigger is designed to keep infrequent. Sharing labeling effort across similar gateways, and federating the local models without exporting raw telemetry, are natural extensions for very large estates and are noted in future work.
9.3. Limitations
Six limitations bound the claims. (i) Cross-corpus shift between public datasets is a reproducible
proxy for cross-hospital deployment, not a substitute; no public corpus pairs two captures from two distinct hospitals, so the hospital-to-hospital shift magnitude is unmeasured.
Section 9.1 discusses the validity and scope of this proxy and the related drift realism. (ii) The harmonized nine-feature schema discards dataset-specific information; richer per-corpus features may close part of the gap, and the audit therefore bounds rather than measures the best achievable transfer. (iii) The adversarial analysis (
Section 7.11) covers white-box evasion and targeted label-suppression on the deployed model, but we do not model a fully adaptive adversary that co-evolves with the agent across repeated retraining rounds, nor a black-box query-limited attacker. (iv) Analyst labels may be noisy in real deployments;
Section 7.9 bounds the cost of
symmetric noise (about five
points at a
error rate with
) and
Section 7.11 quantifies the worst case of attack-label suppression, but other structured mislabeling patterns (an analyst systematically deceived about a particular attack family) remain unmeasured. (v) Public IDS datasets differ from live hospital telemetry in device populations, capture pipelines, and operational drift profiles, so absolute
values are within-corpus references rather than direct estimates of production performance. (vi) The study targets binary attack/benign detection. Real hospital deployments ultimately need finer-grained attack categorization and response-oriented actions (isolating a device, escalating an alert, applying a playbook), which a binary detector does not provide on its own. We scope the detector as the first-stage gateway triage layer that decides whether a flow warrants attention, feeding a second-stage classifier or analyst workflow for attribution and response. Binary scope also avoids the invalid multiclass label mappings that arise across corpora with incompatible attack taxonomies, which is what makes the cross-corpus audit well defined. Extending the local-supervised step to multi-class attack-family attribution, where the same harmonized features and labeling budget would have to support more classes, is future work.
11. Conclusions
We presented a drift-aware human-in-the-loop edge AI agent for IoMT intrusion detection and audited its deployment behavior under cross-corpus shift as a reproducible proxy for cross-hospital deployment. Across all four corpora, spanning medical IoMT (WUSTL-EHMS-2020, CIC-IoMT-2024), general IoT/IIoT (TON-IoT), and enterprise traffic (CSE-CIC-IDS-2018), the harmonized feature distributions are highly distinguishable, and the negative-transfer pattern is the same in the medical and non-medical directions alike. Over all twelve transfer directions, unlabeled adaptation is unstable and source pretraining provides no measurable advantage over from-scratch training once the fine-tuning schedule is matched; a domain-adaptation error bound, driven vacuous by the measured separability, anticipates this behavior. The agent automates traffic summarization, representative-flow selection, lightweight local training, inference, and drift monitoring while preserving human control over labeling. The tiny 1206-parameter model is supported by architecture and feature ablations: larger or classical alternatives do not materially improve the deployment tradeoff, and no single harmonized feature dominates the decision rule. Robustness tests also delimit the approach: the local model absorbs realistic (≤10%) symmetric analyst error at a cost of a few points, but targeted malicious-to-benign label suppression and white-box feature-space evasion remain meaningful threats, so protecting the labeling channel and the model internals is an operational requirement. Finally, the closed-loop evaluation and detector comparison show the calibrated MMD trigger gives fast, low-false-alarm retraining decisions under severe simulated drift, where error-based detectors lag or miss. Under the evaluated severe cross-corpus shift, the evidence favors labeling a small representative sample of recent local traffic and training a compact model on-premises, rather than deploying a public-corpus IDS as-is or relying on marginal-alignment adaptation.