The escalating prevalence of undiagnosed prediabetes and type 2 diabetes presents a significant barrier to effective public health intervention1,2. Beyond its role as a precursor to diabetes, prediabetes independently increases the risk of cardiovascular disease and all-cause mortality3, which makes early identification of both conditions urgent. To address the need for accessible, non-invasive risk stratification, we previously developed the Machineborne Early Diabetic Warning And Control System (MEDWACS)4. This machine learning tool utilizes seven easily measurable, non-invasive physical, hemodynamic, and anthropometric parameters, including waist circumference, limb lengths, and blood pressure, to predict the likelihood of prevalent dysglycemia with high discrimination and calibration accuracy. To maximize usability and facilitate home-based self-assessment, MEDWACS was intentionally designed to be parsimonious, excluding complex parameters such as dietary history.

However, poor diet quality is an upstream driver of metabolic dysfunction and a modifiable determinant of type 2 diabetes risk. Self-reported high intakes of fruits, vegetables, and whole grains have been associated with lower risk, whereas high intakes of red and processed meats, and sugar-sweetened beverages have been associated with increased risk5,6. By excluding dietary data, the current model relies on physiological evidence that anthropometric markers act as downstream integrators of long-term nutritional habits4. Waist circumference and body mass index reflect the cumulative balance of energy intake and expenditure over time7, while limb measurements such as leg length are established markers of nutritional status during childhood and adolescence8. It remains an open question whether this exclusion compromises screening accuracy, or if the anthropometric and demographic profile effectively encodes the metabolic history relevant for detection.

In this study, we used 20 years of National Health and Nutrition Examination Survey (NHANES) data to test this assumption. We investigated whether integrating the Healthy Eating Index 2020 (HEI), the federally established metric for quantifying adherence to the Dietary Guidelines for Americans, provides additional predictive utility over the existing anthropometric framework4,9. Specifically, we assessed if aggregated data on diet quality (e.g., sodium, saturated fat, and fruit intake) could enhance the predictive performance of digital screening tools, or if routine anthropometric and clinical measurements render such dietary data unnecessary for the purpose of identifying prevalent disease.

We analyzed data from 22,839 adult participants in the NHANES 1999–2018. The median age was 46.0 years (interquartile range, IQR 31.0–63.0), and 51.0% (n = 11,637) were female. The median body mass index (BMI) was 27.5 kg/m2 (24.0–31.9). The median Total HEI score was 49.6 (41.7–58.5) out of 100. Baseline characteristics, including all 13 HEI component scores, are shown in Table 1. Baseline characteristics stratified by sex are presented in Supplementary Table S1. As expected, males and females differed significantly (p < 0.001) across all anthropometric parameters, systolic blood pressure, the Total HEI score, total energy intake, and outcome prevalence (61.1% in males vs. 47.6% in females). Among the 13 individual HEI components, eight differed significantly at p < 0.001, two more reached significance at p < 0.05 (Seafood/Plant Proteins, p = 0.011; Saturated Fats, p = 0.029), and three were not significantly different between sexes (Sodium, p = 0.32; Added Sugars, p = 0.097; Refined Grains, p = 0.22). The correlation matrix (Supplementary Fig. S1) showed generally low correlations among HEI components, with expected high correlations observed between Total Fruits and Whole Fruits (0.789), and between Saturated Fats and Fatty Acids (0.598). The next highest moderate correlations were observed between Seafood/Plant Proteins and Greens/Beans (0.472), and Dairy and Fatty Acids (−0.469).

Table 1 Baseline characteristics of the study population, by train and test set split

The intakes underlying each HEI component score are quantified in Supplementary Table S2. Reported total energy intake was lower in participants with prediabetes or diabetes than in normoglycemic participants (median 1898 versus 1990 kcal/day; p < 0.001), as were absolute added sugars (53.8 versus 65.2 g/day; p < 0.001), whereas whole fruit intake was higher (0.28 versus 0.21 cup equivalents/day; p < 0.001). Absolute differences between outcome groups were small throughout.

