Code vs Serialized AST Inputs for LLM-Based Code Summarization: An Empirical Study

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Dong, Shijia, Zhao, Haoruo, Harvey, Paul
Format: Preprint
Veröffentlicht: 2026
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866914310972768256
author Dong, Shijia
Zhao, Haoruo
Harvey, Paul
author_facet Dong, Shijia
Zhao, Haoruo
Harvey, Paul
contents 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, require shorter training times, and achieve summarization quality comparable to existing approaches.
format Preprint
id arxiv_https___arxiv_org_abs_2602_06671
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Code vs Serialized AST Inputs for LLM-Based Code Summarization: An Empirical Study
Dong, Shijia
Zhao, Haoruo
Harvey, Paul
Software Engineering
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, require shorter training times, and achieve summarization quality comparable to existing approaches.
title Code vs Serialized AST Inputs for LLM-Based Code Summarization: An Empirical Study
topic Software Engineering
url https://arxiv.org/abs/2602.06671