This week in lab meeting, I presented a mini-bootcamp covering Richard Sutton & Andrew Barto’s Reinforcement Learning, Part 1: Tabular Solution Methods (Chapters 2-8). My attempt to get through 170 pages of material in 75 minutes can be found below (as `.pptx`

or `.pdf`

):

# Category Archives: lab meetings

# Lapses in perceptual judgments reflect exploration

In lab meeting this week, we discussed Lapses in perceptual judgments reflect exploration by Pisupati*, Chartarifsky-Lynn*, Khanal and Churchland. This paper proposes that, rather than corresponding to inattention (Wichmann and Hill, 2001), motor error, or -greedy exploration as has previously been suggested, lapses (errors on “easy” trials with strong sensory evidence) correspond to uncertainty-guided exploration. In particular, the authors compare empirically-obtained psychometric curves characterizing the performance of rats on a 2AFC task, with predicted psychometric curves from various normative models of lapses. They found that their softmax exploration model explains the empirical data best.

**Empirical psychometric curve**

Psychometric curves are used to characterize the behavior of animals as a function of the stimulus intensity when performing, for example, 2AFC tasks. They are defined by four parameters:

where is a sigmoidal curve (we will assume the cumulative normal distribution in what follows); determines the decision boundary and is the inverse slope parameter. is the lower asymptote of the curve, while is the upper asymptote. Together, , comprise the asymmetric lapse rates for the “easiest” stimuli (highest intensity stimuli).

While Bayesian ideal observer models have been able to motivate the cumulative normal shape of the psychometric curve (as the authors show in their Methods section), this paper aims to compare different normative models to explain the and parameters of the psychometric curve.

**Inattention model**

For their inattention model, the authors assume that, with probability , the rat pays attention to the task-relevant stimulus, while, with probability , it ignores the stimulus and instead chooses according to its bias . That is:

or, equivalently, and .

**Softmax exploration model**

In comparison to the inattention model, which assumes that, when the animal is paying attention to the task-relevant variable, it chooses the action corresponding to the maximum expected action-value, ; the softmax-exploration model assumes that the animal chooses to go right in a 2AFC task according to

where is the inverse temperature parameter and controls the balance between exploration and exploitation and is the difference in the expected value of choosing Right compared to choosing Left (see below). In the limit of , the animal will once again choose its action according to ; while in the low regime, the animal is more exploratory and may choose actions despite them not having the largest expected action values.

In the task they consider, where an animal has to determine if the frequency of an auditory and/or visual cue exceeds a predetermined threshold, the expected action values are , where is the posterior distribution over the category of the stimulus (whether the frequency of the generated auditory and/or visual stimuli are above or below the predetermined threshold) given the animal’s noisy observations of the auditory and visual stimuli, and . is the reward the animal will obtain if it chooses to go Right and is correct. Similarly, .

The authors show that the softmax exploration model corresponds to setting the lapse parameters as

and

**Model Comparison**

The authors compare the empirically obtained psychometric curves with those predicted by the inattention and exploration models for two experimental paradigms:

- Matched vs Neutral Multisensory stimuli: in this experiment, rats are either presented with auditory and visual stimuli of the same frequency (‘matched’), or with auditory and visual stimuli, where one of the channels has a frequency close to the category threshold, so is, in effect, informationless (‘neutral’). The idea here is that both matched and neutral stimuli have the same ‘bottom-up salience’, so that the parameter is the same for both matched and neutral experiments in the inattention model. By contrast, there is no such restriction for the softmax exploration model, and there is a different exploration parameter for the matched and neutral experiments. The authors find that the psychometric curves corresponding to the softmax model resemble the shape of the empirically obtained curves more closely; and that BIC/AIC are lower for this model.
- Reward manipulations: whereas the reward for choosing left or right was previously equal, now the reward for choosing right (when the frequency is above the predetermined threshold) is either increased or decreased. Again, the authors find that the psychometric curves corresponding to the softmax model resemble the shape of the empirically obtained curves more closely; and that BIC/AIC are lower for this model.

**Reflections on this paper**

