Manuscript Offprint

arXiv:2608.25846

Why ML-based cough models do not generalize: a systematic cross-dataset evaluation for tuberculosis screening

Wensi Zhang, Tomas Teijeiro, Jérôme Thevenot, David Atienza

Abstract

Cough acoustics are promising for non-invasive tuberculosis (TB) screening, yet whether machine learning (ML) models capture disease-related acoustics or artifacts of data collection remains unresolved. We evaluated the cross-dataset generalizability of classical ML and deep learning (DL) cough-based TB classifiers across three independent datasets. Despite moderate within-dataset performance (ROC-AUC up to 0.755±0.0560.755 \pm 0.056), both pipelines fail to generalize, with external performance frequently below 0.6, indicating a possible limitation of the data. We further observed audio representations are organized by recording device and dataset rather than TB status, predicted TB probability tracks country-level prevalence in CODA, and device mismatch degrades transfer while device-diverse training improves it. Additionally, a clinical-variable baseline generalizes more consistently (ROC-AUC 0.655–0.711), indicating acquisition-specific variability is a stronger driver of poor generalizability than population shift. High within-dataset performance is not enough. External validation is essential before cough-based TB models are clinically ready.

Keywords: Tuberculosis Screening, Cough Monitoring, Acoustic Epidemiology, Machine Learning, Domain Generalization, Model Generalization

Introduction

Acoustic epidemiology is an emerging field that investigates how sound can provide clinically and epidemiologically relevant information. In respiratory health, growing interest has focused on the automated detection and analysis of cough for diagnosis, monitoring, and surveillance. The COVID-19 pandemic accelerated research in this area, leading to the development of machine learning (ML) models based on cough, speech, and breathing sounds, as well as large public audio collections such as COUGHVID [1–3]. However, robust validation has remained difficult. Public datasets are still limited, and large-scale crowd-sourced or loosely controlled collections introduce unreliable labels, variable recording environments, heterogeneous devices, and uncontrolled comorbidities [1, 4, 5]. These factors create substantial domain shift and make it hard to determine whether a model has learned disease-related acoustics or artifacts of how the data were collected. This concern is not unique to cough. Across medical AI, models frequently achieve strong internal performance by exploiting spurious, acquisition-related “shortcuts” rather than disease signal [6–9].

Tuberculosis (TB) remains one of the world's leading infectious causes of death. In 2024, an estimated 10.7 million people developed TB and 1.23 million died [10,11][10, 11]. Confirmatory diagnosis typically requires sputum-based molecular or microbiological assays, often combined with chest imaging. These tools are difficult to deploy consistently in the low-resource settings that often carry the highest burden [12][12]. This has motivated strong interest in simple, scalable triage tools [13][13]. In this context, cough is of particular interest because it is both a common symptom of pulmonary TB and a main mechanism of transmission. A low-cost embedded device using cough could support screening, surveillance, and longitudinal monitoring [12][12].

Early TB-cough studies reported strong within-dataset results with area under the receiver operating characteristic curve (ROC-AUC) values around 0.95 for handcrafted features with classical classifiers [14, 15]. Later

Datasets

CODA

TBscreen

Zambia CIDRZ

Analyses

Cross-dataset generalization

Classical ML

CLAP audio

embedding;

time/frequency-

domain features.

Deep learning

Spectrogram input;

pretrained

backbones.

Bias analysis

Acquisition

bias in CODA

Predicted prob. vs.

country prevalence.

Device generalization

in Zambia

Single-device and multi-device

training and generalization.

Clinical-variable

baseline

Logistic regression; cross

dataset validation.

Key Findings

Poor cross-dataset transfer

AUC frequently drops below 0.6 across both

pipelines.

Device/location

shortcuts

Model associates site-

specific features with

disease prior.

Device gap limits

transfer

Cross-device ROC-AUC

drops; multi-device training

helps.

Clinical baseline

generalizes better

Poor cough-based model

transfer points more to

audio-specific variability

than population shift.

Implications and Prospectives

Rigorous validation

Always use external validation and stratified

analysis by device, site, and population.

Device characterization

Identify hardware properties suitable for

cough-based TB screening applications.

Device-diverse datasets

Balance device, site, and disease status by

design to avoid confounding.

Fig. 1: Overview of the study design. The study evaluates cross-dataset generalization of cough-based TB classifiers across three public datasets using classical ML and DL pipelines. Four major analyses are conducted: cross-dataset generalization, acquisition-related bias in CODA, device generalization in Zambia, and a clinical-variable baseline. Key findings and implications for future study design are also presented.

studies explored more complex modeling strategies, including recurrent neural networks and attention-based architectures, with several reporting accuracies greater than 85% or ROC-AUC values greater than 0.85 [16–19]. However, evaluation was done almost always on small and private data under within-dataset validation. The release of large, structured TB-cough resources, such as the CODA dataset [20], the TBscreen dataset [21], and the Zambia CIDRZ dataset [22], now makes it possible to answer the question: does a model trained on one dataset retain performance on an independent dataset collected elsewhere?

Evidence that generalization of TB-cough models is challenging is already emerging. When the CODA TB DREAM Challenge models were validated on an independent Peruvian cohort collected under a closely matched protocol, ROC-AUC fell from 0.689–0.743 internally to 0.480–0.615 externally [23]. However, the cause of this decline was not further investigated. More broadly, cross-dataset evaluation in this field remains rare and methodologically inconsistent [24, 25]. Known pitfalls, for example within-dataset-only validation, information leakage without subject-level splitting, and disease status confounded with site, device, or recruitment, are acute [19, 20].

Here we present a systematic cross-dataset evaluation of cough-based TB classifiers across the CODA, TBscreen, and Zambia datasets (Fig. 1) using both a classical ML and a deep learning (DL) pipeline. We complement this with an analysis of location- and device-related bias in the CODA dataset, a device-generalization study in the Zambia dataset, and a clinical-variable baseline. Our analysis yields four main messages.

  1. Moderate within-dataset performance does not transfer: cross-dataset ROC-AUC frequently drops below 0.6 for both pipelines, which reflects difference in data domains rather than the modeling approach.

  2. Models exploit acquisition shortcuts: audio representations are organized more strongly by device and dataset than by TB status and predicted TB probability tracks country-level prevalence in CODA.

  3. Recording-device mismatch directly degrades transfer, whereas device-diverse training improves robustness to unseen hardware.

  4. A simple clinical-variable model generalizes more consistently, pointing to audio-specific acquisition variability as a primary driver of poor transfer rather than population differences alone.

Together, these results show that strong within-dataset performance should not be interpreted as evidence of clinical readiness.

Figure

(a) Classical ML pipeline

Figure

(b) DL pipeline

Figure

(c) Clinical-variable baseline

Fig. 2: Cross-dataset performance of the acoustic pipelines and the clinical-variable baseline. For each source dataset, the model configuration was selected using within-dataset validation and then evaluated on all target datasets. Values show subject-level ROC-AUC, with variability reported across outer folds. Across both acoustic pipelines, within-dataset performance did not translate into consistent external generalization, and the selected configuration differed by source dataset. In contrast, the clinical-variable baseline showed more stable external generalization across datasets.