消除高密度电生理锋电位分类中的过度分割错误
SLAy-ing oversplitting errors in high-density electrophysiology spike sorting
导读
《Nature Methods》刊出研究提出Spike-sorting Lapse Amelioration System(SLAy)算法,利用 spike 波形相似度与交叉相关图指标,自动合并被过度拆分的单元。该算法在多种动物模型、脑区和探针几何结构下,能找回人工策展人约97%的合并,人工策展人认同SLAy约90%的合并,并识别出人工策展人最初遗漏的有效合并;与自动单元质量标注配合时,可实现可靠的全自动 spike sorting 策展。
正在把原文翻译成中文,长文需要一两分钟;先显示原文。
- Article
- Open access
- Published: 01 December 2026
Nature Methods (2026) Cite this article
Abstract
High-density electrophysiological probes produce simultaneous recordings of hundreds of single neurons, enabling studies of neuronal populations at high spatiotemporal resolution. Drawing scientific insights from these large-scale data first requires spike sorting to identify the timing and neuronal identity of the recorded action potentials. While scalable, automated spike sorters systematically oversplit spikes from individual ground-truth neurons into multiple detected units—errors that require time-consuming manual curation to correct. Here we introduce the Spike-sorting Lapse Amelioration System (SLAy), an algorithm that uses spike waveform similarity and cross-correlogram metrics to automatically merge oversplit units. Across a range of animal models, brain regions and probe geometries, SLAy recovers ~97% of merges identified by human curators, and human curators agree with ~90% of SLAy’s merges. SLAy also identifies valid merges that human curators miss initially. When used alongside automated unit quality labeling, SLAy enables reliable, fully automated spike-sorting curation, a critical capability as electrophysiological recordings grow rapidly in scale.
Main
One of the aims of neuroscientific research is to understand how the concerted activity of neuronal populations gives rise to higher-order phenomena, including sensory perception and behavior. High-density electrophysiological (ephys) probes such as Neuropixels1,2,3 have facilitated these efforts by enabling chronic recordings of hundreds of neurons with single-neuron precision. Because ephys probes can reach deep brain regions and record at sub-millisecond resolution, they are particularly well suited for studying neural processes that involve rapid, coordinated activity across multiple cortical and subcortical brain regions. Comparable recording methods such as two-photon calcium imaging lack this capability owing to limited imaging depth and slow calcium indicator kinetics. Indeed, Neuropixels probes have advanced our understanding of a wide variety of neural processes, including perception4,5, decision-making6,[7](https://www.nature.com/articles/s41592-026-03311-7#ref-CR7 "Bondy, A. G. et al. Multi-region coordination of evidence accumulation and decision commitment in the brain. Preprint at bioRxiv https://doi.org/10.1101/2024.08.21.609044
(2026).") and navigation[8](https://www.nature.com/articles/s41592-026-03311-7#ref-CR8 "Gardner, R. J. et al. Toroidal topology of population activity in grid cells. Nature 602, 123–128 (2022)."),[9](https://www.nature.com/articles/s41592-026-03311-7#ref-CR9 "Low, I. I. C., Williams, A. H., Campbell, M. G., Linderman, S. W. & Giocomo, L. M. Dynamic and reversible remapping of network representations in an unchanging environment. Neuron 109, 2967–2980.e11 (2021)."). Extracting scientific insights from ephys recordings, which capture the joint electrical activity of many neurons, relies on spike sorting: identifying the timing and identity of individual neurons’ action potentials from the raw voltage traces. Although ephys recordings have historically been spike\-sorted by hand[10](https://www.nature.com/articles/s41592-026-03311-7#ref-CR10 "Gray, C. M., Maldonado, P. E., Wilson, M. & McNaughton, B. Tetrodes markedly improve the reliability and yield of multiple single-unit isolation from multi-unit recordings in cat striate cortex. J. Neurosci. Methods 63, 43–54 (1995)."), the increasing channel count of high\-density electrophysiology datasets—especially those recorded using multiple probes—renders manual spike sorting impractical and necessitates automated solutions.
Automated spike sorters assume that a probe records a distinct stereotyped voltage waveform for each neuron, determined by the neuron’s intrinsic biophysical properties and location relative to the probe. Early semi-automated methods involve three steps11 (Fig. 1a, left): (1) thresholding to detect spikes, (2) dimensionality reduction, usually principal component analysis (PCA), to represent spike waveforms in a low-dimensional feature space and (3) manual or automatic clustering in this feature space to identify putative neurons12,13. Although faster than fully manual clustering, these methods struggle with temporally overlapping spikes and typically require some manual interventions. Modern algorithms, including Kilosort2,14, SpyKING CIRCUS15 and others[16](https://www.nature.com/articles/s41592-026-03311-7#ref-CR16 "Lee, J. H. et al. YASS: Yet Another Spike Sorter. In 31st Conference on Neural Information Processing Systems (NIPS 2017) https://proceedings.neurips.cc/paper_files/paper/2017/file/1943102704f8f8f3302c2b730728e023-Paper.pdf
(2017)."), use template matching (Fig. [1a](https://www.nature.com/articles/s41592-026-03311-7#Fig1), right). They initialize a set of waveform templates for each putative neuron and then alternate between two steps: (1\) detecting spikes by iteratively convolving the data with the templates and subtracting the best match (matching pursuit[17](https://www.nature.com/articles/s41592-026-03311-7#ref-CR17 "Mallat, S. G. & Zhang, Z. Matching pursuits with time-frequency dictionaries. IEEE Trans. Signal Process. 41, 3397–3415 (1993).")) and (2\) refining the templates based on the signal at the detected spike times. While template matching improves on earlier methods, it remains imperfect. As template matchers assume a static waveform for each putative neuron (with a rare exception[18](https://www.nature.com/articles/s41592-026-03311-7#ref-CR18 "Boussard, J. et al. DARTsort: a modular drift tracking spike sorter for high-density multi-electrode probes. Preprint at bioRxiv
https://doi.org/10.1101/2023.08.11.553023
(2023).")), they fail to account for waveform changes caused by probe movement or biophysical mechanisms (for example, amplitude reduction during bursting; Fig. [1b](https://www.nature.com/articles/s41592-026-03311-7#Fig1)), both of which are commonly observed in recordings from behaving animals. As a result, template matchers often ‘oversplit’ spikes from a (presumed) single neuron into multiple putative units.
Fig. 1: Spike sorting and errors in high-density electrophysiology data.

a, Left: early automatic spike sorters involve three steps—spike detection, feature extraction and clustering. Right: newer template-matching algorithms start with a template for each putative unit and alternate between detecting spike times with matching pursuit and refining templates. Spike times are detected by convolving the data with each waveform template, identifying the time and template corresponding to the best match (right middle, red box) and subtracting an appropriately scaled version of the template from the data. This leaves behind a residual version of the data with the detected spike removed (right bottom, red box), and the detection process is repeated iteratively on the residual data. b, Common failure modes for template-matching algorithms include waveform changes due to drift (top), biophysical waveform changes due to bursting (middle) and coincident spike time identification due to either improper template learning or detection of multiple parts of a single neuron (bottom).
Another class of oversplitting errors is the co-detection of a single spike by templates corresponding to multiple units, which results in many identical or slightly shifted spike times between units (Fig. 1b, bottom). This can occur for two reasons. In the more common case, the sorting algorithm learns an incomplete template that fails to capture the full amplitude or shape of a ground-truth neuron’s spike waveform. As a result, subtracting the template from the neuron’s spikes leaves behind a stereotyped residual waveform. The algorithm then learns another template for this residual, which is used to detect additional ‘spikes’ of a second unit at many of the original spike times (effectively ‘double-counting’ the same physical event). Alternatively, multiple compartments of the same neuron may be detected on noncontiguous parts of the probe. Because the templates used to detect spikes are constrained to be spatially localized, the sorter learns a separate template for each compartment. In both cases, the resulting units have highly similar mean waveforms (calculated by averaging the recorded voltage across the detected spike times) and a very large peak at the center of their cross-correlogram (CCG).
Overmerging errors, while also present, are much less common because template matchers are intentionally biased toward oversplitting14. Although some template matchers include post-sort merging steps14,15, they rely heavily on waveform similarity to suggest merges and thus are unable to account for changes in waveform shape. Therefore, even state-of-the-art spike-sorting algorithms require additional manual curation.
Manually correcting template-matching errors involves excluding low-quality units with refractory period (RP) violations or noise-like waveforms and merging oversplit units. Failing to address these errors can result in flawed scientific conclusions; analyses of single-neuron responses depend directly on the accurate assignment of spikes to neurons, and biased splitting may compromise the validity of dimensionality reduction and subsequent population-level analyses. Oversplitting in spike sorting has been shown to lead to underestimates of pairwise correlations between neurons19, and similar errors in calcium transient attribution have been quantitatively shown to generate false correlations and misrepresent inferred coding properties20,[21](https://www.nature.com/articles/s41592-026-03311-7#ref-CR21 "Inan, H., Erdogdu, M. A. & Schnitzer, M. In 31st Conference on Neural Information Processing Systems (NIPS 2017) https://papers.nips.cc/paper_files/paper/2017/file/e449b9317dad920c0dd5ad0a2a2d5e49-Paper.pdf
(2017).").
Although automated procedures for labeling unit quality have recently been developed[22](https://www.nature.com/articles/s41592-026-03311-7#ref-CR22 "Fabre, J. M. J., van Beest, E. H., Peters, A. J., Carandini, M. & Harris, K. D. Bombcell: automated curation and cell classification of spike-sorted electrophysiology data. Zenodo https://doi.org/10.5281/zenodo.8172821
(2023)."),[23](https://www.nature.com/articles/s41592-026-03311-7#ref-CR23 "International Brain Laboratory et al. Reproducibility of in vivo electrophysiological measurements in mice. Elife 13, RP100840 (2025)."), no reliable automated method exists for merging oversplit units. The required manual curation is both time\-consuming and lacking in reproducibility: curation decisions vary widely between curators owing to subjective judgment, fatigue and differences in curation order[13](https://www.nature.com/articles/s41592-026-03311-7#ref-CR13 "Rossant, C. et al. Spike sorting for large, dense electrode arrays. Nat. Neurosci. 19, 634–641 (2016)."),[24](https://www.nature.com/articles/s41592-026-03311-7#ref-CR24 "Wood, F., Black, M. J., Vargas-Irwin, C., Fellows, M. & Donoghue, J. P. On the variability of manual spike sorting. IEEE Trans. Biomed. Eng. 51, 912–918 (2004)."). Growing interest in simultaneous multi\-probe recordings[7](https://www.nature.com/articles/s41592-026-03311-7#ref-CR7 "Bondy, A. G. et al. Multi-region coordination of evidence accumulation and decision commitment in the brain. Preprint at bioRxiv
https://doi.org/10.1101/2024.08.21.609044
(2026)."),[25](https://www.nature.com/articles/s41592-026-03311-7#ref-CR25 "Chen, S. et al. Brain-wide neural activity underlying memory-guided movement. Cell 187, 676–691.e16 (2024)."),[26](https://www.nature.com/articles/s41592-026-03311-7#ref-CR26 "Melin, M. D. et al. Large scale, simultaneous, chronic neural recordings from multiple brain areas. Preprint at bioRxiv
https://doi.org/10.1101/2023.12.22.572441
(2024).") exacerbates the limitations of manual curation, increasing both the time required and the potential for fatigue\-related errors. Thus, automated methods for spike\-sorting error correction are essential for scalable and reproducible data processing pipelines.
To address the lack of a scalable and reproducible method for correcting template-matching errors, we propose the Spike-sorting Lapse Amelioration System (SLAy). We first show that human curators consistently identify oversplitting errors in eight datasets that span a variety of brain regions, probe geometries and animal models. We then introduce two key innovations in SLAy’s design: a waveform similarity metric that uses nonlinear neural-network-based representations of spike waveforms and a CCG structure metric based on the Earth-mover’s distance (EMD). SLAy also automatically tunes its parameters using realistic simulated oversplits, removing the need for manual parameter adjustment. On held-out simulated oversplits, we show that SLAy outperforms an existing merging algorithm, achieving near-perfect recall while avoiding extraneous merges. We also demonstrate that SLAy achieves high agreement with human curators—across datasets, human curators agree with ~90% of merges suggested by SLAy, and SLAy independently identifies ~97% of merges found by human curators. Critically, we show that traditional L2 waveform similarity and PCA features cannot achieve this level of performance, highlighting the importance of nonlinear waveform representations. By providing an automated method to correct template-matching errors, SLAy stands to improve the efficiency of ephys data processing while maintaining the validity of downstream scientific conclusions.
Results
Oversplitting errors occur across brain regions, animal models and probe geometries
To estimate the prevalence of oversplitting across recordings with a variety of characteristics, we sorted each of four recordings with both Kilosort 2.5 (KS2.5)2 and Kilosort 4 (KS4)14, yielding eight datasets in total:
-
1. a macaque motor and premotor cortex recording from a 10-mm Neuropixels 1.0 probe (NP 1.0) (data from ref. [27](https://www.nature.com/articles/s41592-026-03311-7#ref-CR27 "Choi, J. et al. Optimal adaptive electrode selection to maximize simultaneously recorded neuron yield. In 34th Conference on Neural Information Processing Systems (NeurIPS 2020) https://proceedings.neurips.cc/paper_files/paper/2020/file/445e1050156c6ae8c082a8422bb7dfc0-Paper.pdf
(2020).")), -
2. a macaque midbrain recording from a prototype 128-channel Neuropixels NHP probe (NP NHP 128-channel),
-
3. a mouse hippocampus recording from a Neuropixels 2.0 probe (NP 2.0) and
-
4. a rat insula recording from a Neuropixels 2.0 probe.
Each KS4 dataset was independently curated by two curators to assess oversplitting frequency and variability in manual curation. Although KS4 has largely superseded earlier Kilosort versions, we sought to explore whether oversplitting rates differed between Kilosort versions, specifically the previously widely used KS2.5. Each KS2.5 dataset was thus curated by one curator. As is common practice in manual curation, curators considered only pairs of units with waveform similarity above a relatively low threshold. This reduces the number of candidate merges from all possible pairs of units to a more manageable subset.
Human curators identified oversplitting in seven out of eight datasets, with the fraction of units requiring merging ranging from 5% to 13% (Fig. 2a). The remaining dataset contained only 32 single units. The two KS4 curators showed high (~90%) agreement across datasets (Fig. 2b), indicating that the identified oversplits reflect genuine sorting errors rather than idiosyncratic judgments. The observed rates of oversplitting are nontrivial for downstream interpretation, as many analyses depend on accurate single-unit assignment and spurious splitting can obscure or, in the worst case, alter scientific findings19. No consistent pattern of oversplitting rates emerged between sorter versions; KS4 had higher, similar or lower rates of oversplitting than KS2.5 depending on the recording. This suggests that the architectural changes in KS4 do not substantially reduce oversplitting errors.
Fig. 2: Oversplitting errors occur across brain regions, animal models and probe geometries.

a, Fraction of total units merged by at least one human curator for KS4- and KS2.5-sorted datasets across four recordings with a wide range of characteristics. b, Venn diagrams showing the number of merges identified by each of two independent curators for KS4-sorted datasets.
Quantifying waveform similarity, spike time dependence and refractory period violations
When making merging decisions, human curators use graphical interfaces15 (phy, https://phy.readthedocs.io/en/latest/) to qualitatively assess waveform similarity and CCG shape for each pair of units (https://phy.readthedocs.io/en/latest/sorting_user_guide/). Our algorithm, SLAy, automates this time-consuming and subjective manual curation process through a combination of metrics that quantitatively capture the same criteria that human curators use: waveform similarity, CCG structure and RP violations.
A primary indicator of neural identity is the unit’s action potential waveform. When deciding whether to merge two units, curators assess the similarity between their spike waveforms in one of two ways. The first is via the correlation or, equivalently, the normalized inner product between the units’ template waveforms. Correlation provides a first-order measure of shape similarity and is used by spike-sorting algorithms during post-sorting unit-merging steps14 and by human curators to prioritize unit pairs to inspect manually. However, template similarity is only reliable when the learned templates accurately capture the spatiotemporal shape of spike waveforms, and popular spike sorters have nontrivial rates of inaccurate template learning. Furthermore, phy (https://phy.readthedocs.io/en/latest/), the most widely used graphical user interface (GUI) for manual curation, uses templates to determine which channels to show for each unit. Thus, improperly learned templates and the resulting waveform correlations can cause even diligent human curators to miss potential merges.
The second method involves projecting individual spikes from each unit into a low-dimensional feature space, typically through PCA, and visually assessing the degree of overlap between the distributions for pairs of units. However, as principal components (PCs) are computed independently for each channel, the resulting low-dimensional representations often fail to capture information about the spatial decay of waveforms. Combined with the tendency of human curators to consider only the PCs for the one or two highest-amplitude channels, the per-channel feature approach can result in erroneous merging of two units with waveforms that are similar on their peak channels but decay differently across sites. Furthermore, as PCA representations span a low-dimensional linear subspace of the waveform space, they tend to smooth waveforms and remove clear distinguishing features that vary nonlinearly between units.
To address the shortcomings of these existing measures, SLAy computes waveform similarity using an autoencoder (AE) (Fig. 3a). AEs can learn highly nonlinear features that represent the details of the observed spike waveforms more faithfully than linear approaches, thus preserving distinguishing features that can improve the accuracy of merge decisions. AEs consist of two neural networks: an encoder that generates a compressed, low-dimensional representation of its input and a decoder that reconstructs the input as accurately as possible from this low-dimensional representation. Because our AE learns a single representation for all channels rather than per-channel features as is common in PCA approaches, the AE features also capture the spatial decay of waveforms across channels.
Fig. 3: AE-based low-dimensional representations of spike waveforms.

a, SLAy trains an autoencoder network for each dataset to obtain a low-dimensional nonlinear feature space in which to assess waveform similarity. The autoencoder is trained on localized 8 channels by 40 sample spike waveform snippets, with channels sorted by proximity to the channel with peak waveform amplitude. b, Left: a 2D t-distributed stochastic neighbor embedding (t-SNE) plot of the AE latent space shows three large groups of units when using only waveform shape information, indicating relatively low waveform shape diversity. Units close together in latent space have highly similar waveforms (blue and pink), and those far apart have different waveforms (blue and red). Right: including information about the location of units on the probe results in a t-SNE embedding with well-isolated clusters.
To train the AE, SLAy extracts localized snippets of spike waveforms (8 channels × 40 samples) with the 8 highest-amplitude channels sorted by proximity to the unit’s peak channel. Preprocessing the snippets in this way removes information about the spike’s absolute spatial position, ensuring that the AE learns only features related to the waveform shape. Limiting the snippet size rather than feeding in all probe channels reduces the number of network parameters, and thus the amount of time and data necessary for training. This efficiency is crucial because SLAy trains a new AE for each dataset that it is applied to.
Once the AE is trained, individual spike waveforms from each sorted unit are passed through the encoder to obtain low-dimensional spike representations. Distances in the resulting latent space correspond to waveform similarity: spikes that are close together in the latent space have similar waveform shapes, while those far apart are markedly different (Fig. 3b, left). Because the AE removes information about each spike’s peak channel, spike distributions of distinct sorted units overlap considerably in the AE latent space. In one recording that we tested, units formed three main groups, reflecting low overall diversity of waveform shapes. Reintroducing spatial information by appending the peak channel position to the low-dimensional latent vector (only for visualization purposes) results in much cleaner separation between units (Fig. 3b, right). This suggests that some neurons recorded by the probe in different spatial positions have similar waveform shapes, perhaps owing to having the same cell type and similar distance from the sites that capture them. Even in this 2D visualization of the AE latent space, oversplit or contaminated units are apparent (Supplementary Fig. 9). Furthermore, our AE achieves more accurate snippet reconstructions than PCA at the same dimensionality, highlighting the importance of nonlinear features for faithfully representing spike waveforms (Supplementary Fig. 2).
To derive two units’ waveform similarity from these features, SLAy compute a similarity metric, σ, based on the Euclidean feature-space distance between the unit centroids relative to the standard deviations of the units’ spike latent vector distributions. Normalizing with respect to the spreads of each unit allows the metric to be robust to local distortions in latent space geometry—neural networks are known to warp latent space distances nonuniformly, such that equal distances in different regions need not reflect equal similarity. In practice, this normalization also reduces the sensitivity of the overall SLAy algorithm to changes in parameters (Supplementary Fig. 1).
We pass this normalized distance through an exponential kernel to constrain the metric to be between 0 and 1, with 0 corresponding to maximal dissimilarity and 1 corresponding to identical centroids. Because units with similar waveform shapes but distant locations on the probe cannot correspond to the same ground-truth neuron, we also apply a multiplicative penalty based on the ratios of waveform amplitudes at the two peak channels (Fig. 4, top left). The overall similarity metric is computed as
$${\sigma }_{ij}=\exp \left(\dfrac{-\parallel {\mu }_{i}-{\mu }_{j}{\parallel }_{2}}{{\text{std}}_{i}+{\text{std}}_{j}}\right)\times \sqrt{{\text{decay}}_{ij}\times {\text{decay}}_{ji}},$$
where i and j are the unit identities, μ**i and μ**j are unit centroids in the AE latent space, \({\text{decay}}_{ij}=(\frac{{\text{amp}}_{i,{\text{peak}}_{j}}}{{\text{amp}}_{i,{\text{peak}}_{i}}})\), and \({\text{decay}}_{ji}=(\frac{{\text{amp}}_{j,{\text{peak}}_{i}}}{{\text{amp}}_{j,{\text{peak}}_{j}}})\). Because the AE is trained directly on individual spike waveforms, the metric avoids the shortcomings of computing similarity using templates, which may not faithfully represent waveform shape. SLAy’s similarity metric also takes into account the distribution of individual spike features for each unit, unlike simpler waveform similarity metrics based on the distances (for example, L1 or L2 distance) between the mean waveforms. The AE similarity metric is not overly sensitive to randomness in the training process: correlations between unit similarities were very high for AEs trained with different random seeds (Supplementary Tables 1 and 2), and SLAy suggested the same sets of merges across all random seeds tested.
Fig. 4: Metrics for automatic unit merging.

SLAy thresholds a per-unit-pair metric to determine which pairs to merge. The metric consists of three terms: waveform similarity (left), CCG structure (middle) and RP violation penalty (right). Left: unit similarity is defined as the spread-normalized distance between units in AE latent space, scaled by the geometric mean of the waveform decay across channels. Middle: CCG structure is defined as the EMD between the CCG and a uniform distribution. Right: RP penalty is defined as the minimum contamination probability across a range of possible RPs. Bottom: parameters k1 and k2 control the relative influence of these measures on \({{\mathcal{M}}}_{ij}\), and unit pairs with \({{\mathcal{M}}}_{ij}\) greater than a threshold are merged.
Although waveform shape is the primary criterion for merging units, curators must also consider the characteristics of the CCG. For instance, spikes within a single burst can have substantial waveform variability owing to the complex biophysics underlying action potential generation. Template matchers often assign these spikes to separate units, and waveform shape variability prevents the simple merging schemes from correcting these errors. Therefore, merge decisions for bursting units must also account for salient peaks and dips in the CCG, which correspond to the bursting interspike interval (ISI) and RP, respectively. Conversely, a unit pair with very high waveform similarity is very unlikely to belong to the same ground-truth neuron if their CCG contains many spike collisions during the RP. To account for CCG characteristics when determining which units to merge, SLAy uses two metrics based on CCG shape: one that encourages merges between units whose CCG shows large peaks or troughs and another that penalizes merges that would result in excessive RP violations.
No widely accepted method exists to determine whether a peak in a CCG is statistically significant, as human curators usually inspect CCGs visually to make qualitative judgments about their shapes. Some guides advise curators to merge units only if the CCG resembles the autocorrelograms (ACGs) of the individual units (https://phy.readthedocs.io/en/latest/sorting_user_guide/). However, this approach can overlook potential merges, as structured (that is, nonuniform) splitting due to bursting activity or drift-related changes in waveform shape can divide a single ground-truth neuron into units with distinct ACGs that also differ from the CCG.
One less prevalent approach is to perform binwise significance tests between the observed CCG and a ‘null’ CCG, with a correction for multiple comparisons (https://www.med.upenn.edu/mulab/crosscorrelation.html). While this method does not assume that template matchers oversplit in an unbiased way, the statistical dependency between adjacent bins violates the independence assumption of many correction methods, which can result in underestimates of CCG significance. In addition, binwise comparisons are highly sensitive to sampling noise and the choice of bin width.
To quantify the amount of structure in CCGs, SLAy instead uses the between the (smoothed) observed CCG and a uniform distribution (Fig. 4, top middle). CCGs with pronounced peaks or troughs have large probability mass displacements relative to a uniform distribution and thus produce large EMDs. CCGs with random chance deviations from a uniform distribution instead yield low EMDs even if an individual bin would have passed a binwise significance test. However, this metric is only valid if the observed CCG resembles the ‘true’ CCG given infinite observations. Because low-event CCGs are both unreliable estimates and far from uniform, we apply a multiplicative penalty to discount unit pairs that have CCGs with low spike counts. We also considered using the distance from the observed CCG to a per-unit-pair null CCG computed by repeatedly shuffling spike times. However, computing shuffled null CCGs was unnecessarily expensive, requiring many shuffling iterations while producing nearly identical metric values to a uniform distribution (Supplementary Fig. 3).
To quantify RP contamination, we use a modified version of the sliding RP violation metric, a standard metric for ACG RP contamination23. Given (1) the observed CCG, (2) a threshold of allowable contamination as a proportion of the baseline CCG event rate and (3) a range of possible RPs, the sliding RP metric calculates the probability that the ‘true’ CCG has an unacceptable level of contamination, assuming Poisson-distributed CCG events (Fig. 4, top right). We repeat this for each potential RP width, with the RP penalty defined as the minimum contamination probability across a set of RPs. This metric is conservative when the baseline CCG event rate is low. For example, if the allowable RP contamination for a given CCG is 2 events and the observed CCG has 0 events in its RP, the sliding RP violation metric estimates that the CCG still has a ~14% chance of being contaminated. This behavior is desired because units should be merged only if there is statistical confidence that their CCG has a low rate of RP violations.
To determine which unit pairs to merge, SLAy calculates a weighted sum of the three metrics described above: adding the waveform similarity (σij) and CCG structure metric (ρij), and subtracting the RP penalty (ζij) (Fig. 4, bottom).
$${{\mathcal{M}}}_{ij}={\sigma }_{ij}+{k}_{1}{\rho }_{ij}-{k}_{2}{\zeta }_{ij}$$
SLAy merges pairs of units with \({{\mathcal{M}}}_{ij}\) above a threshold. The scaling constants k1, k2 ≤ 1 allow users to adjust the relative importance of each term. For example, in particularly bursty areas such as the hippocampus, a higher k1 could correct for burst-related oversplitting, while low-burst areas such as the cortex could have k1 set close to 0. k2 can be increased if unit isolation is especially important to downstream analysis. Although these parameters, including the merge threshold, can be tuned manually to align with a user’s judgment, we developed an automatic tuning procedure, described below, to reduce the burden on users.
Realistic simulated oversplitting and automatic parameter selection
We first sought to validate SLAy on oversplit recordings with known ground truth. Such recordings could also serve as validation sets to tune the parameters of SLAy and other automatic merging algorithms. However, no appropriate ground-truth datasets were publicly available. Simulated high-density ephys recordings are not biologically realistic, and spike sorters regularly achieve near-perfect performance on them28. Therefore, there are few errors to correct, and results on these datasets are not representative of real-world performance. Conversely, most real recordings do not have ground truth for merging decisions because manual curation is subjective. To address this issue, we developed a procedure to introduce simulated oversplitting errors into real spike-sorted recordings. This procedure performs one of four types of oversplitting on existing units in the sorting, based on the common classes of errors: (1) amplitude-based, (2) burst-based, (3) drift-based and (4) random (Fig. 5a).
Fig. 5: Simulated oversplitting, parameter selection and evaluation.

a, We introduce four types of realistic oversplitting: (1) amplitude-based splits of a unit’s spikes based on a simple amplitude threshold, (2) burst-based splits of spikes in the second half of each burst into another unit, (3) drift-based splits of spikes based on their temporal position in the recording and (4) uniform random assignment of spikes to new units. b, To automatically select merging algorithm parameters for a specific dataset, SLAy introduces simulated oversplitting and performs a parameter sweep. The parameter combination at the knee (pink) of the recall versus proportion-of-units-merged curve is used to compute the final metric. Pink dashed lines illustrate the knee-finding procedure: the knee is the point with the largest perpendicular distance to the line y = x. c, Scatterplot of algorithms’ performance on artificial oversplitting. The y axis shows the ratio between the number of units merged by the algorithm and the number of units from splits (artificial and real splits, with real estimated from human curation). A ratio >1 indicates overmerging. Each data point corresponds to a single dataset–sorter combination and shows the method’s average performance across five draws of simulated oversplitting. Points near (1.0, 1.0) are jittered for visibility.
The procedure splits only a fraction of the total units in a given recording. Therefore, we can draw multiple ground-truth oversplit datasets from a single original dataset by varying the random seed of our splitting procedure. For example, a unit that is split on one draw may be unaltered on another, or a unit that undergoes an amplitude-based split on one draw may undergo a burst-based split on another. While all draws preserve the overall characteristics of the original recording (for example, firing rates, waveform shapes and amplitudes), they are independent in terms of which units are split and the type of split applied to each.
Because we have ground-truth information about the simulated splits, we can also use them to evaluate the performance of automatic merging algorithms, including runs of the same algorithm with different parameters. We leveraged this capability to develop an automatic parameter-tuning scheme, reducing the need for manual adjustment of SLAy’s parameters (Fig. 5a,b). On a given dataset, the scheme introduces simulated oversplitting and calculates the recall (fraction of ground-truth splits that were identified) and the proportion of total units merged for runs of the algorithm across many different parameter sets. Plotting these two performance metrics against each other produces a curve in the resulting 2D space (Fig. 5b, blue). Intuitively, a good merging algorithm should merge the oversplit units at a high rate while avoiding extraneous merges. We thus use a simple knee-finding procedure (greatest perpendicular distance to the line y = x) to identify the point on the curve (Fig. 5b, pink) where further relaxing the parameters would result in additional merges without improving recall on artificial splits.
In practice, we found that a single draw of oversplitting was sufficient to automatically select parameters for SLAy—running SLAy with different combinations of AE seed and simulated oversplitting draw resulted in autoselected parameters with mild variability (Supplementary Tables 3 and 4), but all runs produced the same set of suggested merges.
Our oversplitting-based parameter selection scheme adds minimal additional runtime for SLAy. The similarity, CCG and RP metrics are calculated independently of the coefficients and merge threshold. Thus, parameter sweeping involves only recombining these pre-calculated metrics with different coefficients and then rethresholding. In practice, we found that a high RP penalty was necessary to avoid false-positive merges. Therefore, the automatic tuning scheme fixes k2 = 1 and sweeps k1 and the threshold on the final metric. Parameters that affect the calculation of SLAy’s individual metrics, such as CCG bin size and RP width, are not tuned as these are standardized by the field for each brain region.
The design of our parameter selection scheme confers two benefits. First, our simulated oversplitting procedure directly splits existing units, so the selected parameters will be suited to the statistics (for example, amplitudes, firing rates) of the specific recording of interest. Second, the scheme relies only on the recall and percent of units merged for each parameter combination, making it applicable to any merging algorithm. However, its effectiveness may depend on the design of the specific algorithm. Below, we show that our parameter selection scheme improves the recall of a prior merging algorithm at the cost of increased false-positive merges.
SLAy achieves high recall and low extraneous merging on simulated oversplitting
For each combination of recording and Kilosort version curated by our curators, we used the procedure above to perform five draws of oversplitting. For each draw, we evaluated SLAy’s recall and compared the number of units that it merged with the total number of split units. This total split count was computed as the sum of units involved in either artificial splits or curator-identified oversplits in the unaltered datasets. The artificial oversplitting instances used for evaluation were generated using different random seeds than those used for automatic parameter selection. As established in the simulated oversplitting section, this ensures that the evaluation and tuning datasets share spiking characteristics while having independent oversplits, thereby avoiding train-test contamination.
SLAy reliably identified simulated oversplits across all recording–sorter combinations, achieving near-perfect recall across each of the eight datasets. This high recall was not the result of indiscriminate merging: the percentage of merges suggested by SLAy closely matched the percentage of total oversplits (Fig. 5c and Extended Data Fig. 1, blue). The few simulated oversplits that SLAy failed to identify were usually rejected because of high RP penalties. In these cases, the CCG event count was low even in the non-refractory bins, making it difficult to confidently rule out RP violations. This reflects a deliberate design choice: the form of the RP penalty was selected to ensure that SLAy merges two units only when they are highly likely to have a low rate of RP collisions. Together, these results show that SLAy consistently corrects oversplitting errors while avoiding extraneous merges.
We also evaluated the performance of the similarity-correlograms (SC) algorithm, an existing merging algorithm available through SpikeInterface. For each pair of units, the SC algorithm computes the mean waveform similarity and the similarities between the CCG and each unit’s ACG, merging them only if all metrics exceed independent thresholds. As a result, this algorithm should, in principle, struggle to account for non-random oversplitting; in bursting neurons, for example, the first and last spikes in a burst can have considerably different waveforms, causing template matchers to systematically split spikes at the beginning and end of bursts into different units. A human curator can typically recognize an oversplit bursting neuron despite lower waveform similarity by noticing the large asymmetric peak in the CCG at the within-burst spike interval. However, the SC algorithm would miss such an oversplitting error because of low waveform similarity and low similarity between the asymmetric CCG and symmetric-by-definition ACGs. This limitation suggests that the SC algorithm would struggle to achieve high recall on our simulated oversplits.
This was indeed the case: the SC algorithm with default parameters was overly conservative across all recordings and Kilosort versions, performing far fewer merges than the number of simulated oversplits (Fig. 5c, yellow). As a result, it achieved a maximum recall of only ~0.3 across datasets (Fig. 5c, yellow). To ensure that SLAy’s parameter selection scheme did not provide an unfair advantage, we also evaluated the performance of SC with our automatic parameter selection procedure (SC-auto). Our parameter selection scheme improved SC-auto’s recall on simulated splits across datasets (Fig. 5c and Extended Data Fig. 1, red; t(7) = 7.50, P = 6.9 × 10−5, d = 2.65, paired t-test). For example, on the monkey motor cortex recording sorted with KS4, using autoselected parameters improved mean recall across draws from 0.17 to 0.9, about a fivefold increase. However, this improvement in recall was at the cost of extraneous merges—SC-auto merged more units than the total number of split units on one recording–sorter combination. We show later that, on unaltered data, SC-auto makes extra merges that human curators disagree with. Even with recall-optimized parameters, SC-auto did not attain near-perfect recall for any dataset (Fig. 5c, red), with recall as low as ~0.5 on the mouse hippocampus recording sorted with KS4 (Extended Data Fig. 1). We suspect that the apparent ceiling on the SC-auto recall values for some datasets is due to an overly conservative contamination check in SpikeInterface’s automerging function, which rejects any merges that would increase the units’ contamination metrics even slightly. SLAy achieved significantly higher mean recall across datasets than SC (t(7) = 24.19, P = 2.6 × 10−8, d = 8.55, paired t-test) and SC-auto (t(7) = 5.51, P = 4.5 × 10−4, d = 1.95, paired t-test). Furthermore, SLAy achieved recall higher than (39/40) or equal to (1/40, perfect recall for both) that of SC-auto across every individual draw of simulated oversplitting for all recording–sorter combinations tested. Thus, SLAy consistently outperforms the primary existing automerging algorithm, even when that algorithm is augmented with our parameter-tuning scheme.
SLAy achieves high agreement with human curators on unaltered real datasets
Having evaluated SLAy and an existing algorithm on hybrid datasets with ground-truth split information, we sought to evaluate how well SLAy and SC aligned with human curators. We applied SLAy (including autoselected parameters), SC and SC with autoselected parameters (SC-auto) to the original, unaltered sorted recordings. In addition, to investigate whether SLAy’s AE-based waveform similarity provides a practical advantage over traditional measures, we tested two ablated versions of SLAy: (1) a version that replaces the AE similarity with the normalized L2 distance between mean waveforms (SLAy-L2) and (2) a version that replaces the AE latent space with 15-dimensional PCA space (SLAy-PCA) but retains all other aspects of the similarity calculation, including the per-unit spread normalization. We applied automatic parameter selection to these versions of SLAy, for which the CCG-related SLAy metrics remained unchanged.
For each algorithm, we computed the percent of human merges that the algorithm successfully recovered (recall) and the percent of the algorithm’s merges that a human curator agreed with (precision). For KS2.5 datasets, this was simply the percent of the algorithm’s merges found by the sole curator. For KS4 datasets, it was the percent of the algorithm’s merges found by either of the two curators. Some disagreements between human curators and algorithms could have stemmed from confounding factors, for example, curator fatigue or limitations of the curation interface. To address this, a human curator re-evaluated any automated merges that they had not identified initially. Crucially, to avoid bias during this secondary review, we included additional unit pairs not suggested by any algorithm as foils; the curator was thus blinded to whether each merge was actually suggested by an algorithm.
SLAy’s identified merges aligned closely with those of human curators (Fig. 6a). Across datasets, SLAy found ~97% of merges that were initially identified by at least one human curator, missing only one curator-identified merge (Fig. 6b and Extended Data Figs. 2 and 3). SLAy did not achieve this performance by simply identifying a large number of merges—after blinded re-evaluation of SLAy’s merges, both human curators agreed with ~90% of all merges suggested by SLAy, and at least one human curator agreed with ~95% of SLAy’s merges. Many of the merges identified by SLAy corresponded to common failure modes of template matching. For example, in the KS2.5-hippocampus recording, SLAy and both human curators merged together an oversplit bursting neuron despite a large difference in their mean waveforms (Extended Data Fig. 4). The waveform similarity was not enough to result in a merge on its own, but the asymmetric peaked CCG, a characteristic of a split bursting neuron, resulted in a high CCG structure metric that pushed the merge decision metric over the threshold.
Fig. 6: SLAy achieves high agreement with human curators on unaltered real datasets.

a, Precision and recall on curator-identified merges for each algorithm. Points at (0, 0) and (100, 100) are jittered for visibility. KS4-monkey midbrain is not shown, as neither the algorithms nor human curators identified any merges in that dataset. b, Venn diagrams showing the number of merges agreed upon between each algorithm and human curators, pooled across datasets. The count indicated by the asterisk includes two merges that were initially missed by human curators but approved after blinded reevaluation.
To illustrate the importance of merging for downstream analyses, we adapted a hidden Markov model (HMM)-based algorithm29 to detect bursts in spike trains (Supplementary Fig. 4). We applied our burst detection algorithm before and after performing merges identified by SLAy. For the insula and hippocampus recordings, SLAy’s identified merges resulted in a marked increase in the number of detected bursts and burst intensity (Supplementary Fig. 5).
Two merges in the KS4 mouse hippocampus dataset were identified only by SLAy and later approved by a human curator upon blinded re-evaluation. Units within each merge corresponded to large temporal shifts of the same spike waveform (Extended Data Fig. 5). The spikes detected with both or only one unit’s template did not differ visually, suggesting that these errors stemmed from improper template learning. The relative shifts in spike time identification resulted in a low L1 similarity between their mean waveforms; because human curators used a GUI that applies an L1 difference threshold to screen pairs of units, both curators missed these merges initially. These pairs did not pass the screening step even though curators used a more permissive threshold than usual (normalized L1 difference < 0.5 versus default value of 0.25). Such curator misses thus may occur more frequently than observed here. Both merges showed features of two types of template-matching failures: a large peak at the center of the CCG, which is a characteristic of units with co-detected spike times, and an asymmetric CCG with short, regular ISIs, which is a characteristic of an oversplit bursting neuron. Further inspection of the spike times for the constituent units revealed that, while many spikes were co-detected as part of both units, some spikes were assigned to only one unit or the other—with the assignment differing even for spikes within a single burst. This means that each oversplit unit contained unique information about the (presumed) ground-truth neuron, and thus, merging them is vital to avoid spurious conclusions about coding properties. The fact that these merges were initially missed by both human curators highlights that, in addition to automating a tedious manual process, SLAy can improve the fidelity of neural datasets and downstream analyses.
A small number of merges were identified only by SLAy and not approved by a human curator upon blinded re-evaluation (Supplementary Fig. 6). One such case involved a pair of high-amplitude units whose mean waveforms differed slightly but noticeably in the repolarization phase. Because this difference was relatively small compared with the overall magnitude of the spikes, it is likely that the AE did not learn sufficiently distinct latent representations for spikes from these two units. Nonetheless, these rare false positives were outweighed by SLAy’s high precision and recall with respect to merges found by human curators.
The ablated versions of SLAy showed a lower degree of alignment with human curators than the AE-based version and performed comparably to each other overall. Across datasets, SLAy-L2 found ~78% of merges that were initially identified by at least one curator (Fig. 6b), while SLAy-PCA found ~86%. Compared with SLAy, both ablated versions also made more merges that human curators disagreed with: human curators agreed with only ~78% of merges identified by SLAy-L2 and ~82% of merges identified by SLAy-PCA.
Both ablated versions were considerably worse than AE-based SLAy on some individual recordings. On the KS2.5 rat insula dataset, a human curator disagreed with 5 out of 14 merges identified by SLAy-L2, compared with only 2 out of 14 disagreements with merges identified by AE-based SLAy. SLAy-PCA was much worse than SLAy and SLAy-L2 on the monkey midbrain recording sorted with KS2.5: SLAy-PCA found the single merge found by both human curators (and SLAy-AE) but suggested three merges not found by SLAy-AE or either human curator. SLAy-L2 missed the merge found by human curators but only suggested one extraneous merge rather than three.
A closer examination of the disagreements between SLAy-L2 and human curators revealed two main types of errors. One type of error was the failure to merge units that had visually similar mean waveforms that were shifted temporally relative to each other (Supplementary Fig. 7a–d). These errors likely occurred because L2 similarity is highly sensitive to time-shifts, as it squares and sums sample-wise differences between mean waveforms. These merges were missed by SLAy-L2 despite having high enough similarity to pass the screening stage of the manual curation GUI, although human curators used a more permissive GUI threshold than normal. Naturally, SLAy-L2 also failed to identify the time-shifted oversplits (Extended Data Fig. 5) that human curators initially missed. Another type of error was merging units with differing spatial decay profiles (Supplementary Fig. 7e,f). Because L2 similarity depends only on pointwise differences, two units with differing spatial decay may have moderately high L2 similarity so long as they have similar waveforms on their highest amplitude channels. In some cases, this may lead to erroneous merges. The presence of these errors highlights the advantages of the AE-based waveform similarity metric; SLAy-L2 was unable to identify pairs of units with even small time-shifts, while SLAy found merges with shifts large enough that they were missed by human curators. In addition, because SLAy’s AE condenses the multichannel waveform into a low-dimensional latent vector and is trained to reconstruct input spikes, it must directly capture the spatial decay profile of each unit. The AE thus better distinguishes units with similar peak channel waveforms but different spatial decay profiles.
Disagreements between SLAy-PCA and human curators were less stereotyped than for SLAy-L2, although some examples of the classes identified above still occurred. For example, SLAy-PCA also missed the time-shift merge in Supplementary Fig. 7a,b. SLAy-PCA also missed a three-way merge identified by both human curators, SLAy and SLAy-L2 in the rat insula KS4 dataset (Supplementary Fig. 8a–c). SLAy-PCA merged together only two of the three units, with the unmerged unit having a slightly temporally shifted mean waveform relative to the other two. This indicates that PC features for individual spike waveforms are sensitive to time-shifts, perhaps more so than L2 similarity. SLAy-PCA also made some errors similar to the spatial decay false-positive merges from SLAy-L2 (Supplementary Fig. 8f). Other disagreements between SLAy-PCA and human curators seemed more idiosyncratic, such as SLAy-PCA not merging two units with very similar mean waveforms and low CCG collisions (Supplementary Fig. 8d,e), or conversely, merging units with highly separable amplitude distributions (Supplementary Fig. 8g). Together, the results from the ablated versions of SLAy showed lower alignment with human curators than the AE version, suggesting that nonlinear waveform features are necessary to achieve effective automatic merging performance.
As on the held-out simulated oversplits, the SC algorithm was overly conservative on the original datasets. Across all eight datasets, SC made only two merges: one each in the KS4 and KS2.5 rat insula datasets. Although human curators agreed with both merges, they correspond to only ~4% of the total number of merges made by human curators. This low rate of merging is expected considering that the SC algorithm is highly similar to post-sorting merge steps already implemented in both Kilosort versions. Consequently, this indicates that the primary existing automerging algorithm does not correct enough oversplits to replace manual curation.
SC-auto identified 20% of the merges made by human curators. Although this was an increase relative to SC, it remains considerably lower than all variants of SLAy. This modest increase came at the cost of considerable extraneous merging: human curators agreed with only 36% of the merges made by SC-auto across datasets. These extraneous merges likely stem from limitations in SC’s design, which requires waveform and ACG–CCG differences to be below certain thresholds. However, both these conditions are unlikely to be satisfied in non-random oversplitting, for example, oversplitting of bursting neurons, which result in units with lower waveform similarity and asymmetric CCGs. As a result, successfully merging simulated burst and/or amplitude oversplits during the parameter-tuning process may have resulted in thresholds that are too permissive. This idea is supported by the values of the SC-auto parameters shown in Supplementary Table 7, which are considerably higher than the SC default values (0.25 for waveforms and 0.16 for ACG–CCG). This reflects a fundamental limitation of SC’s design: its reliance on simultaneous waveform and ACG–CCG similarity makes it ill-suited for identifying non-random oversplits with high sensitivity.
Together, these results show that the new components of SLAy’s design—specifically the use of AE-based waveform similarity and the thresholding of a linear combination of metrics—enable the automated correction of structured oversplitting with high human-curator alignment across a wide range of datasets. While automating and standardizing unit merging alleviate critical bottlenecks for throughput and reproducibility in large-scale ephys data processing, SLAy’s utility may extend further: by identifying valid merges that human curators miss, SLAy could improve the reliability of spike-sorted recordings and the resulting scientific findings.
Discussion
Correcting oversplitting errors in spike sorting, which is usually a labor-intensive manual process, is critical for analyses of neural population activity, especially in recordings with bursting neurons or substantial probe motion. We developed SLAy to identify and correct these errors in a quantitative and reproducible fashion. SLAy suggests valid merges across a variety of animal models, brain regions, probe geometries and spike sorters.
SLAy likely requires different parameters to perform optimally on a wide range of datasets. Many parameters, specifically those involved in the calculation of the individual SLAy metrics (for example, CCG bin size, RP width), can be set to standardized values for each animal model or brain region. For the remaining parameters, namely the coefficient for the CCG structure metric (k1) and the merging threshold on the final metric, we developed an automatic parameter-tuning procedure that adapts to the specific characteristics of each dataset. Our parameter setting scheme introduces structured simulated oversplitting that mimics the failure modes of template-matching algorithms. We were initially concerned that this might result in the selection of overly conservative parameters, as the spikes in our simulated oversplits were already grouped into a single unit by the spike sorter, and thus may be ‘easier’ to detect than real oversplits. However, we show in practice that SLAy detected all oversplits identified by multiple curators, indicating that the simulated oversplits do yield SLAy metrics similar to those of real oversplits. The fact that Kilosort oversplits some presumed ground-truth neurons but not others (that is, bursting neurons that we artificially oversplit) may be related to the inherent stochasticity in the greedy spike detection process. Nevertheless, we show our automated procedure achieves high alignment with human curators, removing the need for manual adjustment of parameters. Our codebase, available as a pip-installable package, retains support for manual parameter adjustment for users who want to align SLAy’s merges more closely with their own needs.
Depending on the considerations for downstream analyses, users may also want to manually review merges suggested by SLAy rather than accepting them automatically. For example, SLAy corrects a template-matching failure mode where the simultaneous firing of different neuronal subparts, which are recorded on noncontiguous parts of the probe, is split into separate units. Although the co-detection merges suggested by SLAy have high waveform similarity and very large peaks at the centers of the CCG, suggesting that merged subparts almost always fire together, some scientific questions may require analysis of the firing of different neuronal compartments. The full version of SLAy, including the AE-based waveform similarity and automatic parameter selection, can thus run in a semi-automated mode that outputs a list of suggestions for manual review. This approach still saves time compared with traditional manual curation because users would have to review a much smaller list of candidates compared with all pairs of clusters with moderately similar waveforms.
Although few postprocessing tools exist to automatically correct oversplitting, with none widely adopted, similar procedures have been devised for other goals. For example, refs. 30 and 31 use mean waveform metrics and spatial localization of neurons among other metrics to track individual neurons across recordings spanning multiple days. These approaches, although not designed for post-sorting correction of a single spike sorter’s output, share conceptual similarities with SLAy’s methodology.
While other studies have used AEs in electrophysiology, unlike SLAy, they do not use the resulting feature space to compute waveform similarities. For instance, Beau et al. use the latent space of an AE to predict neuronal cell type, but their model only encodes the peak-channel mean waveform32. Information regarding the waveform’s spatial decay and the variability of individual spikes within a unit, while perhaps secondary for cell-type classification, are essential for determining whether two putative units correspond to the same ground-truth neuron. Other approaches, such as Yet Another Spike Sorter[16](https://www.nature.com/articles/s41592-026-03311-7#ref-CR16 "Lee, J. H. et al. YASS: Yet Another Spike Sorter. In 31st Conference on Neural Information Processing Systems (NIPS 2017) https://proceedings.neurips.cc/paper_files/paper/2017/file/1943102704f8f8f3302c2b730728e023-Paper.pdf
(2017)."), use AEs to denoise spike waveforms before clustering; however, as Yet Another Spike Sorter is trained on synthetic data without realistic noise, it can hallucinate spikes in noise\-only snippets and does not use the latent vectors as a comparative feature space. Similarly, DeepInterpolation[33](https://www.nature.com/articles/s41592-026-03311-7#ref-CR33 "Lecoq, J. et al. Removing independent noise in systems neuroscience data using DeepInterpolation. Nat. Methods 18, 1401–1408 (2021).") uses a convolutional AE for denoising but uses residual connections that allow information to bypass the bottleneck, making the resulting encoding unsuitable for feature extraction.
Given that many spike sorters still rely on per-channel PCs as features14,15, the advantages shown by our AE-based features—namely higher explained variance, robustness to jitter in spike time identification and a more accurate representation of spatial decay—suggest a promising new direction. Future research should investigate whether clustering directly within an AE-based feature space can improve the accuracy of spike-sorting algorithms, potentially reducing the burden of post-hoc correction.
Although it is clear that oversplitting can bias single-neuron analyses, it may be argued that population analysis techniques involving dimensionality reduction are robust to oversplitting. In this case, one might assume that split units would be sufficiently correlated to collapse together when performing dimensionality reduction. However, this assumption holds only if oversplitting is completely unbiased, which is generally not true. While SLAy rarely suggests merges that human curators disagree with, previous studies have shown that overmerging biases downstream analysis only if the merged units have strongly anticorrelated firing34. Thus, using SLAy to correct oversplitting can strengthen even population analyses of neural activity. When used alongside automated algorithms for unit quality labeling, SLAy enables fully automated spike-sorting curation—a critical unmet need given the growing scale of ephys recordings. SLAy-L2 has already been integrated into SpikeInterface, and the full version of SLAy, featuring AE-based waveform similarity and automatic parameter tuning, is available as a pip-installable package. The standalone package also supports SpikeInterface objects, making SLAy applicable across a wide range of recording hardware and spike sorters, and compatible with existing data processing pipelines. SLAy ran in <10 min for the largest recording that we tested (410 single units, 60-min recording, benchmarked on an NVIDIA RTX 3080), more than an order of magnitude faster than manual curation.
Methods
Datasets
We applied SLAy to four Neuropixels recordings, each sorted with KS4 and KS2.5:
-
Mouse hippocampus, Neuropixels 2.0: this recording was collected by D. Kim in A. Lee’s lab at the Janelia Research Campus. It was about 60 min long across 384 channels.
-
Male Long–Evans rat insula, Neuropixels 2.0 during a free drinking task: this recording was 60 min long across 384 channels and was collected by A. Lawrence in P. Janak’s lab at Johns Hopkins University.
-
Female macaque midbrain, 128-channel prototype Neuropixels NHP during vestibular stimulation (using an Intan recording system): this recording was 10 min long across 128 channels and was collected by R. Mildren in K. Cullen’s lab at Johns Hopkins University.
-
Macaque motor and premotor cortex, Neuropixels 1.0: this recording is a publicly available recording from B. Pesaran’s lab[27](https://www.nature.com/articles/s41592-026-03311-7#ref-CR27 "Choi, J. et al. Optimal adaptive electrode selection to maximize simultaneously recorded neuron yield. In 34th Conference on Neural Information Processing Systems (NeurIPS 2020) https://proceedings.neurips.cc/paper_files/paper/2020/file/445e1050156c6ae8c082a8422bb7dfc0-Paper.pdf
(2020)."). It was 10 min long across 384 channels.
Processing and spike sorting
For the mouse hippocampus, rat insula and macaque motor cortex recordings, preprocessing and spike sorting were performed using CatGT v4.7 and SpikeInterface. Common average referencing, bandpass filtering and artifact removal were performed using CatGT. Preprocessing for the macaque midbrain data was done using a custom Python script, owing to the incompatibility of CatGT and Intan recording hardware. We then used SpikeInterface to spike-sort each recording with KS2.5 and KS4 and identify single units using quality metric filters.
After sorting, we used SpikeInterface to automatically label units as single-unit, multi-unit or noise. Units were marked as noise if they failed any of the following quality metric tests:
- firing rate > 0.1 Hz
- signal-to-noise ratio > 2.
The remaining units were marked as multi-unit if they had sliding refractory period violations < 0.1, and single unit otherwise.
Manual curation
Manual curation was performed in the SpikeInterface GUI based on the guidelines in the phy practical guide to manual curation (https://phy.readthedocs.io/en/latest/sorting_user_guide/). To avoid considering every single pair of units, the SpikeInterface GUI’s merge panel was used to pre-select units with less than 0.5 normalized L1 difference between mean waveforms. We note that this is substantially higher than the default threshold of 0.25. Only pairs under this threshold were considered further for merging. This general procedure of inspecting only pairs with waveform similarity above a certain threshold is standard practice in manual curation.
AE architecture and training
Architecture
The encoder contains 7 layers: a flattening layer that converts the 8 channels by 40 samples snippet into a 320-dimensional vector, followed by 3 pairs of dense linear + Gaussian error linear unit (GeLu) activation layers. The layer sizes are [320 → 600, 600 → 300, 300 → 15], which produces a 15-dimensional feature vector. The decoder also contains 7 layers, in reverse order: 3 pairs of dense linear + GeLu activation with hidden unit counts [15 → 300, 300 → 600, 600 → 320], followed by an unflattening layer that reshapes the snippet to the original 8 channels by 40 samples shape.
Training
SLAy trains a new network for each dataset using PyTorch. Spike snippets for AE training are extracted from the spike-sorted recordings and consist of the peak + 7 nearest channels, using a window from 10 samples before to 30 samples after the inferred spike time. SLAy extracts a maximum of 1,000 snippets per single unit. Snippets are split into training and testing sets using an 80–20 split, and only the training set is used for model training. The AE training procedure uses an L2 loss function, a batch size of 128, a learning rate of 0.001 and 25 epochs of training for all networks. For the results in the main text, all networks were trained on an NVIDIA 3080 RTX GPU.
Waveform similarity calculation
To calculate the waveform similarities between units, SLAy first calculates the latent feature vector for each spike snippet by passing it through the AE’s encoder and then takes the mean feature vector of each unit as its centroid. For each pair of units, SLAy then calculates the unnormalized Euclidean distance between unit centroids μ**i and μ**j. These distances are normalized by the standard deviations of the units, so that the similarity metric is invariant to distortions in latent space geometry. The raw waveform similarity is thus calculated as
$${\mathrm{sim}}_{ij}=\exp \left(\frac{-\parallel {\mu }_{i}-{\mu }_{j}{\parallel }_{2}}{{\mathrm{std}}_{i}+{\mathrm{std}}_{j}}\right).$$
Exponentiating the negative distance yields a raw similarity between 0 and 1 rather than a distance metric. The raw similarity value quantifies the shape similarity between two waveforms but does not include spatial information. To re-introduce spatial information and penalize similarity between similar waveform shapes on different parts of the probe, SLAy incorporates a spatial decay between peak channels for each unit:
$${\text{decay}}_{ij}=\dfrac{{\text{amp}}_{i,{\text{peak}}_{j}}}{{\text{amp}}_{i,{\text{peak}}_{i}}},$$
where \({\text{amp}}_{i,{\text{peak}}_{j}}\) is unit i’s mean amplitude on unit j’s peak channel. If the peak channels are far apart, \({\text{amp}}_{i,{\text{peak}}_{j}}\) and decayi**j will be close to 0. If the peak channels are the same (\({\text{amp}}_{i,{\text{peak}}_{j}}=am{p}_{i,{\text{peak}}_{i}}\)) or the two units have different, nearby peak channels due to noise but decay very little across channels, the decay metric will be close to 1. To calculate the final waveform similarity metric, SLAy penalizes the raw waveform similarity using the calculated decay values:
$${\sigma }_{ij}={\text{sim}}_{ij}\times \sqrt{{\text{decay}}_{ij}\times {\text{decay}}_{ji}}.$$
After calculating the waveform similarities, only unit pairs with a similarity greater than a threshold (0.4 by default) are considered for merging, and the rest are assumed to not be oversplit. This filtering step considerably improves the runtime of SLAy by avoiding computationally expensive CCG calculations for dissimilar units.
CCG structure metric
SLAy computes CCGs using the multithreaded, accelerated SpikeInterface implementation. For the datasets in the paper, we used a window size of 50 ms and a bin width of 0.5 ms. To calculate the CCG structure metric, a window of interest is selected by applying a trough-finding algorithm to the smoothed second derivative of the CCG. The identified troughs in the second derivative correspond to the locations of the sharp changes in the CCG, so the window of interest is taken as 1.5 times the distance from the CCG center to the most central set of troughs. If the CCG does not have a high enough event rate in the window of interest (defined by an adjustable threshold), the window is expanded to 1.5 times the subsequent trough location until the CCG has an acceptable event rate in the window of interest. The CCG structure metric is then calculated as the EMD between the windowed CCG and a uniform distribution divided by a scaling factor of 0.25. The scaling factor of 0.25 corresponds to the unnormalized EMD between a single peak at the center of the CCG and a uniform distribution, which provides a reasonable upper bound on the EMD for a unit pair. If the window based on the furthest set of troughs still has an event rate that is too low, the metric is penalized by the squared ratio between the observed event rate and the minimum allowed event rate. The window sizes and bin widths specified above are the default values, but all values are user-adjustable.
RP violation calculation
RP violations are computed using 2-s window CCGs calculated in the same manner as above. Candidate RPs range from 0.5 ms to 10 ms (user-adjustable). To calculate the sliding RP violation metric, first the baseline CCG event rate is computed as the maximum of the low-pass filtered CCG, and the maximum allowed event rate during the RP is taken to be a fraction (0.15 by default) of the baseline. Assuming a Poisson distribution with λ equal to the maximum allowed refractory event rate, the refractory penalty for each RP width is computed as the probability of observing RP violations less than or equal to the actually observed violation counts. If the observed number of violations is small compared with the allowed violations, the penalty will be small. If the observed number of violations is large compared with the allowed violations, the penalty will be large. The final sliding RP violations metric is the minimum penalty across all tested RP widths.
Merging process
SLAy’s final merge decision metric, \({{\mathcal{M}}}_{ij}\), integrates the above metrics to determine whether to merge units:
$${{\bf{{\mathcal{M}}}}}_{{\bf{ij}}}={\sigma }_{ij}+{k}_{1}{\rho }_{ij}-{k}_{2}{\zeta }_{ij},$$
where σij, ρij and ζij are the waveform similarity metric, cross-correlation structure metric and RP penalty, respectively. k1 and k2 are coefficients ≤ 1 that control the relative importance of the metrics. To perform merges, the unit pairs are sorted by \({{\mathcal{M}}}_{ij}\) in descending order and iterated over. If \({{\mathcal{M}}}_{ij}\) is greater than a threshold and both units in the pair have not already been merged with other units, SLAy merges them. If \({{\mathcal{M}}}_{ij}\) is greater than the threshold but one of the units has already been merged into a new unit, there is a potential multi-way merge. SLAy performs the multi-way merge only if all pairwise merges between constituent units have an \({{\mathcal{M}}}_{ij}\) greater than the threshold.
The pseudocode for the full SLAy algorithm is in Supplementary Note 1.
Simulated oversplitting
For each of the four error types described below, the splitting procedure first identifies a pool of suitable candidate units and then randomly selects a number of these candidates to be split. The ratio of each type of split is equal. To ensure that the split units matched the quality of existing single units, the procedure re-applies single-unit quality filters to the candidate splits and only performs the splits that would result in units that pass all quality filters. Because of this, the percent of units split differs between datasets. To generate error bars for recall and percent of total units merged, we repeated this entire procedure five times for each dataset in the paper.
Burst splitting
To simulate oversplitting due to bursting, the splitting procedure first identifies candidate units where at least 30% of their ISIs were less than 20 ms. Within these units, a burst is defined as a sequence of 3 or more spikes with ISIs under 20 ms. To ensure that the resulting units were sufficiently large for analysis, only units where the total number of bursting spikes is greater than 300 are included as candidates. Each selected unit is split into two new units: the first contains all non-bursting spikes and the spikes from the first half of each burst, while the second contains only the spikes from the second half of each burst.
Amplitude splitting
Earlier versions of Kilosort penalized the variance of the amplitude distribution of each unit and thus oversplit units with highly variable spike amplitudes. To model errors from high amplitude variance, the splitting procedure identifies candidate units whose amplitude variance is between the 75th and 95th percentile of the distribution for that recording. This targets high-variance units while excluding extreme outliers that may have resulted from overmerging errors. For each selected unit, the procedure chooses a random split_ratio between 30% and 50% and assigns the split_ratio of spikes with the highest amplitudes to a new unit.
Drift splitting
To simulate oversplitting due to probe drift, the splitting procedure uses a time-dependent splitting probability defined by a three-part piecewise linear function. The probability of being assigned to the new unit ramps from 0 to 0.1 over the first 40% of the recording, from 0.1 to 0.9 over the middle 20% and from 0.9 to 1.0 over the final 40%. As candidates for this split, the procedure selects units that are active throughout the recording, defined as having at least 30% of their spikes in each half of the recording. For each selected unit, the procedure iterates through its spikes and assigns a spike to the new unit if a randomly sampled number is less than the splitting probability at that spike’s time.
Random splitting
To simulate random oversplitting, the splitting procedure marks all units that pass the noise and multi-unit criteria as candidates. For each unit selected to be oversplit, the procedure selects a random split ratio of spikes between 30% and 50% and randomly assigns that percentage of spikes to a new unit.
Automatic parameter selection
The SLAy algorithm incorporates the automatic parameter selection scheme described in the main text. The scheme fixes k2 = 1 and evaluates the recall and percent of total units merged for the parameter grid (that is, all possible combinations of each parameter) over k1 and the threshold for the final metric:
- k1 = 0.25–0.55, in steps of 0.05.
- merge threshold = 0–0.75, in steps of 0.05.
For the results in the paper, we also applied the automatic parameter selection to the SC algorithm, searching over a grid of thresholds for waveform difference and ACG–CCG difference:
- waveform difference threshold = 0.0–1.0, in steps of 0.05
- ACG–CCG difference threshold = 0.0–1.0, in steps of 0.05.
The default parameters in SpikeInterface for the SC are waveform difference threshold = 0.25 and ACG–CCG difference threshold = 0.16.
Supplementary Tables 5–7 show the parameter selected for each algorithm on each dataset.
Testing sensitivity to AE and simulated oversplitting random seeds
To assess SLAy’s sensitivity to randomness in both AE training and the simulated oversplits used for automatic parameter selection, we ran SLAy on two datasets, the monkey motor cortex sorted with KS2.5 and with KS4. For each dataset, we trained AEs using five different random seeds—this affected both the initial weights of the AE and the dataloader used during training, that is, the sequence of training examples during training. For each pair of different AEs on each dataset, we calculated the Pearson’s correlation between the pairwise unit similarities computed using each AE’s latent space. These are reported in Supplementary Tables 1 and 2.
We then tested the sensitivity of the autoselected parameters to the random seed used in artificial split generation, which affects which units are split, the type of split applied to each unit, and for the random and drift splits, which new unit each spike in a unit was assigned to. For each of the 5 AEs above, we ran SLAy with 5 different simulated oversplitting seeds, for a total of 25 different runs per dataset. The automatically selected parameters for each run are reported in Supplementary Tables 3 and 4. We also examined the variability of the suggested merges across runs. For both datasets tested, all 25 runs produced the exact same set of merges.
Significance tests for performance on simulated oversplitting
For the statistical significance of algorithms’ performance on simulated oversplitting, we averaged the recall across draws for each dataset to get a vector of eight mean recalls for each method (one mean recall per recording–sorter combination). We performed one-sided paired t-tests for each pair of methods (SLAy > SC-auto, SLAy > SC, SC-auto > SC) with Holm–Bonferroni correction for multiple comparisons. We verified that the distribution of differences for each pair of methods was symmetric without outliers, making the paired t-test suitable.
Burst detection
To detect bursts in spike trains, we developed the expectation-maximization (EM)–Kleinberg model, an extension of a model used to identify bursts in text streams29. The original model is a generative HMM that assumes that the system is in one of a few hidden states, each of which is associated with Poisson emissions at a certain firing rate. Each HMM state i**k is parameterized by a Poisson rate a**k ≥ a0s**k that governs the distribution of ISIs, where a0 is the neuron’s overall average firing rate and s > 1 is a multiplicative scaling factor that controls how much the firing rate increases between HMM states. The ‘states’ here are simply a modeling choice to adequately capture the statistics of the observed ISIs and do not necessarily correspond to actual biophysical states of a neuron. We use a method from the original algorithm29 to pre-calculate the number of HMM states based on s, the length of the spike train and minimum observed ISI.
A period of intensity k is defined as an interval where the neuron’s state is ≥i**k. Transitioning to less active states (that is, a lower intraburst firing rate) has no cost, while transitioning to a more active state has a cost proportional to the number of skipped states. The state sequence is inferred by minimizing a cost function that includes the transition cost and the negative log-likelihood of the observed ISI given the underlying state. The bursts are then identified by designating states above a user-defined firing rate as bursting states. We find that initializing with s = 3 and designating firing rates higher than 50 Hz work well for neuronal spike trains. The original algorithm fixes the Poisson rates at a**k = a0s**k, while we initialize the rates using s but then estimate the rates during optimization using EM, with the constraint a**k ≥ a0s**k.
The first step of the EM process is similar to the optimization in the original model; it uses the forward–backward algorithm to estimate the optimal state sequence given the firing rates of each state and the observed ISIs. The M step then uses a maximum likelihood estimator to update the estimated firing rates of each state given the inferred state sequence. Although it is typical to run EM-algorithms until the likelihood converges, we instead minimize runtime by stopping inference after five iterations.
To assess the performance of our burst detection algorithm, we generated simulated spike trains with a wide variety of firing statistics35 (Supplementary Fig. 4c) and compared our algorithm’s performance with those of three existing methods: MaxInterval (http://www.neuroexplorer.com/downloads/NeuroExplorerManual.pdf), logISI36 and the original HMM algorithm29. The Kleinberg and EM–Kleinberg algorithms were implemented in Python using parameters s = 5 and γ = 0.3, designating states ≥2 as bursty states. On spike trains consisting of only bursts, our algorithm achieves near-perfect classification accuracy (burst versus non-burst) regardless of the burst length or intra-burst frequency (Supplementary Fig. 4b). The MaxInterval and logISI methods achieve near-perfect classification on two out of three of the simulated spike trains, while the original Kleinberg HMM algorithm achieves near-perfect accuracy on one simulation and moderate accuracy on the other two. Our algorithm also outperforms the others on simulated spike trains containing both bursts and single spikes.
We applied this burst detection algorithm before and after automatic merges performed by SLAy to illustrate the importance of unit merging for downstream analysis.
Reporting summary
Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.
Data availability
The monkey motor cortex dataset is from an existing publication[27](https://www.nature.com/articles/s41592-026-03311-7#ref-CR27 "Choi, J. et al. Optimal adaptive electrode selection to maximize simultaneously recorded neuron yield. In 34th Conference on Neural Information Processing Systems (NeurIPS 2020) https://proceedings.neurips.cc/paper_files/paper/2020/file/445e1050156c6ae8c082a8422bb7dfc0-Paper.pdf
(2020).") and is publicly available at <https://codeocean.com/capsule/4337586/tree/v1>. The recording used in our paper is the rec\_bank0\_dense recording. The remaining Neuropixels recordings are high\-dimensional and large but are available from the corresponding authors upon reasonable request.
Code availability
Code and documentation for SLAy are available at https://github.com/saikoukunt/SLAy under a GNU GPL v3 license. SLAy-L2 has also been incorporated into the SpikeInterface package.
References
- Jun, J. J. et al. Fully integrated silicon probes for high-density recording of neural activity. Nature 551, 232–236 (2017).
- Steinmetz, N. A. et al. Neuropixels 2.0: a miniaturized high-density probe for stable, long-term brain recordings. Science 372, abf4588 (2021).
Article Google Scholar 3. Trautmann, E. M. et al. Large-scale high-density brain-wide neural recording in nonhuman primates. Nat. Neurosci. 28, 1562–1575 (2025). 4. Stringer, C. et al. Spontaneous behaviors drive multidimensional, brainwide activity. Science 364, eaav7893 (2019).
Article CAS Google Scholar 5. Leonard, M. K. et al. Large-scale single-neuron speech sound encoding across the depth of human cortex. Nature 626, 593–602 (2024).
Article CAS PubMed Google Scholar 6. Steinmetz, N. A., Zatka-Haas, P., Carandini, M. & Harris, K. D. Distributed coding of choice, action and engagement across the mouse brain. Nature 576, 266–273 (2019). 7. Bondy, A. G. et al. Multi-region coordination of evidence accumulation and decision commitment in the brain. Preprint at bioRxiv https://doi.org/10.1101/2024.08.21.609044 (2026). 8. Gardner, R. J. et al. Toroidal topology of population activity in grid cells. Nature 602, 123–128 (2022).
Article CAS PubMed Google Scholar 9. Low, I. I. C., Williams, A. H., Campbell, M. G., Linderman, S. W. & Giocomo, L. M. Dynamic and reversible remapping of network representations in an unchanging environment. Neuron 109, 2967–2980.e11 (2021).
Article PubMed PubMed Central Google Scholar 10. Gray, C. M., Maldonado, P. E., Wilson, M. & McNaughton, B. Tetrodes markedly improve the reliability and yield of multiple single-unit isolation from multi-unit recordings in cat striate cortex. J. Neurosci. Methods 63, 43–54 (1995).
Article CAS PubMed Google Scholar 11. Harris, K. D., Henze, D. A., Csicsvari, J., Hirase, H. & Buzsáki, G. Accuracy of tetrode spike separation as determined by simultaneous intracellular and extracellular measurements. J. Neurophysiol. 84, 401–414 (2000).
Article CAS PubMed Google Scholar 12. Rodriguez, A. & Laio, A. Machine learning. Clustering by fast search and find of density peaks. Science 344, 1492–1496 (2014).
Article CAS PubMed Google Scholar 13. Rossant, C. et al. Spike sorting for large, dense electrode arrays. Nat. Neurosci. 19, 634–641 (2016). 14. Pachitariu, M., Sridhar, S., Pennington, J. & Stringer, C. Spike sorting with Kilosort4. Nat. Methods 21, 914–921 (2024).
Article CAS PubMed Google Scholar 15. Yger, P. et al. A spike sorting toolbox for up to thousands of electrodes validated with ground truth recordings in vitro and in vivo. Elife 7, e34518 (2018).
Article PubMed PubMed Central Google Scholar 16. Lee, J. H. et al. YASS: Yet Another Spike Sorter. In 31st Conference on Neural Information Processing Systems (NIPS 2017) https://proceedings.neurips.cc/paper_files/paper/2017/file/1943102704f8f8f3302c2b730728e023-Paper.pdf (2017). 17. Mallat, S. G. & Zhang, Z. Matching pursuits with time-frequency dictionaries. IEEE Trans. Signal Process. 41, 3397–3415 (1993).
Article Google Scholar 18. Boussard, J. et al. DARTsort: a modular drift tracking spike sorter for high-density multi-electrode probes. Preprint at bioRxiv https://doi.org/10.1101/2023.08.11.553023 (2023). 19. Cohen, M. R. & Kohn, A. Measuring and interpreting neuronal correlations. Nat. Neurosci. 14, 811–819 (2011). 20. Gauthier, J. L. et al. Detecting and correcting false transients in calcium imaging. Nat. Methods 19, 470–478 (2022). 21. Inan, H., Erdogdu, M. A. & Schnitzer, M. In 31st Conference on Neural Information Processing Systems (NIPS 2017) https://papers.nips.cc/paper_files/paper/2017/file/e449b9317dad920c0dd5ad0a2a2d5e49-Paper.pdf (2017). 22. Fabre, J. M. J., van Beest, E. H., Peters, A. J., Carandini, M. & Harris, K. D. Bombcell: automated curation and cell classification of spike-sorted electrophysiology data. Zenodo https://doi.org/10.5281/zenodo.8172821 (2023). 23. International Brain Laboratory et al. Reproducibility of in vivo electrophysiological measurements in mice. Elife 13, RP100840 (2025). 24. Wood, F., Black, M. J., Vargas-Irwin, C., Fellows, M. & Donoghue, J. P. On the variability of manual spike sorting. IEEE Trans. Biomed. Eng. 51, 912–918 (2004).
Article PubMed Google Scholar 25. Chen, S. et al. Brain-wide neural activity underlying memory-guided movement. Cell 187, 676–691.e16 (2024).
Article PubMed PubMed Central Google Scholar 26. Melin, M. D. et al. Large scale, simultaneous, chronic neural recordings from multiple brain areas. Preprint at bioRxiv https://doi.org/10.1101/2023.12.22.572441 (2024). 27. Choi, J. et al. Optimal adaptive electrode selection to maximize simultaneously recorded neuron yield. In 34th Conference on Neural Information Processing Systems (NeurIPS 2020) https://proceedings.neurips.cc/paper_files/paper/2020/file/445e1050156c6ae8c082a8422bb7dfc0-Paper.pdf (2020). 28. Bao, C. & Charles, A. Comparing spike sorting algorithms on simulated extracellular multi-electrode array recordings. In 2023 IEEE International Conference on Bioinformatics and Biomedicine (eds Jiang, X. et al.) 3280–3287 (IEEE, 2023). 29. Kleinberg, J. Bursty and hierarchical structure in streams. In Proc. Eighth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (eds Hand, D. et al.) 91–101 (Association for Computing Machinery, 2002). 30. Yuan, A. X. et al. Multi-day neuron tracking in high-density electrophysiology recordings using earth mover’s distance. Elife 12, RP92495 (2024).
Article PubMed PubMed Central Google Scholar 31. van Beest, E. H. et al. Tracking neurons across days with high-density probes. Nat. Methods 22, 778–787 (2024).
Article PubMed PubMed Central Google Scholar 32. Beau, M. et al. A deep learning strategy to identify cell types across species from high-density extracellular recordings. Cell 188, 2218–2234 (2025). 33. Lecoq, J. et al. Removing independent noise in systems neuroscience data using DeepInterpolation. Nat. Methods 18, 1401–1408 (2021). 34. Trautmann, E. M. et al. Accurate estimation of neural population dynamics without spike sorting. Neuron 103, 292–308.e4 (2019).
Article PubMed PubMed Central Google Scholar 35. Cotterill, E., Charlesworth, P., Thomas, C. W., Paulsen, O. & Eglen, S. J. A comparison of computational methods for detecting bursts in neuronal spike trains and their application to human stem cell-derived neuronal networks. J. Neurophysiol. 116, 306–321 (2016).
Article PubMed PubMed Central Google Scholar 36. Pasquale, V., Martinoia, S. & Chiappalone, M. A self-adapting approach for the detection of bursts and network bursts in neuronal cultures. J. Comput. Neurosci. 29, 213–229 (2010).
Acknowledgements
We thank D. Kim of Pohang University of Science and Technology, A. Lee of Harvard University and P. Janak of Johns Hopkins University for allowing us to use their Neuropixels recordings to test and validate SLAy.
Funding
S.K., A.C., A.R.G. and T.D.H. were supported by NIH grant NIH U01NS115587. A.S.C. was partially supported by NSF CAREER award 2340338. A.L. was supported by NIH R01AA031609 and NIH R01AA027213. R.M. was supported by the Kavli Neuroscience Discovery Institute Distinguished Postdoctoral Fellowship and the Natural Sciences and Engineering Postdoctoral Fellowship. This work was supported by the National Institutes of Health/National Institute on Deafness and Other Communication Disorders (R01-DC002390 and R01-DC018061) to K.E.C.
Ethics declarations
Competing interests
The authors declare no competing interests.
Peer review
Peer review information
Nature Methods thanks Alessio Buccino and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Primary Handling Editor: Nina Vogt, in collaboration with the Nature Methods team.
Additional information
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Extended data
Extended Data Fig. 1 Per-dataset performance on simulated oversplitting.
(a) Recall on simulated oversplitting for SLAy (blue), similarity-correlograms (SC, orange), and SC with autoselected parameters (SC-auto, red), broken down by recording and Kilosort version. Error bars show the 95% confidence interval across five independent draws of simulated oversplitting. (b) Ratio of units merged by each algorithm to the total number of split units (artificial and curator-identified). Bars show means across five draws; error bars show 95% confidence interval.
Extended Data Fig. 2 Per-dataset comparison of automated merging algorithms to human curators.
(a) Recall (top; percent of human curator merges recovered by each algorithm) and precision (bottom; percent of algorithm merges agreed with by a human curator) for each merging algorithm on each dataset. Improved precision for merges validated by a human curator during post-hoc blinded examination is shown as a hatched bar. Asterisks indicate no merges were suggested by the algorithm for that dataset. (b) Venn diagrams showing the overlap in merges between each algorithm and two human curators for each KS4 recording. Numbers denote the total number of merges in each section.
Extended Data Fig. 3 Per-dataset comparison of automated merging algorithms to human curators on Kilosort 2.5 datasets.
Venn diagrams showing the overlap in merges between each algorithm and the single human curator for each KS2.5 recording. Numbers denote the total number of merges in each section.
Extended Data Fig. 4 SLAy accounts for biophysical waveform changes.
SLAy merges two units in the mouse hippocampus recording that were oversplit by Kilosort 2.5 due to bursting-related wave- form changes. (a) The mean waveforms for the two units show clear visible differences (colored traces), though the distributions of individual spikes (shaded regions) overlap slightly between units. (b) A salient burst in the recording was split into two different units. The first two spikes from the recording were assigned by Kilosort to unit 6 (red), and the last spike in the burst had a wider waveform shape, causing it to be assigned to unit 3 instead (blue). (c) The cross-correlogram has a highly peaked and asymmetric shape, characteristic of an oversplit bursting neuron.
Extended Data Fig. 5 SLAy identifies oversplit units that human curators initially missed.
Two example unit pairs that SLAy flagged for merging. Human curators missed these initially, as the pairs did not pass the curation GUI’s initial L1 similarity screening step, but a blinded human curator agreed with the merges post-hoc. (a) Mean waveforms for the units in merge 1, plotted separately (left) and overlapped (right). Shading shows distribution of individual spike waveforms. (b) Auto- and cross-correlograms for the units in merge 1, showing a large central peak, consistent with a co-detected spikes error, and asymmetry, consistent with an oversplit burst neuron. (c) Example voltage traces with colored dots showing the detected spike times for each unit. Within a single burst, some spikes are detected with both units’ templates, some with only one, and some with only the other. (d-f) Same as (a-c) for another merge pair found by SLAy but missed by human curators, with similar characteristics to the first.
Supplementary information
Supplementary Information (download PDF )
Supplementary Note 1, Tables 1–7 and Figs. 1–9.
Reporting Summary (download PDF )
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Koukuntla, S., DeWeese, T., Cheng, A. et al. SLAy-ing oversplitting errors in high-density electrophysiology spike sorting. Nat Methods (2026). https://doi.org/10\.1038/s41592\-026\-03311\-7
- Received: 09 July 2025
- Accepted: 09 October 2026
- Published: 01 December 2026
- Version of record: 01 December 2026
- DOI: https://doi.org/10\.1038/s41592\-026\-03311\-7
Share this article
Anyone you share the following link with will be able to read this content:
Sorry, a shareable link is not currently available for this article.
Provided by the Springer Nature SharedIt content-sharing initiative
出处
- S 官方Nature Methods · RSS阅读原文 ↗
SLAy-ing oversplitting errors in high-density electrophysiology spike sorting
生成时使用了正文节选。