Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Clustering brainstorm: speed and hard-to-find waveforms

Session 2026-10-28. The ideas, scores and verdicts below are the brainstorm’s proposals, not findings; scores are decision aids. What was built afterwards, and how it measured, is in the decision log.

Focal question. Which new Sorrel features would make re-clustering much faster and recover units or spikes that Kilosort 4 leaves behind? The target cases are low-amplitude units, units buried in MUA or noise, overlapping spikes, units split by drift, bursting units and sparse units.

Participants (all AI).

IDRoleModelStage
P01Statistics / ML algorithmsOpusindependent
P02GPU / systemsOpusindependent
P03Curator workflowHaikuindependent
P04Cross-field transferHaikuindependent
R1Adversarial review and raterOpusreview
R2Blind raterHaikureview
L1Prior-art check (web search)Haikuevidence
P05Post-evidence ideationHaikupost-check

Round 1 produced 44 ideas, grouped into 11 clusters by mechanism. No human participant generated or rated ideas. That is the main missing perspective.

Main result

Most recall ideas share one unmet prerequisite, so they should be ordered by dependency, not by score.

  1. Sorrel cannot yet do residual work correctly. It never loads whitening_mat*.npy, spike_positions.npy or the KS4 drift shifts. The templates live in whitened, drift-corrected space, but the trace mmap is raw. Every subtraction or matched-filter idea (C1, C2, C3, C7) is therefore wrong until those files are loaded. (Located evidence: grep of crates/, verified by the facilitator.)
  2. Kilosort 4 already runs template pursuit and resolves most collisions. A native Sorrel detector only adds value below KS4’s threshold, and false positives concentrate there. So every detector must beat a simple baseline first: rerunning KS4 on a channel and time window with a lower threshold.
  3. Recall cannot be measured without hybrid injection (C8). Injection comes first, because it is how the gate below gets checked.
  4. Sorrel’s unique advantage as a curator is the human in the loop, the journal of decisions, interactive views and the ability to compare sorters. The strongest new ideas from the post-evidence round (P05) use these, not raw signal processing.

Gate (applies outside the scores). A recall feature may only emit journaled proposals the curator reviews, each with a null or false-positive estimate. Nothing applies automatically. This rules out “batch-accept p > 0.95” and “auto-accept the tail” (C9) as originally proposed.

Proposed sequence (facilitator proposal, not a decision)

StepWhatWhy firstSmallest check
0Instrumentation: per-operation timestamps and view dwell time in the journal (R1-new-5)Speed claims must be measured, not assertedReplay a journal and report the median time per decision
1Mergeable statistics and per-cluster cache keys (P02-02)Exact, low-risk speed win. Today every cache key includes journal_head, so any edit invalidates everythingFixture assert that CCG(A∪B) = ACG(A) + ACG(B) + CCG(A,B) + CCG(B,A); measure latency after a merge
2Load whitening, spike positions and drift shifts (R1-new-1)Prerequisite for C1, C2, C3 and C7Whitened mean snippet matches templates.npy for a unit
3Virtual hybrid injection (C8) through a DataProvider wrapper; never write to the .datMeasures recall; calibrates C1/C2 thresholds3 templates at 3 amplitudes are recovered by the mean-snippet shader
4Cheap recall and precision proposals: drift-aware amplitude_cutoff per time bin (R1-new-4); ambiguous-assignment proposals from template_features.npy (R1-new-3); burst-aware split test (P01-04) with connection tagging (P05-02)Reuse existing code; show where spikes are lost before building detectorsCount GMM split suggestions that disappear after regressing amplitude on ISI
5Drift-fragment merge score (P01-03)Highest-scoring recall cluster; pairwise and reversibleCurator blind-rates the top 20 pairs against 20 random pairs
6Detectors on the residual (C1, then C2), compared against a KS4 window rerun (R1-new-2), after the template-error vs unexplained triage (P05-01)Only worthwhile if they beat the baseline under injectionAt 0.5–1× threshold, the injected-spike recall of the Sorrel peel exceeds the KS4 rerun