The median fasting plasma glucose (FPG) was 99.0 mg/dL (91.0–108.8), and the median glycohemoglobin was 5.4% (5.2–5.8%). In total, 12,385 participants (54.2%) met the criteria for the composite outcome of prevalent prediabetes or diabetes, while 10,454 (45.8%) had normal results for both measures.

To determine if these dietary signals could enhance prediction, we applied the Boruta feature selection algorithm to the 13 HEI components. Boruta confirmed 11 components as statistically relevant, rejecting HEI-Saturated Fats and HEI-Greens and Beans (Supplementary Fig. S2). This selection was sensitive to sample composition. Across 50 reruns using freshly drawn training partitions of identical size, the number of components confirmed ranged from 9 to 13 (median 11), and the exact set of 11 components confirmed in the primary analysis was reproduced in only 3 of 50 reruns (6.0%; Supplementary Fig. S3). HEI-Added Sugars and HEI-Dairy were identified as the strongest dietary predictors, followed by HEI-Sodium and HEI-Whole Fruits. A subsequent learning curve analysis (Supplementary Fig. S4) revealed a flat trajectory, demonstrating that sequentially adding these Boruta-confirmed dietary features to the base anthropometric model yielded no measurable incremental improvement in discrimination. When features were instead selected at random rather than by Boruta importance, drawing three independent subsets at each of eleven subset sizes (33 models in total), cross-validated discrimination remained equally flat, ranging from 0.7947 to 0.7969 across all randomly selected subsets, closely matching the 0.7960 to 0.7974 range of the importance-ordered curve (Supplementary Fig. S5). Consequently, to test the predictive limits of diet quality, we defined a “Base + Boruta-Selected HEI Components” model incorporating all 11 confirmed HEI parameters alongside the base anthropometric parameters.

We compared four neural network models to assess clinical utility (Fig. 1 and Table 2). The Base MEDWACS model (7 parameters) achieved robust discrimination with an area under the receiver operating characteristic curve (ROCAUC) of 0.797 (95% CI 0.787–0.807). Integrating the HEI Total Score yielded no statistically significant improvement (ROCAUC 0.797 [0.787–0.808]; p = 0.243, DeLong’s test). Similarly, the Base + Boruta-Selected HEI Components model provided no statistically significant additional benefit, yielding an identical ROCAUC of 0.797 (0.787–0.808; p = 0.513). By contrast, the HEI Components Only model, which relied exclusively on diet quality without anthropometric data, performed poorly with an ROCAUC of 0.589 (0.577–0.603). Calibration remained strong across all models that included anthropometrics (Fig. 1B). No evidence of miscalibration in any of the four models was found (all p ≥ 0.146 by Spiegelhalter’s z-test and all p ≥ 0.170 by the Hosmer–Lemeshow C statistic; Table 2). However, the HEI Components Only model exhibited a limited calibration range, failing entirely to predict probabilities at the lower and upper extremes. Its predicted probabilities spanned only 0.227 to 0.759, so it satisfied the calibration tests while assigning nearly every participant a risk close to the population prevalence of 54.2%. These performance patterns were consistent during cross-validation (Supplementary Table S3). The details of the hyperparameters’ tuning are available in Supplementary Table S4.

Fig. 1: Comparative discrimination and calibration performance of screening models.

The base MEDWACS model and its two HEI-enhanced versions have similar performance, while the HEI components-only model performs worse. Their ROC AUC and precision-recall AUC scores are approximately 80 to 81 percent, compared with 59 and 61 percent for HEI components only. One minus the Brier score is approximately 82 percent for the three base models and 76 percent for HEI components only. Calibration curves plot observed against predicted probabilities. All four models generally follow the ideal calibration line, although the HEI components-only curve fluctuates more at lower probabilities.