By demonstrating that lapse rates can be manipulated with rewards or by using unisensory compared to multisensory stimuli, this paper highlights that traditional explanations for lapses as being due to a fixed probability of the animal neglecting the task-relevant stimulus; motor-error or greedy exploration are overly-simplistic. The asymmetric effect on left and right lapse rates of modified reward is particularly interesting, as many traditional models of lapses fail to capture this effect. Another contribution that this paper makes is in implicating the posterior striatum and secondary motor cortex as areas which may be involved in determining lapse rates; and better characterizing the role of these areas in lapse behavior than has been done in previous experiments.

This being said, some lab members raised some questions and/or points of concern as we discussed the paper. Some of these points include:

- We would have liked to see further justification for keeping the same across the matched and neutral experiments and we question if this is a fair test for the inattention model of lapses. Previous work such as Körding et al. (2007) makes us question whether the animal uses different strategies to solve the task for the matched and neutral experiments. In particular, in the matched experiment, the animal may infer that the auditory and visual stimuli are causally related; whereas in the neutral experiment, the animal may detect the two stimuli as being unrelated. If this is true, then it seems strange to assume that and for the inattention model should be the same for the matched and neutral experiments.
- When there are equal rewards for left and right stimuli, is there only a single free parameter determining the lapse rates in the exploration model (namely )? If so, how do the authors allow for asymmetric left and right lapse rates for the exploration model curves of Figure 3e (that is, the upper and lower asymptotes look different for both the matched and neutral curves despite equal left and right reward, yet the exploration model seems able to handle this – how does the model do this?).
- How could uncertainty be calculated by the rat? Can the empirically determined values of be predicted from, for example, the number of times that the animal has seen the stimulus in the past? And what were some typical values for the parameter when the exploration model was fit with data? How exploratory were the rats for the different experimental paradigms considered in this paper?

# The Lottery Ticket Hypothesis

Deep learning is black magic. For some reason, a neural network with millions of parameters is not cursed to overfit. Somewhere, either in the architecture or the training or the weights themselves, exists a magic that allows deep neural networks to generalize. We are now only beginning to understand why this is. As in most cases in science, a good starting place is to observe a paradox about the system, suggest a hypothesis to explain the paradox, and then test, test, test.

**The Paradox:** This week we discussed “The lottery ticket hypothesis: Finding sparse, trainable neural networks” by Frankle and Carbin, *ICML*, 2019. Recent studies have shown that a deep neural network can be pruned down to as little as 10% of the size of the original network with no loss in test prediction. This leads to a paradox: Training the small, pruned network (randomly initialized) leads to worse test prediction than training a large network and then pruning it. This is heresy to the ML doctrine of “Thou shalt start simple, and then go complex.” What is going on?

**The Hypothesis:** This paradox suggests that the *initialization* of the weights of the pruned network matters. This leads to the Lottery Ticket Hypothesis:

The Lottery Ticket Hypothesis: “dense, randomly-initialized, feed-forward networks contain subnetworks (i.e., winning tickets) that—when trained in isolation—reach test prediction comparable to the original network in a similar number of iterations.”

These “winning tickets” start out with an initialization that make training particularly effective. If the winning tickets were re-initialized randomly, they would no longer be winning tickets—training would not reach the same level of test prediction. This may explain why deep and wide networks tend to perform better than shallow, narrow networks—> the deeper, wider networks have more chances of having the winning ticket. It also suggests that training a neural network is akin to stochastic gradient descent seeking out these winning tickets.

**The Test, Test, Test:** To find the winning ticket, the authors employ iterative pruning. They start with a large neural network, train it a bit, set the smallest-magnitude weights to zero (these weights are no longer trainable), rewind the trainable parameters to their original initialized values, and train again. This is repeated until pruning drastically hurts test prediction. They find that these winning tickets can be as sparse as 3.7% of the original network’s size while having the same if not higher test prediction (Figure 1, solid lines). Interestingly, if they randomly re-initialize the weights of these pruned networks, test prediction decreases considerably (Figure 1, dashed lines, ‘reinit’). Thus, we have a way to identify winning tickets, these winning tickets are a measly fraction of the size of the original network, and their original initialization is crucial to train them. The authors do a thorough job of confirming the robustness of this effect (45 figures in all). However, they did not investigate the properties of the subnetworks (e.g., did pruning happen most in the deeper layers?).

