Presentation on theme: "Deep learning with multiplicative interactions"— Presentation transcript:
1Deep learning with multiplicative interactions Geoffrey HintonCanadian Institute for Advanced Research&Department of Computer ScienceUniversity of Toronto
2OverviewBackground: How to learn a multilayer generative model of unlabeled data using a Restricted Boltzmann MachineHow to fine-tune for better discriminationA speech recognition example (Dahl & Mohamed)The new idea: RBM’s with factored, 3-way interactionsWhy generative models need 3-way interactionsFactorizing 3-way interactions to save on parametersInference and learning in the factored 3-way modelMemisevic: Learning how images transform over timeTaylor: Transforming a model of human motionRanzato: Creating a pixel covariance matrix on the flyApplied to object recognition in tiny color images.
3Restricted Boltzmann Machines We restrict the connectivity to make learning easier.Only one layer of stochastic binary hidden units.No connections between hidden units.In an RBM, the hidden units are conditionally independent given the visible states.So we can quickly get an unbiased sample from the posterior distribution when given a data-vector.hiddenjivisiblebias terms left out to simplify the math
4The Energy of a joint configuration (ignoring terms to do with biases) binary state of visible unit ibinary state of hidden unit jEnergy with binary vectors v on the visible units and h on the hidden unitsweight between units i and j
5Using energies to define probabilities The probability of a joint configuration over both visible and hidden units depends on the energy of that joint configuration compared with the energy of all other joint configurations.The probability of a configuration of the visible units is the sum of the probabilities of all the joint configurations that contain it.partition function
6A picture of the maximum likelihood learning algorithm for an RBM jjjja fantasyiiiit = t = t = t = infinityStart with a training vector on the visible units.Then alternate between updating all the hidden units in parallel and updating all the visible units in parallel.
7A quick way to learn an RBM Start with a training vector on the visible units.Update all the hidden units in parallelUpdate the all the visible units in parallel to get a “reconstruction”.Update the hidden units again.jjiit = t = 1datareconstructionThis is not following the gradient of the log likelihood. But it works well. It is approximately following the gradient of another objective function called contrastive divergence (Hinton, 2002).
8Training a deep network (the main reason RBM’s are interesting) First train a layer of features that receive input directly from the pixels.Then treat the activations of the trained features as if they were pixels and learn features of features in a second hidden layer.This creates a multi-layer generative model.It can be proved that each time we add another layer of features we improve a variational lower bound on the log probability of the training data.The proof is complicated.
9Fine-tuning for discrimination First learn one layer of features at a time without using label information.Then add a final layer of label units.Then use backpropagation from the label units to fine-tune the features that were learned in the unsupervised “pre-training” phase.This overcomes many of the limitations of standard backpropagation.The label information is used to adjust decision boundaries, not to discover featuresIt finds much deeper minima that generalize much better (Bengio lab).
10Why unsupervised pre-training makes sense stuffstuffhigh bandwidthlow bandwidthimagelabelimagelabelIf image-label pairs are generated this way, it makes sense to first learn to recover the stuff that caused the image by inverting the high bandwidth pathway.If image-label pairs were generated this way, it would make sense to try to go straight from images to labels.For example, do the pixels have even parity?
11A neat application of deep learning A very deep belief net is beats the record at phone recognition on the very well-studied TIMIT database.The task:Predict the probabilities of 183 context-dependent phone labels for the central frame of a short window of speechThe training procedure:Train lots of big layers, one at a time, without using the labels.Add a 183-way softmax of context-specific phone labelsFine-tune with backprop on a big GPU board for several daysThe performance:After the standard post-processing using a bi-phone model this gets 23.0% phone error rate.Our speech experts believe that this beats all previous recognition methods that use the standard decoder.For TIMIT, the classification task is a bit easier than the recognition task. Deep networks are the best at classification too (Honglak Lee)
12One very deep belief net for phone recognition 183 labelsnot pre-trainedMohamed, Dahl & Hintonposter in the NIPS speech workshop on Saturday128 units2000 binary hidden units2000 binary hidden units2000 binary hidden units2000 binary hidden units11 frames of 39 MFCC’sThe Mel Cepstrum Coefficients are a standard representation for speech
13A simple real-valued visible unit We model MFCC coefficients as Gaussian variables that are independent given the hidden states. Alternating Gibbs sampling is still easy, but learning needs to be much slower.E energy-gradient due to top-down input to unit i.parabolic containment
14The new idea The basic RBM module is flawed. It is no good at dealing with multiplicative interactions.Multiplicative interactions are ubiquitousStyle and content (Freeman and Tenebaum)Image transformations (Tensor faces)Heavy-tailed distributions caused by multiplying together two Gaussian distributed variables.
15Generating the parts of an object: why multiplicative interactions are useful One way to maintain the constraints between the parts is for the level above to specify the location of each part very accuratelyBut this would require a lot of communication bandwidth.Sloppy top-down specification of the parts is less demandingbut it messes up relationships between partsso use redundant features and specify lateral interactions to sharpen up the mess.Each part helps to locate the othersThis allows a noisy top-down channel
16Generating the parts of an object “square”+pose parameterssloppy top-down activation of partsclean-up using lateral interactions specified by the layer above.parts with top-down supportIts like soldiers on a parade ground
17Towards a more powerful, multi-linear stackable learning module We want the states of the units in one layer to modulate the pair-wise interactions in the layer below (not just the biases)Can we do this without losing the nice property that the hidden units are conditionally independent given the visible states?To modulate pair-wise interactions we need higher-order Boltzmann machines.These have far too many parameters, but we have a trick for fixing that.
18Higher order Boltzmann machines (Sejnowski, ~1986) The usual energy function is quadratic in the states:But we could use higher order interactions:Unit k acts as a switch. When unit k is on, it switches in the pairwise interaction between unit i and unit j.Units i and j can also be viewed as switches that control the pairwise interactions between the other two units.
19Using higher-order Boltzmann machines to model image transformations (the unfactored version, Memisevic &Hinton CVPR 2007)A global transformation specifies which pixel goes to which other pixel.Conversely, each pair of similar intensity pixels, one in each image, votes for a particular global transformation.image transformationimage(t)image(t+1)
20Factoring three-way multiplicative interactions unfactoredwith cubically many parametersfactored with linearly many parameters per factor.
21A picture of the rank 1 tensor contributed by factor f Its a 3-way outer product.Each layer is a scaled version of the same rank 1 matrix.
22Inference with factored three-way multiplicative interactions Energy contributed by factor fHow changing the binary state of unit h changes the energy contributed by factor fWhat unit h needs to know in order to do Gibbs sampling=
23Belief propagationThe outgoing message at each vertex of the factor is the product of the weighted sums at the other two vertices.
24Learning with factored three-way multiplicative interactions message from factor f to unit h2.30?
25Showing what a factor learns by alternating between its pre- and post- fields receptive field in pre-imagereceptive field in post-imagepre-imagepost-image
26The factor receptive fields The network is trained on translated random dot patterns.
27The factor receptive fields The network is trained on translated random dot patterns.
28The network is trained on rotated random dot patterns.
29The network is trained on rotated random dot patterns.
30How does it perceive two overlaid sparse dot patterns moving in different directions? First we train a second hidden layer. Each of these units prefers motion in a different direction.Then we compute the perceived motion by adding up the preferences of the active units in the second hidden layer.If the two motions are within about 30 degrees it sees a single average motion.If they are further apart it sees two separate motions.The separate motions are slightly further apart than the real ones.This is just like human perception and it was not trained on transparent motion.The training is entirely unsupervised.
31Time series modelsInference is difficult in directed models of time series if we use non-linear, distributed representations in the hidden units.It is hard to fit directed graphical models to high-dimensional sequences (e.g motion capture data).So people tend to use methods with much less representational powerHMM’s give up on distributed representationsLinear Dynamical Systems give up on non-linearity.
32The conditional RBM model (a partially observed bipartite CRF) Start with a generic RBM.Add two types of conditioning connections.Given the data, the hidden units at time t are conditionally independent.The autoregressive weights can model most short-term temporal structure very well, leaving the hidden units to model nonlinear irregularities.hvt t t
33Causal generation from a learned model Keep the previous visible states fixed.They provide a time-dependent bias for the hidden units.Perform alternating Gibbs sampling for a few iterations between the hidden units and the most recent visible units.This picks new hidden and visible states that are compatible with each other and with the recent history.Even when we change the model, generation will be similar
34Higher level models skip? Once we have trained the model, we can add more layers.Treat the hidden activities of the first CRBM as data for training the next CRBM.Add “autoregressive” connections to a layer when it becomes the visible layer.Adding a second layer makes it generate more realistic sequences.Motions that I show you next will use 2 layerst t t
35An application to modeling motion capture data Human motion can be captured by placing reflective markers on the jointsUse lots of infrared cameras to track the 3-D positions of the markersGiven a skeletal model, the 3-D positions of the markers can be converted intoThe joint anglesThe 3-D translation of the pelvisThe roll, pitch and delta yaw of the pelvis
36Using a style variable to modulate the interactions (there is additional weight sharing: Taylor&Hinton, ICML 2009)style: 1-of-N600 hidden units100 style features200 factors6 earlier visible framescurrent visible frame
37Show demo’s of multiple styles of walking These can be found at
38Modeling the covariance structure of a static image by using two copies of the image Each factor sends the squared output of a linear filter to the hidden units.It is exactly the standard model of simple and complex cells. It allows complex cells to extract oriented energy.The standard model drops out of doing belief propagation for a factored third-order energy function.Copy 1Copy 2
39An advantage of modeling covariances between pixels rather than pixels During generation, a hidden “vertical edge” unit can turn off the horizontal interpolation in a region without worrying about exactly where the intensity discontinuity will be.This gives some translational invarianceIt also gives a lot of invariance to brightness and contrast.The “vertical edge” unit acts like a complex cell.By modulating the correlations between pixels rather than the pixel intensities, the generative model can still allow interpolation parallel to the edge.
40Using linear filters to model the inverse covariance matrix of two pixel intensities small weightbig weightEach factor creates a parabolic energy trough.The joint distribution of 2 pixels
41Modulating the precision matrix by using additive contributions that can be switched off Use the squared outputs of a set of linear filters to create an energy function.The energy function represents the negative log probability of the data under a full covariance Gaussian.Adapt the precison matrix to each datapoint by switching off the energy contributions from some of the linear filters.This is good for modeling smoothness constraints that almost always apply, but sometimes fail catastrophically (e.g. at edges).
42Using binary hidden units to remove violated smoothness constraints Free energy filter output, y When the negative input from the squared filter exceeds the positive bias, the hidden unit turns off.
43Inference with hidden units that represent active smoothness constraints The hidden units are all independent given the pixel intensitiesThe factors do not create dependencies between hidden units.Given the states of the hidden units, the pixel intensity distribution is a full covariance Gaussian that is adapted for that particular image.The hidden states do create dependencies between the pixels.
44Learning with an adaptive precision matrix Since the pixel intensities are no longer independent given the hidden states, it is much harder to produce reconstructions.We could invert the precision matrix for each training example, but this is slow.Instead, we produce reconstructions using Hybrid Monte Carlo, starting at the data.The rest of the learning algorithm is the same as before.
45Hybrid Monte Carlo Skip? Given the pixel intensities, we can integrate out the hidden states to get a free energy that is a deterministic function of the image.Backpropagation can then be used to get the derivatives of the free energy with respect to the pixel intensities.Hybrid Monte Carlo simulates a particle that starts at the datapoint with a random initial momentum and then moves over the free energy surface.20 leapfrog steps work well for our networks.
46mcRBM (mean and covariance RBM) Use one set of binary hidden units to model the means of the real-valued pixels.These hidden units learn blurry patterns for coloring in regionsUse a separate set of binary hidden units to model the image-specific precision matrix.These hidden units get their input from factors.The factors learn sharp edge filters for representing breakdowns in smoothness.
47Receptive fields of the hidden units that represent the means Trained on 16x16 patches of natural images.
48Receptive fields of the factors that are used to represent precisions Notice the color blob with low frequency red-green and yellow-blue filters
49Why is the map topographic? We laid out the factors in a 2-D grid and then connected each hidden unit to a small set of nearby factors.If two factors get activated at the same time, it pays to connect them to the same hidden unit.You only lose once by turning off that hidden unit.
50Multiple reconstructions from the same hidden state of a mcRBM The mcRBM hidden states are the same for each row. The hidden states should reflect human similarity judgements much better than squared difference of pixel intensities.
51Test examples from the CIFAR-10 dataset plane car bird cat deer dog frog horse ship truck
52Application to the CIFAR-10 labeled subset of the TINY images dataset (Marc’Aurelio Ranzato) There are x32 training images and x32 testing images for each of 10 different classes.In addition, there are 80 million unlabeled images.Train the mcRBM model on a very large number of 8x8 color patches81 hiddens for the mean144 hiddens and 900 factors for the precisionReplicate the patches across the 32x32 color images49 patches with a stride of 4This gives 49 x 225 = hidden units.
53How well does it discriminate? Compare with Gaussian-Binary RBM model that has the same number of hidden units, but only models the means of the pixel intensities.Use multinomial logistic regression directly on the hidden units representing the means and the hidden units representing the precisions.We can probably do better, but the aim is to evaluate the mcRBM idea.Also try unsupervised learning of extra hidden layers with a standard RBM to see if this gives even better features for discrimination.
54Percent correct on CIFAR-10 test data Gaussian RBM (only models the means)49x225 = hiddens59.7%3-way RBM (only models the covariances) 49x225 = hiddens, filters per patch62.3%3-way RBM (only models the covariances)49x225 = hiddens, filters per patch (extra factors allow pooling of similar filters)67.8%mcRBM (models means & covariances)49x(81+144) = hids, filters per patch69.1%mcRBM then extra hidden layer of 8096 units72.1%
55SummaryIt is easy to learn deep generative models of unlabeled data by stacking RBM’s.RBM’s can be modified to allow factored multiplicative interactions. Inference is still easy.Learning is still easy if we condition on one set of inputs (the pre-image for learning image transformations; the style for learning mocap)Multiplicative interactions allow an RBM to model pixel covariances in an image-specific way.This gives good hidden representations for object recognition.
57Learning a deep directed network etc.h2First learn with all the weights tiedThis is exactly equivalent to learning an RBMContrastive divergence learning is equivalent to ignoring the small derivatives contributed by the tied weights between deeper layers.v2h1v1h0h0v0v0
58Then freeze the first layer of weights in both directions and learn the remaining weights (still tied together).This is equivalent to learning another RBM, using the aggregated posterior distribution of h0 as the data.etc.h2v2h1v1v1h0h0v0
59The hybrid generative model after learning 3 layers To generate data:Get an equilibrium sample from the top-level RBM by performing alternating Gibbs sampling for a long time.Perform a top-down pass to get states for all the other layers.So the lower level bottom-up connections are not part of the generative model. They are just used for inference.h3h2h1data
60Learning with unreliable labels We can infer the true hidden label by combining evidence.This allows us to get surprisingly low error rates with very bad labels:Perfect labels: %Labels 50% wrong: 2%Labels 80% wrong: 5%It’s the mutual information that matters.2000 top-level neurons10 hidden labels500 neuronsconfusion matrix500 neurons10 noisy labels28 x 28 pixel image