A Violin plots displaying the distribution of performance metrics across 1000 bootstrap resamples. The width of the violin represents the density of the results. All box plots within the violins comprise the median line, the box indicates the interquartile range (IQR), whiskers denote the rest of the data distribution, and outliers are denoted by points greater than ±1.5 × IQR. B Calibration curves comparing predicted probabilities (x-axis) against observed probabilities (y-axis). The dotted diagonal line represents perfect calibration. The HEI Components Only model (dark red) shows limited calibration range, failing to predict probabilities at the lower and upper extremes. ROCAUC Area Under the Receiver Operating Characteristic Curve, PRAUC Area Under the Precision-Recall Curve, MEDWACS Machineborne Early Diabetic Warning And Control System, HEI Healthy Eating Index.

Table 2 Discrimination and calibration performance of the screening models

Interpretability analysis using SHapley Additive exPlanations (SHAP) values (Fig. 2) revealed how individual feature values shift the model’s predicted risk of dysglycemia, highlighting a contrast between feature importance and global model performance10. In the Base + Boruta-Selected HEI Components model (Fig. 2C), HEI-Added Sugars emerged as the highest-ranking dietary predictor. Multiple dietary components, including Added Sugars, Total Fruits, Refined Grains, and Sodium, surpassed body mass index (BMI) in predictive importance. However, the directionality of these self-reported dietary features was counterintuitive: higher HEI-Added Sugars scores (indicating lower sugar intake) were associated with increased predicted risk.

Fig. 2: Interpretability analysis using SHapley Additive exPlanations (SHAP).

Four SHAP plots compare how features contribute to prediction probability. In panels A through C, age and waist circumference have the widest ranges of influence: higher values generally increase the prediction, while lower values decrease it. Higher upper leg length generally decreases the prediction. Gender also has a substantial influence, but its categories are not identified. Blood pressure, arm circumference, body mass index, and dietary measures generally have smaller effects. Panel D compares dietary measures alone. HEI added sugars and whole fruits have the widest ranges, with higher values generally increasing the prediction. Higher HEI dairy and total fruits values generally decrease it.

Summary plots illustrating the impact of feature values on model predictions for (A) Base MEDWACS (7 parameters), (B) Base + HEI Total Score, (C) Base + Boruta-Selected HEI Components, and (D) HEI Components Only (11 parameters selected by Boruta). Each dot represents a single participant. The color indicates the feature value (red = high, blue = low). The x-axis position indicates the SHAP value; positive values indicate an increased probability of prevalent prediabetes or diabetes, while negative values indicate a decreased probability. MEDWACS Machineborne Early Diabetic Warning And Control System, HEI Healthy Eating Index, BMI Body Mass Index.

This paradoxical pattern was amplified in the HEI Components Only model (Fig. 2D), where anthropometric data were excluded. Without physical measurements to anchor the predictions, HEI-Added Sugars became the single most important predictor overall, driving the risk predictions in a clinically counterintuitive direction. A similar association was observed for HEI-Whole Fruits. This could reflect reporting bias and reverse causality (e.g., individuals actively restricting sugar or eating more fruit following medical advice or weight gain)11. Adjusting for diabetes medication use and physical activity attenuated the association for HEI-Added Sugars and did not reveal any paradoxical association for HEI-Whole Fruits once anthropometric parameters were included (Supplementary Table S5).

