0. INTRODUCTION
Inspired by the contrastive divergence model (Hinton, 2002), Bengio and Senecal (2003) proposed a sampling-based method to speed up the training of NNLMs. The parameters of neural network and feature vectors for words are learned using stochastic gradient descent method, and the computation of the partition function is quite expensive. The idea of sampling based method is to approximate the gradient of the log-likelihood with repect to the parameters set $\theta$ based on sampling method rather than computing the gradient explicitly.
1. PRELIMINARIES
In all NNLMs, a softmax layer is used to regularize the outputs, and NNLMs can be treated as a special case of energy-based probability models:
where, is the target word, is the previous context of target word, is the size of vocabulary, and , is the output of neural network model.
NNLMs are commonly trained using stochastic gradient descent (SGD) to maximum the log-likelihood of training data set, and the log-likelihood gradient for the parameters set should be calculated during training which can be generally represented as the sum of two parts: positive reinforcement for word and negative reinforcement for all word , weighted by , :
The detail inference process to get the above equation is as follows:
With sampling method, the second part of above log-likelihood gradient, negative reinforcement for words, will be approxiamted, and three approximation algorithms are invested by Bengio and Senecal (2003): Monte-Carlo Algorithm, Independent Metropolis-Hastings Algorithm, Importance Sampling Algorithm. Monte-Carlo algorithm is not feasible beacuse Monte-Carlo approximations cannot be cheaply performed with training samples. One solution is to using a proposal distribution $Q$, like n-grams or markov chain. When a Monte-Carlo Markov Chain (MCMC) is adopted as a proposal distribution, it will be the Independent Metropolis-Hastings Algorithm. But the convergence of the Markov chain is is a problem and performance of neural network language models using Metropolis-Hastings algorithm is very poor. With importance sampling, 19-fold speed-up is achieved while the perplexities on training data set and test data set is almost the same as the nerual network language model trained with exact and complete gradient (Bengio and Senecal, 2003). Therefore, only the detail procedure of importance sampling will be introduced here.
2. IMPORTANCE SAMPLING ALGORITHM
Importance sampling is a Monte-Carlo scheme, which can be used when an existing distribution is adopted to approximate gradient. For the following gradient:
its improtance sampling estimator is:
where is the size of samples.
Appling importance sampling estimator to the gradient of negative samples in NNLMs:
However, in order to speed up traing of NNLMs, the calcualtion of should be avoided. Covert into:
and is itself is a average with uniform distribution :
so can be estiamted by importence sampling using a proposal distribution too:
then the overall gradient estimator for example is:
The sample size should increase as training progresses to avoid divergence, the adaptive sample size algorithm:
where is the importance sampling ratio for the j-th sampling, and is estimated as:
sampling by ‘blocks’ with sie $N_b$ until the effective sample size $S$ becomes greater than a minimum value $N_0$, and do full back-progration when the samping size is greater than a threshold.
The detail procedure of importance sampling are as following: calculate the positive contribution of the gradient; $N$ samples from the proposal distribution $Q$;
As more efficent and easy speed up techiques have been proposed now, just posted here for completeness and no futher studies will be performanced.