Title: EFFICIENT VECTOR REPRESENTATION FOR DOCU-MENTS THROUGH CORRUPTION

Abstract: We present an efficient document representation learning framework, Document Vector through Corruption (Doc2VecC). Doc2VecC represents each document as a simple average of word embeddings. It ensures a representation generated as such captures the semantic meanings of the document during learning. A corruption model is included, which introduces a data-dependent regularization that favors informative or rare words while forcing the embeddings of common and non-discriminative ones to be close to zero. Doc2VecC produces significantly better word embeddings than Word2Vec. We compare Doc2VecC with several state-of-the-art document representation learning algorithms. The simple model architecture introduced by Doc2VecC matches or out-performs the state-of-the-art in generating high-quality document representations for sentiment analysis, document classification as well as semantic relatedness tasks. The simplicity of the model enables training on billions of words per hour on a single machine. At the same time, the model is very efficient in generating representations of unseen documents at test time.

1. INTRODUCTION:

Text understanding starts with the challenge of finding machine-understandable representation that captures the semantics of texts. Bag-of-words (BoW) and its N-gram extensions are arguably the most commonly used document representations. Despite its simplicity, BoW works surprisingly well for many tasks (Wang & Manning, 2012) . However, by treating words and phrases as unique and discrete symbols, BoW often fails to capture the similarity between words or phrases and also suffers from sparsity and high dimensionality.

Recent works on using neural networks to learn distributed vector representations of words have gained great popularity. The well celebrated Word2Vec (Mikolov et al., 2013a) , by learning to predict the target word using its neighboring words, maps words of similar meanings to nearby points in the continuous vector space. The surprisingly simple model has succeeded in generating high-quality word embeddings for tasks such as language modeling, text understanding and machine translation. Word2Vec naturally scales to large datasets thanks to its simple model architecture. It can be trained on billions of words per hour on a single machine.

Paragraph Vectors (Le & Mikolov, 2014) generalize the idea to learn vector representation for documents. A target word is predicted by the word embeddings of its neighbors in together with a unique document vector learned for each document. It outperforms established document representations, such as BoW and Latent Dirichlet Allocation (Blei et al., 2003) , on various text understanding tasks (Dai et al., 2015) . However, two caveats come with this approach: 1) the number of parameters grows with the size of the training corpus, which can easily go to billions; and 2) it is expensive to generate vector representations for unseen documents at test time.

We propose an efficient model architecture, referred to as Document Vector through Corruption (Doc2VecC), to learn vector representations for documents. It is motivated by the observation that linear operations on the word embeddings learned by Word2Vec can sustain substantial amount of syntactic and semantic meanings of a phrase or a sentence (Mikolov et al., 2013b) . For example, vec("Russia") + vec("river") is close to vec("Volga River") (Mikolov & Dean, 2013) , and vec("king") -vec("man") + vec("women") is close to vec("queen") (Mikolov et al., 2013b) . In Doc2VecC, we represent each document as a simple average of the word embeddings of all the words in the document. In contrast to existing approaches which post-process learned word embeddings to form document representation (Socher et al., 2013; Mesnil et al., 2014) , Doc2VecC enforces a meaningful document representation can be formed by averaging the word embeddings during learning. Furthermore, we include a corruption model that randomly remove words from a document during learning, a mechanism that is critical to the performance and learning speed of our algorithm. Doc2VecC has several desirable properties: 1. The model complexity of Doc2VecC is decoupled from the size of the training corpus, depending only on the size of the vocabulary; 2. The model architecture of Doc2VecC resembles that of Word2Vec, and can be trained very efficiently; 3. The new framework implicitly introduces a data-dependent regularization, which favors rare or informative words and suppresses words that are common but not discriminative; 4. Vector representation of a document can be generated by simply averaging the learned word embeddings of all the words in the document, which significantly boost test efficiency; 5. The vector representation generated by Doc2VecC matches or beats the state-of-the-art for sentiment analysis, document classification as well as semantic relatedness tasks.

2. RELATED WORKS AND NOTATIONS:

Text representation learning has been extensively studied. Popular representations range from the simplest BoW and its term-frequency based variants (Salton & Buckley, 1988) , language model based methods (Croft & Lafferty, 2013; Mikolov et al., 2010; Kim et al., 2015) , topic models (Deerwester et al., 1990; Blei et al., 2003) , Denoising Autoencoders and its variants (Vincent et al., 2008; Chen et al., 2012) , and distributed vector representations (Mesnil et al., 2014; Le & Mikolov, 2014; Kiros et al., 2015) . Another prominent line of work includes learning task-specific document representation with deep neural networks, such as CNN (Zhang & LeCun, 2015) or LSTM based approaches (Tai et al., 2015; Dai & Le, 2015) .

