Towards Understanding What State Space Models Learn About Code

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Wu, Jiali, Anand, Abhinav, Verma, Shweta, Mezini, Mira
Natura: Preprint
Pubblicazione: 2026
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866917254592987136
author Wu, Jiali
Anand, Abhinav
Verma, Shweta
Mezini, Mira
author_facet Wu, Jiali
Anand, Abhinav
Verma, Shweta
Mezini, Mira
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2602_06774
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Towards Understanding What State Space Models Learn About Code
Wu, Jiali
Anand, Abhinav
Verma, Shweta
Mezini, Mira
Artificial Intelligence
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.
title Towards Understanding What State Space Models Learn About Code
topic Artificial Intelligence
url https://arxiv.org/abs/2602.06774