---
title: Disease-Level Contrastive Learning
url: https://www.emergentmind.com/topics/disease-level-contrastive-learning
type: topic
---

# Disease-Level Contrastive Learning

Searching arXiv for recent and foundational papers on disease-level contrastive learning and closely related medical contrastive-learning formulations.
Searching for metadata-aware medical contrastive learning in retinal OCT and supervised/clinical-oriented medical contrastive learning papers.
Disease-level contrastive learning is a class of representation-learning methods in which the similarity structure used by contrastive objectives is chosen to reflect disease state, disease progression, or disease similarity, rather than only instance identity. In medical settings, this shift appears when positives are defined by longitudinal metadata such as patient identity, eye laterality, and time in retinal OCT [2208.02529], by shared disease labels in gastrointestinal endoscopy [2307.07603], by lesion and image-quality strata in low-quality fundus and chest imaging [2404.04887], by patient-level video correspondence in echocardiography [2207.11581], by ontology-derived code similarity in ICD coding [2310.09672], or by explicit separation of common healthy variation from salient disease-specific variation [2402.11928]. Across these formulations, the central objective is to learn embeddings whose geometry is aligned with clinically meaningful relations.

## 1. Conceptual scope

Conventional contrastive learning methods such as SimCLR, MoCo, and BYOL are built around an instance-level approximation: two augmented views of the same sample are positives, while other samples are treated as negatives unless labels are available. In medical imaging, this approximation is often systematically misleading because many samples share the same anatomy, the same disease, or the same patient-specific trajectory. In retinal OCT, for example, scans of the same eye at nearby time points may represent nearly the same age-related macular degeneration state, yet standard instance discrimination would treat them as negatives if they arise from different source images [2208.02529]. Disease-level contrastive learning replaces that approximation with relations that better match the disease process.

A second conceptual axis is the contrastive-analysis view of healthy versus diseased populations. SepCLR formalizes the problem with a background dataset \(X\) of healthy subjects and a target dataset \(Y\) of diseased subjects, and decomposes latent factors into common variables \(c\), shared by both populations, and salient variables \(s\), present only in the target dataset [2402.11928]. In that formulation, disease-level contrastive learning is not merely class separation; it is the separation of disease-specific variation from anatomy, demographics, and acquisition effects.

This suggests that disease-level contrastive learning is best understood as a relation-design paradigm rather than a single loss family. The loss may be InfoNCE, BYOL, MaxMargin, Barlow Twins, or a graph contrastive objective, but the defining feature is that the positive and negative structure is anchored to disease-relevant semantics.

## 2. Formalization of disease relations

A canonical formulation appears in metadata-enhanced retinal OCT pretraining. For longitudinal eye series
\[
{}^{u}e^{l} = \{ ( {}^{u}x^{l}_i, {}^{u}t^{l}_i ) \}_{i=1}^{L},
\]
a metadata-derived relation function is defined as
\[
S_{\delta_T^{\min}, \delta_T}({}^{u}x^{l}_i, {}^{v}x^{m}_j) =
\begin{cases}
+ & (u = v) \land (l = m) \land (\delta_T^{\min} \le |t^u_i - t^v_j| \le \delta_T) \\
- & (u \neq v) \\
? & \text{otherwise},
\end{cases}
\]
so that positives are scans from the same patient and same eye within a temporal window, negatives are scans from different patients, and ambiguous pairs are excluded [2208.02529]. This is a disease-level approximation because temporal proximity within one eye is used as a proxy for similar disease state.

A supervised formulation appears in gastrointestinal endoscopy and semi-supervised skin-lesion diagnosis. There, the positive set for anchor \(i\) is \(P(i)=\{j\neq i: y_j=y_i\}\), and negatives are \(N(i)=\{j: y_j\neq y_i\}\), so the disease label itself defines the contrastive supervision [2307.07603, 2304.05047]. The same idea reappears in multimodal fusion for pulmonary embolism and future lung cancer prediction, where supervised sigmoid-based contrastive learning uses disease labels to determine positive and negative pairs among CT, tabular, and fused representations [2509.18284].

A hierarchy-aware variant appears in ICD coding. Each note’s ICD labels are lifted to a spanning super-tree \(\mathcal{T}_i\) inside the ICD hierarchy, and inter-note similarity is defined by
\[
\alpha_{ij} = 1 - \frac{2 \times \mathrm{dist}(\mathcal{T}_i, \mathcal{T}_j)}{|\mathcal{T}_i \cup \mathcal{T}_j| - 1},
\]
where \(\mathrm{dist}\) is tree edit distance [2310.09672]. Contrast is then driven by soft disease similarity rather than a binary same-class relation.