In this section, we briefly introduce Word2Vec and Paragraph Vectors, the two approaches that are most similar to ours. There are two well-know model architectures used for both methods, referred to as Continuous Bag-of-Words (CBoW) and Skipgram models (Mikolov et al., 2013a) . In this work, we focus on CBoW. Extending to Skipgram is straightforward. Here are the notations we are going to use throughout the paper:

D = {D 1 , • • • , D n }:

a training corpus of size n, in which each document D i contains a variablelength sequence of words w 1 i , • • • , w Ti i ; V : the vocabulary used in the training corpus, of sizes v;

x ∈ R v×1 : BoW of a document, where x j = 1 iff word j does appear in the document.

c t ∈ R v×1 : BoW of the local context w t-k , • • • , w t-1 , w t+1 , • • • , w t+k

at the target position t. c t j = 1 iff word j appears within the sliding window of the target; U ∈ R h×v : the projection matrix from the input space to a hidden space of size h. We use u w to denote the column in U for word w, i.e., the "input" vector of word w; V ∈ R v×h : the projection matrix from the hidden space to output. Similarly, we use v w to denote the column in V for word w, i.e., the "output" vector of word w.

Word2Vec. Word2Vec proposed a neural network architecture of an input layer, a projection layer parameterized by the matrix U and an output layer by V . It defines the probability of observing the target word w t in a document D given its local context c t as

P (w t |c t ) = exp(v w t Uc t )

w ∈V exp(v w Uc t ) The word vectors are then learned to maximize the log likelihood of observing the target word at each position of the document. Various techniques (Mitchell & Lapata, 2010; Zanzotto et al., 2010; Yessenalina & Cardie, 2011; Grefenstette et al., 2013; Socher et al., 2013; Kusner et al., 2015) have been studied to generate vector representations of documents from word embeddings, among which the simplest approach is to use weighted average of word embeddings. Similarly, our method forms document representation by averaging word embeddings of all the words in the document. Differently, as our model encodes the compositionality of words in the learned word embeddings, heuristic weighting at test time is not required.

Paragraph Vectors. Paragraph Vectors, on the other hands, explicitly learns a document vector with the word embeddings. It introduces another projection matrix D ∈ R h×n . Each column of D acts as a memory of the global topic of the corresponding document. It then defines the probability of observing the target word w t in a document D given its local context c t as

P (w t |c t , d) = exp(v w t (Uc t + d)) w ∈V exp(v w (Uc t + d))

where d ∈ D is the vector representation of the document. As we can see from this formula, the complexity of Paragraph Vectors grows with not only the size of the vocabulary, but also the size of the training corpus. While we can reasonably limit the size of a vocabulary to be within a million for most datasets, the size of a training corpus can easily go to billions. What is more concerning is that, in order to come up with the vector representations of unseen documents, we need to perform an expensive inference by appending more columns to D and gradient descent on D while fixing other parameters of the learned model.

3. METHOD:

Several works (Mikolov & Dean, 2013; Mikolov et al., 2013b) showcased that syntactic and semantic regularities of phrases and sentences are reasonably well preserved by adding or subtracting word embeddings learned through Word2Vec. It prompts us to explore the option of simply representing a document as an average of word embeddings. Figure 1 illustrates the new model architecture. Similar to Word2Vec or Paragraph Vectors, Doc2VecC consists of an input layer, a projection layer as well as an output layer to predict the target word, "ceremony" in this example. The embeddings of neighboring words ("opening", "for", "the") provide local context while the vector representation of the entire document (shown in grey) serves as the global context. In contrast to Paragraph Vectors, which directly learns a unique vector for each document, Doc2VecC represents each document as an average of the embeddings of words randomly sampled from the document ("performance" at position p, "praised" at position q, and "brazil" at position r).

Huang et al. ( 2012) also proposed the idea of using average of word embeddings to represent the global context of a document. Different from their work, we choose to corrupt the original document by randomly removing significant portion of words, and represent the document using only the embeddings of the words remained. This corruption mechanism offers us great speedup during training as it significantly reduces the number of parameters to update in back propagation. At the same time, as we are going to detail in the next section, it introduces a special form of regularization, which brings great performance improvement.

