Implementation and Optimization of Diagonal State Space Models
摘要
Diagonal State Space Models (DSSMs) offer an efficient and interpretable alternative for long-range sequence modeling, especially suited for edge applications due to their favorable memory/compute scaling and roots in control theory. However, deploying DSSMs in memory- and compute-constrained environments requires system-level optimizations beyond standard frameworks. This work presents a set of generalized optimizations for DSSMs that significantly reduce memory and arithmetic demands. Across multiple models, these optimizations achieve 40–77% memory and 25–35% compute reduction. Additionally, we examine the real-time behavior of DSSMs with internal down-sampling, identifying deterministic execution spikes as a challenge for scheduling. Our findings are validated through a custom C++17 prototype framework and compared to reference implementations, offering actionable guidance for efficient DSSM deployment in TinyML scenarios. Github: https://github.com/embedded-machine-learning/Cpp-NN .