As software systems continue to grow in scale and complexity, efficiently under standing large codebases has become a critical challenge in software development. Code summarization aims to address this issue by generating concise natural language desc...
As software systems continue to grow in scale and complexity, efficiently under standing large codebases has become a critical challenge in software development. Code summarization aims to address this issue by generating concise natural language descriptions of source code, thereby improving readability and maintain ability. However, existing Transformer-based models struggle to effectively capture the structural semantics of code and suffer from computational inefficiency, with O(n²) complexity with respect to input length. This study proposes AlignMamba, a new model designed to preserve structural characteristics of source code while enhancing semantic consistency between code and its corresponding summaries. The primary goal is to improve the semantic alignment between the functional meaning of source code and its natural-language representation. Experimental results demonstrate that AlignMamba consistently outperforms existing models across multiple metrics, including METEOR, BERTScore, and SIDE. In partic ular, the model achieved the highest performance on the SIDE metric, which evaluates semantic correspondence between code and summary. Furthermore, effi ciency evaluations show that AlignMamba maintains high processing throughput and strong semantic summarization quality despite its lightweight architecture, suggesting its potential as an effective alternative to large Transformer-based models.By redefining code summarization as a problem of semantic alignment rather than merely natural language generation, this study highlights the impor tance of structural information integration and semantic consistency. The results demonstrate that AlignMamba can achieve high-quality, semantically faithful code summaries without increasing model complexity. These findings further sug gest that semantic alignment–based code representation learning holds significant potential for future applications, including code search, defect prediction, and automated software documentation.