Here we describe the stochastic process we used to generate a global context at each update. The global context, which we denote as x, is generated through a unbiased mask-out/drop-out corruption, in which we randomly overwrites each dimension of the original document x with probability q. To make the corruption unbiased, we set the uncorrupted dimensions to 1/(1 -q) times its original value. Formally, xd = 0, with probability q

EQUATION

Doc2VecC then defines the probability of observing a target word w t given its local context c t as well as the global context x as

P (w t |c t , x) = exp(v w t ( local context Uc t + global context 1 T Ux )) w ∈V exp(v w Uc t + 1 T Ux) (2)

Here T is the length of the document. Exactly computing the probability is impractical, instead we approximate it with negative sampling (Mikolov et al., 2013a) .

EQUATION

here P v stands for a uniform distribution over the terms in the vocabulary. The two projection matrices U and V are then learned to minimize the loss:

EQUATION

Given the learned projection matrix U, we then represent each document simply as an average of the embeddings of the words in the document,

EQUATION

We are going to elaborate next why we choose to corrupt the original document with the corruption model in eq.( 1) during learning, and how it enables us to simply use the average word embeddings as the vector representation for documents at test time.

3.1. CORRUPTION AS DATA-DEPENDENT REGULARIZATION:

We approximate the log likelihood for each instance f (w, c, x) in eq.( 4) with its Taylor expansion with respect to x up to the second-order (Van Der Maaten et al., 2013; Wager et al., 2013; Chen et al., 2014) . Concretely, we choose to expand at the mean of the corruption

µ x = E p(x|x) [x]: f (w, c, x) ≈ f (w, c, µ x ) + (x -µ x ) ∇ xf + 1 2 (x -µ x ) ∇ 2 xf (x -µ x )

where ∇ xf and ∇ 2 xf are the first-order (i.e., gradient) and second-order (i.e., Hessian) of the log likelihood with respect to x. Expansion at the mean µ x is crucial as shown in the following steps. Let us assume that for each instance, we are going to sample the global context x infinitely many times, and thus compute the expected log likelihood with respect to the corrupted x.

E p(x|x) [f (w, c, x)] ≈ f (w, c, µ x ) + 1 2 tr E[(x -x)(x -x) ]∇ 2 xf

The linear term disappears as E p(x|x) [x -µ x ] = 0. We substitute in x for the mean µ x of the corrupting distribution (unbiased corruption) and the matrix

Σ x = E[(x -µ x )(x -µ x ) ]

for the variance, and obtain

E p(x|x) [f (w, c, x)] ≈ f (w, c, x) + 1 2 tr Σ x ∇ 2 xf (6)

As each word in a document is corrupted independently of others, the variance matrix Σ x is simplified to a diagonal matrix with j th element equals q 1-q x 2 j . As a result, we only need to compute the diagonal terms of the Hessian matrix ∇ 2 xf . The j th dimension of the Hessian's diagonal evaluated at the mean x is given by

∂ 2 f ∂x 2 j = -σ w,c,x (1 -σ w,c,x )( 1 T v w u j ) 2 - w ∼Pv σ w ,c,x (1 -σ w ,c,x )( 1 T v w u j ) 2

Plug the Hessian matrix and the variance matrix back into eq.( 6), and then back to the loss defined in eq.( 4), we can see that Doc2VecC intrinsically minimizes

= - n i=1 Ti t=1 f (w t i , c t i , x i ) + q 1 -q v j=1 R(u j ) (7) Each f (w t i , c t i , x i )

in the first term measures the log likelihood of observing the target word w t i given its local context c t i and the document vector

d i = 1 T Ux i .

As such, Doc2VecC enforces that a document vector generated by averaging word embeddings can capture the global semantics of the document, and fill in information missed in the local context.

The second term here is a data-dependent regularization. The regularization on the embedding u j of each word j takes the following form,

R(u j ) ∝ n i=1 Ti t=1 x 2 ij σ w t i ,c t i ,xi (1 -σ w t i ,c t i ,xi )( 1 T v w t i u j ) 2 + w ∼Pv σ w ,c t i ,xi (1 -σ w ,c t i ,xi )( 1 T v w u j ) 2

