Code vs Serialized AST Inputs for LLM-Based Code Summarization: An Empirical Study
Shijia Dong, Haoruo Zhao, Paul Harvey

TL;DR
This study investigates the impact of using serialized AST representations versus raw code in LLM-based code summarization, demonstrating that complete AST serialization improves efficiency without sacrificing quality.
Contribution
Introduces AST(NIT), a novel method for serializing and augmenting ASTs for LLM input, enhancing code summarization performance and efficiency.
Findings
Serialized ASTs reduce input length and training time.
Achieve comparable summarization quality to existing methods.
Effective encoding of structural and lexical code features.
Abstract
Summarizing source code into natural language descriptions (code summarization) helps developers better understand program functionality and reduce the burden of software maintenance. Abstract Syntax Trees (ASTs), as opposed to source code, have been shown to improve summarization quality in traditional encoder-decoder-based code summarization models. However, most large language model (LLM)-based code summarization methods rely on raw code or only incorporate partial AST signals, meaning that the potential of complete AST representation has not been fully explored for LLMs. This paper presents AST(NIT), an AST augmentation and serialization method that preserves lexical details and encodes structural information into LLM-compatible sequences. Experiments with the LLaMA-3.1-8B model on the CodeXGLUE Python dataset show that the proposed serialized ASTs reduce the length of LLM inputs,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Topic Modeling · Software Testing and Debugging Techniques
