Intra Subject Contrastive Learning for Physiological and Behavioral Data

40 concepts25 papers1 proposal

When training self-supervised models on images, the recipe for creating "positive pairs" is straightforward: you take a single image of a cat, crop it, rotate it, or change its color. The underlying semantic category ("cat") remains invariant across these synthetic transformations.

However, when applying self-supervised learning to human time-series data—such as electrocardiograms (ECGs), brain scans, or wearable behavioral logs—this approach breaks down. If you apply synthetic jitter or cropping to a 10-second ECG segment, the model simply learns to recognize transient signal artifacts or localized wave shapes. It misses the deeper, long-term physiological traits of the person behind the data. Furthermore, the baseline differences between two healthy individuals are often far greater than the fluctuations within a single individual over time, causing standard models to get lost in population-wide variance.

To solve this, a powerful paradigm has emerged: intra-subject contrastive learning. Instead of relying on artificial data augmentations, this approach uses the identity of the subject as the natural anchor for representation learning. By treating different recordings from the same individual as positive pairs and recordings from different individuals as negative pairs, models learn to separate persistent biological traits from transient noise.


The Core Intuition: Longitudinal Data as a Natural Augmentation

The fundamental insight behind intra-subject contrastive learning is that an individual's physiological or behavioral state changes over time, but their underlying biological blueprint remains constant.

Instead of artificially altering a single data point, researchers use longitudinal data collected from the same person at different times or via different sensors as natural augmentations.

