Towards Understanding What State Space Models Learn About Code

Jiali Wu, Abhinav Anand, Shweta Verma, Mira Mezini
2/6/2026
cs.AI

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

State Space Models (SSMs) have emerged as an efficient alternative to the transformer architecture. Recent studies show that SSMs can match or surpass Transformers on code understanding tasks, such as code retrieval, when trained under similar conditions. However, their internal mechanisms remain a black box. We present the first systematic analysis of what SSM-based code models actually learn and perform the first comparative analysis of SSM and Transformer-based code models. Our analysis reveals that SSMs outperform Transformers at capturing code syntax and semantics in pretraining but forgets certain syntactic and semantic relations during fine-tuning on task, especially when the task emphasizes short-range dependencies. To diagnose this, we introduce SSM-Interpret, a frequency-domain framework that exposes 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, validating that our analysis directly enables better models.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 2 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{wu2026towards,
  title  = {Towards Understanding What State Space Models Learn About Code},
  author = {Jiali Wu and Abhinav Anand and Shweta Verma and Mira Mezini},
  year   = {2026},
  eprint = {2602.06774},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.06774v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2602.06774.svg)](https://codeofpaper.com/paper/2602.06774)

Discussion