A Prompt Learning Framework for Source Code Summarization
- URL: http://arxiv.org/abs/2312.16066v1
- Date: Tue, 26 Dec 2023 14:37:55 GMT
- Title: A Prompt Learning Framework for Source Code Summarization
- Authors: Weisong Sun and Chunrong Fang and Yudu You and Yuchen Chen and Yi Liu
and Chong Wang and Jian Zhang and Quanjun Zhang and Hanwei Qian and Wei Zhao
and Yang Liu and Zhenyu Chen
- Abstract summary: We propose a novel prompt learning framework for code summarization called PromptCS.
PromptCS trains a prompt agent that can generate continuous prompts to unleash the potential for LLMs in code summarization.
We evaluate PromptCS on the CodeSearchNet dataset involving multiple programming languages.
- Score: 24.33455799484519
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: (Source) code summarization is the task of automatically generating natural
language summaries for given code snippets. Such summaries play a key role in
helping developers understand and maintain source code. Recently, with the
successful application of large language models (LLMs) in numerous fields,
software engineering researchers have also attempted to adapt LLMs to solve
code summarization tasks. The main adaptation schemes include instruction
prompting and task-oriented fine-tuning. However, instruction prompting
involves designing crafted prompts for zero-shot learning or selecting
appropriate samples for few-shot learning and requires users to have
professional domain knowledge, while task-oriented fine-tuning requires high
training costs. In this paper, we propose a novel prompt learning framework for
code summarization called PromptCS. PromptCS trains a prompt agent that can
generate continuous prompts to unleash the potential for LLMs in code
summarization. Compared to the human-written discrete prompt, the continuous
prompts are produced under the guidance of LLMs and are therefore easier to
understand by LLMs. PromptCS freezes the parameters of LLMs when training the
prompt agent, which can greatly reduce the requirements for training resources.
We evaluate PromptCS on the CodeSearchNet dataset involving multiple
programming languages. The results show that PromptCS significantly outperforms
instruction prompting schemes on all four widely used metrics. In some base
LLMs, e.g., CodeGen-Multi-2B and StarCoderBase-1B and -3B, PromptCS even
outperforms the task-oriented fine-tuning scheme. More importantly, the
training efficiency of PromptCS is faster than the task-oriented fine-tuning
scheme, with a more pronounced advantage on larger LLMs. The results of the
human evaluation demonstrate that PromptCS can generate more good summaries
compared to baselines.
Related papers
- Source Code Summarization in the Era of Large Language Models [23.715005053430957]
Large language models (LLMs) have led to a great boost in the performance of code-related tasks.
In this paper, we undertake a systematic and comprehensive study on code summarization in the era of LLMs.
arXiv Detail & Related papers (2024-07-09T05:48:42Z) - Efficient Prompting Methods for Large Language Models: A Survey [50.171011917404485]
Prompting has become a mainstream paradigm for adapting large language models (LLMs) to specific natural language processing tasks.
This approach brings the additional computational burden of model inference and human effort to guide and control the behavior of LLMs.
We present the basic concepts of prompting, review the advances for efficient prompting, and highlight future research directions.
arXiv Detail & Related papers (2024-04-01T12:19:08Z) - Code Prompting Elicits Conditional Reasoning Abilities in Text+Code LLMs [65.2379940117181]
We introduce code prompting, a chain of prompts that transforms a natural language problem into code.
We find that code prompting exhibits a high-performance boost for multiple LLMs.
Our analysis of GPT 3.5 reveals that the code formatting of the input problem is essential for performance improvement.
arXiv Detail & Related papers (2024-01-18T15:32:24Z) - If LLM Is the Wizard, Then Code Is the Wand: A Survey on How Code
Empowers Large Language Models to Serve as Intelligent Agents [81.60906807941188]
Large language models (LLMs) are trained on a combination of natural language and formal language (code)
Code translates high-level goals into executable steps, featuring standard syntax, logical consistency, abstraction, and modularity.
arXiv Detail & Related papers (2024-01-01T16:51:20Z) - LMRL Gym: Benchmarks for Multi-Turn Reinforcement Learning with Language
Models [56.25156596019168]
This paper introduces the LMRL-Gym benchmark for evaluating multi-turn RL for large language models (LLMs)
Our benchmark consists of 8 different language tasks, which require multiple rounds of language interaction and cover a range of tasks in open-ended dialogue and text games.
arXiv Detail & Related papers (2023-11-30T03:59:31Z) - Context-Aware Prompt Tuning for Vision-Language Model with
Dual-Alignment [15.180715595425864]
We introduce a novel method to improve the prompt learning of vision-language models by incorporating pre-trained large language models (LLMs)
With DuAl-PT, we propose to learn more context-aware prompts, benefiting from both explicit and implicit context modeling.
Empirically, DuAl-PT achieves superior performance on 11 downstream datasets on few-shot recognition and base-to-new generalization.
arXiv Detail & Related papers (2023-09-08T06:51:15Z) - Low-code LLM: Graphical User Interface over Large Language Models [115.08718239772107]
This paper introduces a novel human-LLM interaction framework, Low-code LLM.
It incorporates six types of simple low-code visual programming interactions to achieve more controllable and stable responses.
We highlight three advantages of the low-code LLM: user-friendly interaction, controllable generation, and wide applicability.
arXiv Detail & Related papers (2023-04-17T09:27:40Z) - A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT [1.2640882896302839]
This paper provides contributions to research on prompt engineering that apply large language models (LLMs) to automate software development tasks.
It provides a framework for documenting patterns for structuring prompts to solve a range of problems so that they can be adapted to different domains.
Third, it explains how prompts can be built from multiple patterns and illustrates prompt patterns that benefit from combination with other prompt patterns.
arXiv Detail & Related papers (2023-02-21T12:42:44Z) - RLPrompt: Optimizing Discrete Text Prompts With Reinforcement Learning [84.75064077323098]
This paper proposes RLPrompt, an efficient discrete prompt optimization approach with reinforcement learning (RL)
RLPrompt is flexibly applicable to different types of LMs, such as masked gibberish (e.g., grammaBERT) and left-to-right models (e.g., GPTs)
Experiments on few-shot classification and unsupervised text style transfer show superior performance over a wide range of existing finetuning or prompting methods.
arXiv Detail & Related papers (2022-05-25T07:50:31Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.