A graph-biological variant appears in disease similarity prediction. PhenoGnet treats known gene–phenotype associations as positive pairs and unrelated pairs as negatives, then represents a disease by the mean embeddings of its associated genes and/or phenotypes; pairwise disease similarity is computed by cosine similarity [2509.14037]. Here the disease-level object is induced from entity-level contrastive alignment.

| Relation source | Positive structure | Representative paper |
|---|---|---|
| Longitudinal metadata | Same patient, same eye, temporally close | [2208.02529] |
| Disease labels | Same disease class | [2307.07603] |
| Hierarchical code similarity | High ICD-tree similarity | [2310.09672] |
| Cross-view biology | Known gene–phenotype association | [2509.14037] |
| Healthy/diseased partition | Target-only salient factors, healthy salient collapse | [2402.11928] |

## 3. Major design patterns

One major design pattern uses routinely available clinical metadata to define disease relations without explicit disease-stage labels. In retinal OCT, patient ID, eye laterality, and timestamps are used to build positive pairs from the same eye within \([\delta_T^{\min}, \delta_T]\), to exclude fellow-eye or distant-time pairs as unknown, and to ensure that every image in a batch participates in at least one positive pair [2208.02529]. This is a disease-aware self-supervised formulation: labels such as early, late, dry, and wet AMD are not used in pair construction, but disease progression is encoded implicitly through time.

A second pattern uses direct disease supervision. In Hyper-Kvasir gastrointestinal classification, any two images sharing the same disease or condition label are positives and images from different classes are negatives; the encoder is first trained with a supervised contrastive objective and then frozen while a classifier is trained on top, with optional class-weighted cross-entropy to address imbalance [2307.07603]. In semi-supervised skin lesion diagnosis, supervised contrastive pre-training creates disease-aware clusters while Sample Relation Consistency regularizes the geometry of labeled and unlabeled data through student–teacher Gram matrices [2304.05047].

A third pattern is clinical stratification beyond labels alone. CoMCL partitions data into high-quality lesion images \(X^{L}\), low-quality lesion images \(\tilde X^{L}\), high-quality healthy images \(X^{H}\), and low-quality healthy images \(\tilde X^{H}\), then constructs contrastive losses among these levels to disentangle lesion features from low-quality artifacts; a lesion detector trained on IDRiD supplies lesion-centered patches, and self-paced hard-negative mining progressively emphasizes difficult confounders [2404.04887]. This formulation treats disease/lesion status and image quality as separate but interacting axes of similarity.

A fourth pattern uses subject-level or modality-level correspondence. EchoCLR defines positive pairs as distinct parasternal long-axis videos from the same echocardiography study and adds a frame re-ordering pretext task to encode temporal coherence [2207.11581]. Reduced-lead ECG diagnosis aligns a reduced-lead embedding \(v^{x}\) to the corresponding 12-lead embedding \(v^{12}\) through a joint loss \(\mathcal{L}=\mathcal{L}_{\text{cls}}+\alpha\,\mathrm{sim}(v^{12},v^{x})\), thereby transferring disease-discriminative structure from rich to sparse measurements [2304.11080]. Multimodal Alzheimer’s disease prediction aligns MRI and tabular modalities in a CLIP-style shared space and uses tabular attention to amplify salient biomarkers and assessments [2308.15469]. Multimodal disease detection with missing modalities further extends this idea by adding learnable modality tokens and fused-representation contrastive terms \(\hat{\mathcal{L}}^{con}=\mathcal{L}^{con}_{c,t}+\mathcal{L}^{con}_{c,f}+\mathcal{L}^{con}_{t,f}\) [2509.18284].

A fifth pattern addresses distributional or infrastructural constraints. Federated dermatology pretraining shares feature vectors rather than raw images, uses MoCo-style instance discrimination, and removes local negatives so that images on the same device are not needlessly pushed apart [2202.07470]. Cross-lingual clinical-text diagnosis aligns parallel symptom descriptions across English, Hindi, and Bengali by a Siamese contrastive module, a translation consistency loss, and a disease classifier, enabling zero-shot transfer without language-specific fine-tuning [2509.20567].

## 4. Objective families and architectural realizations