Cluster scores

Two raters (R1, R2) scored each cluster independently from 1 to 5, using criteria and weights fixed before scoring:

CriterionWeight
recall0.25
speed0.20
verifiable0.15
feasibility0.15
safety0.15
novelty0.10

Each cell is the mean of the two raters. The interval spans the widest low and high either rater gave. The ranking was computed by the skill’s evaluate_matrix.py with ±20% one-at-a-time weight sensitivity.

ClusterBest memberScore [interval]Rank rangeR1 verdictPrior art (L1)
C11 Interactive speedP02-02 mergeable statistics51 [33–66]1–2advance P02-02 onlymixed
C4 Drift-fragment stitchingP01-03 shifted template × complementary presence51 [25–75]1–2advance P01-03 onlymixed (DARTsort, SpikeSift)
C10 Cross-session priorsimport UnitMatch output46 [24–71]3–4revise: import, don’t rebuildsupport (UnitMatch)
C9 Learning from the curatorP01-06 in-session active learning45 [23–68]3–4revise: drop auto-acceptmixed (UnitRefine)
C8 Hybrid injectionvirtual DataProvider overlay42 [30–58]5–7advance first (enabler)support (SI hybrid)
C5 Burst-aware split/mergeP01-04 amplitude~ISI regression41 [18–61]5–7advance (cheap)mixed (SLAy)
C1 Residual matched filterP01-01 + second-best-template margin40 [21–68]5–7revisemixed (KS4)
C2 New units from residualP03-02 lasso-scoped re-threshold38 [13–69]8–9revise; split off P03-02challenge (none located)
C3 Collision recoveryP02-10 refit only at CCG dips37 [15–66]8–9parksupport (KS4, binary pursuit)
C6 MUA density re-clusteringP01-08 recursive dip on computed PCs34 [10–68]10advance P01-08; park P01-11mixed (ISO-SPLIT)
C7 Sparse unitsP03-07 with held-out templates31 [3–58]11revise; park P04-04search incomplete

How to read this. The ranking is fragile. Every interval overlaps the others, and 9 of 11 clusters change rank under weight perturbation. The formula is compensatory, so recall clusters score low because of false-discovery risk, even though recall is half of the question. Use the verdicts and the dependency order, not the numbers.

Where the raters disagree (gap of one point or more):

ClusterCriteriaR1 vs R2
C6speed, verifiable, feasibility, safetyR1 higher on each: computed PCs make it testable
C3recall, noveltyR1 lower
C4safetyR1 higher
C10feasibilityR1 lower
C7verifiableR1 lower: double-dipping
C8safetyR1 higher

Adversarial findings (R1)

  • C1, C2: recovered spikes may belong to a neighbouring unit, and residual hotspots near large units are probably template error. Mitigations: require a margin over the second-best template; reject candidates with a zero-lag CCG peak against the parent unit; run P05-01’s refit test before hunting.

  • C4: KS4 templates are already drift-corrected, so shifting by Δz corrects twice. Fragments only appear where nonrigid drift is left over.

  • C5: an asymmetric 3–15 ms CCG is also the signature of a monosynaptic connection. Merging such a pair is a silent error (P05-02 addresses this).

  • C7: building a template from fewer than 100 spikes and scoring those same spikes is circular. Build on half A, score half B.

  • C9: speed gains may just mean the curator stopped looking (automation bias). Learning within a session and learning across sessions rest on different assumptions.

  • C11: a 1% reservoir (P02-11) cuts coincident pair counts by about 10⁴, which makes ACG and refractory-violation views meaningless. Refractory metrics must stay exact.

  • Attractive mainly because of the technology:

    IdeaMethod
    P01-11contrastive embedding
    P04-07LSH (a 1000² similarity matrix is trivial)
    P04-08SPRT (Sorrel does not assign spikes)
    P04-05kernel differencing
    P04-10sticky HMM

    Several P04 items rename existing methods: successive interference cancellation is matching pursuit, CFAR is a MAD threshold, and network coincidence is a multichannel template.

