Table of Contents
Fetching ...

Enhancing Source Code Classification Effectiveness via Prompt Learning Incorporating Knowledge Features

Yong Ma, Senlin Luo, Yu-Ming Shang, Yifei Zhang, Zhengjun Li

TL;DR

This work proposes CodeClassPrompt, a text classification technique that harnesses prompt learning to extract rich knowledge associated with input sequences from pre-trained models, thereby eliminating the need for additional layers and lowering computational costs.

Abstract

Researchers have investigated the potential of leveraging pre-trained language models, such as CodeBERT, to enhance source code-related tasks. Previous methodologies have relied on CodeBERT's '[CLS]' token as the embedding representation of input sequences for task performance, necessitating additional neural network layers to enhance feature representation, which in turn increases computational expenses. These approaches have also failed to fully leverage the comprehensive knowledge inherent within the source code and its associated text, potentially limiting classification efficacy. We propose CodeClassPrompt, a text classification technique that harnesses prompt learning to extract rich knowledge associated with input sequences from pre-trained models, thereby eliminating the need for additional layers and lowering computational costs. By applying an attention mechanism, we synthesize multi-layered knowledge into task-specific features, enhancing classification accuracy. Our comprehensive experimentation across four distinct source code-related tasks reveals that CodeClassPrompt achieves competitive performance while significantly reducing computational overhead.

Enhancing Source Code Classification Effectiveness via Prompt Learning Incorporating Knowledge Features

TL;DR

This work proposes CodeClassPrompt, a text classification technique that harnesses prompt learning to extract rich knowledge associated with input sequences from pre-trained models, thereby eliminating the need for additional layers and lowering computational costs.

Abstract

Researchers have investigated the potential of leveraging pre-trained language models, such as CodeBERT, to enhance source code-related tasks. Previous methodologies have relied on CodeBERT's '[CLS]' token as the embedding representation of input sequences for task performance, necessitating additional neural network layers to enhance feature representation, which in turn increases computational expenses. These approaches have also failed to fully leverage the comprehensive knowledge inherent within the source code and its associated text, potentially limiting classification efficacy. We propose CodeClassPrompt, a text classification technique that harnesses prompt learning to extract rich knowledge associated with input sequences from pre-trained models, thereby eliminating the need for additional layers and lowering computational costs. By applying an attention mechanism, we synthesize multi-layered knowledge into task-specific features, enhancing classification accuracy. Our comprehensive experimentation across four distinct source code-related tasks reveals that CodeClassPrompt achieves competitive performance while significantly reducing computational overhead.
Paper Structure (48 sections, 14 equations, 9 figures, 22 tables)

This paper contains 48 sections, 14 equations, 9 figures, 22 tables.

Figures (9)

  • Figure 1: The architecture of CodeClassPrompt
  • Figure 2: Attention values at each layer for code language classification
  • Figure 3: Attention values at each layer for code smell classification
  • Figure 4: Attention values at each layer for code comment classification.
  • Figure 5: Attention values at each layer for technical debt classification
  • ...and 4 more figures