One question I had remaining is if these winning tickets were necessary or sufficient to train the large network. One analysis that could get at this question is the following. First, identify a winning ticket, and then re-initialize its weights in the original, large network. This ensures that this subnetwork is no longer is a winning ticket. Keep repeating this process. After removing winning tickets, does the large network fail to train? How many winning tickets does the large network have? Will the large network always have a winning ticket? We could also do the reverse of this: For a large network, keep initializing subnetworks that are winning tickets. Is it the case that with more winning tickets, the network trains faster with higher test prediction?

**Implications for deep learning:** There are several implications for deep learning. 1. Finding out what is special about the initializations of these winning tickets may help us improve initialization strategies. 2. We may be able to improve optimization techniques by better guiding stochastic gradient descent to find and train the winning ticket as fast as possible. 3. New theory that focuses on subnetworks may lead to more insight into deep learning. 4. These winning tickets may be helpful for solving other tasks (i.e., transfer learning). There have already been some follow up studies about these issues and re-examining the lottery ticket hypothesis: Liu et al., 2019, Crowley et al., 2019, Frankle et al., 2019, Zhou et al, 2019.

**Does the brain have winning tickets?** I had one recurring thought while reading this paper: I know brains prune synaptic connections substantially during development—could the brain also consist of whittled-down winning tickets? After some searching, I realized that it is largely unknown the amount of pruning that occurs or when certain pruning happens. What would be some tell-tale signs of winning tickets? First, substantial pruning should occur (and likely does…perhaps as much as 50%). Second, randomly initializing a developing circuit should lead to a drop in performance after the same amount of training as a control subject (not sure if we can randomly set synaptic weights yet). Third, what would happen if we could prune small-magnitude synaptic connections ourselves during development? Could the brain recover? These tests could first be carried out in insects, where we have gene lines, optogenetics, whole-brain recordings, and well-labeled cell types.

# Deep Neural Networks as Gaussian Processes

In lab meeting this week, we read Deep Neural Networks as Gaussian Processes by Lee, Bahri, Novak, Schoenholz, Pennington and Sohl-Dickstein, and which appeared at ICLR 2018. The paper extends a result derived by Neal (1994); and the authors show that there is a correspondence between deep neural networks and Gaussian processes. After coming up with an efficient method to evaluate the associated kernel, the authors compared the performance of their Gaussian process model with finite width neural networks (trained with SGD) on an image classification task (MNIST, CIFAR-10). They found that the performance of the finite width networks approached that of the Gaussian process performance as the width increased, and that the uncertainty captured by the Gaussian process correlated with mean squared prediction error. Overall, this paper hints at new connections between Gaussian processes and neural networks; and it remains to be seen whether future work can harness this connection in order to extend Gaussian process inference to larger datasets, or to endow neural networks with the ability to capture uncertainty. We look forward to following progress in this field.

**Single Layer Neural Networks as Gaussian Processes – Neal 1994**

Let us consider a neural network with a single hidden layer. We can write the ith output of the network, , as

where is the post-activation of the jth neuron in the hidden layer; is some nonlinearity, and is the kth input to the network.

If we now assume that the weights for each layer in the network are sampled i.i.d. from a Gaussian distribution: , ; and that the biases are similarly sampled: and ; then it is possible to show that, in the limit of , , for a kernel which depends on the nonlinearity. In particular, this follows from application of the Central Limit Theorem: for a fixed input to the network , as where (which is the same for all ).

We can now apply a similar argument to the above in order to examine the distribution of ith output of the network for a collection of inputs: that is we can examine the joint distribution of . Application of the Multidimensional Central Limit Theorem tells us that, in the limit of ,

,

where and and .

Since we get a joint distribution of this form for *any* finite collection of inputs to the network, we can write that , as this is the very definition of a Gaussian process.

This result was shown in Neal (1994); and the precise form of the kernel was derived for the error function (a form of sigmoidal activation function) and Gaussian nonlinearities in Williams (1997).

**Deep Neural Networks as Gaussian Processes**

Lee et al. use similar arguments to those presented in Neal (1994) to show that the th output of the th layer of a network with a Gaussian prior over all of the weights and biases is a sample from a Gaussian process in the limit of . They use an inductive argument of the form: suppose that (the jth output of the th layer of the network is sampled from a Gaussian process). Then:

