PT - JOURNAL ARTICLE AU - Pachitariu, Marius AU - Sridhar, Shashwat AU - Stringer, Carsen TI - Solving the spike sorting problem with Kilosort AID - 10.1101/2023.01.07.523036 DP - 2023 Jan 01 TA - bioRxiv PG - 2023.01.07.523036 4099 - http://biorxiv.org/content/early/2023/01/07/2023.01.07.523036.short 4100 - http://biorxiv.org/content/early/2023/01/07/2023.01.07.523036.full AB - Spike sorting is the computational process of extracting the firing times of single neurons from recordings of local electrical fields. This is an important but hard problem in neuroscience, complicated by the non-stationarity of the recordings and the dense overlap in electrical fields between nearby neurons. To solve the spike sorting problem, we have continuously developed over the past eight years a framework known as Kilosort. This paper describes the various algorithmic steps introduced in different versions of Kilosort. We also report the development of Kilosort4, a new version with substantially improved performance due to new clustering algorithms inspired by graph-based approaches. To test the performance of Kilosort, we developed a realistic simulation framework which uses densely sampled electrical fields from real experiments to generate non-stationary spike waveforms and realistic noise. We find that nearly all versions of Kilosort outperform other algorithms on a variety of simulated conditions, and Kilosort4 performs best in all cases, correctly identifying even neurons with low amplitudes and small spatial extents in high drift conditions.Competing Interest StatementThe authors have declared no competing interest.