HP-GSBS: Accelerating greedy state boundary search with reusable interval statistics
Greedy State Boundary Search (GSBS) identifies transitions between relatively stable neural activity patterns, but repeated candidate evaluation makes large analyses expensive. HP-GSBS is an open-source Python package that reorganizes the search around reusable interval contributions and correlation statistics. Streaming candidate reduction and local refinement further reduce repeated work; CPU, PyTorch CUDA and Triton backends share sequential segmentation decisions. Across seven controlled workloads with two realizations each, median same-input speedups range from 154 to 1730 times. All 168 optimized executions reproduce original boundaries and selected state counts, with maximum absolute t-distance difference $1.88\times10^{-11}$. Four frozen EEG recordings provide complementary validation, including a complete input-to-segmentation application example. Batch processing, versioned result persistence and optional low-memory execution support recording collections and longer inputs. By removing redundant computation, HP-GSBS makes established neural-state segmentation faster while preserving its scientific outputs.