is Gaussian distributed as and any finite collection of will have a joint multivariate Gaussian distribution, i.e., where

.

If we assume a base kernel of the form , these recurrence relations can be solved in analytic form for the ReLU nonlinearity (as was demonstrated in Cho and Saul (2009)), and they can be solved numerically for other nonlinearities (and Lee et al., give a method for finding the numerical solution efficiently).

**Comparison: Gaussian Processes and Finite Width Neural Networks**

Lee et al. went on to compare predictions made via Gaussian process regression with the kernels obtained by solving the above recurrence relations (for nonlinearities ReLU and tanh), with the predictions obtained from finite width neural networks trained with SGD. The task was classification (reformulated as a regression problem) of MNIST digits and CIFAR-10 images. Overall, they found that their “NNGP” often outperformed finite width neural networks with the same number of layers for this task; and they also found that the performance of the finite width networks often approached that of the NNGP as the width of these networks was increased:

# oi-VAE: output interpretable VAEs

We recently read oi-VAE: Output Interpretable VAEs for Nonlinear Group Factor Analysis, which was published at ICML in 2018 by Samuel Ainsworth, Nicholas Foti, Adrian Lee, and Emily Fox. This paper proposes a nonlinear group factor analysis model that is an adaptation of VAEs to data with groups of observations. The goal is to identify nonlinear relationships between groups and to learn latent dimensions that control nonlinear interactions between groups. This encourages *disentangled *latent representations among sets of functional groups. A prominent example in the paper is motion capture data, where we desire a generative model of human walking and train on groups of observed recorded joint angles.

Let us consider observations that we group into groups . We note that the paper does not discuss how to choose the groups and assumes that a grouping has already been specified. The generative model maps a set of latent variables to group-specific generator networks via group-specific mapping matrices such that

for each .

For learning interpretable sets of latents that control separate groups, the key feature of this approach is to place a sparsity-inducing prior on the columns of each . The authors use a hierarchical Bayesian sparse prior that when analytically marginalized corresponds to optimizing a group lasso penalty on the columns of .

The model is trained in the standard VAE approach by optimizing the ELBO with an amortized inference network , with the addition of the group lasso penalty and a prior on the parameters of the generator networks

where is the -th column of and is a parameter controlling the sparsity. The prior fixes the scaling of the neural network parameters relative to the mapping matrices .

The above objective consists of a differentiable term (the ELBO plus log prior on ) plus a convex but non-differential term (group LASSO). Therefore the authors use proximal gradient methods to optimize it. First, they update all parameters using the gradients of the ELBO plus log-prior with respect to , and . Then, they apply the proximal operator

to each to respect the group lasso penalty, where is a step-size. The authors fixed for all of their experiments fitting oi-VAE, so one question I had reading was how the authors determined and how varying affects the results.

The authors validate the approach on a toy example. They generated synthetic bars data, where one row of a square matrix was sampled from a Gaussian with non-zero mean while the rest of the matrix was sampled from zero-mean noise. The authors fit oi-VAE with each group set to a row of observations, and found that the model learned the appropriate sparse mapping where each latent component mapped to one of the rows. This latent space improved on the VAE, which did not have any discernible structure in the latent space. Importantly, oi-VAE still successfully identified the correct number of latent components (8) and sparse mapping even when the model was fit with double the amount of components.

After validating the approach, the authors applied it to motion capture data. Here, the output groups were different joint angles. They trained the oi-VAE model on walking motion capture data. The learned latent dimensions nicely corresponded to intuitive groups of joint angles, such as the left leg (left foot, left lower leg, left upper leg). Next, the imposed structure in the model helped it generate more realistic unconditional samples of walking than the VAE, presumably because the inductive bias allowed oi-VAE to better learn invalid joint angles.

These results suggest the oi-VAE is a useful model for discovering nonlinear interactions between groups. In particular, I liked the approach of adding structure in the generative model to gain interpretability, and hypothesize that adding other forms of structure to VAE generative models is a good way to encourage disentangled representations (see a recent example of this in Dieng et al., 2019).

Two questions when using the approach are how to choose and how to choose the grouping of the data, as this work assumes a grouping has been chosen. In some data we may have prior knowledge about a natural grouping structure but that will not always be the case. However, even without multiple groups, the approach could be useful for learning the number of latent dimensions useful for explaining the amount of data. Finally, we point the reader to factVAE, where the authors further develop this idea to simultaneous learn complementary sparse structure in the inference network and generative model.

