Abstract
Hypoglycemia is a major barrier to safe diabetes management. Although deep learning has been widely applied to blood glucose (BG) prediction, most studies provide limited hypoglycemia forewarning and are trained on small type 1 diabetes cohorts with restricted generalizability. We developed MT-HypoNet, a multitask neural network for real-time BG prediction and hypoglycemia forewarning from continuous glucose monitoring data. To improve detection near the hypoglycemia boundary, we introduce a statistically guided soft-label strategy. MT-HypoNet was validated on a multicenter cohort of 1,662 patients with type 1 and type 2 diabetes and prospectively evaluated in 36 perioperative patients with type 2 diabetes. In internal validation, MT-HypoNet achieved an AUC of 0.946 (95% CI: 0.946-0.947) for hypoglycemia forewarning and an RMSE of 19.84 ± 4.92 mg/dL for BG prediction. It generalized well to external datasets and maintained high prospective performance (AUC 0.966; RMSE 16.62 ± 4.01 mg/dL), supporting proactive management and improved safety.