Re_Trans: Combined Retrieval and transformer model for Source Code Summarization
preprint
OA: closed
CC-BY-4.0
Abstract
Source code summarization (SCS) refers to the natural language description on what a source code is performing. It can help developers understand programs and maintain software efficiently. Retrieval methods (RM) generate SCS reorganize terms selected from source code or use SCS of similar code snippets. Generative methods (GM) generate SCS via attentional encoder-decoder architecture. However, a GM can generate SCS for any code, but sometime the accuracy is still far from expectation (due to the lack of numerous high-quality training set). A RM is considered with a higher accuracy, but usually fail to generate SCS for a source code in the absence of a similar candidate in the database. In order to effectively combine the advantages of RM and GM, we propose a new method Re_Trans. For a given code, we first utilize RM to get the most similar code w.r.t sematic and its SCS (S_RM). Then, we input the given code and similar code into the trained discriminator. If the discriminator outputs 1, we take S_RM as the result, otherwise, we utilize the GM, transformer, to generate the given code’ SCS. Particularly, we use AST-augmented and code sequence-augmented information to make the source code semantic extraction more fully. Furthermore, we build a new SCS retrieval library through the public dataset. We evaluate our method on a data set of 2.1 million Java code-comment pairs, and experimental results show improvement over the state-of-the-art (SOTA) benchmarks, which demonstrates the effectiveness and efficiency of our method.
My notes (saved in your browser only)
Citation neighborhood (no data yet)
We don't have any in-corpus citations linked to this paper yet. The paper's references may be in our DB but unresolved to ``paper_id`` (resolution happens at ingest when the cited DOI matches a row we already have). Run the cross-source citation reconcile pass to retry.
Source provenance
- europepmc
- last seen: 2026-05-19T01:45:01.086888+00:00
- unpaywall
- last seen: 2026-05-26T02:00:01.498150+00:00
License: CC-BY-4.0