Disease-level contrastive learning is implemented with a wide range of objective functions. In retinal OCT, SimCLR-ME keeps the InfoNCE form but redefines positives and negatives via metadata, while BYOL-ME keeps the BYOL loss unchanged and only changes what counts as a positive pair [2208.02529]. The implication is that disease-level behavior can arise from relation redesign without altering the base loss.

In gastrointestinal endoscopy, several supervised contrastive losses were compared—TripletMargin, MaxMargin, NPairs, and supervised NT-Xent—and MaxMargin yielded the best train and test loss for ResNet50, after which all backbone experiments used MaxMargin [2307.07603]. In echocardiography, EchoCLR combines the standard NT-Xent loss with a frame-order prediction term,
\[
\mathcal{L}_{\text{EchoCLR}}=\mathcal{L}_{\text{NT-Xent}}+\mathcal{L}_{\text{order}},
\]
so that temporal dynamics and patient-level invariance are learned jointly [2207.11581].

Other papers change the training architecture more radically. SRCL performs supervised contrastive pre-training and then fine-tunes with Sample Relation Consistency, where student and teacher Gram matrices are matched under perturbation; the two-stage formulation outperforms the joint variant at several label fractions, indicating objective conflict when contrastive clustering and relational stabilization are optimized simultaneously [2304.05047]. EHR prediction in COVID-19 uses a supervised contrastive objective over patient embeddings and event embeddings, with patient–event and patient–patient terms weighted by \(\alpha=0.8\) and \(\beta=0.2\), respectively, to increase margins under severe class imbalance [2101.04013]. Social-media disease detection combines two cross-entropy losses with a Barlow Twins-style contrastive term on clean and self-augmented hidden states,
\[
L=\frac{(1-\alpha)}{2}(L_{CE_1}+L_{CE_2})+\alpha L_c,
\]
so that disease-related textual representations remain invariant under internal perturbation [2405.01597]. DAAC for medical time series stacks hierarchical losses \(L_S, L_R, L_E, L_T,\) and \(L_V\) on top of an AE-GAN-derived discrepancy channel that acts as a disease-probability-like feature [2508.05572]. SepCLR derives common and salient alignment/uniformity objectives from an InfoMax formulation and adds kernel-based joint entropy maximization to prevent information leakage between healthy/shared and disease-specific spaces [2402.11928].

This suggests that disease-level contrastive learning is not tied to a specific backbone either. The literature spans ResNet-50 (4× width), 3D-ResNet-18, DenseNet-121, Xception, InceptionTime, XLM-RoBERTa, graph convolutional networks, graph attention networks, and lightweight fusion MLPs, with the disease-aware component residing primarily in the supervision graph, pairing strategy, or population partition rather than in the encoder family.

## 5. Empirical behavior across domains

Across modalities, the most consistent empirical pattern is improved label efficiency on disease-focused tasks. In retinal OCT, metadata-enhanced pretraining outperformed both standard contrastive methods and a retinal image foundation model in five out of six image-level downstream tasks related to AMD, and on Southampton late-versus-early AMD classification the reported high-data AUCs were approximately \(0.79\text{–}0.80\) for RETFound, approximately \(0.83\) for standard BYOL, and approximately \(0.845\) for BYOL-ME with \(\delta_T \le 1\); BYOL-ME with only 100–400 labeled samples matched or exceeded RETFound trained with 10,000 labels [2208.02529].

In Hyper-Kvasir gastrointestinal classification, contrastive pretraining alone yielded strong performance across backbones, and for the best Xception encoder the downstream classifier reached approximately \(83\text{–}84\%\) test accuracy and weighted \(F_1=0.81\) without cost sensitivity; with class-weighted cross-entropy, the same pipeline reached \(88.74\%\) accuracy and weighted \(F_1=0.86\), with notable gains on several more difficult classes such as `esophagitis_b_d` [2307.07603].

For low-quality medical images, CoMCL improved robustness as image quality deteriorated. On EyeQ at the original quality proportion, CoMCL achieved Kappa / ACC \(=0.884 / 0.872\), and at 100% low-quality it achieved \(0.793 / 0.776\), outperforming Lesion-aware CL at \(0.757 / 0.724\). On Chest X-ray at 100% low-quality, CoMCL achieved Kappa / ACC \(=0.641 / 0.663\), again above the reported baselines [2404.04887].

Label-scarce settings show the same tendency. On ISIC 2018, SRCL reached AUROC \(0.925\) and accuracy \(0.936\) with 20% labeled data, and AUROC \(0.950\) and accuracy \(0.946\) with 50% labeled data [2304.05047]. On echocardiography, EchoCLR reached AUROC \(0.72\) on LVH classification with 10% of available training data, compared to \(0.61\) for a standard transfer learning approach, and AUROC \(0.82\) on severe AS classification with 1% of available training data, again compared to \(0.61\) with transfer learning [2207.11581]. In COVID-19 EHR prediction, contrastive-loss models on the restricted sample improved AUPRC by \(0.04\) to \(0.15\) and AUROC by \(0.05\) to \(0.1\) over cross-entropy models, while preserving clinically meaningful feature importance such as pulse oximetry [2101.04013].

Ontology- and fusion-based settings also show disease-level gains. In ICD coding, adding tree-based contrastive pretraining and masked section training increased MSMN Macro \(F_1\) on MIMIC-rare-50 from \(23.7\) to \(31.2\), and MultiResCNN from \(11.2\) to \(22.8\), indicating particular benefit for rare codes [2310.09672]. In multimodal PE detection, the proposed fusion framework achieved AUROC \(0.842\) and AP \(0.775\) in the image+tabular setting, and \(0.801\) AUROC in the image-only setting; on NLST 2-year cancer prediction it achieved AUROC \(0.857\) in the multimodal setting [2509.18284]. In cross-lingual clinical-text diagnosis, SwasthLLM reported \(97.22\%\) test accuracy and \(97.17\%\) F1 in supervised settings, plus zero-shot accuracy \(92.78\%\) on Hindi and \(73.33\%\) on Bengali [2509.20567]. For disease similarity prediction, PhenoGnet’s gene-based disease embeddings achieved AUCPR \(0.9012\) and AUROC \(0.8764\) on a benchmark of 1,100 similar and 866 dissimilar disease pairs [2509.14037].

## 6. Limitations, misconceptions, and open directions

A common misconception is that disease-level contrastive learning is synonymous with supervised contrastive learning over disease classes. The literature does not support that narrow reading. Disease-level structure can be imposed through longitudinal metadata [2208.02529], same-patient video correspondence [2207.11581], healthy-versus-diseased population structure [2402.11928], ICD hierarchy [2310.09672], cross-lingual case alignment [2509.20567], or gene–phenotype associations aggregated to diseases [2509.14037]. This suggests that the decisive ingredient is whether the contrastive relation encodes clinically meaningful proximity.

The principal limitations are equally heterogeneous. Metadata-driven methods depend on accurate identifiers and timestamps, and fixed temporal windows ignore heterogeneity in progression rates; fellow eyes remain excluded because their relationship is complex [2208.02529]. In GI endoscopy, some extremely rare classes still had \(F_1=0\) despite contrastive and cost-sensitive training [2307.07603]. CoMCL requires disease labels, quality labels, and a lesion detector trained on a pixel-level annotated dataset, which increases annotation dependence and domain-transfer assumptions [2404.04887]. SRCL-Joint can underperform the two-stage SRCL formulation because contrastive and relational objectives may conflict in the same embedding space [2304.05047]. EchoCLR is limited to the parasternal long-axis view and to a single institution with temporal external validation rather than cross-site validation [2207.11581]. Federated feature sharing improves dermatology pretraining but does not provide a formal privacy mechanism [2202.07470]. SwasthLLM depends on parallel multilingual data for strong alignment [2509.20567].

The main research directions already identified in the literature are hybrid objectives and richer relation sources. Retinal OCT work explicitly proposes combining metadata-informed self-supervision with weakly supervised or supervised disease signals [2208.02529]. GI endoscopy motivates joint optimization of disease-discriminative embeddings and misclassification-cost awareness beyond the current two-stage pipeline [2307.07603]. CoMCL points toward extension to more modalities and multi-organ lesions, as well as more sophisticated disentanglement of nuisance factors such as quality, device, and protocol [2404.04887]. EchoCLR proposes multi-view echocardiography and multimodal expansion [2207.11581]. Reduced-lead ECG alignment motivates more complex contrastive learning than the current pairwise similarity term [2304.11080]. Multimodal fusion with missing modalities points toward end-to-end training with unfrozen encoders and additional modalities beyond CT and tabular data [2509.18284].

Taken together, the field defines disease-level contrastive learning less by a single architecture than by a recurring principle: similarity in the embedding space should track disease process, disease mechanism, or disease-relevant uncertainty, and any available structure—time, anatomy, labels, hierarchies, modality correspondence, or healthy baselines—can be used to enforce that alignment.

Source: https://www.emergentmind.com/topics/disease-level-contrastive-learning