where σ w,c,x = σ(v w (Uc+ 1 T Ux)) prescribes the confidence of predicting the target word w given its neighboring context c as well as the document vector d = 1 T Ux. Closely examining R(u j ) leads to several interesting findings: 1. the regularizer penalizes more on the embeddings of common words. A word j that frequently appears across the training corpus, i.e, x ij = 1 often, will have a bigger regularization than a rare word; 2. on the other hand, the regularization is modulated by σ w,c,x (1 -σ w,c,x ), which is small if σ w,c,x → 1 or 0. In other words, if u j is critical to a confident prediction σ w,c,x when it is active, then the regularization is diminished. Similar effect was observed for dropout training for logistic regression model (Wager et al., 2013) and denoising autoencoders (Chen et al., 2014) .

4. EXPERIMENTS:

We evaluate Doc2VecC on a sentiment analysis task, a document classification task and a semantic relatedness task, along with several document representation learning algorithms. All experiments can be reproduced using the code available at https://github.com/mchen24/iclr2017 4.1 BASELINES We compare against the following document representation baselines: bag-of-words (BoW); Denoising Autoencoders (DEA) (Vincent et al., 2008) , a representation learned from reconstructing original document x using corrupted one x. SDAs have been shown to be the state-of-the-art for sentiment analysis tasks (Glorot et al., 2011) . We used Kullback-Liebler divergence as the reconstruction error and an affine encoder. To scale up the algorithm to large vocabulary, we only take into account the non-zero elements of x in the reconstruction error and employed negative sampling for the remainings; Word2Vec (Mikolov et al., 2013a )+IDF, a representation generated through weighted average of word vectors learned using Word2Vec; Doc2Vec (Le & Mikolov, 2014); Skip-thought Vectors (Kiros et al., 2015) , a generic, distributed sentence encoder that extends the Word2Vec skipgram model to sentence level. It has been shown to produce highly generic sentence representations that apply to various natural language processing tasks. We also include RNNLM (Mikolov et al., 2010) , a recurrent neural network based language model in the comparison. In the semantic relatedness task, we further compare to LSTM-based methods (Tai et al., 2015) that have been reported on this dataset. Setup. We test the various representation learning algorithms under two settings: one follows the same protocol proposed in (Mesnil et al., 2014) , where representation is learned using all the available data, including the test set; another one where the representation is learned using training and unlabeled set only. For both settings, a linear support vector machine (SVM) (Fan et al., 2008) is trained afterwards on the learned representation for classification. For Skip-thought Vectors, we used the generic model1 trained on a much bigger book corpus to encode the documents. A vector of 4800 dimensions, first 2400 from the uni-skip model, and the last 2400 from the bi-skip model, are generated for each document. In comparison, all the other algorithms produce a vector representation of size 100. The supervised RNN-LM is learned on the training set only. The hyper-parameters are tuned on a validation set subsampled from the training set.

Accuracy. Comparing the two columns in Table 1 , we can see that all the representation learning algorithms benefits from including the testing data during the representation learning phrase. Doc2VecC achieved similar or even better performance than Paragraph Vectors. Both methods outperforms the other baselines, beating the BOW representation by 15%. In comparison with Word2Vec+IDF, which applies post-processing on learned word embeddings to form document representation, Doc2VecC naturally enforces document semantics to be captured by averaged word embeddings during training. This leads to better performance. Doc2VecC reduces to Denoising Autoencoders (DEA) if the local context words are removed from the paradigm shown in Figure 1 . By including the context words, Doc2VecC allows the document vector to focus more on capturing the global context. Skip-thought vectors perform surprisingly poor on this dataset comparing to other methods. We hypothesized that it is due to the length of paragraphs in this dataset. The average length of paragraphs in the IMDB movie review dataset is 296.5, much longer than the ones used for training and testing in the original paper, which is in the order of 10. As noted in (Tai et al., 2015) , the performance of LSTM based method (similarly, the gated RNN used in Skip-thought vectors) drops significantly with increasing paragraph length, as it is hard to preserve state over long sequences of words.

Time. Table 2 summarizes the time required by these algorithms to learn and generate the document representation. Word2Vec is the fastest one to train. Denoising Autoencoders and Doc2VecC second that. The number of parameters that needs to be back-propagated in each update was increased by the number of surviving words in x. We found that both models are not sensitive to the corruption rate q in the noise model. Since the learning time decreases with higher corruption rate, we used q = 0.9 throughout the experiments. Paragraph Vectors takes longer time to train as there are more parameters (linear to the number of document in the learning set) to learn. At test time, Word2Vec+IDF, DEA and Doc2VecC all use (weighted) averaging of word embeddings as document 115) switzerland( 101) shabby( 103) fireworks( 101) heavens( 100) thornton( 108) endeavor( 100) dense( 108) circumstance( 119) debacle(103) ParaVectors harp( 118) dense( 108) reels( 115) fireworks(101) its'( 103) unnoticed( 112) pony( 102) fulfilled( 107) heavens( 100) bliss( 110) canned( 114) shabby( 103) debacle(103) Doc2VecC