We confirmed the stability of our findings across diverse subpopulations (Supplementary Table S6). When evaluating sex-specific performance on the test set, the Base MEDWACS model achieved an ROCAUC of 0.811 (95% CI 0.797–0.825) in females (n = 3522) and 0.765 (0.749–0.781) in males (n = 3329). Incorporating dietary quality scores yielded no statistically significant improvement in discrimination for either females (ROCAUC 0.811 [0.797–0.825]; p = 0.960, DeLong’s test) or males (ROCAUC 0.766 [0.749–0.783]; p = 0.409, DeLong’s test). Stratifying by survey era similarly showed no evidence of effect modification. The null HEI finding held in both the earlier half of the study period (1999–2008; ROCAUC 0.800 [95% CI 0.784–0.815] for Base MEDWACS vs. 0.799 [0.784–0.814] for Base + Boruta-Selected HEI Components; DeLong’s p = 0.481) and the later half (2009–2018; 0.788 [0.773–0.802] vs. 0.788 [0.772–0.802]; p = 0.999), despite dysglycemia prevalence rising from 46.1% to 61.8% between the two periods. Across all other subgroups, performance remained robust when stratified by age, ethnicity, and socioeconomic status. Discrimination and calibration diverged across age strata. Participants aged 65 years and over showed a lower ROCAUC (0.679 [95% CI 0.646–0.711]) but a higher PRAUC (0.872 [0.849–0.894]) and higher calibration (0.841 [0.830–0.852]) than those below 65 years (0.785 [0.774–0.797], 0.762 [0.745–0.779] and 0.811 [0.806–0.816], respectively). This reflects the higher dysglycemia prevalence in this age group (78.1% versus 47.7%) rather than better model performance, because PRAUC and calibration each have a prevalence-dependent baseline that ROCAUC does not share (Supplementary Table S6). Measured against these baselines, the older stratum gained less than the younger one (PRAUC +0.091 versus +0.285; calibration +0.013 versus +0.061), while risk estimates remained accurate on the absolute scale in both strata (Spiegelhalter’s z-test p = 0.985 and p = 0.871). The same prevalence gradient explains the pattern by sex (61.9% dysglycemia in males versus 47.0% in females). The finding was also robust to heterogeneity in dietary recall methodology. Retraining both models exclusively on participants whose HEI was derived from a 2-day average yielded identical discrimination on the corresponding test set (n = 4931; ROCAUC 0.795 [0.783–0.807] for both; DeLong’s p = 0.928), and the null was reproduced separately within the single-day (p = 0.956) and 2-day (p = 0.994) recall strata. The finding was similarly robust to restricting the population to participants with no prior diagnosis of diabetes or prediabetes (NHANES DIQ010; n = 19,929 of 22,839, 87.3%), among whom dysglycemia prevalence remained 48.2%. Retraining both models on this subset reproduced the null result (ROCAUC 0.771 [95% CI 0.760–0.782] for Base + Boruta-Selected HEI Components versus 0.770 [0.758–0.782] for Base MEDWACS; DeLong’s p = 0.512), as did evaluating the original models restricted to the same subset (p = 0.823). Because HEI scores reflect diet quality (density per 1000 kcal), we also tested the inclusion of Total Energy (kcal) to capture absolute caloric load. When forced into the model, the ROCAUC remained unchanged at 0.797 (95% CI 0.787–0.808). Furthermore, SHAP analysis revealed a counterintuitive inverse association, where higher reported caloric intake contributed to a lower predicted probability of dysglycemia (Supplementary Fig. S6). A sensitivity analysis in the 2007–2018 cycles found that physical activity was associated with the outcome (Supplementary Table S7), but adding it to the model did not significantly improve discrimination (ROCAUC 0.790 [95% CI 0.776–0.804] for the Base MEDWACS model versus 0.789 [0.776–0.803] with physical activity added; p = 0.710, DeLong’s test), and the HEI components remained statistically non-contributory in its presence (p = 0.437). With the network architecture held fixed across models, all four models were statistically indistinguishable (ROCAUC 0.785 to 0.789).

In this study, we evaluated the predictive utility of integrating detailed diet quality metrics into a machine learning-based diabetes screening tool. Using a nationally representative dataset spanning 20 years, we found that while specific dietary components are statistically relevant predictors, their addition to the MEDWACS framework yielded no measurable clinical benefit in this cross-sectional screening model. The inclusion of Healthy Eating Index (HEI) scores resulted in no measurable improvement in discrimination performance (ROCAUC 0.797 vs. 0.797). This finding reinforces the robustness of the original 7-parameter anthropometric model and suggests that for the specific purpose of screening for prevalent dysglycemia, these aggregated dietary quality features add little value once anthropometric data are considered.

