Next Article in Journal
Deep Reinforcement Learning for Dynamic Pricing and Ordering Policies in Perishable Inventory Management
Previous Article in Journal
Review of Shape-Memory Polymer Nanocomposites and Their Applications
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

P-Distill: Efficient and Effective Prompt Tuning Using Knowledge Distillation

by
Hyun-Sik Won
1,
Joon-Young Choi
2,
Namrah Zaman
1,
Dinara Aliyeva
3 and
Kang-Min Kim
1,4,*
1
Department of Artificial Intelligence, The Catholic University of Korea, Bucheon-si 14662, Republic of Korea
2
Danggeun Market Inc., Seoul 06611, Republic of Korea
3
Department of Computer Science, College of Arts & Sciences, The University of North Carolina at Chapel Hill, Chapel Hill, NC 27599, USA
4
Department of Data Science, The Catholic University of Korea, Bucheon-si 14662, Republic of Korea
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(5), 2420; https://doi.org/10.3390/app15052420
Submission received: 20 January 2025 / Revised: 14 February 2025 / Accepted: 20 February 2025 / Published: 24 February 2025
(This article belongs to the Special Issue Machine Learning Approaches in Natural Language Processing)

Abstract

:
In the field of natural language processing (NLP), prompt-based learning is widely used for efficient parameter learning. However, this method has the drawback of shortening the input length by the extent of the attached prompt, leading to the inefficient utilization of the input space. In this study, we propose P-Distill, a novel prompt compression method that mitigates the aforementioned limitation of prompt-based learning while maintaining performance via knowledge distillation. The knowledge distillation process of P-Distill consists of two methods, namely prompt initialization and prompt distillation. Experiments on various NLP tasks demonstrated that P-Distill exhibited comparable or superior performance compared to other state-of-the-art prompt-based learning methods, even with significantly shorter prompts. Specifically, we achieved a peak improvement of 1.90% even with the prompt lengths compressed to one-eighth. An additional study further provides insights into the distinct impact of each method on the overall performance of P-Distill. Our code will be released upon acceptance.

1. Introduction

Pre-trained language models (PLMs) have been effective in improving the performances of various natural language processing (NLP) tasks [1,2,3]. These models are fine-tuned by optimizing all parameters to enhance the performances of specific downstream tasks; however, fine-tuning requires significant computational resources while training. The need for significant computational resources for storage and training becomes a challenge, especially when fine-tuning large language models such as Llama2 [3], which may not be readily available to most users.
To reduce computational costs, researchers have explored various methods for efficiently fine-tuning parameters [4,5,6]. In contrast to the traditional model of fine-tuning that updates all parameters for a downstream task, P-tuning v2 [6] fixes the pre-trained parameters and only trains the continuous prompts, which are trainable embeddings attached at the beginning or throughout each layer of the model. While P-tuning v2 is computationally efficient, especially for PLMs with a large number of parameters, it does not effectively address the inefficiency of utilizing the input space due to the use of continuous prompts [5]. This attachment increases the attention computation, thereby requiring the truncation of the positional encodings for the attached prompts, which reduces the available input token sequence length. Extending the input token sequence by forcibly modifying the code can lead to issues with attention calculation beyond the model’s training [7]. Such modifications often result in performance degradation, as the attention mechanism might struggle with sequences extending beyond its initially intended scope. Similar to the findings in the work [6], more challenging tasks require longer prompt lengths to achieve better performance.
In this paper, we propose P-Distill, which is a novel prompt compression method to mitigate the limitations of long prompts. Our method involves a two-step process where we first train a teacher model using P-tuning v2 to achieve superior performance with long prompts. We then transfer this knowledge to a student model with significantly shorter prompts through a distillation process. To ensure stability in training, we first perform prompt initialization based on the teacher model prompts. Then, we focus on distilling knowledge between the teacher and student models, specifically targeting the outputs of their intermediate and prediction layers. This is due to the impact of continuous prompts on the hidden states within these layers, which subsequently influences the model’s predictions. This method enables the compression of prompts to shorter lengths without a significant degradation in performance, thereby addressing the inefficiencies inherent in longer prompts.
To validate its effectiveness and efficiency, we evaluate P-Distill using various NLP benchmarks. Our results demonstrate that P-Distill exhibits comparable or superior performance to those of the existing state-of-the-art prompt-based models. To the best of our knowledge, this study is the first to train teacher prompts and transfer their knowledge to student prompts for compressing prompts. The main contributions of this study are summarized as follows:
  • We propose a method called P-Distill to compress the continuous prompts, effectively mitigating the limitation of reducing the model’s usable sequence length in prompt-based learning.
  • We introduce a prompt distillation method utilizing the teacher model’s hidden-state and prediction outputs, influenced by continuous prompts, and propose a prompt initialization for stable prompt distillation.
  • We validate P-Distill across multiple NLP benchmarks, demonstrating its ability to maintain or enhance accuracy while reducing prompt lengths by up to eight times.
This paper is structured as follows: Section 2 outlines the preliminaries; Section 3 delves into the proposed methodology in detail; Section 4 discusses the experimental results and provides an in-depth analysis; and Section 5 concludes the study with key findings and insights.

2. Preliminaries

2.1. Pre-Trained Language Models Based on the Transformer

The transformer model [8], comprising an encoder and decoder, is the fundamental architecture of the majority of recent PLMs, including BERT [1], RoBERTa [9], and GPT-3 [2]. Each encoder and decoder consists of multiple transformer layers and incorporates key components, such as multi-head attention modules (MHA), feed-forward networks, layer normalization, and residual connections. A key component of this architecture is the multi-head attention mechanism, which computes attention weights using query (Q), key (K), and value (V) matrices. Mathematically, the attention function in multi-head attention can be represented as follows:
A t t ( x ) = s o f t m a x ( Q K T d k ) V ,
where d k is the scaling factor for gradient stabilization during training. This attention mechanism is crucial in understanding language and generating tasks by modulating the focus of the model on different parts of the input data.

2.2. Prompt-Based Learning Methods

Prompt-based learning methods have emerged as an efficient alternative to full-model fine-tuning, especially for PLMs [6,10]. These methods use prompts to guide the model predictions for specific tasks. Several approaches [11,12] employ discrete prompts, which are fixed templates added to the input. For example, in sentiment analysis, a template might be “This text [Input Text] expresses a [MASK] sentiment”. However, discrete prompts are limited in that their performances significantly depend on template selection. Advanced approaches, such as prefix-tuning [13] and P-tuning [10], use continuous prompts that are trainable embeddings independent of the model vocabulary. Particularly, P-tuning v2 [6] attaches continuous prompts to each layer of the model, thereby influencing its behavior and enhancing its performance in downstream tasks. These continuous prompts are integrated into the attention mechanism of the transformer model as follows:
A t t ( x ) = s o f t m a x Q ( P k : K ) T d k ( P v : V ) ,
where P k R n p × d and P v R n p × d are the continuous prompts added to the key and value vectors, respectively, the colon denotes the concatenation of these prompts with the key and value matrices. The dimension n p indicates the lengths of the prompts, and d represents the dimensions of the key and value vectors. This integration enables the model to influence layers closer to the output, significantly affecting the final predictions.
A significant disadvantage of P-tuning v2 is the necessity for long continuous prompts to achieve maximum performance, resulting in a reduced input token space. Figure 1 demonstrates the influence of continuous prompt length on model performance across diverse NLP tasks, indicating that more complicated tasks often need longer prompts.
This discovery inspired our investigation into prompt compression, in which we wanted to maintain model efficacy while minimizing prompt length. In Section 3, we present P-Distill, an innovative method that use knowledge distillation to address the inefficiencies linked to long prompts.

