Towards Understanding What State Space Models Learn About Code

Jiali Wu, Shweta Verma, Abhinav Anand, Mira Mezini


Abstract
State Space Models (SSMs) have emerged as an efficient alternative to the Transformer architecture. Prior work shows that, when trained under comparable conditions, SSMs can match or surpass Transformers on code understanding tasks. However, their internal mechanisms remain a black box. We present the first systematic analysis of what SSM-based code models learn along with the direct comparison between SSM and Transformer models in this domain. Our analysis shows that SSMs capture syntactic and semantic structure more effectively than Transformers during pretraining but forgets certain relations during fine-tuning on some tasks. To investigate this behavior, we introduce SSM-Interpret, a frequency-domain framework that shows a “spectral shift" toward short-range dependencies during fine-tuning. Guided by these findings, we propose architectural modifications that significantly improve the performance of SSM-based code model by upto +6 MRR on NLCodeSearch. This demonstrates that our analysis not only explains model behavior but also leads directly to better designs.
Anthology ID:
2026.findings-emnlp.2071
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
44078–44101
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.2071/
DOI:
10.18653/2026.findings-emnlp.2071
Bibkey:
Cite (ACL):
Jiali Wu, Shweta Verma, Abhinav Anand, and Mira Mezini. 2026. Towards Understanding What State Space Models Learn About Code. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 44078–44101, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Towards Understanding What State Space Models Learn About Code (Wu et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.2071.pdf