QuantFormer: Learning to Quantize for Neural Activity Forecasting in Mouse Visual Cortex

Salvatore Calcagno, Isaak Kavasidis, Simone Palazzo, Marco Brondi, Luca Sità, Giacomo Turri, Daniela Giordano, Vladimir R. Kostic, Tommaso Fellin, Massimiliano Pontil, Concetto Spampinato · DOI

Abstract

QuantFormer is a novel Transformer-based architecture designed to forecast future neural activity in the mouse visual cortex. By reframing neural forecasting from a traditional regression task into a discrete classification problem via vector quantization, the model effectively captures sparse and complex calcium imaging signals. QuantFormer utilizes neuron-specific tokens to scale across diverse populations and employs a self-supervised pre-training phase. Experimental results on the Allen Brain Observatory dataset demonstrate that QuantFormer achieves state-of-the-art performance, outperforming existing time-series models in both activation classification and response forecasting.

Introduction

In neuroscience, understanding the relationship between the external world and internal brain states is typically divided into encoding (stimulus to activity) and decoding (activity to behavior). However, neural forecasting—predicting future brain activity from past observations—represents a "Holy Grail" for the field. It is a critical component for closed-loop experimental systems, such as those used for real-time optogenetic interventions to preempt seizures or specific motor intents.

Neural signals present a significant challenge for forecasting due to their extreme sparsity—characterized by long periods of inactivity punctuated by sudden bursts—and intricate dependencies across thousands of neurons. Traditional regression-based models often struggle with this sparsity, frequently "smoothing out" significant bursts or failing to generalize across different subjects with varying neuron counts.

Methodology

QuantFormer addresses these challenges through two primary innovations: Vector Quantization (VQ) and Neuron-Specific Tokens. Instead of predicting continuous calcium trace values, the model learns a discrete "codebook" of neural activity patterns, effectively tokenizing the neural signal. This allows the forecasting task to be treated as a classification problem, which is more robust for capturing sharp, sparse spikes that regression models often miss.

To handle varying neuron counts across different mice and recording sessions, learnable neuron-specific tokens are prepended to the input. This allows a single model to scale across diverse neuronal populations without structural redesign.

The QuantFormer architecture featuring self-supervised pre-training with a masked auto-encoder and downstream task fine-tuning.

The training process involves two distinct stages:

  1. Self-Supervised Pre-training: The model learns to reconstruct masked patches of neural data using a masked auto-encoder (MAE) framework, developing a generalized representation of neuronal behavior.
  2. Downstream Tuning: The pre-trained encoder is fine-tuned for specific tasks: Activation Classification (predicting if a neuron will fire) and Response Forecasting (predicting the specific activity trace).

Experimental Setup

The model was benchmarked using the Allen Brain Observatory Dataset, a massive resource of two-photon calcium imaging data from the mouse visual cortex. The dataset includes responses from 11 different mice across multiple 90-minute sessions, covering stimuli such as drifting gratings, static gratings, natural scenes, and locally sparse noise. In total, over 236,000 multivariate signals were utilized, providing a rigorous benchmark for neural time-series modeling.

Results and Discussion

QuantFormer demonstrates superior performance compared to existing state-of-the-art (SOTA) time-series models, including Informer, Autoformer, and Cross-former. In stimulus response classification, QuantFormer achieved an accuracy of 77.39%, outperforming the next best model by nearly 2%.

Quantitative comparison of QuantFormer against SOTA models and qualitative forecasting visualizations showing superior tracking of neural bursts.

Quantitatively, the model consistently achieved lower Mean Squared Error (MSE) and higher Correlation (Corr) than its competitors. Qualitatively, as shown in the forecasting visualizations, QuantFormer's predictions closely match the "shape" and timing of actual neural bursts. In contrast, traditional models often predict flat lines or mean activity levels, failing to capture the essential sparse dynamics of the visual cortex. Furthermore, the model maintained robust performance when tested on unseen mice, suggesting strong generalization capabilities.

Conclusion and Future Work

The success of QuantFormer suggests that neural data may be better modeled using discrete representations, similar to natural language, rather than continuous values. This approach positions QuantFormer as a potential foundational model for neural signal processing.

Despite its success, the authors note limitations, such as the current lack of an explicit biological inhibition mechanism, which can lead to occasional over-activation in predictions. Future research will focus on adapting the architecture for high-resolution electrophysiological spiking data and demonstrating its utility in live, closed-loop hardware environments.

Summary updated

BibTeX
@misc{calcagno2024quantformer,
  author = {Salvatore Calcagno and Isaak Kavasidis and Simone Palazzo and Marco Brondi and Luca Sità and Giacomo Turri and Daniela Giordano and Vladimir R. Kostic and Tommaso Fellin and Massimiliano Pontil and Concetto Spampinato},
  title = {{QuantFormer: Learning to Quantize for Neural Activity Forecasting in Mouse Visual Cortex}},
  year = {2024},
  eprint = {2412.07264},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.07264},
}
Figure