2.3. Knowledge Distillation

In artificial intelligence, knowledge distillation is a technique for reducing the size of large models while preserving their performances [14,15,16,17]. Recent improvements in knowledge distillation have presented parameter-efficient online distillation [18], prompt transfer-based knowledge distillation for efficient model adaptation [19], and retrieval-augmented knowledge distillation for enhanced generalization [20]. Furthermore, pseudo-target training has been investigated for enhancing knowledge distillation in natural language generation tasks [21]. Beyond NLP, knowledge distillation has been effectively applied in other domains such as visible–infrared transmission line detection using contrastive learning [22] and object detection through cross-head distillation [23], gradient-guided knowledge distillation for object detectors [24], and instance, scale, and teacher adaptive knowledge distillation for visual detection in autonomous driving [25]. These advancements demonstrate the versatility of knowledge distillation across diverse domains. During knowledge distillation, a smaller student model is trained to internalize and emulate the complex decision-making patterns and behaviors of a larger teacher model. This process involves the behavior functions of the models, f T and f S , transforming inputs into informative representations, typically defined as the output of any layer within the model. These representations contain abundant information for model predictions. Knowledge distillation is quantified using loss functions, such as the Kullback–Leibler divergence [26] or Mean Squared Error (MSE) [17], as follows:
L K D = x X L ( f S ( x ) , f T ( x ) ) ,
where x is the input and X and L denote the dataset and the loss function, respectively. This approach enables the student model to gain a comprehensive understanding of various classes, enhancing its application in fields such as NLP.
Table 1 summarizes the main notations applied throughout this paper to help clarity and the simplicity of referencing.

3. Methodology

Many existing prompt tuning methods, including P-tuning v2, have the drawback of occupying an unnecessarily large portion of the input token space, owing to their long prompts. Inspired by knowledge distillation methods, we propose a novel prompt compression methodology called P-Distill. This approach aims to compress the prompts while maintaining the performance, thereby increasing the available space for input tokens and enhancing the overall model efficiency. To this end, the proposed P-Distill comprises the following two methods: prompt initialization and prompt distillation. Figure 2 shows the learning and compression processes of P-Distill. Our approach involved two main steps where the first step was training a teacher model using P-tuning v2 and the second step focused on distilling knowledge to a student model with shorter prompts, effectively reducing the length of the prompts.

3.1. Prompt-Based Teacher Learning

When solving downstream tasks using P-tuning v2, we froze the pre-trained weights of the language model and only trained the continuous prompts. Prompt lengths that yield good performance vary according to task complexity. In general, simple classification tasks tend to use shorter prompts, with lengths of around 20, while more complex sequence labeling tasks often require longer prompts, with lengths of around 100 [6]. Understanding the variation in prompt length is crucial, particularly during the inference stage, as longer prompts inherently limit the maximum sequence length that the model can handle.
We trained a teacher model on various tasks based on the P-tuning v2 methodology. This model tokenized input data, x, and embedded them into text embeddings, x ¯ . Subsequently, the continuous prompts P k T , P v T R n t × d of the teacher model were randomly initialized and concatenated with the key vectors K R n x × d and value vectors V R n x × d of each layer. Here, d is the dimensionality of the hidden representations, n t is the prompt length of the teacher model, and n x is the length of token embeddings. The teacher model, which utilizes attention heads incorporating continuous prompts, was trained to take the text embedding x ¯ as an input and generate the final logits, y T . The parameter optimization of the teacher model was guided by the cross-entropy loss, which is formalized as follows:
L C E T = 1 | B | i = 1 | B | log ( s o f t m a x ( y i T ) [ c i ] ) ,
where | B | is the number of data points in the current batch, y i T is the logits output by the teacher model for the i-th data point in the batch, s o f t m a x ( y i T ) is the softmax-transformed probability distribution over the classes, and c i is the true class index for the i-th data point.

3.2. Prompt-Enhanced Distillation (P-Distill)

We initiated the training of a student model which employs shorter continuous prompts, rather than the teacher model, using the same prompt attachment methodology. During the initial training phase, we initialized the continuous prompts of the student model, P k S and P v S R n s × d , based on the teacher model’s prompts, P k T and P v T . Subsequently, student prompts were also attached to the key and value vectors across all layers to compute the attention heads. The length of the student model prompts, represented by n s , is shorter than that of the teacher model prompts n t . The student model, denoted by f S , takes the text embedding x ¯ as input and generates the output logits y S . The teacher and student models share the same underlying language model architecture, differing only in the length and content of their respective prompts. In this context, we focused on distilling the knowledge from the more extensive teacher model prompts into the shorter student model prompts. To enhance the effectiveness of knowledge transfer, we propose two novel methods for knowledge distillation.

3.2.1. Prompt Initialization

For solving downstream tasks, the model utilizes the attached prompts to generate answers. Starting with the randomly initialized prompts for the model can result in an unstable training process [27]. To mitigate this challenge, the study [28] employed a method for transferring the prompts learned in one task to another task. We aimed to stabilize the training by initializing the student model prompts P k S and P v S based on the teacher model prompts P k T , P v T . We experimented with various prompt initialization methods, including reparameterization, average pooling, and max. pooling, as illustrated in Figure 3. In reparameterization, we employed a reparameterization encoder to adjust the length of the teacher model prompts to that of the student model prompts. For average pooling, we divided the teacher model’s prompts into smaller segments and computed their averages to initialize the student prompts. In max. pooling, we focused on the most prominent features by obtaining the maximum value from each segment of the teacher model’s prompts. Based on the experimental results, we applied the reparameterization encoder to the teacher model’s prompts to construct the student model’s prompts as follows:
P k S = ( P k T · W k T ) + b k T ,
P v S = ( P v T · W v T ) + b v T ,
where W k T and W v T are the learnable weight matrices used to construct the student’s prompts, and b k T and b v T are the corresponding bias. The results of various prompt initialization experiments are shown in Section 4.5.

3.2.2. Prompt Distillation