Our analysis revealed that the addition of aggregated dietary features provided no statistically or clinically significant improvement over the base anthropometric model. This lack of clinical performance gain, despite the biological relevance of diet to diabetes etiology, likely reflects the nature of anthropometrics as downstream integrators of metabolic history. Parameters such as waist circumference, upper leg length, and arm circumference physically encode the cumulative effects of long-term nutritional habits7,12,13. Consequently, the physical phenotype is a robust marker of prevalent disease. Furthermore, this aligns with previous epidemiological analyses demonstrating no substantial or consistent differences in self-reported macronutrient and micronutrient intake between US adults with and without diabetes14. This apparent homogeneity in self-reported dietary patterns suggests that such aggregated data may lack the discriminative variance necessary to effectively classify dysglycemia status in population-scale machine learning models14.

This lack of a robust biological signal is further evidenced by the instability of feature selection. Repeating Boruta selection across 50 freshly drawn training partitions of identical size reproduced the exact primary set of 11 confirmed components in only 6.0% of reruns, and HEI-Total Vegetables, confirmed in the primary analysis, was confirmed in only 38% of reruns (Supplementary Fig. S3). This instability concentrated among components with substantial pairwise correlation (Pearson r = 0.60 between HEI-Fatty Acids and HEI-Saturated Fats, and r = 0.47 between HEI-Greens and Beans and HEI-Seafood and Plant Proteins), consistent with Boruta’s known sensitivity to collinearity, whereby importance is diluted between correlated predictors rather than reflecting a genuine loss of dietary signal. Consistent with this, replacing the importance-based feature ordering with randomly selected feature subsets left the learning curve unchanged (Supplementary Fig. S5).

This interpretation is further supported by our SHAP analysis, which revealed an important distinction between feature importance and discriminative utility. In the Base + Boruta-Selected HEI Components model, HEI-Added Sugars ranked highly in importance, consistent with the model exploiting self-reported dietary patterns as a proxy for behavioral reverse causality, reporting bias, or general predictor instability, rather than as a measure of physiological nutritional benefit. However, this refinement resulted in no measurable AUC improvement. This indicates that while dietary data may help sharpen the calibration of risk, it rarely provides the orthogonal information necessary to reclassify a low-risk individual as high-risk, or vice versa, once the comprehensive anthropometric profile is known. Reverse causation, whereby subclinical dysglycemia prompts early dietary change rather than resulting from it, would align with this pattern: an attenuated dietary signal relative to the comparatively stable anthropometric profile, consistent with the limited utility we observed. However, restricting the population to participants with no prior diagnosis of diabetes or prediabetes, where post-diagnosis dietary change cannot operate, reproduced the same null HEI finding (DeLong’s p = 0.512), suggesting the limited dietary utility reflects weak and unstable predictors more generally rather than reverse causation specifically. To test whether this directionality reflected confounding by physical activity or post-diagnosis dietary change marked by diabetes medication use, we adjusted for each separately (Supplementary Table S5). The HEI-Added Sugars association was small, attenuated after adjustment, and reversed direction in the 2007–2018 subset, consistent with the broader instability of dietary associations documented elsewhere in this study. HEI-Whole Fruits showed no paradoxical association once anthropometric parameters were included at any stage, indicating the paradox was specific to the poorly discriminating HEI Components Only model (Fig. 2D, ROCAUC 0.589).

From a digital health perspective, these results support the design of low-friction screening tools. Dietary assessment via 24-h recalls or food frequency questionnaires is burdensome, time-consuming, and prone to significant reporting bias15,16. Physical activity itself, despite its association with the outcome (Supplementary Table S7), added no measurable discriminative value once the anthropometric profile was known, mirroring the result for diet quality and reinforcing that non-invasive physical measurements already capture much of the relevant risk signal. Furthermore, our subpopulation analyses demonstrated that this null finding held consistently across the evaluated US demographics. Despite substantial baseline differences in body composition and dysglycemia prevalence between males and females, the addition of dietary quality scores provided no statistically significant incremental discriminative gain in either sex (DeLong’s p = 0.960 for females; p = 0.409 for males). The lower ROCAUC in participants aged 65 years and over reflects the compressed range of predicted risk in a stratum where most people already have dysglycemia, not a change in model quality (Supplementary Table S6). Predicted risk remained accurate on the absolute scale across all age and sex strata, which is the property relevant to clinical use of a screening probability. The base non-linear neural network appears to accommodate sex-specific risk thresholds, producing accurate predictions across demographic and socioeconomic variations. These results suggest that non-invasive physical measurements alone can support screening that is simple, objective, and scalable. Such aggregated diet quality assessments may therefore be more valuable in the prevention and management phase than in detection, where they remain important for lifestyle intervention. Although our null finding indicates limited incremental value of diet quality for identifying prevalent dysglycemia in a cross-sectional screening model, it does not contradict the well-established causal role of dietary and lifestyle intervention in preventing incident type 2 diabetes, demonstrated in randomized trials in high-risk populations17,18,19,20,21, alongside the Diabetes Prevention Program (DPP)22. Physical activity showed the same pattern in our data: it was clearly associated with the outcome, consistent with prior evidence23. However, adding it to the model conferred no measurable incremental discriminative value once anthropometric data were known (Supplementary Table S7).