# Uncertainty Autoencoders: Learning Compressed Representations via Variational Information Maximization

This week we continued the deep generative model theme and discussed Uncertainty Autoencoders: Learning Compressed Representations via Variational Information Maximization. This work is in the context of *statistical compressive sensing, *which attempts to recover a high-dimensional signal from low dimensional measurements in a way that leverages a set of training data . This is in contrast to traditional compressive sensing, which a priori asserts a sparsity based prior over and learns the recovery of a single from a single compressed measurement .

The central compressive sensing problem can be written as

.

In traditional compressive sensing, is a known random Gaussian matrix that takes linear combinations of the sparse signal to encode . Here, describes additive Gaussian noise. The goal of compressive sensing is to decode , given measurements . This is traditionally done via LASSO, which minimizes the convex optimization problem . In contrast, *statistical compressive sensing* is a set of methods which recovers from using a procedure that results from training on many examples of . That is, the decoding of from is done in a way that utilizes statistical properties learned from training data . The encoding, on the other hand, may either involve a known random Gaussian matrix , as is the case above, or it may also be learned as a part of the training procedure.

There are two statistical compressive sensing methods discussed in this paper. One is prior work that leverages the generative stage of variational autoencoders to reconstruct from (Bora et al. 2017). In this paper, the decoding network of learned VAE creates an from a sample . This is adapted to a compressive sensing framework of recreating the best from measurement by solving the following minimization problem:

Here, is the VAE decoding mapping. The optimization is: given some measurements , we seek to find the that generates an such that, when it is compressed, best matches the measurements .

This VAE-based decompression method is used as a comparison to a new method presented in this paper, called the Uncertainty Autoencoder (UAE) which is able to optionally learn *both* an encoding process, the mapping of to , and a decoding process, the recovery of a reconstructed from a . It learns these encoding and decoding mappings by maximizing the mutual information between and , parameterized by encoding and decoding distributions. The objective, derived through information theoretic principles, can be written as:

Here, is an encoding distribution parameterized like the original sparse coding compression mapping , and is a variational distribution that decodes from using a deep neural network parameterized by . This objective is maximized by drawing training data samples from what is asserted as a uniform prior over , which is simply the data itself, .

Using this objective, it is possible to derive an optimal linear encoder under a Gaussian noise assumption in the limit of infinite noise. This linear encoding, however, is *not* the same as PCA, which is derived under the assumption of linear *decoding*. UAE linear compression, instead, makes no assumptions about the nature of the decoding. The authors use this optimal linear compressor on MNIST, and use a variety of classification algorithms (k-nearest neighbors, SVMs, etc) on this low-d representation to test classification performance. They find that the UAE linear compression better separates clusters of digits than PCA. It is unclear, however, how this UAE classification performance would compare to linear compression algorithms that are known to work better for classification, such as random projections and ICA. I suspect it will not do as well. Without these comparisons, unclear what use this particular linear mapping provides.

The authors demonstrate that UAE outperforms both LASSO and VAE decoding on reconstruction of MNIST and omniglot images from compressed measurements. They implement two versions of the UAE, one that includes a trained encoding , and another where is a random Gaussian matrix, as it is for the other decoding conditions. This allows the reader to distinguish to what extent the UAE decoder does a better job at reconstructing under the same encoding as the alternative algorithms.

Most interestingly, the authors test the UAE in a *transfer compressive sensing* condition, where an encoder and decoder is learned on some data, say omniglot, and the decoder is re-learned using compressed measurements from different data, MNIST. In this condition, the training algorithm has *no access to the test MNIST signals*, but still manages to accurately recover the test signals given their compressed representations. This suggests that reasonably differently structured data may have similar optimal information-preserving linear encodings, and an encoder learned from one type of data can be utilized to create effective reconstruction mappings across a variety of data domains. The applications here may be useful.

It is unclear, however, how well these comparisons hold up in a context where traditional compressive sensing has proven to be very effective, like MRI imaging.

There are interesting parallels to be drawn between the UAE and other recent work in generative modeling and their connections to information theory. As the author’s point out, their objective function corresponds to last week’s –*VAE* objective function with . That is, the UAE objective written above is the same as the VAE objective minus the KL term. Though a VAE with does not actually satisfy the bound derived from the marginal distribution, and hence is not a valid ELBO, is *does* satisfy the bound of maximal mutual information. And as Mike derives in the post below, there is an additional connection between rate-distortion theory and the –*VAE* objective. This suggests that powerful generative models can be derived from either principles of Bayesian modeling or information theory, and connections between the two are just now beginning to be explored.

# Reductions in representation learning with rate-distortion theory

In lab meeting this week, we discussed unsupervised learning in the context of deep generative models, namely -variational auto-encoders (-VAEs), drawing from the original, Higgins et al. 2017 (ICLR), and its follow-up, Burgess et al. 2018. The classic VAE represents a clever approach to learning highly expressive generative models, defined by a deep neural network that transforms samples from a standard normal distribution to some distribution of interest (e.g., natural images). Technically, VAE training seeks to maximize a lower bound on the likelihood , where defines the generative mapping from latents to data . This “evidence lower bound” (ELBO) depends on a variational approximation to the posterior, , which is also parametrized by a deep neural network (the so-called “encoder”).

A crucial drawback to the classic VAE, however, is that the learned latent representations tend to lack interpretability. The -VAE seeks to overcome this limitation by learning “disentangled” representations, in which single latents are sensitive to single generative factors in the data and relatively invariant to others (Bengio et al. 2013). I would call these “intuitively robust” — rotating an apple (orientation) shouldn’t make its latent representation any less red (color) or any less fruity (type). To overcome this challenge, -VAEs optimize a modified ELBO given by:

with and standard VAEs corresponding to . The new hyperparameter controls the optimization’s tension between maximizing the data likelihood and limiting the expressiveness of the variational posterior relative to a fixed latent prior .

Recent work has been interested in tuning the latent representations of deep generative models (Adversarial Autoencoders (Makhzani et al. 2016), InfoGANS (Chen et al. 2016), Total Correlation VAEs (Chen et al. 2019), among others), but the generalization used by -VAEs in particular looked somehow familiar to me. This is because -VAEs recapitulate the classical rate-distortion theory problem. This was observed briefly also in recent work by Alemi et al. 2018, but I would like to elaborate and show explicitly how -VAEs are reducible to a distortion-rate minimization using deep generative models.

Rate-distortion theory is a theoretical framework for lossy data compression through a noisy channel. This fundamental problem in information theory balances the minimum permissible amount of information (in bits) transmitted across the channel, the “rate”, against the corruption of the original signal, a penalty measured by a “distortion” function . Our terminology changes, but the fundamental problem is the same; I made that comparison as obvious as possible in the figure below.

**Derivation.** Given a dataset with a distribution , define any statistical mapping that encodes into a code . Note that is just an encoder, and together they induce a joint distribution with a marginal . The distortion-rate optimization would minimize distortion subject to a maximum rate , i.e.

Consider first the mutual information. We leverage a more tractable upper bound with

We’ve replaced the marginal induced by our choice of encoder with another distribution that makes the optimization more tractable, e.g. in the VAE. Our objective can be rewritten as

Suppose the distortion of interest is posterior density (mis)estimation, . Such a function penalizes representations from which we cannot regenerate an observed data vector through the decoding network with high probability. A typical distortion-rate problem would *fix* the distortion function, but we choose to learn this decoder. We can optimize the objective *for each* to eliminate the outer expectation over the data , fix , and recover the -VAE objective precisely:

When , our optimization prioritizes minimizing the second term (rate) over maximizing the first one (distortion). In this sense, the authors’ argument for large can be reinterpreted as an argument for higher-distortion, lower-rate codes (*read:* latent representations) to encourage interpretability. I edited a figure below from Alemi et al. 2018 to clarify this.

Information-theoretic hypotheses abound. Perhaps enforcing optimization in this region could discourage solutions that depend on learning an ultra-powerful decoder (*VAE:* generator) , in other words solutions that depend on a good *code*, not necessarily a good *decode*. Does eliminating this possibility simply make room to fish out an ad-hoc interpretable representation, or is there a more sophisticated explanation waiting to be found? We’ll see.