In this section, we focus on prompt distillation, a key aspect of the proposed approach. Recognizing the influence of continuous prompts on both the hidden-state and the prediction-layer outputs within the model, we employed the following two distillation techniques: prediction-layer and hidden-state distillations. These techniques focused on different aspects of the teacher model’s output to ensure comprehensive knowledge transfer.
Prediction-layer distillation In this method, a student model learns to emulate the predictions of a teacher model. This process involves the student model utilizing soft labels from the teacher model’s output, which encapsulate the teacher model’s understanding of the data. Particularly, a loss function was used to minimize the difference between the logits y S and y T produced by the student and teacher models, respectively. The distillation loss L p r e d is formulated as follows:
L p r e d = K L ( s o f t m a x ( y i S / θ ) , s o f t m a x ( y i T / θ ) ) ,
where y i S and y i T are the logits vectors predicted by the student and teacher, respectively, and K L denotes the Kullback–Leibler divergence, which measures the difference between the probability distributions of the two models. θ is a temperature hyperparameter that adjusts the smoothness of these distributions, enabling a more nuanced transfer of knowledge from the teacher to student model. The distillation loss L p r e d was then used in the optimization process to update the parameters of the student model, thereby aligning its predictive behavior more closely with that of the teacher model.
Hidden-state distillation Additionally, we also distilled knowledge from the intermediate representations of the teacher model. The concept of distilling knowledge through intermediate representations was initially introduced by Fitnets [29], with the aim of enhancing the training process of the student model. Based on the provided prompts and inputs, we extracted knowledge from the transformer layers of the teacher model and distilled it into the student model. This process was formalized using the loss function L h i d d e n , which is calculated as the MSE between the hidden states H S and H T of the student and teacher models, respectively, as follows:
L h i d d e n = M S E ( H S , H T ) ,
where the matrices H S , H T R n × d represent the hidden states, n is the input sequence length, and d is the hidden-state dimensionality of the two models.

3.3. Distillation-Based Student Learning

While training the student model, the cross-entropy loss was computed similarly to that of the teacher model. This loss serves as a measure of the student model’s accuracy in predicting the true class labels as follows:
L C E S = 1 | B | i = 1 | B | log ( s o f t m a x ( y i S ) [ c i ] ) .
Subsequently, the overall loss function L t o t a l for the student model is then a weighted combination of the cross-entropy loss and the distillation losses as follows:
L t o t a l = λ 1 · L C E S + λ 2 · L p r e d + λ 3 · L h i d d e n ,
where λ 1 , λ 2 , and λ 3 are the learnable weighted coefficients with the constraint that their combined sum equals 1. During the training, the teacher model parameters were fixed to serve as the sources of prior knowledge.

4. Experiments

This section presents the datasets employed in our experiments, baseline models for comparison, results of these datasets, and analyses from our additional studies.

4.1. Datasets

Our evaluation of the proposed P-Distill method included a comprehensive range of natural language understanding tasks, utilizing datasets that are well-established benchmarks in the field.
We included various tasks from the SuperGLUE benchmark [30], which assesses a model’s understanding and reasoning abilities across different contexts, including BoolQ [31], CB [32], COPA [33], MultiRC [34], ReCoRD [35], RTE [36,37], WiC [38] and WSC [39]. We also utilized the CoNLL-2003 [40], CoNLL-2004 [41], CoNLL-2005 [42], CoNLL-2012 [43], and OntoNotes 5.0 datasets [44], each providing richly annotated text for entity classification. The SQuAD dataset, in its versions 1.1 [45] and 2.0 [46], facilitated testing reading comprehension, requiring the model to parse passages and answer questions with a high degree of understanding. In addition, we extended our experiments to the Allsides dataset [47], which consists of news articles with an average token length of over 1000. This dataset allowed us to examine the effects of P-Distill in scenarios where input tokens are frequently truncated. All these datasets are English, open-source, and used for academic research purposes only. For accurate comparisons, we followed the train, validation, and test set splits as specified in the referenced work [6].

4.2. Baselines

We compared P-Distill against the following methods to validate its competitive performance, with all methods utilizing BERTlarge with 335 M parameters as the backbone architecture.
Fine-tuning: all parameters of a PLM are updated and adapted to the given downstream task in a task-specific manner.
P-tuning v2 [6]: this appends trainable, continuous prompts to the key and value matrices of a model, enabling task-specific learning while keeping the model’s pre-trained weights fixed.

4.3. Experimental Details

