Single Model Ensemble using Pseudo-Tags and Distinct Vectors (2020)

Abstract: Model ensemble techniques often increase task performance in neural networks; however, they require increased time, memory, and management effort. In this study, we propose a novel method that replicates the effects of a model ensemble with a single model. Our approach creates K-virtual models within a single parameter space using K-distinct pseudo-tags and K-distinct vectors. Experiments on text classification and sequence labeling tasks on several datasets demonstrate that our method emulates or outperforms a traditional model ensemble with 1/K-times fewer parameters.

## introduction a model ensemble is a promising technique for increasing the performance of neural network models @xcite . this method combines the outputs of multiple models that are individually trained using the same training data. recent submissions to natural language processing(nlp) competitions are primarily composed of neural network ensembles @xcite . despite its effectiveness, a model ensemble is costly. because it handles multiple models, it requires increased time for training and inference, increased memory, and greater management effort. therefore, the model ensemble technique cannot always be applied to real systems, as many systems, such as edge devices, must work with limited computational resources. in this study, we propose a novel method that replicates the effects of the ensemble technique with a single model. following the principle that aggregating multiple models improves performance, we create multiple virtual models in a shared space. our method virtually inflates the training data k times with k-distinct pseudo-tags appended to all input data. it also incorporates kdistinct vectors, which correspond to pseudo-tags. each pseudo-tag @xmath0, . . . , k} is attached to the beginning of the input sentence, and the k-th vector is added to the embedding vectors for all tokens in the input sentence. fig. 1 presents a brief overview of our proposed method. intuitively, this operation allows the model to shift the embedding of the same data to the k-th designated subspace and can be interpreted as explicitly creating k virtual models in a shared space. we thus expect to obtain the same (or similar) effects as the ensemble technique composed of k models with our k virtual models generated from a single model. experiments in text classification and sequence labeling tasks reveal that our method outperforms single models in all settings with the same parameter size. moreover, our technique emulates or surpasses the normal ensemble with 1/k-times fewer parameters on several datasets. ## related work the neural network ensemble is a widely studied method @xcite @xcite ; however studies have focused mainly on improving performance while ignoring cost, such as computational cost, memory space, and management cost. several methods have overcome the shortcomings of traditional ensemble techniques. for training snapshot ensembles, @xcite ) used a single model to construct multiple models by converging into multiple local minima along the optimization path. for inference distillation, @xcite transferred the knowledge of the ensemble model into a single model. these methods use multiple models either during training or inference, which partially solves the negative effects of the traditional ensemble. the incorporation of pseudo-tags is a standard technique widely used in the nlp community, @xcite . however, to the best of our knowledge, our approach is the first attempt to incorporate pseudo-tags as an identification marker of virtual models within a single model. the most similar approach to ours is dropout @xcite , which stochastically omits each hidden unit during each mini-batch, and in which all units are utilized for inference. @xcite interpreted this technique as implicitly using an exponential number of virtual models within the same network. as opposed to dropout, our method explicitly utilizes virtual models with a shared parameter, which is as discussed in section 5, complementary to dropout. ## base encoder model the target tasks of this study are text classification and sequence labeling. the input is a sequence of tokens (i.e., a sentence). here, x t denotes the one-hot vector of the t-th token in the input. let @xmath1. we obtain the embedding vector e t at position t by e @xmath2. here, we introduce the notation e 1:t to represent the list of vectors (e 1 , e 2 , . . . , e t ) that correspond to the input sentence, where t is the number of tokens in the input. given e 1:t , the feature (or hidden) vectors h @xmath3, . . . , t } are computed as an encoder neural network enc(•), where h denotes the dimensions of the feature vector. namely, h 1:@xmath4:t ) . finally, the output y given input x 1:t is estimated as @xmath5:t ) where φ (•) represents the task dependent function (e.g., a softmax function for text classification and a conditional random field layer for sequence labeling). it should be noted that the form of the output y differs depending on the target task. in this section, we introduce the proposed method, which we refer to as singleens. fig. 1 presents an overview of the method. the main principle of this approach is to create different virtual models within a single model. we incorporate pseudo-tags and predefined distinct vectors. for the pseudo-tags, we add special tokens {ℓ k } k @xmath6, where hyper-parameter k represents the number of virtual models. for the predefined distinct vectors, we leverage mutually orthogonal vectors {o k } k @xmath7, where the orthogonality condition requires satisfying o k • o k 0 for all (k, k ) when @xmath8. finally, we assume that all input sentences start from one of the pseudo-tags. we then add the corresponding orthogonal vector o k of the attached pseudo-tag ℓ k to the embedding vectors at all positions. the new embedding vector ẽ0:t is written in the following form: we substitute e 1:t in eq. 1 by ẽ(k) 0:t in the proposed method. an intuitive explanation of the role of pseudotags is to allow a single model to explicitly recognize differences in homogeneous input, while the purpose of orthogonal vectors is to linearly shift the embedding to the virtual model's designated direction. therefore, by combining these elements, we believe that we can define virtual models within a single model and effectively use the local space for each virtual model. aggregating these virtual models can then result in imitation of ensemble. ## experiments to evaluate the effectiveness of our method, we conducted experiments on two tasks: text classification and sequence labeling. we used the imdb @xcite 2005), and rcv1 @xcite datasets for text classification, and the conll-2003 @xcite and conll-2000 datasets @xcite for sequence labeling. we used the transformer model @xcite as the base model for all experiments, and its token vector representations were then empowered by pretrained vectors of glove, @xcite , bert @xcite , or elmo @xcite . the models are referred to as tfm:glove, tfm:bert, and tfm:elmo, respectively. 1 for tfm:bert, we incorporated the feature (or hidden) vectors of the final layer in the bert model as the embedding vectors while adopting drop-net technique @xcite . all the models have dropout layers to assess the complementarity of our method and dropout. we compared our method (singleens) to a single model (single), a normal ensemble (normalens), and a normal ensemble in which each component has approximately 1/k parameters 2 (1/k ens). 3 although other ensemble-like methods discussed in section 2 could have been compared (e.g., snapshot ensemble, knowledge distillation, or dropout during testing to generate predictions and aggregate them), they are imitations of a normal ensemble, and we assumed that the results of a normal ensemble were upper-bound. we used @xmath9. 2 because bert requires a fixed number of parameters, we did not reduce the parameters accurately for 1/k tfm:bert. malens, 1/k ens, and singleens. we thus prepared nine pseudo-tags {ℓ k } 9 ## analysis in this section, we investigate the properties of our proposed method. unless otherwise specified, we use tfm:bert and tfm:elmo on imdb and conll-2003 for the analysis. ## conclusion in this paper, we propose a single model ensemble technique called singleens. the principle of singleens is to explicitly create multiple virtual models in a single model. our experiments demonstrated that the proposed method outperformed single models in both text classification and sequence labeling tasks. moreover, our method with tfm:bert surpassed the normal ensemble on the imdb and rotten datasets, while its parameter size was 1/k-times smaller. the results thus indicate that explicitly creating virtual models within a single model improves performance. the proposed method is not limited to the two aforementioned tasks, but can be applied to any nlp as well as other tasks such as machine translation and image recognition. further theoretical analysis can also be performed to elucidate the mechanisms of the proposed method. acknowledgment the research results were achieved by "research and development of deep learning technology for advanced multilingual speech translation", the commissioned research of national institute of information and communications technology (nict), japan. the work was partly supported by jsps kakenhi grant number 19h04162. we would like to thank motoki sato of preferred networks and shun kiyono of riken for cooperating in preparing the experimental data. we would also like to thank the three anonymous reviewers for their insightful comments.