\documentclass[english]{jnlp_3.7}
\usepackage{jnlpbbl_2.2}
\usepackage[dvipdfmx]{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{url}
\usepackage{hangcaption_jnlp}
\usepackage{array}
%%%%\usepackage{udline}
%%%%\setulminsep{1.2ex}{0.2ex}
%%%%\let\underline=\ul
\allowdisplaybreaks


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% author's definition

%%%%%\renewcommand\UrlFont{\rmfamily}
%%%%%\usepackage{algorithm}
%%%%%\usepackage{algorithmic}
\usepackage{booktabs}
%%%%%\usepackage{graphicx}
\usepackage{multirow}
%%%%%\usepackage{makecell}
%%%%%\usepackage{color}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\Volume{31}
\Number{1}
\Month{March}
\Year{2024}
%%%%\Issuetitle{「　　　　」特集号}

\received{2023}{8}{24}
\revised{2023}{11}{20}
%%%%%\rerevised{2006}{5}{6}
\accepted{2023}{12}{21}

\setcounter{page}{250}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\esubject{General Paper}
\etitle{Focused Prefix Tuning for Controllable Text Generation}
\eauthor{Congda Ma\affiref{Author_1} \and Tianyu Zhao\affiref{Author_2} \and Makoto Shing\affiref{Author_3} \and Kei Sawada\affiref{Author_2} \and Manabu Okumura\affiref{Author_1}} 
\eabstract{
	In a controllable text generation dataset, unannotated attributes may provide irrelevant learning signals to models that use them for training, thereby degrading their performance. We propose \emph{focused prefix tuning}(FPT) to mitigate this problem and enable control to focus on the desired attribute. Experimental results show that FPT can achieve better control accuracy and text fluency than baseline models in single-attribute control tasks. In multi-attribute control tasks, FPT achieves control accuracy comparable to that of the state-of-the-art approach while maintaining the flexibility to control new attributes without retraining existing models.
}
\ekeywords{Controllable Text Generation, Parameter-Efficient Fine-Tuning}

\headauthor{Ma et al.}
\headtitle{Focused Prefix Tuning for Controllable Text Generation}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\affilabel{Author_1}{}{Tokyo Institute of Technology}
\affilabel{Author_2}{}{rinna Co. Ltd.}
\affilabel{Author_3}{}{Stability AI Ltd.}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}\label{intro}
Controllable text generation aims to generate text associated with specific attributes. For example, given an attribute \textsc{topic} = \emph{sports} and a prompt ``\emph{There is},'' a model is supposed to generate a continuation whose \textsc{topic} is \emph{sports}, such as ``\emph{There is a tennis match ...}''.


In datasets for the controllable text generation task, there exists an annotated attribute, which we call the \emph{explicit attribute} (e.g., the \textsc{topic} attribute in the AGNews dataset). In addition to the \emph{explicit attributes}, the datasets tend to have their own tendencies. For example, up to 98\% of training data pieces in the IMDb dataset exhibit ``\textsc{topic} = \emph{sci/tech}'', while up to 94\% of training data pieces in the AGNews exhibit ``\textsc{sentiment} = \emph{negative}''.\footnote{The models used for classification are from \cite{DBLP:journals/corr/abs-2210-02889}.} This tendency is called an \emph{implicit attribute} (e.g., the \textsc{topic} attribute in the IMDb dataset).

The existence of \emph{implicit attributes} could degrade the performance in controlling an \emph{explicit attribute} when the models are trained on the datasets. Since implicit attributes are at the dataset level and are related to undesired explicit attributes, the probability of generating content with implicit attributes is likely to increase initially. When the text with implicit attributes is generated, the probability of generating content with other undesired explicit attributes increases, and the text with these attributes might be generated next. Consequently, as shown in Table \ref{problem}, the model generates content with high implicit attribute relevance but low desired explicit attribute relevance (e.g., Vanilla Prefix Tuning \cite{li-liang-2021-prefix}). In contrast, if the model generates content with low implicit attribute relevance, it will have highly desired explicit attribute relevance (e.g., DExperts \cite{liu-etal-2021-dexperts}). We call this phenomenon \emph{attribute transfer}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}[t]
\input{09table01.tex}
\hangcaption{Relevance of texts generated by different models (e.g., DExperts and Vanilla Prefix Tuning) trained on IMDb dataset. We found a lower desired explicit attribute (e.g., \textsc{sentiment}) relevance is related to a higher implicit attribute (e.g., \textsc{topic} = \emph{sci/tech}) relevance. The relevance is calculated by the classifier models in Sec. \ref{4.1.2}.}
\label{problem}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