Ideas added after the evidence check

IDIdeaTarget
R1-new-1Load whitening, spike_positions.npy and KS4 drift shiftsprerequisite
R1-new-2KS4 rerun on a channel/time window at lower threshold, through the sorrel auto sidecar, as the baselinerecall (baseline)
R1-new-3Reassignment proposals for spikes whose best and second-best templates are closeprecision
R1-new-4amplitude_cutoff per time bin: which units lose spikes, and whenrecall (diagnosis)
R1-new-5Decision-time telemetry in the journalmeasuring speed
P05-01Triage residual hotspots into template error (refit with gain/shift) vs unexplainedprecision
P05-02Tag stable-latency, spatially disjoint asymmetric-CCG pairs as putative connections; block mergesprecision
P05-03Second sorter through the sidecar; queue only units the sorters disagree onrecall
P05-04Calibrate merge thresholds on the journal’s merge/reject history (selection-biased sample)precision, speed
P05-05“Stop here” line in the queue from journaled yield per minute; rare-unit flags bypass itspeed

Parked

IdeaReason
C3 collision refitMeasure the zero-lag CCG deficit on 3 KS4 sorts first; close it if under 5%
P01-11 contrastive embeddingNeeds a training stack and its own validation
P04-04 track-before-detectNo supporting evidence located
P04-05, P04-06, P04-10Heavy models for a problem a pairwise score covers
P02-11 approximate viewsBreaks exact refractory metrics
P04-07, P04-08No problem to solve at Sorrel’s scale
P02-12 compute on the remote hostRevisit once a remote GPU workload exists

Citations

L1 checked these with web search only and opened no pages. These corrections apply before anything is cited:

  • Pillow et al. 2013, PLoS One 8:e62123: authors are Pillow, Shlens, Chichilnisky and Simoncelli.
  • Chung et al. 2017, Neuron 95:1381: the title is “A Fully Automated Approach to Spike Sorting”. ISO-SPLIT is a separate Magland & Barnett paper.
  • Boussard et al. 2021, NeurIPS: “Three-dimensional spike localization and improved motion correction for Neuropixels recordings”.
  • Rossant et al. 2016, Nat. Neurosci.: hybrid ground truth was not confirmed in this paper. It is attributed to Pachitariu et al. 2016 (KiloSort, NeurIPS).
  • YASS: Lee et al. 2017, NeurIPS / bioRxiv 151928. The 2020 version is an extension.
  • DREDge: Windolf et al., Nat. Methods 2025. The DOI comes from a search summary only.

Verified as cited:

WorkVenue
Kilosort4Nat. Methods 2024
UnitMatchNat. Methods 2024
CEEDNeurIPS 2023
SpikeForesteLife 2020
Shelly 2007Nature
Yoon 2015Sci. Adv.
Alard & Lupton 1998ApJ
Adams & MacKay 2007arXiv
VBxCSL 2022
Fee 1996J. Neurosci. Methods
Hellerstein 1997SIGMOD
Bansal 2004Mach. Learn.

Not finding prior art in a bounded search does not show that an idea is novel.

Decision log

  • 2026-10-28: the user chose in-place spike addition. Implemented W1–W5 from the plan; KS4 whitening I/O, collision refit, active learning, UnitMatch import and the other pruned items were dropped as low value. New units from the residual are deferred.
  • Results:
    • incremental suggestions 5.7× faster;
    • rescue verified end to end on a CINPLA KS2 copy: 661 spikes added, phylib loads the result, arrays aligned;
    • hybrid recall varies by unit (see usage/rescue.md).
  • Open:
    • choice of null (channel shift vs sign flip);
    • low feature-calibration R²;
    • a labelled Neuropixels KS4 sort for real recall.