,( 1099319) .( 1306691) the( 1340408) of( 581667) and( 651119) up( 49871) to( 537570) that( 275240) time( 48205) endeavor( 100) here( 21118) way( 31302) own( 13456)

representation. Paragraph Vectors, on the other hand, requires another round of inference to produce the vector representation of unseen test documents. It takes Paragraph Vectors 4 minutes and 17 seconds to infer the vector representations for the 25,000 test documents, in comparison to 7 seconds for the other methods. As we did not re-train the Skip-thought vector models on this dataset, the training time2 reported in the table is the time it takes to generate the embeddings for the 25,000 training documents. Due to repeated high-dimensional matrix operations required for encoding long paragraphs, it takes fairly long time to generate the representations for these documents. Similarly for testing. The experiments were conducted on a desktop with Intel i7 2.2Ghz cpu.

Data dependent regularization. As explained in Section 3.1, the corruption introduced in Doc2VecC acts as a data-dependent regularization that suppresses the embeddings of frequent but uninformative words. Here we conduct an experiment to exam the effect. We used a cutoff of 100 in this experiment. Table 3 lists the words having the smallest l 2 norm of embeddings found by different algorithms. The number inside the parenthesis after each word is the number of times this word appears in the learning set. In word2Vec or Paragraph Vectors, the least frequent words have embeddings that are close to zero, despite some of them being indicative of sentiment such as debacle, bliss and shabby. In contrast, Doc2VecC manages to clamp down the representation of words frequently appear in the training set, but are uninformative, such as symbols and stop words.

Subsampling frequent words. Note that for all the numbers reported, we applied the trick of subsampling of frequent words introduced in (Mikolov & Dean, 2013) to counter the imbalance between frequent and rare words. It is critical to the performance of simple Word2Vec+AVG as the sole remedy to diminish the contribution of common words in the final document representation. If we were to remove this step, the error rate of Word2Vec+AVG will increases from 12.1% to 13.2%. Doc2VecC on the other hand naturally exerts a stronger regularization toward embeddings of words that are frequent but uninformative, therefore does not rely on this trick.

4.3. WORD ANALOGY:

In table 3, we demonstrated that the corruption model introduced in Doc2VecC dampens the embeddings of words which are common and non-discriminative (stop words). In this experiment, we are going to quantatively compare the word embeddings generated by Doc2VecC to the ones generated by Word2Vec, or Paragraph Vectors on the word analogy task introduced by Mikolov et al. (2013a) .

The dataset contains five types of semantic questions, and nine types of syntactic questions, with a total of 8,869 semantic and 10,675 syntactic questions. The questions are answered through simple linear algebraic operations on the word embeddings generated by different methods. Please refer to the original paper for more details on the evaluation protocol. Table 4 : Top 1 accuracy on the 5 type of semantics and 9 types of syntactic questions.

We trained the word embeddings of different methods using the English news dataset released under the ACL workshop on statistical machine translation. The training set includes close to 15M paragraphs with 355M tokens. We compare the performance of word embeddings trained by different methods with increasing embedding dimensionality as well as increasing training data.

We observe similar trends as in Mikolov et al. (2013a) . Increasing embedding dimensionality as well as training data size improves performance of the word embeddings on this task. However, the improvement is diminishing. Doc2VecC produces word embeddings which performs significantly better than the ones generated by Word2Vec. We observe close to 20% uplift when we train on the full training corpus. Paragraph vectors on the other hand performs surprisingly bad on this dataset.

Our hypothesis is that due to the large capacity of the model architecture, Paragraph Vectors relies mostly on the unique document vectors to capture the information in a text document instead of learning the word semantic or syntactic similarities. This also explains why the PV-DBOW Le & Mikolov (2014) model architecture proposed in the original work, which completely removes word embedding layers, performs comparable to the distributed memory version.

In table 5, we list a detailed comparison of the performance of word embeddings generated by Word2Vec and Doc2VecC on the 14 subtasks, when trained on the full dataset with embedding of size 100. We can see that Doc2VecC significantly outperforms the word embeddings produced by Word2Vec across almost all the subtasks.

4.4. DOCUMENT CLASSIFICATION:

For the document classification task, we use a subset of the wikipedia dump, which contains over 300,000 wikipedia pages in 100 categories. The 100 categories includes categories under sports, For this data set, we learn the word embedding and document representation for all the algorithms using all the available data. We apply a cutoff of 10, resulting in a vocabulary of size 107, 691.

Table 5 summarizes the classification error of a linear SVM trained on representations of different sizes. We can see that most of the algorithms are not sensitive to the size of the vector representation. Doc2Vec benefits most from increasing representation size. Across all sizes of representations, Doc2VecC outperform the existing algorithms by a significant margin. In fact, Doc2VecC can achieve same or better performance with a much smaller representation vector. We can see that documents from the same category are nicely clustered using the representation generated by Doc2VecC. Doc2Vec, on the other hand, does not produce a clear separation between different categories, which explains its worse performance reported in Table 5 . We can see that documents belonging to a coarser category are grouped together. This subset includes is a wide range of sports descriptions, ranging from football, crickets, baseball, and cycling etc., which explains why the athletes category are less concentrated. In the projection, we can see documents belonging to the musician category are closer to those belonging to albums category than those of athletes or species.

4.5. SEMANTIC RELATEDNESS:

We test Doc2VecC on the SemEval 2014 Task 1: semantic relatedness SICK dataset (Marelli et al., 2014) . Given two sentences, the task is to determine how closely they are semantically related. The set contains 9,927 pairs of sentences with human annotated relatedness score, ranging from 1 to 5. A score of 1 indicates that the two sentences are not related, while 5 indicates high relatedness. The set is splitted into a training set of 4,500 instances, a validation set of 500, and a test set of 4,927.

We compare Doc2VecC with several winning solutions of the competition as well as several more recent techniques reported on this dataset, including bi-directional LSTM and Tree-LSTM3 trained from scratch on this dataset, Skip-thought vectors learned a large book corpus4 (Zhu et al., 2015) and produced sentence embeddings of 4,800 dimensions on this dataset. We follow the same protocol as in skip-thought vectors, and train Doc2VecC on the larger book corpus dataset. Contrary to the vocabulary expansion technique used in (Kiros et al., 2015) to handle out-of-vocabulary words, we extend the vocabulary of the learned model directly on the target dataset in the following way: we use the pre-trained word embedding as an initialization, and fine-tune the word and sentence representation on the SICK dataset. Notice that the fine-tuning is done for sentence representation learning only, and we did not use the relatedness score in the learning. This step brings small improvement to the performance of our algorithm. Given the sentence embeddings, we used the exact same training and testing protocol as in (Kiros et al., 2015) to score each pair of sentences: with two sentence embedding u 1 and u 2 , we concatenate their component-wise product, u 1 • u 2 and their absolute difference, |u 1 -u 2 | as the feature representation.

Table 6 summarizes the performance of various algorithms on this dataset. Despite its simplicity, Doc2VecC significantly out-performs the winning solutions of the competition, which are heavily feature engineered toward this dataset and several baseline methods, noticeably the dependency-tree RNNs introduced in (Socher et al., 2014) , which relies on expensive dependency parsers to compose sentence vectors from word embeddings. The performance of Doc2VecC is slightly worse than the LSTM based methods or skip-thought vectors on this dataset, while it significantly outperforms skip-thought vectors on the IMDB movie review dataset (11.70% error rate vs 17.42%). As we hypothesized in previous section, while Doc2VecC is better at handling longer paragraphs, LSTMbased methods are superior for relatively short sentences (of length in the order of 10s). We would like to point out that Doc2VecC is much faster to train and test comparing to skip-thought vectors. It takes less than 2 hours to learn the embeddings on the large book corpus for Doc2VecC on a desktop with Intel i7 2.2Ghz cpu, in comparison to the 2 weeks on GPU required by skip-thought vectors.

5. CONCLUSION:

We introduce a new model architecture Doc2VecC for document representation learning. It is very efficient to train and test thanks to its simple model architecture. Doc2VecC intrinsically makes sure document representation generated by averaging word embeddings capture semantics of document during learning. It also introduces a data-dependent regularization which favors informative or rare words while dampening the embeddings of common and non-discriminative words. As such, each document can be efficiently represented as a simple average of the learned word embeddings. In comparison to several existing document representation learning algorithms, Doc2VecC outperforms not only in testing efficiency, but also in the expressiveness of the generated representations. Tai et al., 2015) ; the third group are methods based on LSTM reported in (Tai et al., 2015) as well as the skip-thought vectors (Kiros et al., 2015) . 

Method:



:

available at https://github.com/ryankiros/skip-thoughts

As reported in the original paper, training of the skip-thought vector model on the book corpus dataset takes around 2 weeks on GPU.

The word representation was initialized using publicly available 300-dimensional Glove vectors trained on 840 billion tokens of Common Crawl data

The dataset contains 11,038 books with over one billion words

Figures and Tables:

Figure 1: A new framework for learning document vectors.

Figure 3: Visualization of document vectors on Wikipedia dataset using t-SNE.

Figure 4: Visualization of Wikipedia Doc2VecC vectors using t-SNE.

Figure3visualizes the document representations learned by Doc2Vec (left) and Doc2VecC (right) using t-SNE(Maaten & Hinton, 2008). We can see that documents from the same category are nicely clustered using the representation generated by Doc2VecC. Doc2Vec, on the other hand, does not produce a clear separation between different categories, which explains its worse performance reported in Table5.

Figure 4 visualizes the vector representation generated by Doc2VecC w.r.t. coarser categorization. we manually grouped the 100 categories into 7 coarse categories, television, albums, writers, musicians, athletes, species and actors. Categories that do no belong to any of these 7 groups are not included in the figure.

Classification error of a linear classifier trained on various document representations on the Imdb dataset.For sentiment analysis, we use the IMDB movie review dataset. It contains 100,000 movies reviews categorized as either positive or negative. It comes with predefined train/test split(Maas et al., 2011): 25,000 reviews are used for training, 25,000 for testing, and the rest as unlabeled data. The two classes are balanced in the training and testing sets. We remove words that appear less than 10 times in the training set, resulting in a vocabulary of 43,375 distinct words and symbols.

Table content: <table><tr><td>Model</td><td colspan="2">Error rate % (include test) Error rate % (exclude test)</td></tr><tr><td>Bag-of-Words (BOW)</td><td>12.53</td><td>12.59</td></tr><tr><td>RNN-LM</td><td>13.59</td><td>13.59</td></tr><tr><td>Denoising Autoencoders (DEA)</td><td>11.58</td><td>12.54</td></tr><tr><td>Word2Vec + AVG</td><td>12.11</td><td>12.69</td></tr><tr><td>Word2Vec + IDF</td><td>11.28</td><td>11.92</td></tr><tr><td>Paragraph Vectors</td><td>10.81</td><td>12.10</td></tr><tr><td>Skip-thought Vectors</td><td>-</td><td>17.42</td></tr><tr><td>Doc2VecC</td><td>10.48</td><td>11.70</td></tr><tr><td>4.2 SENTIMENT ANALYSIS</td><td/><td/></tr></table>

Learning time and representation generation time required by different representation learning algorithms.

Table content: <table><tr><td>Model</td><td colspan="2">Learning time Generation time</td></tr><tr><td>Denoising Autoencoders</td><td>3m 23s</td><td>7s</td></tr><tr><td>Word2Vec + IDF</td><td>2m 33s</td><td>7s</td></tr><tr><td>Paragraph Vectors</td><td>4m 54s</td><td>4m 17s</td></tr><tr><td>Skip-thought</td><td>2h</td><td>2h</td></tr><tr><td>Doc2VecC</td><td>4m 30s</td><td>7s</td></tr></table>

Words with embeddings closest to 0 learned by different algorithms.

Table content: <table><tr><td>Word2Vec</td><td>harp(118) distasteful(</td></tr></table>

Accuracy on subset of the Semantic-Syntactic Word Relationship test set. Only questions containing words from the most frequent 30k words are included in the test.

Table content: <table><tr><td/><td/><td colspan="5">ParagraphVectors Word2Vec Doc2VecC</td><td/><td colspan="4">ParagraphVectors Word2Vec Doc2VecC</td></tr><tr><td/><td>60</td><td/><td/><td/><td/><td/><td>60</td><td/><td/><td/><td>58.2</td></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td/><td>52.6</td><td>50.7</td></tr><tr><td/><td/><td/><td/><td/><td/><td>46.7</td><td/><td/><td/><td/><td>48.2</td></tr><tr><td>Accuracy (%)</td><td>20 40</td><td>18.7 20.3</td><td>26.4 28.1</td><td>32.7 36.4</td><td>36.1 42.5</td><td>13.3 38.9</td><td>20 40</td><td>23.6 24.3</td><td>34.7 34.1</td><td>42.4 44.1</td></tr><tr><td/><td/><td>3.8</td><td>6.1</td><td>8.3</td><td>9.1</td><td/><td/><td>5.1</td><td>7.5</td><td>10.9</td><td>10.2</td><td>10.2</td></tr><tr><td/><td>0</td><td/><td/><td/><td/><td/><td>0</td><td/><td/><td/></tr><tr><td/><td/><td>1M</td><td>2M</td><td>4M</td><td>8M</td><td>15M</td><td/><td>1M</td><td>2M</td><td>4M</td><td>8M</td><td>15M</td></tr><tr><td/><td/><td colspan="5">Number of paragraphs used for learning</td><td/><td colspan="4">Number of paragraphs used for learning</td></tr><tr><td/><td/><td/><td colspan="2">(a) h=50</td><td/><td/><td/><td/><td colspan="2">(b) h=100</td></tr><tr><td colspan="4">Figure 2: Semantic questions</td><td colspan="3">Word2Vec Doc2VecC</td><td/><td colspan="3">Syntactic questions</td><td>Word2Vec Doc2VecC</td></tr><tr><td colspan="5">capital-common-countries</td><td>73.59</td><td>81.82</td><td colspan="5">gram1-adjective-to-adverb</td><td>19.25</td><td>20.32</td></tr><tr><td/><td colspan="3">capital-world</td><td/><td>67.94</td><td>77.96</td><td/><td colspan="3">gram2-opposite</td><td>14.07</td><td>25.54</td></tr><tr><td/><td/><td>currency</td><td/><td/><td>17.14</td><td>12.86</td><td/><td colspan="3">gram3-comparative</td><td>60.21</td><td>74.47</td></tr><tr><td/><td colspan="3">city-in-state</td><td/><td>34.49</td><td>42.86</td><td/><td colspan="3">gram4-superlative</td><td>52.87</td><td>55.40</td></tr><tr><td/><td/><td>family</td><td/><td/><td>68.71</td><td>64.62</td><td/><td colspan="3">gram5-present-participle</td><td>56.34</td><td>65.81</td></tr><tr><td/><td/><td/><td/><td/><td/><td/><td colspan="5">gram6-nationality-adjective</td><td>88.71</td><td>91.03</td></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td colspan="3">gram7-past-tense</td><td>47.05</td><td>51.86</td></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td colspan="3">gram8-plural</td><td>50.28</td><td>61.27</td></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td colspan="3">gram9-plural-verbs</td><td>25.38</td><td>39.69</td></tr></table>

Classification error (%) of a linear classifier trained on various document representations on the Wikipedia dataset.

Table content: <table><tr><td>Model</td><td colspan="5">BOW DEA Word2Vec + AVG Word2Vec + IDF ParagraphVectors Doc2VecC</td></tr><tr><td>h = 100</td><td>36.03 32.30</td><td>33.2</td><td>33.16</td><td>35.78</td><td>31.92</td></tr><tr><td>h = 200</td><td>36.03 31.36</td><td>32.46</td><td>32.48</td><td>34.92</td><td>30.84</td></tr><tr><td>h = 500</td><td>36.03 31.10</td><td>32.02</td><td>32.13</td><td>33.93</td><td>30.43</td></tr><tr><td colspan="2">h = 1000 36.03 31.13</td><td>31.78</td><td>32.06</td><td>33.02</td><td>30.24</td></tr></table>

Test set results on the SICK semantic relatedness task. The first group of results are from the submission to the 2014 SemEval competition; the second group includes several baseline methods reported in (

Table content: <table/>

Peer review (iclr2017):
This paper presents a framework for creating document representations. The main idea is to represent a document as an average of its word embeddings with a data-dependent regularization that favors informative or rare words while forcing common words to be close to 0. Experiments on sentiment analysis and document classification show that the proposed method has the lowest error rates compared to baseline document embedding methods. While I like the motivation of finding the best way to encode a document into a vector, the paper does not offer significant technical contributions. Most of the techniques are not new, and the main selling point is the simplicity and speed of the proposed method. For this reason, I would like to see good results for more than two tasks to be convinced that this is the best way to learn document representations. For RNN-LM, is the LM trained to minimize classification error, or is it trained as a language model? Did you use the final hidden state as the representation, or the average of all hidden states? One of the most widely used method to represent documents now is to have a bidirectional LSTM and concatenate the final hidden states as the document representation. I think it would be useful to know how the proposed method compares to this approach for tasks such as document classification or sentiment analysis.