arrow
Return

Less Is More: DocString Compression in Code Generation

delete2026-02-01
delete0
PRE
AI
G
Guang Yang
周余 (Yu Zhou) *
W
Wei Cheng
X
Xiangyu Zhang
陈翔 cover
陈翔 (Xiang Chen)
T
Terry Yue Zhuo
Z
Zhou, Xin
L
Liu, Ke
D
David Lo
T
Taolue Chen *
DOI:10.1145/3735636delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
The widespread use of Large Language Models (LLMs) in software engineering has intensified the need for improved model and resource efficiency. In particular, for neural code generation, LLMs are used to translate function/method signature and DocString to executable code. DocStrings, which capture user requirements for the code and are typically used as the prompt for LLMs, often contain redundant information. Recent advancements in prompt compression have shown promising results in Natural Language Processing (NLP), but their applicability to code generation remains uncertain. Our empirical study shows that the state-ofthe-art prompt compression methods achieve only about 10% reduction, as further reductions would cause significant performance degradation. In our study, we propose a novel compression method, ShortenDoc, dedicated to DocString compression for code generation. Our experiments on six code generation datasets, five open source LLMs (1B to 10B parameters), and one closed-source LLM GPT-4o confirm that ShortenDoc achieves 25-40% compression while preserving the quality of generated code, outperforming other baseline methods at similar compression levels. The benefit of this method is to improve efficiency and reduce the token processing cost while maintaining the quality of the generated code, especially when calling third-party APIs.
Keywords:
DocString Compression
Code Generation
Large Language Model

Journal

A
ACM Transactions on Software Engineering and Methodology
IF:
6.2
Papers:
1.2K
Citations:
3.4K

Organization

N
nantong university
Scholars:
3.9K
Papers: 1.2K
Citations: 0
N
nanjing university of aeronautics & astronautics
Scholars:
1.9K
Papers: 653
Citations: 0
U
university of london
Scholars:
21.5W
Papers: 19.7W
Citations: 305
M
monash university
Scholars:
8.3K
Papers: 3.8K
Citations: 0
S
singapore management university
Scholars:
338
Papers: 257
Citations: 0
N
national university of defense technology - china
Scholars:
1.8W
Papers: 1.4W
Citations: 9
researcher View more organizations