To mitigate the effects of attribute transfer, we propose \emph{focused prefix tuning}(FPT), which focuses the generation on the desired explicit attributes. FPT uses \emph{specific} and \emph{general }prefixes to encode the explicit and implicit attributes, respectively. FPT combines the control power of the two prefixes via \emph{logits manipulation} at inference time. Experimental results show that FPT achieves better control accuracy and fluency in single-attribute control tasks. In multi-attribute control tasks, FPT can achieve performance comparable to that of the state-of-the-art approach. Moreover, as we show, FPT enables the training of each attribute prefix individually, allowing for the incremental addition of new attributes without retraining all the prefixes.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Related Work}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Controllable Generation}

Methods for controlling text generation have rapidly developed \cite{ficler-goldberg-2017-controlling,DBLP:conf/iclr/DathathriMLHFMY20,madotto-etal-2020-plug,DBLP:conf/iclr/ChanOPZF21}. \citeA{Keskar2019CTRLAC} trained a large transformer model to generate contents conditioned on up to 55 attributes. However, the cost of training such models is extremely high.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Prefix Tuning}

Parameter-efficient fine-tuning (PEFT) methods, such as prompt tuning \cite{lester-etal-2021-power}, have become particularly significant in driving various natural language processing tasks to reduce the high training cost. Prefix tuning \cite{li-liang-2021-prefix} is a PEFT method that steers pre-trained models \cite{radford2019language,lewis-etal-2020-bart} by applying an additional continuous vector embedding before every activation layer. \citeA{qian-etal-2022-controllable} proposed a contrastive prefix-tuning method that improves its performance by utilizing the relations between attributes. However, they focused only on explicitly annotated attributes and ignored the effects of implicit attributes.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Inference-time Methods}

Inference time methods \cite{mireshghallah-etal-2022-mix,yang-klein-2021-fudge,DBLP:conf/iclr/DathathriMLHFMY20,madotto-etal-2020-plug}, which are lightweight approaches that do not update the parameters, have been used for controllable text generation. To enhance controllability, \citeA{krause-etal-2021-gedi-generative} proposed a method that combines the computed classification probability distributions. \citeA{liu-etal-2021-dexperts} found that directly applying probability distributions from language models is a simple but effective approach to control generated texts. Inspired by their work, we propose a method that uses probability distributions from language models to eliminate the effects of implicit attributes.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Methodology}

The task of controllable generation is, given a sequence of prompt tokens $x_{<t}$ and an attribute \textsc{attr} = \emph{val} (e.g., \textsc{topic} = \emph{sports}), to generate a sequence of tokens as a continuation $x$ that conforms to both the prompt and specified attribute.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Vanilla Prefix Tuning}

In controllable text generation, a prefix can steer a pre-trained model parameterized by $\theta$ to generate texts under a specific attribute value \textsc{attr} = \emph{val}. Particularly, vanilla prefix tuning \cite{li-liang-2021-prefix} prepends a set of continuous vectors before each activation layer of the pre-trained transformer. The continuous vectors are referred to as the prefix $H_{\phi}^{\text{attr=val}}$, which is parameterized by $\phi$.

During training, we freeze the pre-trained model's parameters $\theta$ and update only the prefix parameters $\phi$ to optimize the following objective:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{align}
    -\sum_{x \in \mathcal{D}^{\text{attr=val}}} {log P(x_t|x_{<t}, H_{\phi}^{\text{attr=val}}, \theta)},
    \label{equ:vanilla_pt_obj}
\end{align}
where $\mathcal{D}^{\text{attr=val}}$ is the subset of the entire dataset $\mathcal{D}$ whose attribute \textsc{attr} is \emph{val}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Following \citeA{li-liang-2021-prefix}, we initialize the prefix $H_{\phi}$ with the activation of actual tokens from the pre-trained model's vocabulary.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Specific and General Prefixes}

The prefix in vanilla prefix tuning captures an explicit attribute in a dataset by training it on the subset dataset $\mathcal{D}^{\text{attr=val}}$. In contrast, to capture only implicit attributes while ignoring any explicit attributes, we propose training another prefix on the entire dataset $\mathcal{D}$. 
To distinguish between the two prefixes, we refer to the prefix trained on $\mathcal{D}^{\text{attr=val}}$ as a \emph{specific prefix} and the one trained on $\mathcal{D}$ as a \emph{general prefix}.

