Towards robust and generalizable representations of extracellular data using contrastive learning

Ankit Vishnubhotla, Charlotte Loh, Liam Paninski, A. Srivastava, Cole Hurwitz

TL;DR

This paper introduces CEED, a novel contrastive learning framework for analyzing extracellular neural recordings. CEED learns robust representations of neural activity that significantly outperform traditional methods like PCA for spike sorting and cell-type classification, even in challenging out-of-distribution scenarios.

What Problem Does This Paper Address?

Neuroscience research increasingly relies on high-density extracellular recordings to capture the complex activity of large neural populations. However, extracting meaningful information from these raw signals is a significant challenge. Key tasks like spike sorting (identifying individual neuron spikes) and cell-type classification (grouping neurons by their electrical properties) are hindered by "nuisance variables" – factors like overlapping spikes, background noise, and variations in spike amplitude or timing that can distort the signal. Existing methods, particularly Principal Component Analysis (PCA), often struggle with these variations, leading to less accurate or generalizable results. This paper aims to develop a more robust and adaptable method for learning representations from extracellular data that can overcome these limitations.

Methods

The core of CEED is contrastive learning, a self-supervised learning technique that trains a model to distinguish between similar and dissimilar data points. Here's how it works:

  • Stochastic View Generation Module: For each raw extracellular waveform (a snippet of neural activity), CEED creates multiple "views" by applying various transformations. These transformations are designed to mimic common nuisance variables (like amplitude jitter, background noise, and spike collisions) and task-specific ones (relevant for cell-type classification). The goal is to teach the model that these altered versions of the same spike should have similar representations.
  • Neural Network Encoder: CEED employs a neural network to learn low-dimensional representations (embeddings) from these waveform views. The paper explores two architectures:
  • Transformer-based encoder with Spatiotemporal Causal Attention Mask (SCAM): This leverages the power of transformers for sequential data, incorporating a novel mask to respect the temporal and spatial causality of neural signals.
  • Multi-layer Perceptron (MLP): A simpler, more computationally efficient alternative that can be trained on a single GPU.
  • Contrastive Loss Function: A standard contrastive loss (similar to SimCLR) is used to train the encoder. It encourages the embeddings of different views from the same waveform to be close together in the representation space, while pushing embeddings from different waveforms further apart.

By learning representations that are invariant to these nuisance variables, CEED aims to produce embeddings that are more informative for downstream tasks.

Datasets

The researchers utilized publicly available extracellular recordings from the International Brain Laboratory (IBL):

  • DY016 and DY009 recordings: These are high-density, multi-region Neuropixels recordings from mice performing a decision-making task.

They constructed several datasets for evaluation:

  • Spike Sorting Datasets:
    • In-distribution (ID) datasets: Trained and tested on data from the same set of neurons.
  • Out-of-distribution (OOD) datasets: Trained on one set of neurons and tested on a completely different set, or even on data from a different animal (monkey) and probe geometry. This is crucial for testing generalizability.
  • Cell-type Classification Dataset: Used pooled "good" units from DY016 and DY009 for unsupervised cell-type discovery.
  • Zero-shot Cell-type Classification Dataset: Evaluated on a dataset of single units from a monkey brain, recorded with a different probe type, to assess generalization to unseen experimental conditions.

Key Insights and Ideas

  • Contrastive learning is powerful for neural data: The paper demonstrates that contrastive learning, while successful in other domains, is highly effective for extracting meaningful features from complex neural signals like extracellular waveforms.
  • Invariance is key: The core hypothesis that representations invariant to nuisance variables lead to better performance is strongly supported. By explicitly training for invariance, CEED overcomes limitations of methods that don't account for these signal distortions.
  • Generalization is surprisingly strong: CEED shows remarkable performance on out-of-distribution datasets, including those from different animals and probe types, suggesting its learned representations are highly generalizable.
  • CEED outperforms established methods: CEED consistently outperforms PCA and even non-linear autoencoders on spike sorting tasks, and shows competitive or superior performance to state-of-the-art methods like WaveMap for cell-type classification.

Key Results

  • Spike Sorting: CEED achieved significantly higher Adjusted Rand Index (ARI) scores compared to PCA and autoencoders on both in-distribution and out-of-distribution spike sorting tasks. For example, on an OOD task, CEED achieved an ARI of ~0.78, while denoised PCA and autoencoders were around ~0.46-0.49.
  • Cell-type Classification:
    • On IBL recordings, CEED identified distinct clusters that corresponded well to narrow-spiking and broad-spiking units, suggesting it can capture morphoelectric differences.
  • In a zero-shot setting on a monkey dataset, CEED achieved 93.4% accuracy in predicting cell-type clusters using a downstream classifier, outperforming WaveMap's 88.8% accuracy, despite being trained on entirely different animal and probe data.

Limitations and Future Work

  • Dataset Size and Diversity: The current training datasets are relatively small and may lack neuron diversity. Future work should involve training on larger, more varied datasets to further enhance generalizability across different recordings and animals.
  • Computational Cost: The transformer-based encoder (SCAM) is computationally intensive, requiring multi-GPU clusters. While an MLP encoder offers a more accessible alternative, further research into accelerating transformer training (e.g., using optimization techniques) is needed.
  • Integration into Full Pipelines: The current spike sorting experiments involve "re-sorting" already sorted data. Integrating CEED into a complete, end-to-end spike sorting pipeline would be a valuable next step for broader adoption.
  • Functional Validation: The cell-type classification results are based on morphoelectric features. Incorporating functional data to validate these clusters would provide a more comprehensive understanding.
  • Environmental Impact: The authors acknowledge the significant computational resources and potential carbon emissions associated with training large neural networks. They propose an MLP-based architecture as a more environmentally friendly alternative and suggest further research in this direction.

Summary updated

BibTeX
@inproceedings{vishnubhotla2023towards,
  author = {Ankit Vishnubhotla and Charlotte Loh and Liam Paninski and A. Srivastava and Cole Hurwitz},
  title = {{Towards robust and generalizable representations of extracellular data using contrastive learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=h6WUKM7PCI},
}
Figure