Here is the proof showing that the KL divergence of two distributions and is always non-negative.

The key step is to apply the Jensen’s inequality so that the logarithm will be placed outside of the integration.

Here is the proof showing that the KL divergence of two distributions and is always non-negative.

The key step is to apply the Jensen’s inequality so that the logarithm will be placed outside of the integration.

Advertisements

Does adding more stochastic layers to the recognition model (encoder function) give a tighter lower-bound? Daniel Jiwoong (Bengio’s student)’s AAAI paper, “Denoising Criterion for Variational Auto-Encoding Framework. (AAAI 2017)”, claims that this is true.

It has been known that multi-modal recognition models can learn a more complex posterior distribution from the input data (see [2], [3]). Intuitively, adding more stochastic layers increases the complexity of the recognition models.

This proof shows that the following inequality is true:

By using the KL divergence property, which is defined as:

Since KL divergence is always non-negative (you can also prove that too.), arranging the inequality will result in the following expression:

Hence,

This statement says that the cross entropy for and is always at least the entropy of $f$. This makes sense because when we set distribution $g$ to be the same as $f$, we will get the lowest cross entropy.

A feedforward network with multiple stochastic layers can be defined as a marginal distribution of multiple latent variables:

Then,

We will prove that left and right inequality are satisfied.

We start with the right inequality by simplifying the expression:

From Lemma 0: if we replace with and with , we will end up with the following inequality:

This shows that the right inequality is satisfied.

We expand the encoder function as:

According to the Jensen’s inequality:

The left inequality is also satisfied.

I went over the proof presented in the paper, “Denoising Criterion for Variational Auto-Encoding Framework”. The simple proof on adding one extra stochastic layer shows that we get a tighter lowerbound. The original paper also generalizes its claim to L stochastic layers. By following the same proof strategy, they show that the lowerbound will be tighter as we add more stochastic layers.

**Reference:**

[1] Im, Daniel Jiwoong, et al. “Denoising Criterion for Variational Auto-Encoding Framework.” AAAI. 2017.

[2] Kingma, Diederik P., et al. “Improved variational inference with inverse autoregressive flow.” Advances in Neural Information Processing Systems. 2016.

[3] Dinh, Laurent, Jascha Sohl-Dickstein, and Samy Bengio. “Density estimation using Real NVP.” *arXiv preprint arXiv:1605.08803* (2016).

I highlighted the key concepts from chapter 8 of “Neural Network Methods for NLP” by Yoav Goldberg.

**One hot encoding**: a sparse feature vector, assign a unique dimension for each possible feature. Each row of W corresponds to a particular feature.

**Dense encoding**: a dimension is smaller than the number of features. The matrix W is much smaller. It has a better generalization. Can use the pre-trained embedding from a larger text corpus.

**Windows-based features**: represent a local structure around the focus word.

- Concat all surrounding words if we care the word position.
- Sum or average word vectors if we do not care the word position.
- Use weight sum if we somewhat care the word position.

**CBOW** – an average of word vectors.

**Padding**: add a special symbol to the vocabulary e.g. beginning or ending indicators.

**Unknown word**: a special token represents an unknown word.

**Word signature**: a fine-grained strategy to deal with unknown words. E.g. any rare word ending with ‘ing’ is replaced with *__ING*; any number is replaced with a *NUM* token.

**Word Dropout**

- Replace some infrequent features (words) with an unknown token. But we lose some information.
- Randomly replace a word with an unknown token. This replacement is based on word frequency. One possible formula is where is dropout aggressiveness.

**Word dropout as regularization**

Apply word dropout to all words, ignoring the word frequency. Use Bernoulli trial.

**References:**

Chapter 8, “Neural Network Methods for NLP”, 2nd edition, Yoav Goldberg.

The classical work in a generative model that has a connection to an artificial neural network is the Boltzmann Machine [1] and Restricted Boltzmann Machine (RBM) [2]. The deep version of RBM [3] shows many successes in pretraining the parameters of the neural networks. There are many good tutorials on RBM and source code that we can find online, my goal for this post is to point out some important aspects of RBM as my review material before posting about more complicated models such as NADE [4].

My favorite tutorial on RBM is by Fischer and Christian [5]. It covers many key ideas for modeling and training RBM. My post is based on this tutorial paper.

What I understand about the RBM is that we are modeling a joint probability of visible and hidden units, . RBM removes all connections between hidden units, and result in an effective learning because all hidden units are conditional independence given visible units.

One way to define the joint probability is to use Gibbs distribution and it defines , where Z is a normalization constant or a partition function, . It important to realize that computing the normalization constant is intractable because we have to enumerate all possible and .

The gradient of log-likelihood is . Once we take a derivative w.r.t. to the model parameter, , the gradient is:

This expression shows that the gradient is the difference between an expected energy under the model distribution and under the posterial distribution. Directly evaluating these summation is intractable.

RBM defines an energy function as We can derive the gradient w.r.t. to . First, we derive . Then, the gradient is become:

We can also show that is a sigmoid function. A similar derivation can be applied for . Due to these facts, RBM can be interpreted as a stochastic neural network where the probability of a hidden node being one is dictated by .

Training RBM is tricky because we can’t directly evaluate the expected term. One common approximation is to use Gibbs sampling to sample the most probable hidden and variable units from Then, we can approximate the second term. However, running Gibbs sampling requires many iterations in order to reach a stationary point, Hinton proposed a contrastive divergence where running Gibbs sampling only for k steps.