The specific prefix is the same as the one used in vanilla prefix tuning; therefore, we still use Equation \ref{equ:vanilla_pt_obj} to update its parameters. To update the general prefix's parameters, we optimize the following objective:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{align}
    -\sum_{x \in \mathcal{D}} {log P(x_t|x_{<t}, H_{\phi'}^{\text{genl}}, \theta)}, 
    \label{equ:general_pt_obj}
\end{align}
where $H_{\phi'}^{\text{genl}}$ represents the general prefix parameterized by $\phi'$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Inference-time Logits Manipulation}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[b]
\begin{center}
%%%%%\includegraphics[width=1.0\linewidth]{fig.pdf}
\includegraphics{31-1ia9f1.pdf}
\end{center}
\caption{Proposed model framework.}
\label{fig-1}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


As shown in Figure \ref{fig-1}, FPT suppresses the probability of words with implicit attributes in the generated text by combining logits $z^\text{attr=val}$ steered by the specific prefix and logits $z^{\text{genl}}$ steered by the general prefix via logits manipulation at inference time. For example, when generating text with the attribute \textsc{topic} = \emph{sports}, the probability of words with implicit attributes (e.g., ``\emph{impossible}'' with \textsc{sentiment} = \emph{negative}) would be suppressed.
During inference, at each step $t$, we first make two forward runs respectively with the specific and general prefixes to obtain their logits, $z_t^\text{attr=val}$ and $z_t^{\text{genl}}$.
Since $z_t^\text{attr=val}$ encodes both the explicit and implicit attributes while $z_t^{\text{genl}}$ encodes mostly the implicit attributes, we use a subtraction operation at the logits level
to suppress the probability of words with implicit attributes:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{align}
P&(x_t|x_{<t}, \textsc{attr}=\emph{val}) \nonumber \\
&= P(x_t|x_{<t}, H_{\phi}^{\text{attr=val}}, H_{\phi'}^{\text{genl}}, \theta) \nonumber \\
&= \text{softmax}(\alpha z_t^{\text{attr=val}} - (\alpha-1) z_t^{\text{genl}}), 
\label{equ:logits_manipulation}
\end{align}
where $\alpha$ is a hyperparameter that can be interpreted as the strength of controlling for implicit attributes. Following \citeA{liu-etal-2021-dexperts}, we respectively set $\alpha$ and $\alpha-1$ as the weight of $z^\text{attr=val}$ and $z_t^{\text{genl}}$ to make the ratio of logits after the logits manipulation equal to 1.

To ensure the fluency of the generated texts, we follow \citeA{liu-etal-2021-dexperts} and use top-$p$ filtering \cite{conf/iclr/HoltzmanBDFC20} to remove the tokens that have low scores in advance before logits manipulation. In particular, we modify the logits produced by the specific prefix by calculating the top-$p$ vocabulary $\widetilde{V}$ and setting all the logits outside $\widetilde{V}$ to $-\infty$:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{equation}
\widetilde{z}[v]=\left \{
\begin{aligned}
z[v] & , & if \quad v\in \widetilde{V} \\
-\infty & , & if \quad v\notin \widetilde{V}
\end{aligned}
\right.
\label{sampling}
.
\end{equation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Therefore, the logits manipulation in Equation \ref{equ:logits_manipulation} is updated as follows:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{align}
P'&(x_t|x_{<t}, \textsc{attr}=\emph{val}) \nonumber \\
&= \text{softmax}(\alpha \widetilde{z_t^{\text{attr=val}}} - (\alpha-1) z_t^{\text{genl}}).
\end{align}
The token at step $t$ is then selected by ancestral sampling from $P'(x_t|x_{<t}, \textsc{attr}=\emph{val})$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Multi-attribute FPT}

FPT is also applicable to multi-attribute control tasks, where we aim to simultaneously control multiple different attributes at the same time. Similarly, we first train the specific prefix for each attribute. Then, we adapt the logits manipulation to the multi-attribute task as follows:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{align}
    P'(x_t|x_{<t}, &\{\textsc{attr}_i = \emph{val}_i\}_{1 \le i \le K} ) \nonumber \\
    & = \text{softmax}( \sum_{i=1}^{K} z^{\text{attr}_i}_{t}),
\end{align}
where $K$ denotes the number of different attributes; each $z^{\text{attr}_i}_{t}$ is the combination of the logits from the corresponding specific and general prefixes. Since applying top-$p$ filtering to every attribute could possibly result in an empty $\widetilde{V}$, we apply the filtering only to the first attribute:
\begin{equation}
z^{\text{attr}_i}_{t} = \left\{
    \begin{aligned}
    \alpha \widetilde{z_t^{\text{attr$_i$=val$_i$}}} - (\alpha-1) z_t^{\text{genl$_i$}} & , & \text{if } i = 1 \\
    \alpha z_t^{\text{attr$_i$=val$_i$}} - (\alpha-1) z_t^{\text{genl$_i$}} & , & \text{otherwise}
    \end{aligned}
\right.
\label{equ:multi_attr_logits_manipulation}
\end{equation}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Experiments}\label{4}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Single-attribute Control Experiments}\label{4.1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Baselines}

\paragraph{GPT-2} \cite{radford2019language}: We used the public checkpoint of GPT-2 Medium as the most common baseline.\footnote{The checkpoint of GPT-2 Medium is from \url{https://huggingface.co/gpt2-medium}.} 
\paragraph{DExperts} \cite{krause-etal-2021-gedi-generative}: A fine-tuning method applying logits manipulation in the inference step. 
\paragraph{GeDi} \cite{krause-etal-2021-gedi-generative}: A method combining the classification probabilities for possible next tokens in the inference step. 
\paragraph{Vanilla Prefix Tuning} \cite{li-liang-2021-prefix}: The common prefix-tuning method. 
\paragraph{Contrastive Prefix Tuning} \cite{qian-etal-2022-controllable}: A strong baseline that takes into account the relationship between attributes.

We also set up a variant of FPT:
\begin{itemize}
\item[1]\textbf{Contrastive FPT}: In this variant, we apply the contrastive prefix-tuning method \cite{qian-etal-2022-controllable}. When training a specific prefix (e.g., \textsc{topic} = \emph{world}), we infuse the prefixes with information about what is discouraged to generate (e.g., \textsc{topic} = \emph{sports, business, sci/tech}) by using the discriminative loss they proposed. All settings follow those reported in \citeA{qian-etal-2022-controllable}. The general prefix is trained with the entire dataset, which is the same one as in FPT. In inference, the specific and general prefixes are used the same as in FPT.
\item[2] We also set an ablated model that uses the logits of the frozen GPT-2 instead of the logits from the model guided by our general prefix.
\end{itemize}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Experimental Settings}\label{4.1.2}

Following previous works \cite{krause-etal-2021-gedi-generative,qian-etal-2022-controllable}, we evaluated the models on the topic control dataset AGNews \cite{zhang2015character} and the sentiment control dataset IMDb \cite{maas-etal-2011-learning}. AGNews is a sub-dataset of the corpus of news articles AG, constructed from the four topic categories (``world, '' ``sports, '' ``business, '' and ``sci/tech'') in AG. AGNews contains 30,000 training samples for each category, with a total of 120,000 training samples. IMDb is a dataset containing two sentiment categories (``positive'' and ``negative''), with its training set comprising 25,000 highly polar movie reviews. We scored the sentiment relevance using HuggingFace's sentiment analysis classifier \cite{Liu2019RoBERTaAR} trained on 15 datasets. For scoring the topic relevance, we trained a classifier that obtained results comparable to what was reported previously.
Perplexity was used to evaluate text fluency. Bias ($| \texttt{implicit score} - 50|$) measures how much the relevance of implicit attributes deviates from unbiased relevance (50). As mentioned in Section \ref{intro}, in the analysis of datasets, we found that up to 98\% of training data pieces in IMDb exhibit \textsc{topic} = \emph{sci/tech}, so we set \textsc{topic} = \emph{sci/tech} as the implicit attribute in sentiment control generation. Additionally, up to 94\% of the training
data pieces in AGNews exhibit \textsc{sentiment} = \emph{negative}. Therefore, we set \textsc{sentiment} = \emph{negative} as the implicit attribute in the topic control generation. Prompts from \citeA{DBLP:conf/iclr/ChanOPZF21} were employed to generate continuation samples. We generated 20 samples for each attribute and prompt. All the experiments were conducted using a GPT-2 Medium model. The parameters of the GPT-2 model were frozen during the training all prefixes. The length of all prefixes was set equal to 10. The GPU used for all training is a P40. 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Topic Control Text Generation Settings}
Following the previous work \cite{qian-etal-2022-controllable}, we used half of the data pieces in the AGNews dataset to obtain the general and specific prefixes. The number of specific prefixes for this task was four (e.g., \emph{worlds}, \emph{sports}, \emph{business}, and \emph{sci/tech}). Following \citeA{qian-etal-2022-controllable}, we used AdamW as the optimizer and set the learning rate to $10^{-4}$. We set the number of epochs to 10, and the batch size to 8. To balance the performance between fluency and controllability, the hyperparameters $\alpha$ for generation were set to 1.1, and the top p was set to 0.8, according to the results in the validation set. Following \citeA{DBLP:journals/corr/abs-2210-02889}, the classifier was trained on the Deberta model \cite{DBLP:conf/iclr/HeLGC21}, which was used to compute the attribute relevance in this task.

Prompts for the evaluation: 
``\emph{In summary,}'', 
``\emph{This essay discusses}'',
``\emph{Views on}'',
``\emph{The connection}'',
``\emph{Foundational to this is}'',
``\emph{To review}'',
``\emph{In brief}'',
``\emph{An illustration of}'',
``\emph{Furthermore}'',
``\emph{The central theme}'',
``\emph{To conclude}'',
``\emph{The key aspect}'',
``\emph{Prior to this}'',
``\emph{Emphasized are}'',
``\emph{To summarize}'',
``\emph{The relationship}'',
``\emph{More importantly}'',
``\emph{It has been shown}'',
``\emph{The issue focused on}'',
and ``\emph{In this essay}''.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Sentiment Control Text Generation Settings}
Following the previous work \cite{qian-etal-2022-controllable}, we used half of the data pieces in IMDb to obtain the general and specific prefixes. The number of specific prefixes for this task was two (e.g., \emph{positive} and \emph{negative}). As reported in \citeA{qian-etal-2022-controllable}, we use AdamW as the optimizer, and the learning learning rate was set to $2.0\times10^{-5}$. We set the batch size to 8, and the number of epochs to 50. To balance the performance between fluency and controllability, the hyperparameter $\alpha$ for generation was set to 3, and the top-p was set to 0.8, according to the results in the validation set.

Prompts for the evaluation: 
``\emph{Once upon a time}'',
``\emph{The book}'',
``\emph{The chicken}'',
``\emph{The city}'',
``\emph{The country}'',
``\emph{The horse}'',
``\emph{The lake}'',
``\emph{The last time}'',
``\emph{The movie}'',
``\emph{The painting}'',
``\emph{The pizza}'',
``\emph{The potato}'',
``\emph{The president of the country}'',
``\emph{The road}'',
and ``\emph{The year is 1910}''.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Experimental Results}\label{4.1.5}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table*}[b]
\begin{center}
\input{09table02.tex}
\end{center}
\hangcaption{Results of the single-attribute control tasks. DExperts \protect\cite{krause-etal-2021-gedi-generative} was used only in the sentiment attribute control task. We did not calculate the bias for GeDi because its decoding method has effects on text fluency, which cannot be fairly compared with.}
\label{single}
\end{table*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


As shown in Table \ref{single}, in the single-attribute control tasks, Contrastive FPT achieves higher attribute relevance than prefix-tuning-based baselines, while having lower bias scores. This indicates that the generated texts are well controlled under the target explicit attribute without being influenced by implicit attributes. In FPT, the perplexity score was the highest among the control-based baselines. The ablation experiment suggests that the proposed general prefix is essential for attribute control. We also found that when $\alpha$ is set larger, FPT exhibits better control ability, while the fluency is worse. Since GeDi applies Bayes' rule to compute the classification probabilities of the next possible token in each generation timestep, this allows for the control of attributes at the token level, showing strong control and resulting in high relevance scores for the generated text. However, this modification allows the distribution of the original language model output to be altered, resulting in high perplexity.



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table*}[b]
\input{09table03.tex}
\caption{Training time of our models and baselines in the single-attribute control experiments.}
\label{time}
\end{table*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table*}[p]
\input{09table04.tex}
\hangcaption{Samples generated by our models and baselines with the positive attribute. Desired explicit attribute: positive, undesired explicit attribute: negative. We marked the \textbf{words with desired explicit attributes}, and \textit{words with undesired explicit attributes}.}
\label{samples1}
\end{table*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{table*}[p]
\input{09table05.tex}
\hangcaption{Samples generated by our models and baselines with the sports attribute. Desired explicit attribute: sports, undesired explicit attributes: world, business, sci/tech. We marked the \textbf{words with desired explicit attributes}, and \textit{words with undesired explicit attributes}.}
\label{samples2}
\end{table*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




Table \ref{time} presents a detailed comparison of the training cost disparities between our models and the baselines across the two experimental iterations. Compared to Dexpert and GeDi, given that the parameter size of GPT-2 Medium was not extensive, the training time advantage of FPT was not markedly evident in the experiments. However, as the parameters of the pre-trained language model increase, the training efficiency advantage of FPT is expected to become more pronounced. In comparison with the Vanilla Prefix Tuning method, the training cost for FPT is relatively higher due to the necessity of training an additional general prefix in each experiment. In contrast to FPT, Contrastive FPT incurs a higher training cost, primarily because it adopts the contrastive prefix-tuning method, which requires more comparative instances to obtain a discriminative loss for training the prefix.

Table \ref{samples1} shows the generation samples of \textsc{sentiment} = \emph{positive} from our models and the baselines. Table \ref{samples2} shows the generation samples of \textsc{topic} = \emph{sports} from our models and the baselines. In the FPT based model, there are more \textbf{words with desired explicit attributes} in the generated texts, while the baselines contain more \textit{words with undesired explicit attributes}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 7 --> 6
\begin{table}[t]
\input{09table07.tex}
\caption{Specialized weights in multi-attribute control tasks for attribute balance.}
\label{special weight}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Multi-attribute Control Experiments}\label{4.2}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Baselines}

In the multi-attribute control experiments, we introduced the \textbf{Distribution Lens} \cite{DBLP:journals/corr/abs-2210-02889} as a strong baseline. It searches for the intersection space of multiple-attribute distributions as their combinations for generation.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Experimental Settings}

To explore the capability of FPT in the multi-attribute control tasks, we introduced a toxic comment dataset\footnote{\url{https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/}} for toxicity control. We also used the Google Perspective API\footnote{\url{https://www.perspectiveapi.com/}} to evaluate the relevance of toxicity. Given the inappropriate nature of generating toxic content, we exclusively applied non-toxic attributes in this task. The prompts used for generating the samples were  identical to those used in the sentiment control task. Twenty samples were generated for each attribute combination and prompt. For the nontoxic attribute, we employed 10,000 pieces of non-toxic labeled data to train the specific prefix. Subsequently, another 20,000 pieces were randomly sampled from the entire dataset to train the general prefix. In the multi-attribute control task, we set the batch size to 8 for training the non-toxic specific and general prefixes. We used AdamW as the optimizer, and the learning rate was set to $1.0\times10^{-4}$. To balance the performance among attributes from different aspects,we set the combination of hyperparameters for generation as shown in Table \ref{special weight}.



To determine the first attribute, we selected 20 different prompts as inputs and obtained the filtered vocabulary sizes for different attributes. The average sizes of filtered vocabularies are shown in Table \ref{vacab}. We selected the attribute with the largest filtered vocabulary size for logits manipulation. This method can be used to determine the first attribute when new attributes are added. 



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 8 --> 7
\begin{table}[t]
\input{09table08.tex}
\hangcaption{Results of average filtered vocabulary size. We set all the $\alpha$ as 1.5. After filtering the vocabulary in logits manipulation, the specific prefix of the topic attribute guided model has the largest vocabulary size among these three attributes. We also found that the filtered vocabulary of the topic attribute can cover 85\% of the filtered vocabulary of the sentiment attribute.}
\label{vacab}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% table 6 --> 8
\begin{table}[t]
\input{09table06.tex}
\caption{Results of the multi-attribute control tasks.}
\label{multi}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Prompts used for the evaluation:
``\emph{Once upon a time}'',
``\emph{The book}'',
``\emph{The chicken}'',
``\emph{The city}'',
``\emph{The country}'',
``\emph{The horse}'',
``\emph{The lake}'',
``\emph{The last time}'',
``\emph{The movie}'',
``\emph{The painting}'',
``\emph{The pizza}'',
``\emph{The potato}'',
``\emph{The president of the country}'',
``\emph{The road}'',
and ``\emph{The year is 1910}''.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Experimental Results}

Table \ref{multi} shows that our method can achieve comparable performance to that of state-of-the-art approach. However, Distribution Lens requires aggregating the datasets of all attributes to train its prefixes. If one wishes to add a prefix to control a new attribute, they have to retrain all the prefixes (approximately 8~h). In contrast, FPT trains a prefix for each attribute individually and enables new attribute-control prefixes to be added incrementally without retraining existing ones (approximately 1~h). When introducing contrastive prefix learning, the filtered vocabulary size was too narrow for manipulation among the attributes, so we did not apply Contrastive PFT in these experiments.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conclusion}

We proposed FPT, a prefix-tuning-based method, to mitigate the effect of attribute transfer. FPT encodes implicit attributes in a dataset using a general prefix and uses it to suppress attribute transfer via inference-time logits manipulation. The results of the single-attribute control experiments showed that with FPT, the generated texts could be more effectively controlled under the desired attribute with higher text fluency. The experimental results in the multi-attribute control tasks suggested that FPT can achieve comparable performance to the state-of-the-art approach while maintaining the flexibility of adding new prefixes without retraining.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\acknowledgment
The authors gratefully acknowledge the reviewers for their valuable comments.
This study is an extended version of the paper \cite{ma-etal-2023-focused}, accepted at the 61st Annual Meeting of the Association for Computational Linguistics (ACL 2023).

The following changes have been made in this version:
\begin{itemize}
\item
More detailed information about datasets was introduced in Section \ref{4.1.2}.
\item
More detailed experiment settings were added in Section \ref{4.1} and Section \ref{4.2}. They were in the appendix of the original paper.
\item
We added analysis about baselines and training time in Section \ref{4.1.5}.
\item
We also added more generated samples in Section \ref{4.1.5} from the appendix of the original paper, which can show the effect of our method in practice.
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \bibliographystyle{jnlpbbl_1.7}
%%%%\bibliography{e_yourrefs}
    \bibliography{09refs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{biography}

\bioauthor[:]{Congda Ma}{%
Congda Ma is currently a Ph.D. candidate in the Department of Information and Communications Engineering at the Tokyo Institute of Technology. Before that, he earned an M.E. from the Japan Advanced Institute of Science and Technology in 2021. His research interests include natural language processing, particularly large language models, and controllable text generation.
}

\bioauthor[:]{Tianyu Zhao}{%
Tianyu Zhao completed his bachelor's degree at the Peking University in 2015 and earned both an M.E. and a Ph.D. from the Kyoto University in 2017 and 2020, respectively. Currently, he serves as a researcher at rinna Co., Ltd. His expertise lies in large language models and dialogue systems.
}

\bioauthor[:]{Makoto Shing}{%
Makoto Shing is an AI scientist specializing in Computer Vision and NLPfields. He joined Stability AI in April 2023 to help democratize AI, especially in the Japanese community. Until then, he worked for the research team of rinna Co., Ltd., and contribute to open-sourcing Japanese CLIP and Japanese Stable Diffusion.
}

\bioauthor[:]{Kei Sawada}{%
Kei Sawada received his Ph.D degree in Scientific and Engineering Simulation from the Nagoya Institute of Technology, Nagoya, Japan, in 2018. In the same year, he joined Microsoft Development Co., Ltd. as a Research SDE. After the team was spun out from Microsoft, he took up the position of Research and Data Manager at rinna Co., Ltd. in 2020. His research interests include dialogue, speech synthesis, and image synthesis based on machine learning.
}

\bioauthor[:]{Manabu Okumura}{%
Manabu Okumura was born in 1962:
He earned his B.E., M.E., and Dr. Eng. from Tokyo Institute of Technology in 1984, 1986, and 1989, respectively.
He served as an assistant at the Department of Computer Science, Tokyo Institute of Technology, from 1989 to 1992, and as an associate professor at the School of Information Science, Japan Advanced Institute of Science and Technology, from 1992 to 2000.
Currently he is a professor at the Institute of Innovative Research at Tokyo Institute of Technology, Japan.
His research interests include natural language processing, particularly text summarization, computer-assisted language learning, sentiment analysis, and text data mining.
}
\end{biography}

\biodate   %%%% Following settings will be edited by editors.


\end{document}