In our training process, we exclusively focused on continuous prompts while keeping the backbone parameters of the model fixed. For full fine-tuning, we used a batch size of 8 with a learning rate of 2 × 10 5 . For P-tuning V2, we also used a batch size of 8 but used a higher learning rate of 5 × 10 3 and a dropout rate of 0.2. For P-Distill, the model was trained with a batch size of 16, and the learning rate was individually optimized for each task. Furthermore, we employed the AdamW optimizer for training. For the temperature hyperparameter θ used in the distillation process, we experimentally determined the optimal setting by sweeping across {1, 5, 10}. For the learnable parameter λ 2 , we explored the initial values of {0.1, 0.5, 0.9}. Considering the significant impact of the hidden-state loss, we experimented with the initial values of { 1 × 10 3 , 1 × 10 4 , 1 × 10 5 } for λ 3 . All experiments were performed using PyTorch 2.0 (https://pytorch.org/ (21 February 2025)) and HuggingFace Transformers [48] on three NVIDIA A100 GPUs, and to ensure consistency in our results, each task was conducted using a fixed random seed.

4.4. Results

Table 2 and Table 3 present the experimental results of fine-tuning, P-tuning v2, and P-Distill. In P-Distill, the prompt length was compressed to one-eighth of that of the teacher model prompts. For fewer than eight teacher model prompts, the length was compressed to 1. For a detailed analysis of prompt compression ratios, refer to Section 4.4.3. In general, the proposed P-Distill method exhibited a comparable or superior performance to those of the other methods while using shorter prompts.

4.4.1. Results on SuperGLUE

Table 2 shows the performance of each approach on the SuperGLUE benchmark. The experimental results show that despite using shorter prompts, P-Distill matched or exceeded the performance of P-tuning v2, which utilized long prompts. Specifically, P-Distill exhibited a 0.51% performance improvement on average on SuperGLUE tasks. The improvement increased to 2.75% when compared to P-tuning v2 with the same prompt length. These results reveal that P-Distill effectively compressed the prompt length while maintaining or even improving performance.
Additionally, we compared P-Distill with P-tuning v2 across varying prompt sizes, ensuring a fair assessment of initiating with a short prompt in the first place against distillation-based compression. The results confirm that simply using a shorter prompt did not yield the same benefits as P-Distill, which applied structured knowledge transfer from a teacher model to a student model. P-Distill not only achieved competitive or superior performance but performed so with significantly compressed prompt lengths, highlighting the effectiveness of the proposed distillation strategy in preserving and even enhancing task-specific knowledge while optimizing efficiency.

4.4.2. Results on Other Tasks

Table 3 presents the experimental results for diverse tasks, including named entity recognition, question answering, semantic role labeling, and long-sequence classification. We first observe that achieving superior performance via P-tuning v2 on these tasks required training with longer prompts (up to 128 tokens), which aligns with the phenomenon reported in previous work [6] where complex tasks tend to require long prompts.
In comparison to the baseline methods, P-Distill achieved comparable performance using significantly shorter prompts even for tasks where P-tuning v2 employed long prompts. In particular, P-Distill outperformed P-tuning v2 with 128 prompt tokens on CoNLL04 while utilizing a prompt of length 16. Furthermore, P-Distill achieved a performance improvement of 2.54% over the prompt of the same length trained using P-tuning v2 and a 0.90% improvement over the teacher model.
Moreover, P-Distill outperformed the baseline methods on the Allsides dataset, which consisted of long input instances where the average token length exceeded 1000. Specifically, with prompts significantly compressed to four, P-Distill not only mitigated token truncation issues but also showed a 1.03% performance improvement over the best P-tuning v2 configuration. This highlights the advantage of P-Distill in handling long-sequence tasks by preserving input space with shorter prompts. Additionally, P-Distill exhibited 1.42% performance improvement when compared to P-tuning v2 with a prompt length of four, showing that P-Distill is an effective method for compressing prompt length. A qualitative evaluation of the Allsides dataset is provided in Section 4.9, offering further insights on long-sequence tasks.

4.4.3. Impact of Compression Ratio

To investigate the impact of different compression ratios on the performance of P-Distill, we conducted additional experiments with 2× and 4× compression ratios and compared the results. We used the CoNLL04 dataset in these experiments, as it is known to require longer prompts for sufficient training.
Table 4 presents the performance results for these different compression ratios within CoNLL04. We observed a trade-off between the compression ratio and model performance, as a higher compression ratio led to relatively lower performance. Yet, it is worth noting that a 2× compression with P-Distill did preserve the performance of the original long prompt and that P-Distill still matched the performance of fine-tuning at the compression ratio of 8×.

4.5. Ablation Study

To further verify the effectiveness of the proposed method, we conducted ablation studies using the following variants of P-Distill.
P-Distillinit: instead of training with prompt initialization, it focuses exclusively on leveraging the two types of distillation losses designed to transfer the knowledge from the teacher to student model in different ways.
P-Distillpred: This approach does not implement prediction-layer distillation loss. Following the application of the prompt initialization method, it trains the student model based on hidden-state distillation loss. This method aligns the internal representations of the student model with those of the teacher model without focusing on the final output predictions.
P-Distillhidden: This variant does not consider the differences between the hidden-state outputs of the teacher and student models. Instead, it focuses on training based on the differences in the prediction-layer outputs. This approach aligns the final predictions of the student model closely with those of the teacher model without directly focusing on their internal representations.
Results Figure 4 shows that all three variants of P-Distill underperformed compared to the original P-Distill among various tasks. This shows that each component of P-Distill contributed to the performance achieved on downstream tasks.
Given these results, we further observe that the extent of degradation varied among different variants. First, P-Distillinit exhibited the most significant performance degradation across various tasks. While not utilizing prompt initialization and only conducting prediction-layer distillation and hidden-state distillation still led to performance improvements over P-tuning v2, the degradation in performance was clear compared to other variants and the original P-Distill. This indicates that prompt initialization, based on the teacher model’s prompt, is crucial in prompt-based knowledge distillation. Second, P-Distillhidden and P-Distillpred exhibited decreased prediction performance. This demonstrates that integrating prompt initialization with the hidden-state or prediction-layer distillation techniques enhances the stability and effectiveness of knowledge distillation.

4.6. Impact of Prompt Initialization

To inspect the impact of different prompt initialization methods within P-Distill, we conducted experiments to compare the performance of P-Distill with two variants: P-Distillmean, which initializes the student model prompts using an average-pooling layer over the teacher model prompts, and P-Distillmax, which uses a max.-pooling layer for the same purpose.
The results, as detailed in Table 5, demonstrate that both P-Distillmean and P-Distillmax underperformed compared to P-Distill, which utilizes a reparameterization encoder for prompt initialization. We conjecture that the use of average pooling and max. pooling led to an excessive simplification of the teacher model’s prompts, resulting in the loss of crucial nuances and complexities. Conversely, the reparameterization encoder for prompt initialization effectively captured and transferred the complex knowledge of the teacher model prompts without the loss of crucial task information. This suggests that the reparameterization encoder is a more suitable method for prompt initialization in P-Distill, contributing significantly to the overall effectiveness of the knowledge distillation process.

4.7. Experimental Results of Applying P-Distill to P-Tuning Methodology

To evaluate the effectiveness of P-Distill when the prompts directly occupied the input sequence space, we applied P-Distill to the P-tuning methodology that attached prompts to the input embeddings. The experimental results are shown in Table 6.
These results demonstrate the effectiveness of applying P-Distill to the P-tuning methodology. When P-Distill was used, it showed higher performance across all datasets compared to using prompts of the same length without P-Distill. Particularly, on the CB and COPA datasets, P-Distill achieved the same performance as the teacher prompts despite compressing the prompts to one-eighth. These results indicate that P-Distill effectively compressed the prompt length while maintaining performance, even when the prompts were attached to the input embeddings.

4.8. Inference Costs

To examine the benefits of P-Distill in the inference stage, we compared the inference costs across P-Distill, fine-tuning, and P-tuning v2. This reduction in computational requirements is quantified in Table 7, which presents the GFLOPs required during the inference stage with average length samples from each task in the SuperGLUE benchmark.
While both P-tuning v2 and P-Distill demonstrated increased inference GFLOPs compared to fine-tuning due to the inclusion of prompts, we observed that P-Distill added fewer computations compared to P-tuning v2. The difference was more clear in cases where long prompts were utilized in P-tuning v2. This demonstrates the advantage of compressing prompt length in terms of lowering computational costs.

4.9. Qualitative Analysis in Long-Sequence Classification

To further examine the effectiveness of expanding the input space by using shorter prompts via P-Distill, we conducted a qualitative analysis on the Allsides dataset. The task was to predict the political perspectives inherent in a news article. Therefore, the dataset consisted of news articles that generally exceeded the model’s input capacity of 512 tokens.
We compared the input text and prediction results of P-tuning v2, trained with 32 prompt tokens, to those of P-Distill, which compressed and appended only four prompt tokens, which are shown in Table 8. Note that while P-tuning v2 could utilize up to 480 input tokens by attaching 32 prompt tokens, P-Distill extended the input capacity by using up to 508 input tokens with only four prompt tokens appended.
We observed that the P-tuning v2 model could not access the detailed explanation of the Fairness Doctrine due to its limited input space. However, P-Distill could access the remainder of the sentence, namely ‘broadcasters provide “equal time” to divergent political views’, which provided the key information for the model in making an accurate prediction: ‘Center’. This example verifies that the input space preserved by compressing the prompt length with P-Distill could contribute to accurate prediction with the model, leading to better performance overall.

5. Conclusions

In this paper, we introduce P-Distill, a novel approach in NLP that utilizes two knowledge distillation techniques to enhance performance by compressing unnecessary prompt length. This approach combines prompt initialization and two types of prompt distillation to effectively transfer knowledge from a teacher model with longer prompts to a student model with prompts that are eight times shorter. To evaluate the efficacy of our proposed method, we conducted experiments across various NLP tasks. Our results demonstrate that, using prompts of the same length, the proposed method achieved an average improvement of 2.75% over the existing prompt-tuning methods across the SuperGLUE benchmark. Furthermore, P-Distill exhibited competitive performance even against models trained with prompts that were eight times longer.

6. Limitations

One limitation of this study is that we evaluated our method only on the BERT architecture. Conducting additional experiments on other architectures could be beneficial to determine the generalizability of our findings. Additionally, while our model improves performance through the process of training a teacher model and transferring its knowledge, it incurs more time and cost compared to previous methods. Furthermore, since P-Distill compresses task-specific prompts, direct cross-task transferability remains limited without re-optimization, similar to other prompt-tuning approaches. In future work, we plan to develop an approach that integrates the training of the teacher model and the knowledge distillation process in an end-to-end manner.

Author Contributions

Conceptualization, K.-M.K. and H.-S.W.; methodology, H.-S.W.; software, H.-S.W.; validation, H.-S.W. and J.-Y.C.; formal analysis, H.-S.W. and J.-Y.C.; investigation, H.-S.W. and J.-Y.C.; resources, H.-S.W. and J.-Y.C.; data curation, H.-S.W. and J.-Y.C.; writing—original draft preparation, H.-S.W., J.-Y.C. and N.Z.; writing—review and editing, H.-S.W., J.-Y.C., N.Z. and D.A.; visualization, H.-S.W.; supervision, K.-M.K. and D.A.; project administration, K.-M.K.; funding acquisition, K.-M.K. and H.-S.W. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Basic Research Program through the National Research Foundation of Korea (NRF) grant funded by the Korea Government [Ministry of Science and ICT (MSIT)] (No. 2022R1C1C1010317), and Seoul R&BD Program (CC240003) through the Seoul Business Agency(SBA) funded by Seoul Metropolitan Government.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The code is available from the corresponding author upon request.

Conflicts of Interest

Author Joon-Young Choi was employed by the company Danggeun Market Inc. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

References

  1. Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), Minneapolis, MN, USA, 2–7 June 2019; Burstein, J., Doran, C., Solorio, T., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2019; pp. 4171–4186. [Google Scholar] [CrossRef]
  2. Brown, T.B.; Mann, B.; Ryder, N.; Subbiah, M.; Kaplan, J.; Dhariwal, P.; Neelakantan, A.; Shyam, P.; Sastry, G.; Askell, A.; et al. Language Models are Few-Shot Learners. arXiv 2020, arXiv:2005.14165. [Google Scholar] [CrossRef]
  3. Touvron, H.; Martin, L.; Stone, K.; Albert, P.; Almahairi, A.; Babaei, Y.; Bashlykov, N.; Batra, S.; Bhargava, P.; Bhosale, S.; et al. Llama 2: Open Foundation and Fine-Tuned Chat Models. arXiv 2023, arXiv:2307.09288. [Google Scholar] [CrossRef]
  4. Houlsby, N.; Giurgiu, A.; Jastrzebski, S.; Morrone, B.; de Laroussilhe, Q.; Gesmundo, A.; Attariyan, M.; Gelly, S. Parameter-Efficient Transfer Learning for NLP. arXiv 2019, arXiv:1902.00751. [Google Scholar] [CrossRef]
  5. Hu, E.J.; Shen, Y.; Wallis, P.; Allen-Zhu, Z.; Li, Y.; Wang, S.; Wang, L.; Chen, W. LoRA: Low-Rank Adaptation of Large Language Models. arXiv 2021, arXiv:2106.09685. [Google Scholar] [CrossRef]
  6. Liu, X.; Ji, K.; Fu, Y.; Tam, W.; Du, Z.; Yang, Z.; Tang, J. P-Tuning: Prompt Tuning Can Be Comparable to Fine-tuning Across Scales and Tasks. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), Dublin, Ireland, 22–27 May 2022; Muresan, S., Nakov, P., Villavicencio, A., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2022; pp. 61–68. [Google Scholar] [CrossRef]
  7. Chen, S.; Wong, S.; Chen, L.; Tian, Y. Extending Context Window of Large Language Models via Positional Interpolation. arXiv 2023, arXiv:2306.15595. [Google Scholar] [CrossRef]
  8. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention Is All You Need. arXiv 2023, arXiv:1706.03762. [Google Scholar] [CrossRef]
  9. Liu, Y.; Ott, M.; Goyal, N.; Du, J.; Joshi, M.; Chen, D.; Levy, O.; Lewis, M.; Zettlemoyer, L.; Stoyanov, V. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv 2019, arXiv:1907.116922. [Google Scholar] [CrossRef]
  10. Liu, X.; Zheng, Y.; Du, Z.; Ding, M.; Qian, Y.; Yang, Z.; Tang, J. GPT Understands, Too. arXiv 2023, arXiv:2103.10385. [Google Scholar] [CrossRef]
  11. Jiang, Z.; Xu, F.F.; Araki, J.; Neubig, G. How Can We Know What Language Models Know? Trans. Assoc. Comput. Linguist. 2020, 8, 423–438. [Google Scholar] [CrossRef]
  12. Shin, T.; Razeghi, Y.; IV, R.L.L.; Wallace, E.; Singh, S. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. arXiv 2020, arXiv:2010.15980. [Google Scholar] [CrossRef]
  13. Li, X.L.; Liang, P. Prefix-Tuning: Optimizing Continuous Prompts for Generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), Online, 1–6 August 2021; Zong, C., Xia, F., Li, W., Navigli, R., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2021; pp. 4582–4597. [Google Scholar] [CrossRef]
  14. Jiao, X.; Yin, Y.; Shang, L.; Jiang, X.; Chen, X.; Li, L.; Wang, F.; Liu, Q. TinyBERT: Distilling BERT for Natural Language Understanding. In Proceedings of the Findings of the Association for Computational Linguistics: EMNLP 2020, Online, 16–20 November 2020; Cohn, T., He, Y., Liu, Y., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2020; pp. 4163–4174. [Google Scholar] [CrossRef]
  15. Sun, Z.; Yu, H.; Song, X.; Liu, R.; Yang, Y.; Zhou, D. MobileBERT: A Compact Task-Agnostic BERT for Resource-Limited Devices. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online, 5–10 July 2020; Jurafsky, D., Chai, J., Schluter, N., Tetreault, J., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2020; pp. 2158–2170. [Google Scholar] [CrossRef]
  16. Sanh, V.; Debut, L.; Chaumond, J.; Wolf, T. DistilBERT, a distilled version of BERT: Smaller, faster, cheaper and lighter. arXiv 2020, arXiv:1910.01108. [Google Scholar] [CrossRef]
  17. Hinton, G.; Vinyals, O.; Dean, J. Distilling the Knowledge in a Neural Network. arXiv 2015, arXiv:1503.02531. [Google Scholar]
  18. Wang, Y.; Wang, J.; Zhang, X. Parameter-efficient online knowledge distillation for pretrained language models. Expert Syst. Appl. 2025, 265, 126040. [Google Scholar] [CrossRef]
  19. Zhong, Q.; Ding, L.; Liu, J.; Du, B.; Tao, D. PanDa: Prompt Transfer Meets Knowledge Distillation for Efficient Model Adaptation. IEEE Trans. Knowl. Data Eng. 2024, 36, 4835–4848. [Google Scholar] [CrossRef]
  20. Zhang, J.; Muhamed, A.; Anantharaman, A.; Wang, G.; Chen, C.; Zhong, K.; Cui, Q.; Xu, Y.; Zeng, B.; Chilimbi, T.; et al. ReAugKD: Retrieval-Augmented Knowledge Distillation For Pre-trained Language Models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), Toronto, ON, Canada, 9–14 July 2023; Rogers, A., Boyd-Graber, J., Okazaki, N., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2023; pp. 1128–1136. [Google Scholar] [CrossRef]
  21. Calderon, N.; Mukherjee, S.; Reichart, R.; Kantor, A. A Systematic Study of Knowledge Distillation for Natural Language Generation with Pseudo-Target Training. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Toronto, ON, Canada, 9–14 July 2023; Rogers, A., Boyd-Graber, J., Okazaki, N., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2023; pp. 14632–14659. [Google Scholar] [CrossRef]
  22. Zhou, W.; Wang, Y.; Qian, X. Knowledge Distillation and Contrastive Learning for Detecting Visible-Infrared Transmission Lines Using Separated Stagger Registration Network. IEEE Trans. Circuits Syst. I Regul. Pap. 2024, 1–13. [Google Scholar] [CrossRef]
  23. Wang, J.; Chen, Y.; Zheng, Z.; Li, X.; Cheng, M.M.; Hou, Q. CrossKD: Cross-Head Knowledge Distillation for Object Detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 16–22 June 2024; pp. 16520–16530. [Google Scholar]
  24. Lan, Q.; Tian, Q. Gradient-Guided Knowledge Distillation for Object Detectors. arXiv 2023, arXiv:2303.04240. [Google Scholar] [CrossRef]
  25. Lan, Q.; Tian, Q. Instance, Scale, and Teacher Adaptive Knowledge Distillation for Visual Detection in Autonomous Driving. IEEE Trans. Intell. Veh. 2023, 8, 2358–2370. [Google Scholar] [CrossRef]
  26. Kullback, S.; Leibler, R.A. On information and sufficiency. Ann. Math. Stat. 1951, 22, 79–86. [Google Scholar] [CrossRef]
  27. Lester, B.; Al-Rfou, R.; Constant, N. The Power of Scale for Parameter-Efficient Prompt Tuning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, Online and Punta Cana, Dominican Republic, 7–11 November 2021; Moens, M.F., Huang, X., Specia, L., Yih, S.W.t., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2021; pp. 3045–3059. [Google Scholar] [CrossRef]
  28. Vu, T.; Lester, B.; Constant, N.; Al-Rfou’, R.; Cer, D. SPoT: Better Frozen Model Adaptation through Soft Prompt Transfer. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Dublin, Ireland, 22–27 May 2022; Muresan, S., Nakov, P., Villavicencio, A., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2022; pp. 5039–5059. [Google Scholar] [CrossRef]
  29. Romero, A.; Ballas, N.; Kahou, S.E.; Chassang, A.; Gatta, C.; Bengio, Y. FitNets: Hints for Thin Deep Nets. arXiv 2015, arXiv:1412.6550. [Google Scholar] [CrossRef]
  30. Wang, A.; Pruksachatkun, Y.; Nangia, N.; Singh, A.; Michael, J.; Hill, F.; Levy, O.; Bowman, S.R. SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems. arXiv 2019, arXiv:1905.00537. [Google Scholar] [CrossRef]
  31. Clark, C.; Lee, K.; Chang, M.W.; Kwiatkowski, T.; Collins, M.; Toutanova, K. BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questions. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), Minneapolis, MN, USA, 2–7 June 2019; Burstein, J., Doran, C., Solorio, T., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2019; pp. 2924–2936. [Google Scholar] [CrossRef]
  32. De Marneffe, M.C.; Simons, M.; Tonhauser, J. The CommitmentBank: Investigating Projection in Naturally Occurring Discourse. 2019. To Appear in Proceedings of Sinn und Bedeutung 23. Available online: https://github.com/mcdm/CommitmentBank/ (accessed on 20 January 2025).
  33. Roemmele, M.; Bejan, C.A.; Gordon, A.S. Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In Proceedings of the 2011 AAAI Spring Symposium Series, Stanford, CA, USA, 21–23 March 2011. [Google Scholar]
  34. Khashabi, D.; Chaturvedi, S.; Roth, M.; Upadhyay, S.; Roth, D. Looking beyond the surface: A challenge set for reading comprehension over multiple sentences. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), New Orleans, LA, USA, 1–6 June 2018; pp. 252–262. [Google Scholar]
  35. Zhang, S.; Liu, X.; Liu, J.; Gao, J.; Duh, K.; Durme, B.V. ReCoRD: Bridging the Gap between Human and Machine Commonsense Reading Comprehension. arXiv 2018, arXiv:1810.12885. [Google Scholar]
  36. Dagan, I.; Glickman, O.; Magnini, B. The PASCAL recognising textual entailment challenge. In Machine Learning Challenges. Evaluating Predictive Uncertainty, Visual Object Classification, and Recognising Tectual Entailment; Springer: Berlin/Heidelberg, Germany, 2006; pp. 177–190. [Google Scholar]
  37. Bar Haim, R.; Dagan, I.; Dolan, B.; Ferro, L.; Giampiccolo, D.; Magnini, B.; Szpektor, I. The Second PASCAL Recognising Textual Entailment Challenge. In Proceedings of the Second PASCAL Challenges Workshop on Recognising Textual Entailment, Venice, Italy, 10–12 April 2006; Volume 7, pp. 785–794. [Google Scholar]
  38. Pilehvar, M.T.; Camacho-Collados, J. WiC: The Word-in-Context Dataset for Evaluating Context-Sensitive Meaning Representations. In Proceedings of the NAACL-HLT, Minneapolis, MN, USA, 2–7 June 2019. [Google Scholar]
  39. Levesque, H.J.; Davis, E.; Morgenstern, L. The Winograd schema challenge. In Proceedings of the AAAI Spring Symposium: Logical Formalizations of Commonsense Reasoning, Stanford, CA, USA, 21–23 March 2011; Volume 46, p. 47. [Google Scholar]
  40. Tjong Kim Sang, E.F.; De Meulder, F. Introduction to the CoNLL-2003 Shared Task: Language-Independent Named Entity Recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, Edmonton, AB, Canada, 31 May–1 June 2003; pp. 142–147. [Google Scholar]
  41. Carreras, X.; Màrquez, L. Introduction to the CoNLL-2004 Shared Task: Semantic Role Labeling. In Proceedings of the Eighth Conference on Computational Natural Language Learning (CoNLL-2004) at HLT-NAACL 2004, Boston, MA, USA, 6–7 May 2004; pp. 89–97. [Google Scholar]
  42. Carreras, X.; Màrquez, L. Introduction to the CoNLL-2005 Shared Task: Semantic Role Labeling. In Proceedings of the Ninth Conference on Computational Natural Language Learning (CoNLL-2005), Ann Arbor, MI, USA, 29–30 June 2005; Dagan, I., Gildea, D., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2005; pp. 152–164. [Google Scholar]
  43. Pradhan, S.; Moschitti, A.; Xue, N.; Uryupina, O.; Zhang, Y. CoNLL-2012 Shared Task: Modeling Multilingual Unrestricted Coreference in OntoNotes. In Proceedings of the Joint Conference on EMNLP and CoNLL - Shared Task, Jeju Island, Republic of Korea, 12–14 July 2012; Pradhan, S., Moschitti, A., Xue, N., Eds.; Ninth Conference on Computational Natural Language Learning. pp. 1–40. [Google Scholar]
  44. Weischedel, R.; Palmer, M.; Marcus, M.; Hovy, E.; Pradhan, S.; Ramshaw, L.; Xue, N.; Taylor, A.; Kaufman, J.; Franchini, M.; et al. Ontonotes release 5.0 ldc2013t19. Linguist. Data Consort. 2013, 23, 170. [Google Scholar]
  45. Rajpurkar, P.; Zhang, J.; Lopyrev, K.; Liang, P. SQuAD: 100,000+ Questions for Machine Comprehension of Text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, Austin, TX, USA, 1–5 November 2016; Su, J., Duh, K., Carreras, X., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2016; pp. 2383–2392. [Google Scholar] [CrossRef]
  46. Rajpurkar, P.; Jia, R.; Liang, P. Know What You Don’t Know: Unanswerable Questions for SQuAD. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), Melbourne, Australia, 15–20 July 2018; Gurevych, I., Miyao, Y., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2018; pp. 784–789. [Google Scholar] [CrossRef]
  47. Li, C.; Goldwasser, D. Encoding Social Information with Graph Convolutional Networks forPolitical Perspective Detection in News Media. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Florence, Italy, 28 July–2 August 2019; Korhonen, A., Traum, D., Màrquez, L., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2019; pp. 2594–2604. [Google Scholar] [CrossRef]
  48. Wolf, T.; Debut, L.; Sanh, V.; Chaumond, J.; Delangue, C.; Moi, A.; Cistac, P.; Rault, T.; Louf, R.; Funtowicz, M.; et al. Transformers: State-of-the-Art Natural Language Processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, Online, 16–20 November 2020; Liu, Q., Schlangen, D., Eds.; Association for Computational Linguistics: Stroudsburg, PA, USA, 2020; pp. 38–45. [Google Scholar] [CrossRef]
