This repository contains the code for reproducing or extending the Subject Conditioned Layer from our spotlight presentation at the NeurIPS 2025 Workshop on Foundation Models for the Brain and Body.
Mitigating Subject Dependency in EEG Decoding with Subject-Specific Low-Rank Adapters
Timon Klein, Piotr Minakowski & Sebastian Sager
OpenReview
arXiv
We propose Subject-Conditioned Layer, an adaptive layer designed as a drop-in replacement for standard linear or convolutional layers in any neural network architecture. Our layer captures subject-specific variability by decomposing its weights into a shared, subject-invariant component and a lightweight, low-rank correction unique to each subject.
The input
For each subject, a subject-specific low-rank adapter, parameterized by matrices
git clone https://github.com/timonkl/SubjectConditionedLayer.git
cd SubjectConditionedLayerpython -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windowspip install -r requirements.txtOur SubjectModelWrapper is a lightweight and convenient drop-in module that lets you adapt existing models to handle subject-conditioned learning with minimal code changes.
Simply wrap your existing model and specify the number of subjects — no architecture redesign required.
from subject_conditioned_layer.subject_conditioned_layer import SubjectModelWrapper
# Original model
base_model = BaseModel()
# Wrap it
num_subjects = 5
model = SubjectModelWrapper(base_model=base_model, num_subjects=num_subjects)
# Print to confirm that linear layers have been replaced
print(model)
# forward pass
x = torch.randn(4, 32) # batch_size x input_dim
subject_id = torch.randint(0, num_subjects, (4,)) # batch_size
out = model(x, subject_id)A complete runnable example can be found in subject_conditioned_layer/example.py.
The research code used to reproduce the experiments from the paper is available in the experiments/ folder.
If you use this work, please cite our paper:
@misc{klein2025mitigatingsubjectdependencyeeg,
title={Mitigating Subject Dependency in EEG Decoding with Subject-Specific Low-Rank Adapters},
author={Timon Klein and Piotr Minakowski and Sebastian Sager},
year={2025},
eprint={2510.08059},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2510.08059},
}Contributions are welcome! Please open an issue or pull request if you’d like to add features, fix bugs, or extend the model.