Our study is limited by the cross-sectional design of NHANES, which precludes causal inference24. However, this design is appropriate for our stated purpose: MEDWACS is intended to detect prevalent, currently undiagnosed dysglycemia at a single point in time, not to predict future disease onset, a use case for which cross-sectional data is well suited and consistent with established screening principles25. We also combined prediabetes and diabetes into a single composite outcome, consistent with our aim of identifying individuals requiring clinical attention regardless of diagnostic category26. This composite design does not allow us to determine whether dietary quality contributes differentially to the two conditions, whose clinical and biological drivers may differ. Furthermore, we did not stratify participants by preexisting non-diabetic medical conditions (e.g., cardiovascular disease or clinical obesity), which may independently trigger dietary modifications and exacerbate reverse causality. Future research could link NHANES data with follow-up Medicare or commercial claims data to ascertain the longitudinal onset of chronic diseases, effectively turning NHANES into a cohort study to evaluate causal relationships. Moreover, our physical activity analyses were necessarily restricted to the 2007–2018 cycles, because the NHANES physical activity questionnaire and its reference period changed in 2007, and rely on self-report rather than accelerometry. Antihypertensive medication use did not meaningfully affect model discrimination (ROCAUC 0.699 with medication versus 0.687 without; Supplementary Table S8). The null HEI finding also held for three additional diet quality indices (Alternate Mediterranean Diet [aMED] score, Dietary Approaches to Stop Hypertension [DASH] score, and Planetary Health Diet Index [PHDI] score), none of which meaningfully improved discrimination over the base anthropometric model (Supplementary Table S9). Additionally, the inherent subjectivity of self-reported dietary data remains a limitation. The degree of underreporting of dietary intake or overreporting of physical activity may also differ between participants with and without dysglycemia, which self-reported instruments cannot distinguish from a true behavioral difference. Although participants completed detailed assessments during the mobile examination center visits, these data are still subject to recall bias and misreporting. More objective measures, such as blood-based nutritional biomarkers, might circumvent these biases and offer higher discriminative validity. However, the requirement of venipuncture for such biomarkers conflicts with the premise of accessible, non-invasive digital screening. We also specifically evaluated adherence to recommended dietary guidelines (HEI scores) rather than absolute nutrient intake or granular consumption of individual food items (e.g., sugar-sweetened beverages). In the diet-only model, higher reported whole fruit intake was associated with an increased predicted risk, while total fruit intake was associated with decreased risk. Given the high correlation between these two variables (r = 0.789), this divergence likely illustrates the mathematical instability of highly collinear variables in machine learning models, possibly compounded by behavioral reverse causality. Finally, while we validated the model across diverse US subpopulations, we did not perform external validation on non-US cohorts in this specific dietary analysis. Nonetheless, prioritizing accessible anthropometric measures allows high-risk individuals to be identified quickly, without complex nutritional data collection. Furthermore, our findings suggest that observational studies inferring dietary predictors of dysglycemia should account for comprehensive anthropometric profiles to avoid reporting spurious, confounded associations. MEDWACS remains a parsimonious tool for identifying individuals with undiagnosed dysglycemia.