Figure 1. Performance variation in P-tuning v2 across tasks based on length of continuous prompts.
Figure 1. Performance variation in P-tuning v2 across tasks based on length of continuous prompts.
Applsci 15 02420 g001
Figure 2. (a) An illustration of P-tuning v2 [6]. (b) An illustration of the proposed method, denoted as P-Distill. This method trains a teacher model to generate concise and effective prompts, followed by distilling the knowledge into a student model.
Figure 2. (a) An illustration of P-tuning v2 [6]. (b) An illustration of the proposed method, denoted as P-Distill. This method trains a teacher model to generate concise and effective prompts, followed by distilling the knowledge into a student model.
Applsci 15 02420 g002
Figure 3. Illustration of various prompt initialization methods.
Figure 3. Illustration of various prompt initialization methods.
Applsci 15 02420 g003
Figure 4. Comparison of ablation study results across various tasks, with different colors and bar styles representing distinct variants of P-Distill.
Figure 4. Comparison of ablation study results across various tasks, with different colors and bar styles representing distinct variants of P-Distill.
Applsci 15 02420 g004
Table 1. Notation Table.
Table 1. Notation Table.
SymbolDescription
xInput sequence or data point
Q , K , V Query, key, and value matrices in attention mechanism
d k Dimensionality of key vectors; scaling factor for gradient stabilization
softmaxSoftmax function used for normalization in attention
P k , P v Continuous prompts added to key and value vectors
n p Length of continuous prompts
dDimensionality of hidden states and key/value vectors
f T , f S Behavior functions of teacher and student models in knowledge distillation
L K D Knowledge distillation loss function
XDataset used for training or evaluation
LLoss function (e.g., KL divergence, MSE)
n t Prompt length of teacher model
n s Prompt length of student model
W k , W v Learnable weight matrices for prompt initialization
b k , b v Bias terms for prompt initialization
L C E Cross-entropy loss function
L p r e d Prediction-layer distillation loss
L h i d d e n Hidden-state distillation loss
λ 1 , λ 2 , λ 3 Weighted coefficients for loss combination
Table 2. Experimental results on the SuperGLUE validation dataset. For P-Distill, training was performed using a teacher model with the prompt length exhibiting the best performance for P-tuning v2. The numbers in parentheses indicate the lengths of the prompt attached to the model. (Acc.: accuracy; bold: the best; underline: the second best).
Table 2. Experimental results on the SuperGLUE validation dataset. For P-Distill, training was performed using a teacher model with the prompt length exhibiting the best performance for P-tuning v2. The numbers in parentheses indicate the lengths of the prompt attached to the model. (Acc.: accuracy; bold: the best; underline: the second best).
BoolQ
Acc.
CB
Acc.
COPA
Acc.
MultiRC
F1a
ReCoRD
F1
RTE
Acc.
WiC
Acc.
WSC
Acc.
Average
Fine-tuning0.7770.9460.7100.7050.7060.7620.7460.6830.754
P-tuning v20.764(8)0.946(32)0.810(4)0.711(16)0.728(16)0.794(4)0.756(4)0.731(16)0.780
0.738(1)0.929(4)0.790(1)0.707(2)0.721(2)0.783(1)0.745(1)0.692(2)0.763
P-Distill0.776(1)0.964(4)0.810(1)0.718(2)0.726(2)0.798(1)0.759(1)0.721(2)0.784
Table 3. Experimental results for each method on named entity recognition (NER), question answering (QA), semantic role labeling (SRL), and long-sequence classification (SC). For P-Distill, training was performed using a teacher model with the prompt length exhibiting the best performance for P-tuning v2. The numbers in parentheses indicate the lengths of the prompts attached to the model. All metrics are reported as F1-scores. (bold: the best; underline: the second best).
Table 3. Experimental results for each method on named entity recognition (NER), question answering (QA), semantic role labeling (SRL), and long-sequence classification (SC). For P-Distill, training was performed using a teacher model with the prompt length exhibiting the best performance for P-tuning v2. The numbers in parentheses indicate the lengths of the prompts attached to the model. All metrics are reported as F1-scores. (bold: the best; underline: the second best).
NERSRLQASC
CoNLL03CoNLL04OntoNotes
5.0
CoNLL05
Brown
CoNLL05
WSJ
SQuAD
1.1 Dev
SQuAD
2.0 Dev
Allsides
Fine-tuning0.9280.8820.8900.8270.8850.9110.8190.780
P-tuning v20.919(64)0.880(128)0.885(128)0.837(32)0.890(128)0.902(64)0.782(128)0.775(32)
0.914(8)0.866(16)0.881(16)0.807(4)0.877(16)0.891(8)0.771(16)0.772(4)
P-Distill0.919(8)0.888(16)0.886(16)0.817(4)0.885(16)0.896(8)0.775(16)0.783(4)
Table 4. Comparison of P-Distill performance across varying prompt compression ratios. Bold values indicate the best performance.
Table 4. Comparison of P-Distill performance across varying prompt compression ratios. Bold values indicate the best performance.
CoNLL05 WSJFine-TuningP-Tuning v2P-Distill
0.8850.890(128)0.890(64)
0.888(32)
0.885(16)
Table 5. Comparison of additional experiment results across various tasks based on prompt initialization methods. All metrics are reported as micro-F1-scores. (bold: the best).
Table 5. Comparison of additional experiment results across various tasks based on prompt initialization methods. All metrics are reported as micro-F1-scores. (bold: the best).
CoNLL03CoNLL04CoNLL05
WSJ
CoNLL05
Brown
P-Distill0.9190.8880.8850.817
P-Distillmean0.9150.8750.8780.809
P-Distillmax0.9120.8720.8720.803
Table 6. Experimental results on the SuperGLUE validation dataset for small datasets (CB, COPA, RTE). For P-Distill, training was performed using a teacher model with the prompt length exhibiting the best performance for P-tuning. The numbers in parentheses indicate the lengths of the prompt attached to the model. All metrics are accuracy.
Table 6. Experimental results on the SuperGLUE validation dataset for small datasets (CB, COPA, RTE). For P-Distill, training was performed using a teacher model with the prompt length exhibiting the best performance for P-tuning. The numbers in parentheses indicate the lengths of the prompt attached to the model. All metrics are accuracy.
CBCOPARTE
Fine-tuning0.9460.710.762
P-tuning0.821(16)0.76(16)0.657(16)
0.786(2)0.70(2)0.621(4)
P-Distill0.821(2)0.76(2)0.646(4)
Table 7. Comparing GFLOPs of baseline methods and P-Distill on SuperGLUE using BERTlarge.
Table 7. Comparing GFLOPs of baseline methods and P-Distill on SuperGLUE using BERTlarge.
Fine-TuningP-Tuning v2P-Distill
BoolQ89.0689.17(8)89.07(1)
CB53.9454.22(32)53.97(4)
COPA21.8221.83(4)21.82(1)
MultiRC226.94227.50(16)227.01(2)
ReCoRD163.12163.53(16)163.17(2)
RTE42.7842.81(4)42.79(1)
WiC18.8318.84(4)18.83(1)
WSC23.1123.17(4)23.11(1)
Table 8. Example of P-tuning v2 and P-Distill predictions on Allsides dataset.
Table 8. Example of P-tuning v2 and P-Distill predictions on Allsides dataset.
P-tuning v2 Input Text (480 tokens): President Trump on Wednesday lashed out over a critical news report and escalated his previous attacks on the media by suggesting that news organizations he disagrees with be shut down, alarming free-speech advocates who compared the tactics to intimidation efforts by the Nixon administration.
[…]
Last week, angered by the ongoing investigations into his campaign’s ties to Russia, Trump suggested that the Senate Intelligence Committee investigate news outlets over “fake news”. Over the weekend, he expressed disdain at late-night television hosts over their “anti-Trump” material and proposed bringing back the Fairness Doctrine, a rule phased out in 1987 that had required
Prediction: Left
P-Distill Input Text (508 tokens): President Trump on Wednesday lashed out over a critical news report and escalated his previous attacks on the media by suggesting that news organizations he disagrees with be shut down, alarming free-speech advocates who compared the tactics to intimidation efforts by the Nixon administration.
[…]
Last week, angered by the ongoing investigations into his campaign’s ties to Russia, Trump suggested that the Senate Intelligence Committee investigate news outlets over “fake news”. Over the weekend, he expressed disdain at late-night television hosts over their “anti-Trump” material and proposed bringing back the Fairness Doctrine, a rule phased out in 1987 that had required broadcasters to provide “equal time” for divergent political views on certain issues. First Amendment advocates roundly condemned the president over his remarks, calling them an assault
Prediction: Center
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Won, H.-S.; Choi, J.-Y.; Zaman, N.; Aliyeva, D.; Kim, K.-M. P-Distill: Efficient and Effective Prompt Tuning Using Knowledge Distillation. Appl. Sci. 2025, 15, 2420. https://doi.org/10.3390/app15052420

AMA Style

Won H-S, Choi J-Y, Zaman N, Aliyeva D, Kim K-M. P-Distill: Efficient and Effective Prompt Tuning Using Knowledge Distillation. Applied Sciences. 2025; 15(5):2420. https://doi.org/10.3390/app15052420

Chicago/Turabian Style

Won, Hyun-Sik, Joon-Young Choi, Namrah Zaman, Dinara Aliyeva, and Kang-Min Kim. 2025. "P-Distill: Efficient and Effective Prompt Tuning Using Knowledge Distillation" Applied Sciences 15, no. 5: 2420. https://doi.org/10.3390/app15052420

APA Style

Won, H.-S., Choi, J.-Y., Zaman, N., Aliyeva, D., & Kim, K.-M. (2025). P-Distill: Efficient and Effective Prompt Tuning Using Knowledge Distillation. Applied Sciences, 15(5), 2420. https://doi.org/10.3390/app15052420

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop