- The paper introduces a two-stage framework that combines a conditional VQ-VAE with an autoregressive Transformer for class-controlled synthetic respiratory sound generation.
- Experimental evaluations reveal F1-score gains of up to 2.2 percentage points compared to traditional and other generative augmentation methods.
- The method enhances minority-class representation and classifier robustness by preserving critical spectral details and clinical consistency in noisy datasets.
C2GA: A Class-Controllable Generative Augmentation Framework for Respiratory Sound Classification
Introduction
Data scarcity, high noise, and severe class imbalance are persistent impediments in clinical respiratory sound classification. Traditional augmentation methods often destructively perturb discriminative biomedical cues in time-frequency representations, while prior generative augmentation approaches using VAE/GAN architectures lack sample fidelity and reliable class controllability, especially under low-data regimes. The C2GA framework directly addresses these challenges by introducing class-aware discrete latent representation learning and prototype-guided autoregressive generation. This combination establishes a robust and semantically faithful augmentation pipeline for downstream respiratory sound classification tasks.
Figure 1: Schematic overview of C2GA, depicting encoding of respiratory sounds as discrete tokens, followed by class-prototype conditioned generation of synthetic Mel-spectrograms for classifier training.
Methodology
Discrete Representation and Class Prototypes
Stage 1 employs a conditional VQ-VAE to quantize respiratory log-Mel spectrograms into discrete acoustic token sequences with label-dependent semantic encoding. Class supervision is injected into both tokenization and intermediate encoder skip connections, from which class prototypes are extracted via global pooling with EMA. This guarantees that the resulting codebook has explicit alignment with pulmonary pathology classes, overcoming the entanglement and semantic drift seen in unsupervised or class-agnostic generative models.
Stage 2 utilizes a decoder-only Transformer to autoregressively model the temporal structure of the token sequences. Generation begins from a class embedding and fuses local token semantics with broadcasted global class prototypes, enabling fine-grained and global class control over the generated Mel-spectrogram. During inference (augmentation), Top-p sampling is employed to generate diverse, label-consistent synthetic samples. This two-stage pipeline produces high-fidelity, class-discriminative synthetic data, augmenting minority-class representation and improving classifier robustness.
The VQ-VAE and Transformer prior are optimized using a composite loss: reconstruction (L1), perceptual, adversarial, and VQ-codebook commitment for the VQ-VAE; cross-entropy on token prediction for the Transformer prior. The class prototypes are continually updated via EMA over skip activations, ensuring stability and generalizability across clinical settings.
Experimental Results
Comparative Evaluation
C2GA achieves consistent improvements in classification accuracy, recall, and F1-score over state-of-the-art classical and generative augmentation methods, including conventional VAEs, GANs, and diffusion-based models.
- On two datasets, including a large-scale clinical binary set and a curated, noisy three-class subset of ICBHI, C2GA yields F1-score gains up to 2.2 percentage points, outperforming AudioLDM2 and AFT.
- Traditional signal enhancement and loss reweighting methods (DCRN, ESPnet-SE++, WBCE, Focal Loss) offer limited efficacy under pronounced imbalance and noise, as they fail to synthesize novel pathological patterns.
Numerical results strongly support the utility of combining discrete latent modeling with class conditioning for minor-class densification and majority bias mitigation.



Figure 2: Log-Mel spectrogram comparison for the wet rales class: original, traditional augmentation, GAN-based, and C2GA. C2GA maintains spectral detail and clinical consistency.
Network and Head Robustness
Experiments with multiple classifier backbones (CNN14, ResNet18) verify that C2GA provides architecture-invariant accuracy gains, with improvements robust to variations in the synthetic-to-real data ratio and synthetic loss weight. Results show up to +2.7 percentage points in accuracy for ResNet18 and +2.17 for CNN14 when using optimal synthetic mixing parameters.

Figure 3: ResNet18 loss curves under r=0.75, w=0.25; C2GA-augmented training demonstrates faster convergence and reduced variance relative to the real-only baseline.
Ablation Analysis
Removing any of the key components—Transformer prior, prototype fusion, or class conditioning—consistently ablates performance. The Transformer prior is critical for modeling temporal event structure (drop of >5pp in F1 upon removal), while class prototypes provide global context for local token fusion. Unsupervised VQ-VAE codebooks lack class discriminativeness, resulting in token collapse and poor augmentation for minority classes.
Figure 4: Empirical analysis of cycle durations (Tmax=6s) demonstrates consistent standardization across subjects.
Qualitative Assessment
Synthetic Mel-spectrograms generated by C2GA demonstrate strong preservation of fine-grained spectral patterns and clinical events with high sample diversity. Visual comparison against real and baseline methods confirms that C2GA avoids the blurring and artifact generation prevalent in GAN and traditional augmentations.
Figure 5: Random example of test set and generated spectrograms across classes; C2GA-generated samples closely match the harmonic and transient structure of authentic respiratory events.
Confusion Matrix Improvements
C2GA expansion of the training set with class-controlled samples significantly sharpens classifier decision boundaries, as indicated by diagonally dominant confusion matrices and >4pp increases in minority-class recognition.
Figure 6: Integration of C2GA augmentation leads to uniform confusion matrices and improved minority-class sensitivity across classification heads.
Practical and Theoretical Implications
C2GA introduces an explicit hierarchy of class-controllable latent representations for medical audio, breaking from continuous or unconditional generation paradigms. On the practical side, C2GA enables robust clinical deployment by systematically mitigating class imbalance without expert-intensive data annotation. Theoretically, it motivates further research into discrete semantic modeling with mutual information regularization, class-aware prototype fusion, and augmentation under hard clinical noise constraints.
Several directions exist for future exploration:
- Multi-modal extension: Incorporating physiological signals or clinical metadata as additional conditions for generation.
- Self- and semi-supervised adaptation: Enhancing the framework to operate under weaker annotation or domain shift.
- End-to-end waveform synthesis: Integrating C2GA with neural vocoders for direct waveform output could further increase clinical fidelity.
Conclusion
C2GA establishes a rigorous, class-controllable generative augmentation pipeline for respiratory sound classification, coupling semantic discrete tokenization, prototype guidance, and powerful autoregressive dynamics. Quantitative and qualitative evaluations demonstrate robust and non-trivial gains over state-of-the-art data-level and loss-level strategies, particularly in low-resource, imbalanced, and noisy settings. This framework sets a new paradigm for clinically reliable augmentation in diagnostic auscultation and transferable acoustic disease detection pipelines.