Trace : Contrastive learning for multi-trial time-series data in neuroscience
Lisa Schmors Dominic Gonschorek Jan Niklas Böhm Yongrong Qiu, Na Zhou Dmitry Kobak Andreas Tolias Fabian Sinz, Jacob Reimer Katrin Franke Sebastian Damrich Philipp Berens · 2025
Read Trace : Contrastive learning for multi-trial time-series data in neuroscience by Lisa Schmors Dominic Gonschorek Jan Niklas Böhm Yongrong Qiu, Na Zhou Dmitry Kobak Andreas Tolias Fabian Sinz, Jacob Reimer Katrin Franke Sebastian Damrich Philipp Berens (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2506-04906.txt.
Introduction
Brain recordings now track hundreds of neurons at once, and each experiment repeats the same stimulus many times. Lisa Schmors and co-authors present TRACE, a learning method built for exactly that multi-trial shape. Their 2025 paper trains a contrastive model that pairs averages drawn from different subsets of trials, teaching it which responses truly match.
TRACE folds the data straight into a two-dimensional map that scientists can read at a glance. On simulated data it beat rival methods at telling fine response differences apart. On real recordings, its maps kept smooth biological gradients, grouped cells by type, and even helped flag bad data. The authors pitch the tool as a way to turn repeated trials from a chore into a source of signal.
Catalog record
| CREATOR | Lisa Schmors Dominic Gonschorek Jan Niklas Böhm Yongrong Qiu, Na Zhou Dmitry Kobak Andreas Tolias Fabian Sinz, Jacob Reimer Katrin Franke Sebastian Damrich Philipp Berens |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 47 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2506-04906
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Trace : Contrastive learning for multi-trial time-series data in neuroscience Lisa Schmors Dominic Gonschorek Jan Niklas Böhm Yongrong Qiu, Na Zhou Dmitry Kobak Andreas Tolias Fabian Sinz, Jacob Reimer Katrin Franke Sebastian Damrich Philipp Berens Abstract Modern neural recording techniques such as two-photon imaging allow to acquire vast time-series datasets with responses of hundreds or thousands of neurons. Contrastive learning is a powerful self-supervised framework for learning representations of complex datasets. Existing applications for neural time series rely on generic data augmentations and do not exploit the multi-trial data structure inherent in many neural datasets. Here we present Trace , a new contrastive learning framework that averages across different subsets of trials to generate positive pairs. Trace allows to directly learn a two-dimensional embedding, combining ideas from contrastive learning and neighbor embeddings. We show that Trace outperforms other methods, resolving fine response differences in simulated data. Further, using in vivo recordings, we show that the representations learned by Trace capture both biologically relevant continuous variation, cell-type-related cluster structure, and can assist data quality control. 1 Introduction With advances in recording techniques, datasets in neuroscience have grown in size and complexity [ 7 , 36 ] . For example, two-photon imaging and Neuropixel probes have made it possible to record responses of tens of thousands of neurons from multiple cortical areas under comparable conditions [ 34 , 12 ] . To summarize and visually explore such noisy, high-dimensional data, it is invaluable to represent it in two dimensions to identify functionally similar groups of neurons [ 44 ] . A prominent paradigm for learning informative representations of data is contrastive learning [ 16 , 27 ] . Here, representations are created by contrasting similar samples (referred to as “positive pairs”) against dissimilar ones (“negative pairs”), ensuring that similar samples are grouped together, while dissimilar ones are separated. Contrastive learning has been popular for image data for some years [ 8 ] , but has only recently seen first applications for neuroscience time-series data [ 33 , 40 ] . For example, the contrastive method CEED [ 40 ] learns representations of extracellular action potential wave forms using generic data augmentations such as amplitude jitter. However, most contrastive learning methods, including CEED, do not directly embed into two dimensions necessary for visualization. Here, we exploit a common feature of neuroscience experiments – multiple recorded responses to identical stimuli – to develop a new contrastive learning framework tailored for multi-trial time series in neuroscience. This framework directly learns a two-dimensional (2D) representation of the data. Building on t -SimCNE [ 6 ] , we present Trace : T ime series R epresentation A nalysis through C ontrastive E mbeddings. Instead of using hand-tuned or generic data augmentations, Trace creates positive pairs by averaging across different subsets of trials, better capturing the structure of time-series variation in neural responses (Fig. 1 ). Figure 1: Trace embeds multi-trial time series using subset means for positive-pair generation. Left: Typical experimental structure in neuroscience: multiple trials of neural activity in response to repeats of an identical stimulus (here, full-field light intensity modulations). For Trace , positive pairs are generated using means of subsets of trials. Middle: Positive pairs are fed through an MLP and a fully-connected projection head to get representations z_{i} and z^{\prime}_{i} . The loss function pushes z_{i} and z^{\prime}_{i} together and maximizes their similarity. Right: Final embedding of large-scale neuroscience dataset recorded in superior colliculus. Color-coded according to their functional group. Using a synthetic dataset, we show that Trace indeed automatically identifies informative parts of a time series, where other methods are “drowning in noise”. We then investigate the performance of Trace on a two-photon-imaging dataset of over 70,000 individual retinal ganglion cell boutons recorded in the superior colliculus of awake, head-fixed mice. Trace produces visualizations that capture important biological properties of the recorded cells better than other visualization techniques. In summary, our contributions are: 1. We introduce a novel contrastive self-supervised framework for visualizing multi-trial time-series data in neuroscience in 2D using the Cauchy similarity. 2. We develop a novel data augmentation technique for multi-trial time-series data based on averaging subsets of trials to create positive pairs. 3. We establish the superior performance of our visualization method in terms of quality metrics and alignment with biologically interesting cellular properties. 4. We show how the method can be used for identifying recording artifacts and investigating outliers. Our code is available at https://osf.io/x7qsm/?view_only=e5fd82164c8a4a30807cdba400d80c28 . 2 Related work Dimensionality reduction of neural data has been used in computational neuroscience for (1) assisting the discovery of cell types or continuous functional variation and (2) finding low-dimensional population dynamics. For (1), each point in the computed low-dimensional representation corresponds to a neuron, while for (2), each point corresponds to a time point. Our approach addresses task (1). Towards this goal, two of the most prominent non-linear visualization methods are t -SNE [ 39 ] and UMAP [ 26 ] . While mostly used for single-cell transcriptomics data, they have also been employed for wave-shape classification for electrophysiological data [ 21 ] . t -SNE and UMAP learn a non-parametric 2D embedding, guided by pairs of nearest neighbors in data space. However, nearest neighbors in the high-dimensional space can be a poor proxy for semantic similarity due to the curse of dimensionality [ 17 ] . Alternatively, self-supervised learning approaches train encoder networks to produce high-dimensional representations. For visual exploration, these need to be further reduced, e.g. using PCA [ 30 ] . Instead of pairs of nearest neighbors, these methods rely on data augmentations, better capturing the semantic similarities of samples. The type of augmentation depends on the data modality, e.g. randomly resized crops and flips for images [ 8 ] or sampling consecutive time steps in speech recordings [ 27 ] . Notably, t -SimCNE [ 6 ] uses data augmentations to create positive pairs of images but embeds into 2D to visualize the data. Contrastive learning has been applied to medical time-series data, in particular electrocorticogram (ECoG) data. In addition to general time-series augmentations like scaling, blurring [ 32 ] , and jittering [ 15 ] , frequency- [ 46 ] , cutout- [ 9 ] , and permutation-based augmentations [ 32 ] have been used, which are not applicable to multi-trial non-periodic, stimulus-response data. Some of these works [ 19 , 13 ] also create positive pairs based on patient identity. Mix-up [ 45 ] creates augmentations by blending different samples [ 4 ] , which was also applied to ECoG data [ 9 , 41 ] . Patient-based positive pairs or mix-up are similar in spirit to our approach. An important difference is that they only mix or pair two single trial samples and not a larger subset of trials, as we do. Our approach balances positive pair variability and similarity to inference-time inputs. In neuroscience, there has been comparatively little work on contrastive learning for time-series representations with the goal of identifying discrete cell types (i.e. clusters). Peterson et al. 2022 use a self-supervised model to generate pseudo labels and enrich the collected data this way. Cho et al. 2023 suggest a time-warping loss, which is not applicable to our experiments, which are