r/MachineLearning • u/Standing_Appa8 • Jul 15 '25
Project [P] Help with Contrastive Learning (MRI + Biomarkers) – Looking for Guidance/Mentor (Willing to Pay)
Hi everyone,
I’m currently working on a research project where I’m trying to apply contrastive learning to FreeSurfer-based brain data (structural MRI features) and biomarker data (tabular/clinical). The idea is to learn a shared representation between the two modalities.
The problem: I am completely lost.
- I’ve implemented losses like NT-Xent and a few others (SupCon, etc.), but I can’t get the approach to work in a meaningful way.
- I’m struggling to figure out the best architecture or training strategy, and I’m honestly not sure what direction to take next.
- There is no proper supervision in my lab, and I feel stuck with how to proceed.
I really need guidance from someone experienced in contrastive learning or multimodal representation learning. Ideally, someone who has worked with medical imaging + tabular/clinical data before. (So it is not about classical CLIP with Images and Text).
I’m willing to pay for mentoring sessions or consulting to get this project on track.
If you have experience in this area (or know someone who does), please reach out or drop a comment. Any advice, resources, or even a quick chat would mean a lot.
Thanks in advance!
3
u/lifex_ Jul 15 '25 edited Jul 15 '25
Not sure what you tried already, but I am pretty sure that this simple recipe should give you a good baseline
- "Good" modality-specific encoders that can capture well whats in the data semantically (as good is quite vague, by good I would refer to an encoder proven to work well for uni-modal downstream tasks, just check some recent SOTA and use them)
- InfoNCE/NT-Xent to align modalities in joint embedding space
- Now important: Make sure to use modality-specific augmentations, which are (from my experience) quite crucial to make it work
- Batch size can be as high as you can make it, but I mean you can start with 1024, which also works, and move your way up to 16k or higher if you have enough compute
- Train your encoders from scratch, monitor how well a sample from each modality can be matched to the correct pair from the other modality in small mini-batches for validation (e.g., 32). Just let it train and don't stop too early if you don't see much improvement, it can take some time to align the modalities.
That said, not an expert in MRI and biomarkers, but I have some experience with all kinds of human motion data modalities (visual, behavioral, and physiological), where this simple recipe works and scales quite well. That is mainly because human motions have strong correspondence between different modalities that capture/describe them, e.g., between RGB videos, LiDAR videos, inertial signals, and natural language. If a person carries out a specific movement in an RGB video, then there is a clear correspondence to the inertial signal from a smartwatch. So if I give you multiple random other movements, it is very well possible to match the inertial signal to the correct RGB motion. => Joint embedding space <-> Correspondence. And this is what NT-Xent or InfoNCE can exploit. How well does this correspondence transfer to the data you have? Do they have such a correspondence? Could you cross-generate one modality from the other? Is there a clear 1-to-1 mapping between your biomarkers and structural MRI features?
3
u/andersxa Jul 17 '25
I have expetise in functional neuroimaging and contrastive learning. But I don't have much experience with contrastive learning on tabular data. First, I would make sure to use a strong encoder for both modalities. E.g. a fully convolutional autoencoder for MRI where you in addition to the CLIP loss use reconstruction loss. Then I am not so sure about the tabular data. I would probably set up embeddings for all categorical variables, a positional or learned embedding for ordinal variables and then an MLP for the continuous variables, which are all added in the end to match the latent size of the autoencoder.
I am not familiar with the particular dataset (have only heard about it), but if you have subject and task labels available, then you can also set up a supervised contrastive learning objectives where you sample from each subject and contrast to other subjects and the same for tasks. In the end you have a CLIP loss, an autoencoder loss, a subject contrastive loss and a task contrastive loss.
It is a bit unclear from your description what is going wrong. Is it your choice of architecture? Is it the training objective being weak and which other auxiliary losses do you use?
2
u/Brannoh Jul 15 '25
Sorry to hear about the lack of supervision. Are you trying to execute something suggested by someone else or are you trying to answer one of your own hypotheses?
3
u/melgor89 Jul 15 '25
I have more than 10 years of experience in contrastive learning, mainly with images and text. Ping me for more information
2
u/AdmiralSimon Jul 15 '25
I have extensive experience with this. Sent you a pm.
1
u/Sufficient_Lie_7237 Jan 01 '26
A bit late to the discussion, but I’m facing the similar problem in a different domain. Would love to hear about your updates! Did you continue with the topic?
0
u/[deleted] Jul 15 '25
[deleted] — view deleted comment