Standard Contrastive Learning:
[ECG Segment A]  ───(Synthetic Crop/Noise)───> [ECG Segment A']  (Positive Pair)

Intra-Subject Contrastive Learning:
[ECG Monday, Patient 1] ─────────────────────> [ECG Thursday, Patient 1] (Positive Pair)
[ECG Monday, Patient 1] ───(Pushed Away From)─> [ECG Monday, Patient 2]   (Negative Pair)

As Nathaniel Diamant et al. demonstrate in their work on Patient contrastive learning, mapping high-dimensional physiological signals into a lower-dimensional latent space using this patient-centric pairing forces the network to ignore transient noise like sensor placement or environmental interference. Because the only common denominator between an ECG recorded on Monday and one recorded on Thursday is the patient's unique cardiac architecture, the model naturally prioritizes stable biological traits, such as chronic disease states or genetic markers.

This strategy dramatically improves data efficiency. For instance, Veer Sangha et al. developed Biometric Contrastive Learning (BCL), showing that linking temporally separated ECGs from the same individual allows downstream diagnostic models to achieve high accuracy while using as little as 0.1% of the labeled data required by traditional supervised methods.


Modifying the Loss Function

To implement this intuition, the standard contrastive loss (like InfoNCE) must be rewritten. In standard instance discrimination, every single sample in a batch is contrasted against every other sample. In intra-subject contrastive learning, the loss function treats all data points belonging to the same subject as positive pairs.

In the framework proposed by Dani Kiyasseh et al. called CLOCS, the shared context is explicitly redefined. The model minimizes the distance between embeddings of different time segments, different heart "views" (leads), or entirely different sessions from the same patient. This identity-aware contrastive loss encourages the latent space to form tight, distinct clusters for individual patients rather than scattering segments based on immediate signal similarities.

A subsequent study by Dani Kiyasseh et al. extended this to create Patient Cardiac Prototypes (PCPs). By mapping multiple signal segments from a single individual into a unique, shared embedding space, they generate a digital "fingerprint" of a patient's heart. This allows clinicians to perform patient similarity searches and discover subtle disease subgroups that are invisible when looking at population averages.


The Duality of Subject Awareness: Fingerprinting vs. Invariance

Depending on the downstream task, intra-subject contrastive learning can be steered in two opposite, yet equally powerful, directions: biometric fingerprinting or subject invariance.

1. Biometric Fingerprinting (Maximizing Identity)

When the goal is personalization, the model is rewarded for maximizing the distinctiveness of each individual.

  • Neuroimaging: Gia H. Ngo et al. utilized a dual-objective reconstructive-contrastive loss to predict task-evoked brain activity from resting-state fMRI data. By forcing the network to distinguish individual-specific traits from common population patterns, their model prevents regression to a generic mean, capturing unique neural "fingerprints."
  • Behavioral Logs: In commercial applications like instant messaging, Qixiang Fang et al. applied user-centric contrastive learning to behavioral event logs (clicks, swipes) in G-BLUM. Maximizing the similarity between different behavioral sequences from the same user allowed the model to accurately predict account safety and engagement from just a handful of actions.
  • Clinical Alarms: In the ICU, Yuerong Zhou et al. used intra-subject contrastive learning to reduce false arrhythmia alarms. By comparing an active alarm segment against a patient's own historical baseline data, the model learns to ignore an individual's unique, benign physiological idiosyncrasies that would otherwise trigger standard threshold-based alarms.

2. Subject Invariance (Stripping Identity)

Conversely, in tasks like Human Activity Recognition (HAR), a person's unique physical build or gait acts as a confounding distributional shift. The goal here is to identify the activity (e.g., walking), regardless of who is performing it.

To achieve this, Yavuz Yarici et al. inverted the contrastive mechanism. Their framework applies higher weights to negative samples originating from the same subject. By penalizing similarities between different activities performed by the same person, the encoder is forced to actively discard individual-specific signal patterns, resulting in highly generalizable activity features.


Scaling to Foundation Models

As self-supervised learning scales up, intra-subject contrastive learning has become a core pillar for training large foundation models on wearable data.

For example, Salar Abbaspourazad et al. trained massive foundation models on biosignals (PPG and ECG) from over 141,000 smartwatch users. By structuring the contrastive learning around participant-level positive pairs across distinct time windows, the model avoids relying on transient, segment-specific artifacts. The resulting embeddings successfully generalize to predict diverse health conditions without requiring labeled data during pre-training.

This principle holds true even when moving away from raw waveforms to high-level behavioral metrics. Eray Erturk et al. developed the Wearable Behavior Model (WBM) by aligning representations from different time periods of the same individual across 2.5 billion hours of sleep and step data.

Similarly, in the optical domain, Arvind Pillai et al. introduced PaPaGei, a foundation model for photoplethysmography (PPG). Their participant-aware contrastive objective maintains longitudinal consistency, capturing unique personal signatures while mitigating downstream biases such as skin tone variations.

Beyond the Individual: Cohort Intelligence

While focusing on the individual solves the problem of transient noise, it can sometimes miss broader clinical trends shared among similar patients. To bridge this gap, researchers have begun expanding the concept of intra-subject contrast to group-level dynamics.

As a single author, Changshuo Liu introduced NeuralCohort, a framework that automatically groups similar individuals into fine-grained clinical cohorts. By explicitly optimizing for both intra-cohort similarities and inter-cohort differences, the model ensures that unique clinical characteristics of specific sub-populations are preserved, demonstrating that the principles of identity-driven contrastive learning scale effectively from individual patients to entire clinical communities.

Key Foundational Work

CLOCS: Contrastive Learning of Cardiac Signals Across Space, Time, and Patients (2021) — contributed 4 concept elements to this direction.
From Connectomic to Task-Evoked Fingerprints: Individualized Prediction of Task Contrasts from Resting-State Functional Connectivity (2020) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_intra_subject_contrastive_learning_116a4dcc,
  title = {intra-subject contrastive learning},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/intra-subject-contrastive-learning/rdr_116a4dcc25dd462082ad71ff0d408de8},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-20},
}

This exact version (version 1, frozen text):

@misc{lacuna_intra_subject_contrastive_learning_116a4dcc_v1,
  title = {intra-subject contrastive learning},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/intra-subject-contrastive-learning/rdr_116a4dcc25dd462082ad71ff0d408de8/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-20},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake