In vivo cell-type and brain region classification via multimodal contrastive learning

Han Yu, Hanrui Lyu, Xu E, Charlie Windolf, Eric Lee, Fan Yang, Andrew M. Shelton, Shawn R. Olsen, Sahar Minavi, Olivier Winter, Eva L. Dyer, Chandramouli Chandrasekaran, Nicholas A. Steinmetz, Liam Paninski, Cole Hurwitz

Abstract

Current electrophysiological approaches can track the activity of many neurons, yet it is usually unknown which cell-types or brain areas are being recorded without further molecular or histological analysis. Developing accurate and scalable algorithms for identifying the cell-type and brain region of recorded neurons is thus crucial for improving our understanding of neural computation. In this work, we develop a multimodal contrastive learning approach for neural data that can be fine-tuned for different downstream tasks, including inference of cell-type and brain location. We utilize this approach to jointly embed the activity autocorrelations and extracellular waveforms of individual neurons. We demonstrate that our embedding approach, Neuronal Embeddings via MultimOdal contrastive learning (NEMO), paired with supervised fine-tuning, achieves state-of-the-art cell-type classification for two opto-tagged datasets and brain region classification for the public International Brain Laboratory Brain-wide Map dataset. Our method represents a promising step towards accurate cell-type and brain region classification from electrophysiological recordings.

Introduction

High-density electrode arrays, such as Neuropixels, allow researchers to record the activity of thousands of individual neurons simultaneously. However, these "spikes" are often anonymous: without further molecular analysis or time-consuming histology, it is difficult to determine the specific cell type (e.g., inhibitory vs. excitatory subtypes) or the precise brain region being recorded. Existing automated methods often rely on simple manual features or single data modalities, which lack the robustness to handle the high variability found across different animals and laboratories. There is a pressing need for scalable, "plug-and-play" algorithms that can decode a neuron's identity and location using only raw electrical data.

Methodology: The NEMO Framework

The authors introduce NEMO, which adapts the Contrastive Language-Image Pretraining (CLIP) framework to neural data. Instead of images and captions, NEMO learns to associate two distinct electrophysiological modalities:

  1. Extracellular Action Potentials (EAPs): The average "waveform" or shape of the electrical spike.
  2. Autocorrelograms (ACGs): A representation of the neuron's firing timing and patterns across different firing rates.
Schematic illustration of the NEMO framework, showing how waveforms and spiking activity are encoded into a shared embedding space.

NEMO uses separate neural network encoders for each modality and trains them using a contrastive loss. This objective pushes the embeddings of a waveform and an ACG from the same neuron together in a high-dimensional space while pushing those from different neurons apart. This pre-training allows the model to learn intrinsic neuronal properties from vast amounts of unlabeled data before being fine-tuned for specific classification tasks.

Datasets

The study utilizes two primary datasets for validation:

  • NP Ultra opto-tagged mouse data: A specialized dataset where specific cell types (PV, SST, and VIP) were "tagged" with light-sensitive proteins, providing a ground-truth "gold standard" for cell-type classification.
  • IBL Brain-wide Map: A massive, public dataset from the International Brain Laboratory containing recordings from over 37,000 units across 10 broad brain regions in mice.

Key Results and Insights

NEMO demonstrates that combining "how a neuron looks" (waveform) with "how it behaves" (ACG) is significantly more powerful than using either modality alone. Unlike previous Variational Autoencoder (VAE) approaches that focus on data reconstruction, NEMO’s contrastive approach prioritizes discriminative features, making it more robust to noise.

UMAP visualization and performance metrics showing that NEMO embeddings naturally cluster by cell type and achieve superior classification accuracy.
  • State-of-the-Art Cell Typing: NEMO achieved a 0.88 F1-score for cell-type classification, significantly outperforming the previous state-of-the-art, PhysMAP (0.69), and VAE-based methods.
  • Superior Brain Region Decoding: On the IBL dataset, NEMO outperformed supervised baselines in identifying brain regions. It was particularly successful when using a "multi-unit" approach, ensembling predictions from nearby neurons to improve local accuracy.
  • Data Efficiency: In "label ratio sweeps," NEMO trained on only 10% of labeled data outperformed a VAE model trained on 100% of the labels, highlighting its utility for researchers with limited manually-annotated datasets.

Conclusion

NEMO represents a significant step toward accurate, automated cell-type and brain region classification from electrophysiological recordings. While the current model focuses on information shared between modalities, future work could incorporate population-level features or integrate other modalities like RNA sequencing data to further refine neural identification. The project page and code are available at https://ibl-nemo.github.io/.

Summary updated

BibTeX
@inproceedings{yu2025vivo,
  author = {Han Yu and Hanrui Lyu and Xu E and Charlie Windolf and Eric Lee and Fan Yang and Andrew M. Shelton and Shawn R. Olsen and Sahar Minavi and Olivier Winter and Eva L. Dyer and Chandramouli Chandrasekaran and Nicholas A. Steinmetz and Liam Paninski and Cole Hurwitz},
  title = {{In vivo cell-type and brain region classification via multimodal contrastive learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=10JOlFIPjt},
}
Figure