Analysing Word Representation from the Input and Output Embeddings in Neural Network Language Models (2020)

Abstract: Researchers have recently demonstrated that tying the neural weights between the input look-up table and the output classification layer can improve training and lower perplexity on sequence learning tasks such as language modelling. Such a procedure is possible due to the design of the softmax classification layer, which previous work has shown to comprise a viable set of semantic representations for the model vocabulary, and these these output embeddings are known to perform well on word similarity benchmarks. In this paper, we make meaningful comparisons between the input and output embeddings and other SOTA distributional models to gain a better understanding of the types of information they represent. We also construct a new set of word embeddings using the output embeddings to create locally-optimal approximations for the intermediate representations from the language model. These locally-optimal embeddings demonstrate excellent performance across all our evaluations.

## introduction neural language modelling has recently gained popularity in nlp. a neural network language model (nnlm) is tasked with learning a conditional probability distribution over the occurrences of words in text @xcite . this language modelling objective requires a neural network with sufficient capacity to learn meaningful linguistic information such as semantic knowledge and syntactic structure. due to their ability to learn these important linguistic phenomena, nnlms have been successfully employed as an effective method for generative pretraining @xcite and transfer learning to other natural language tasks @xcite @xcite . as previously suggested by @xcite , @xcite and @xcite , the weights of the final fully-connected output layer, or output embeddings, which compute the conditional probability distribution over the lexicon, also constitute a legitimate set of embedding vectors representing word meaning, as is the case for the input embeddings. this commonality between the input and output layers of the nnlm has motivated researchers to tie these representations together during training, improving performance on language modelling tasks @xcite . furthermore, such a procedure is intuitive, since both the input and output embeddings of the network would appear to be performing a similar task of encoding information about lexical content. as described by @xcite , they clearly live in an identical semantic space in language models, unlike other machine learning models were the input and output embeddings have no direct link. on the other hand, it would also be reasonable to assume that the output representations require highly task-specific features @xcite . despite their utility in language modelling, in-depth analysis of these input and output vector representations remains limited. the goal of this work is to gain a deeper understanding of the aspects of language captured in these contrasting representations. our two main contributions foot_0 are as follows: though generally considered task-agnostic, by making extensive comparisons between these neural representations we may reason about the type of information most salient in the representations in each semantic space. our results demonstrate that the input and output embeddings share little in common with respect to their strength and weaknesses, while the locally-optimal embeddings generally perform the best on most downstream tasks. ## related work recent trends in nlp has seen a focus towards building generative pretraining models, which have achieved state-of-the-art performance on downstream tasks @xcite @xcite @xcite . these sequencebased autoencoder models have almost universally adopted the convention of weight tying in their input and output layers, which has been shown to improve training and decrease perplexity scores on language modelling tasks @xcite . motivated by these results, researchers have proposed a number of modifications to these networks in relation to the output classification layers. for example, @xcite combine weight-tying with a linear projection layer in the penultimate stage of the network to both decouple hidden state representations from the output embeddings and control the size of the embedding vectors. @xcite suggest modifying the architecture of the network by adding a gating mechanism between the input layer and the final classification layer of nnlms. focusing solely on the final classification layer, @xcite propose using a number of weighted softmax distributions, called a mixture of softmaxes, to overcome the bottleneck formed by their limited capacity. @xcite extend this approach by adding what they call a direct output connection, which computes the probability distribution at all layers of the nnlm. other work has focused on weight tying such as with the structural aware output layer @xcite . despite their importance, there is limited work which attempts to further analyse these output embeddings beyond the work of press and wolf (2017), who show that these representations outperform the input embeddings on word similarity benchmarks. in recent years, such analyses has gained popularity in the nlp community as researchers have shifted their focus towards interpretability in neural networks @xcite . examples include probing tasks, which are supervised machine learning problems that look to decode salient linguistic features from embedding vectors @xcite @xcite . other work has focused on determining whether more cognitive aspects of meaning are adequetely encoded within these representations, through probing @xcite @xcite or using cross-modal mappings @xcite @xcite @xcite . moving beyond basic linguistic phenomena, researchers have also investigated more complex aspects of language such as syntactical structure using probing methods @xcite @xcite . ## research context and motivation in this section, we first discuss some background about the input and output embeddings in nnlms. then, we briefly discuss how to compute new representations that are locally-optimal to the prediction step from the fully-connected softmax layer of the nnlm, by using stochastic gradient descent. ## methodology for our research, we require a nnlm that provides good performance without weight tying, so that we may analyse the input and output embeddings as separate entities. we use the freely-available language model of @xcite , which we refer to as jlm. the jlm network consists of a character level embedding input and two lstm layers of size 8192, which both incorporate a projection layer to reduce the hidden state dimensionality down to 1024. the softmax output of the model has a word-level vocabulary of 800k word classes, and the model is trained on the one billion word news dataset @xcite . ## experiments to assess these representations for both taskspecific effectiveness and fine-grained linguistic knowledge, we perform a broad range of experiments. these assessments include comparison with human understanding on word relations (intrinsic evaluations), analysing performance on supervised machine learning tasks (extrinsic evaluations), and using probing tasks to isolate linguistic phenomena. we hypothesise that the input and output embeddings should perform quite well on the intrinsic benchmarks, while the am embeddings should give the best results on downstream prediction tasks, which we would similarly expect with the hidden representations from the intermediate layers of the network @xcite . ## neural language modelling we have demonstrated that the linguistic knowledge captured by the input and output embeddings are moderately distinct. these results may imply that the input and output embeddings of the nnlm require a particular set of non-overlapping characteristics that are important to their respective roles in the nnlm. to further understand whether and how these representations are distinctive to their particular functions in the input and output layers, we perform domain transfer on the language modelling objective. for our evaluation, we test each set of embedding vectors when fixed as certain weights in the network: here we expect the input embeddings and output embeddings to perform well in the case of nnlm in and nnlm out respectively, since in these cases their role is congruent with their origi-nal role in jlm. we also expect the other distributional models to perform well as input embeddings based on previous research. it will also be interesting to see how the am representations perform since they are trained using output embeddings and thus should share a lot of their linguistic knowledge. if the input and output embeddings perform similarly, we can infer that these representations contain considerable overlap in lexical information. however, if they perform poorly when their roles are switched, we can conclude that these representations must learn some role-specific features not encoded in the other semantic spaces. see the appendix for training details, which closely follow the medium-sized lstm model presented by @xcite with the penn treebank dataset @xcite . ## discussion we can draw several conclusions from these results. as expected, the type of semantic knowledge these representations capture is dependent on their position in the network. ## conclusion we perform an in-depth analysis of the input and output embeddings of neural network language models to investigate what linguistic features are encoded in each semantic space. we also extend our analysis by constructing locally-optimal vectors from the output embeddings, which seem to provide overall better performance on both intrinsic and extrinsic evaluation tasks, beating wellestablished distributional semantic models in almost all evaluations.