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.


翻译:状态空间模型(SSMs)已成为Transformer架构的高效替代方案。近期研究表明,在相似训练条件下,SSMs在代码理解任务(如代码检索)上可达到或超越Transformer的性能。然而,其内部机制仍是一个黑箱。本文首次系统分析了基于SSM的代码模型实际学习的内容,并对SSM与基于Transformer的代码模型进行了首次比较分析。我们的分析表明,SSMs在预训练阶段捕捉代码语法和语义的能力优于Transformer,但在针对特定任务进行微调时会遗忘部分语法和语义关系,尤其是在任务强调短程依赖时。为诊断此现象,我们提出了SSM-Interpret——一种频域分析框架,该框架揭示了微调过程中模型频谱向短程依赖的偏移。基于这些发现,我们提出的架构改进显著提升了基于SSM的代码模型性能,验证了我们的分析能够直接指导构建更优模型。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
多模态基础模型的机制可解释性综述
专知会员服务
43+阅读 · 2025年2月28日
非Transformer不可?最新《状态空间模型(SSM)》综述
专知会员服务
75+阅读 · 2024年4月16日
Transformer它就是个支持向量机
专知会员服务
38+阅读 · 2023年9月7日
Meta-Transformer:多模态学习的统一框架
专知会员服务
59+阅读 · 2023年7月21日
一文读懂自注意力机制:8大步骤图解+代码
新智元
153+阅读 · 2019年11月26日
深度学习的下一步:Transformer和注意力机制
云头条
56+阅读 · 2019年9月14日
从信息瓶颈理论一瞥机器学习的“大一统理论”
【学界】机器学习模型的“可解释性”到底有多重要?
GAN生成式对抗网络
12+阅读 · 2018年3月3日
深度学习中的注意力机制
CSDN大数据
24+阅读 · 2017年11月2日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
13+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
13+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员