RBM is the classical stochastic neural network where it models a joint distribution between visible and hidden units. Training RBM is tricky and requires an approximation of the second log-likelihood term. The modern models such as NADE and VAE turn stochastic layers in a neural network to a deterministic system and thus training can be done through a standard backpropagation. This might be one of the reasons why NADE and VAE are more popular than RBM.

References:

[1] Hinton, Geoffrey E., and Terrence J. Sejnowski. “Optimal perceptual inference.” Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. IEEE New York, 1983.

[2] Hinton, Geoffrey E. “Training products of experts by minimizing contrastive divergence.” Neural Computation 14.8 (2002): 1771-1800.

[3] Salakhutdinov, Ruslan, and Geoffrey E. Hinton. “Deep Boltzmann Machines.” AISTATS. Vol. 1. 2009.

[4] Uria, Benigno, et al. “Neural Autoregressive Distribution Estimation.” Journal of Machine Learning Research 17.205 (2016): 1-37.

[5] Fischer, Asja, and Christian Igel. “An introduction to restricted Boltzmann machines.” *Progress in Pattern Recognition, Image Analysis, Computer Vision, and Applications* (2012): 14-36.

Here are my note on some concepts from self-study on Information Theory:

**The Shannon information content:**

This is a measurement of the information content of the event **x = a**. For example, when we flip a coin, an event of landing a head is 0.5, then h(x=’head’) = 1. It means that we only need one bit for this event. E.g. If we landed a tail, we know that it won’t be a head. One bit is sufficient.

**Entropy**: an average of Shannon information:

We consider all events and average out all the Shannon information. Entropy can be thought as an uncertainty. The higher entropy, the more uncertainty of the event. This implies that the Entropy will be maximum when p(x) is a uniform distribution since we can’t make any prediction.

**The Relative entropy (KL Divergence)**

KL(P||Q) is always non-negative (Check Gibbs’ inequality). This term will show up often in many machine learning models. It measures how much distribution q(x) diverges from p(x).

**The Conditional entropy of X given Y:**

This is an average uncertainty that remains about x when y is known. If I know y, then how much I still don’t know about x.

If we average over y:

$latext H(X|Y) = \sum_y p(y) [-\sum_x p(x|y) \log_2 p(x|y) ] = -sum_{x,y} p(x,y) \log p(x|y) $

**Chain rule: **

Information content of x and y is the information content of x plus information coent of y given x.

**Entropy Chain rule:**

An uncertainty about X and Y is the uncertainty of X plus uncertainty of Y given X.

**Mutual Information:**

This term appears often in information retrieval and some machine learning models. This term measures the average reduction in uncertainty about x that results from learning the value of y. E.g. How much I will learn about x once I know about y ? What is an average amount of information that y conveys about x?

When we add more data, we always decrease uncertainty.

**References:**

[1] MacKay, David JC. Information theory, inference and learning algorithms. Cambridge university press, 2003.

Today our colleague presented Memory Network [1] at our research seminar. I want to summarize my understanding on this model and compared it with other deep sequential models such as LSTM and RNNs.

In Question-Answering problem, we are given a question to a learning model, and the model will output an answer based on information and facts that it was given during the training. LSTM and Sequence-To-Sequence models are popular choices of models due to they can handle a variable length input which is common in text and these models avoid vanish gradient problem.

The Memory Network extends these earlier models by adding supporting facts as additional inputs. Intuitively, this should help the model to answer the question better because of the extra information. The model will first locate a few good facts (which is 2 sentences in this paper ) and use that as additional inputs.

Locating relevant facts is time-consuming. Thus, the authors proposed a few approximation to speeding up. The first approximation is to only search for a sentence that sharing the same word with the question. This is the fastest method but not accurate. The second approximation is to cluster all word hash and only search for sentences that have at least one word sharing the same cluster as the given question. This method is much more accurate but it is also slower.

There are a few more extensions such as adding time relation among sentences in order to answer more tricky questions.

In summing up, the memory network does not utilize all facts but instead picking a few relevant facts. The process of fact picking is inefficient. Instead, if we assign a weight to each fact, we might be able to utilize more information to answer the given question. The following up works have exploited this idea and demonstrated better results in QA problem.

**References:**

[1] Weston, Jason, Sumit Chopra, and Antoine Bordes. “Memory networks.” arXiv preprint arXiv:1410.3916 (2014).

In Variational Inference, the evidence lowerbound (ELBO) is defined as:

At this point, I usually pay attention to the first term, the expected log-likelihood and treat the second term, **entropy**, as extra baggage. It makes sense that the entropy term is less relevant especially in mean-field approximation because when the complicated approximate distribution is now just a factored of much simpler approximate distributions, , the entropy term is just a sum of entropy for each hidden variables.

The entropy term shows up again when I worked on the Variational Autoencoder formulation. The entropy term is merge with a prior and result in a relative entropy:

When I pay closer attention, the relative entropy represents a gap (slack) between the lowerbound and the log-likelihood. The high relative entropy means that I badly approximate the true posterior.

When I studied information theory more thoroughly, the entropy can be viewed as the uncertainty of the event of interest. The more uncertainty, the higher entropy because we need to add extra bits to encode these unknown. Then, the entropy in the ELBO could imply how **useful** the variational distribution. If is a uniform distribution, then it is useless because we cannot make any good prediction. Thus, we want to be less flat which automatically means more predictable and lower entropy.

I think I need to be able to look from information theory perspective to get a better sense of how things work in Variational Inference. This knowledge will definitely be helpful for my future research.