Joon-Young Choi, Junho Kim, Jun-Hyung Park, Wing-Lam Mok, SangKeun Lee
Department of Artificial Intelligence, Korea University, Seoul, Republic of Korea
Abstract
- (Ineffeciency in Prompt tuning) Prompt tuning 은 finetuning 을 대체하는 효율적인 학습 방식이지만, 기존의 prompt tuning 은 100 token 이상을 사용하여 inefficiency 가 존재한다.
- ( SMoP ) 저자들은 SMoP (Sparse Mixture-of-Prompts )라는, short soft prompt 를 활용하는 방법론을 제안한다. SMoP 는 data 의 다른 subset 을 각각 specialized handling 하는 short soft prompt 여러 개를 gating mechanism 을 이용해 학습에 활용한다.
- (Experiment) 실험 결과, SMoP 는 training-inference cost 를 줄이면서 basline method 를 outperform 한다.
1. Introduction
▶ Prompt tuning
Prompt tuning 은 Fine-tuning 을 대체할 parameter-efficient alternative tuning 방식으로 최근 주목을 받고 있다. 이 방식은 보통 기존의 LM param 은 freeze 하고 soft prompt 를 solely tuning 하여 mode input 앞단에 prepend 하는 방식으로, 효율적이면서도 강력한 성능을 보여준다. 여러 prompt tuning 기법이 제안이 되는 과정에서, 더 나은 성능을 보이기 위해 더 긴 prompt 가 사용이 되어 왔다. 최근에는 typically 100 token 이 넘는 soft prompt length 가 model performance 향상에 좋다고 알려졌지만, 그 computational requirement 에 대한 고려는 거의 없었다.
▶ SMoP : Sparse Mixture-of-Prompts
이에 저자들은 SMoP(Sparse Mixture-of-Prompts) 라는 방법을 제안한다. SMoP 는 training 와 inference 단계에서 short soft prompt 를 활용한다. Sparsely-Gated Mixture-of-Experts (MoE) 에 영감(inspriation) 을 받아서, 각각 data 의 subset 에 specialized handling 이 가능한 short soft prompt 여러개를 활용하는 방법이다.
아래 그림에서, 기존의 prompt tuning 은 100 토큰이 될 때, 오히려 Training memory 를 finetuning 보다 더 사용하기도 한다. 그러나 SMoP 는 그러한 문제가 전혀 발생하지 않는 효율적이면서도 좋은 성능을 보이는 방법론이다.
실험결과, SMoP는 SuperGLUE benchmark 에 대하여, T5-base 와 T5-large 에 대해, 기존의 prompt tuning 방법론보다, training time, memory, inference computation 에서 효율적이면서도 좋은 성능을 보인다.
2. Method
2.1. Preliminaries
Full Fine-tuning
Sequence-to-Sequence model : $p_{\phi}(y x)$ parameteriezed by $\phi$ - embedding : $X={x_1, x_2, …, x_n } \in R^{n \times e}$
- label : $Y$
- objective of full-fintuning :
Prompt Tuning
- soft prompt length : $l$
- soft prompt embedding : $P_\theta$
- objective of prompt-tuning:
; : concatentation 위의 Figure2 (a) 에서 prompt tuning 을 볼수 있다.
2.2. SMoP: SParse Mixture-of-Prompts
The goal of SMoP is to train multiple short soft prompts, where each prompt is specialized in a subset of the data. SMoP는 각각 data subset 에 specialized 된 여러 개의 short prompt 을 학습한다. 이를 위해, 위의 Figure2 (b) 처럼 Gatining mechanism 을 도입한다.
Gating mechanism 에서는 small linear router model $L_u$ 를 도입한다. 이 모델은 $u \in R^{e \times k}$ 로 parameterized 되어 있다. 라우터 모델은 어떤 soft prompt 가 routed 되어 input 으로 들어갈지를 결정한다. $k$ 개의 soft prompt embedding $P_{\theta_1}, P_{\theta_2}, …, P_{\theta_k}$ 에 대해, 라우터 모델은 그 input average embedding $X$ 를 이용하여 routing probability $p_1, p_2, …,p_k$ 를 계산한다.
이후, highest prob 을 갖는 soft prompt 가 입력으로 routed 되어 들어간다. 따라서 SMoP 의 objective 는 아래와 같다.
c : index of the prompt with the highest probability value
2.3. Router Perturbation
기존의 Mixutre-of-Experts(MoEs) 논문에서, 학습 단계에서의 experts 사이의 balance 조정을 통해 성능을 끌어올린 것처럼, soft prompt 사이의 load balance 를 조절한다. 이를 위해 SMoP 학습에서 router pertrubation 을 도입하여, Gaussian noise 를 주입한다.
따라서 위의 prob 계산 과정에서 Gaussian pertrubation 이 추가된다.
3. Experiments
3.1. Experimental Settings
- Tasks : SUperGLUE
- Backbone Models : T5-base, T5-large
- Baseliens : Prompt tuning (Lester et al.), P-tuning(Liu et al.), full fine-tuning
- Eval setup : prompt tuning : length {5,20,50,100} SMoP : {1,3,5,10}
- report training time, memory usage, FLops for inference cost
3.2. Results
Main Results
- SMoP 가 highest performance 를 달성한다(Average 2.5%, T5-large 에서 3.4% 향상)
- SMoP 가 더욱 효율적이다(14.6% training time, 22.9% training memory, 27.2% inference FLOPs in T5-large).
Length and Number of Soft Prompts
- Best performance 는 4 soft prompt (k=4) 에 length 5 (l=5) 일 때이다.
- prompt length 가 너무 길면 (50 이상) 성능이 좋지 않고, 20 개 이상의 prompt 를 쓰는 것은 도움이 안된다.
Routing Methods
- 다양한 routning method 에 대한 비교에서 SMoP 가 활용하는 routing 기법 (top-1 with gaussian perturbation) 이 가장 성능이 좋다.
Conclusion
We have presented SMoP (Sparse Mixture-ofPrompts), a novel prompt tuning method that utilizes short soft prompts for efficient training and inference while maintaining performance gains associated with increased prompt length. To achieve this, we have employed a gating mechanism in SMoP that routes each instance to one of the multiple short soft prompts. Experimental results have demonstrated that SMoP has outperformed prompt tuning while reducing training and inference costs through the utilization of short soft prompts.
Limitations
Given the same total prompt length, the gating mechanism of SMoP introduces additional parameters compared to prompt tuning, inducing additional storage requirements. Comparing prompt tuning with a soft prompt of length 20 (20,480 trainable parameters) and SMoP with 4 prompts of length 5 (24,576 trainable parameters) on T5-base, SMoP adds 20% trainable parameters and such difference increases as more prompts are utilized. We further note that SMoP is orthogonal to most of the existing prompt tuning methods including prompt transfer learning methods (Vu et al., 2022; Asai et al., 2022; Wang et al., 2023) as mentioned in Section 4. While our investigation has highlighted the significance of incorporating short soft prompts through sparse activation in conventional singletask prompt tuning, we believe that SMoP holds promise as a valuable direction for augmenting the efficiency of prompt tuning methods in the future.