arXiv · 2611.37111
Understanding and Mitigating Representation Drift of Code Models under Software Distribution Shifts
Abstract
Deep learning-based code models often suffer performance degradation under software distribution shifts. Although recent studies have investigated the robustness of code models to out-of-distribution (OOD) data, how distribution shifts reshape internal representations and how such changes can guide adaptation decisions remain insufficiently understood. To answer such puzzles, we present a systematic empirical study organized along a diagnosis-to-adaptation workflow covering seven tasks, five code models, and five distribution shift types. Specifically, we measure generalization gaps between in-distribution (ID) and OOD data, evaluate task-adapted OOD detection signals, diagnose layer-wise representation geometry, and propose a representation-diagnostics-guided adaptation strategy. Our results show that: 1) performance degradation is decoupled from OOD detectability, with detectors achieving AUROC values below 59.00% even when syntactic shifts reduce classification accuracy by up to 15.69%; 2) settings with OOD performance degradation exhibit weaker cross-distribution alignment and more pronounced layer-wise geometric changes; and 3) diagnostics-guided data allocation and configuration search yield higher OOD scores than traditional adaptation strategies. Overall, our findings highlight the necessity of integrating representation-level diagnostics into the evaluation and adaptation of code models under distribution shifts.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Yiqing Shi, Zhifei Chen, Yangyang Zhao, Quanjun Zhang, Wei Song. 2026-11-27. Understanding and Mitigating Representation Drift of Code Models under Software Distribution Shifts. https://arxiv.science/abs/2611.37111
Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.