Semantic and Lexical Retrieval-Augmented Large Language Models for Code Summarization

As software systems grow, automatic code summarization is vital for program comprehension and maintenance. While Large Language Models (LLMs) excel at this task, they often generate verbose, incomplete, or hallucinated summaries when relying solely on source code. Retrieval-augmented generation (RAG) addresses this by incorporating external code-summary examples. However, existing single-strategy retrievers struggle to capture both deep semantic similarity and precise keyword matching. To overcome these limitations, we propose HyRALLM, a hybrid retrieval-augmented LLM framework. First, a dense retriever is constructed via cross-modal contrastive learning for semantic alignment, which is then integrated with a keyword-based sparse retriever. During the generation stage, the retrieved context is utilized to guide the LLM in generating summaries, and the quality of the generated summaries is further enhanced through a multi-candidate strategy and a post-processing discrimination mechanism. Experiments on the JCSD and PCSD benchmark datasets demonstrate that HyRALLM achieves highly competitive performance across BLEU, ROUGE-L, METEOR, and CIDEr metrics. Additional analyses confirm our framework effectively improves summary quality, reduces semantic deviation, and enhances generation robustness.

Link
https://doi.org/10.1142/s0218194027500100
Found by
Crossref
Authors
Jiawei Wang, Chunli Xie, Wei Zhu, Chunpeng Kang
Organizations
Twitter (United States)
Categories
benchmark, dataset
Published
2026-12-02
Last seen by the radar
2026-12-04
Citations
0
Radar score
35.50 / 100 (how it is scored)
Why it scored so
Also found via OpenAlex; Matched: benchmark, dataset; Primary record: Crossref
Is this record right? If you made this work and something here is wrong or missing, tell us what to fix.

More records found by Crossref