Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deep Neural Networks (DNN) with Energy-Based Le...

sambaiga
September 24, 2020

Deep Neural Networks (DNN) with Energy-Based Learning

Energy-Based Models (EBMs) belong to the class of data-driven models that encode dependencies between variables by associating a scalar parametric energy function to each of them. EBMs learn a function that assigns low energy values to inputs in the data distribution and high energy values to other data. The resulting models can then be used to either discriminate whether or not a query input comes from the data distribution or generate new samples from the data distribution. This makes EBM as a flexible framework for learning high-dimensional and complex computations dependencies. As a consequence, EBMs have received attention for most of machine learning applications. This talk will provide a brief overview of EBMs and how they can be used with deep learning on various machine learning applications such as density estimation, regression, classification, out of distribution detection, model calibrations, and reinforcement and learning.

sambaiga

September 24, 2020
Tweet

More Decks by sambaiga

Other Decks in Technology

Transcript

  1. Deep Learning Success Automatic Colorization Figure 1: Automatic colorization Object

    Classification and Detection Figure 2: Object recognition Game Self driving car 2
  2. Motivation Deep Learning use finite number of computational steps (stacked

    layers) to produce a single prediction. Figure 3: Deep learning: credit:M. Mitchell Waldrop Issues: • When the computed output require a complex computations (complex inference). • When we need multiple possible outputs eg. predicting video frames. • When labeled data is not enough. • How to deal with uncertainty in the prediction?. 3
  3. Energy Based Model (EBM) EBM encode dependencies between variables (x,

    y) by associating a scalar parametric energy function Eθ (.) to each of the variables. Figure 4: Energy function • Learn to find if y is compatible to x eg. Is y an accurate high-resolution image of x ? • Eθ (x, y) captures some statistical property of the input data. • Eθ (x, y) takes low values when y is compatible with x and higher values when y is less compatible with x. 4
  4. EBM vs Neural Networks • A feed-forward model is an

    explicit function that computes y from x. • An EBM is an implicit function that captures the dependency between x and y 5
  5. EBM Inference The energy Eθ(.) is used for inference, not

    for learning. Conditional Energy: Eθ(x, y) vs Unconditional Energy: Eθ(x) Inference: find values of y that make Eθ(x, y) small. ˆ y = arg min y Eθ(x, y) (1) The EBM model could be used for: • Prediction, classification, and decision-making which value of y is most compatible with this x • Ranking: is y1 or y2 more compatible with this x • Conditional density estimation: what is the conditional probability distribution over Y given x 6
  6. EBM as Probabilistic Model Eθ (x) can be turned into

    a normalized joint probability distribution pθ (x) through the Gibbs distribution: pθ (x) = exp(−Eθ (x)) Z(θ) (2) where Z(θ) = x∈x exp(−Eθ (x)dx is is the normalizing constant. Pros: • Extreme flexibility: can use pretty much any function −Eθ you want. Cons: • Sampling from pθ (x) is hard. • Evaluating and optimizing likelihood pθ (x) is hard (learning is hard) • No feature learning (but can add latent variables) 7
  7. EBM with latent variable Latent EBM: The output y depends

    on x as well as an extra variable z (the latent variable) Eθ = Eθ(x, y, z) (3) Given z the Eθ (x, y, z)) can be used for both generation of x and identification of a y implicitly. ˆ x = arg min x Eθ (x, y, z) (4) ˆ y = arg min y Eθ (x, y, z) (5) Allows a machine to produce multiple outputs, not just one. 8
  8. Neural Network as Energy Function Eθ(x) can be parameterized by

    neural networks for a wide variety of tasks. • Defining Eθ (x, y) as DNN allow to exploit the predictive power of DNN and the benefits of EBMs. Consider a DNN fθ (x[y]) =⇒ map (x, y) to a scalar value. Re-interpret fθ (x[y]) as the negative energy Eθ = −fθ (x[y]) . pθ (x, y) = exp(fθ (x)[y])) Z(θ) (6) pθ (x) = y pθ (x, y) = y exp(fθ (x)) Z(θ) (7) pθ (y|x) = pθ (x, y) pθ (x) (8) 9
  9. Neural Network as Energy Function The energy function of a

    data point x can thus be defined as Eθ (x) = −LogSumy fθ (x) = − log y exp(fθ (x)) (9) Optimize: arg min θ EpD [− log pθ (x, y)] = arg min θ −EpD [log pθ (x) + log pθ (y|x, θ)] 10
  10. EBM advantages Provide unified framework for probabilistic and non-probabilistic learning

    approaches. • Proper normalization is not required, ⇒ EBMs don’t have the issues arising from estimating the normalization constant in probabilistic models. • Allows for much more flexibility in the design of learning machines. 11
  11. EBM: learning Learning: finding an energy function which gives lower

    energies to observed configurations than unobserved ones • Assigns low Eθ values to inputs in the data distribution and high Eθ values to other inputs. pθ(x) = exp(−Eθ(x) Z(θ) (10) • The log-likelihood of Eθ (x) log pθ (x) = −Eθ − log Ep(x) exp(−Eθ (x)) (11) • For most choices of Eθ , it is hard to estimate Z(θ) ⇒ intractable • If x is 16 × 16 RGB image • Computing Z(θ) −→ summation over (256 × 256 × 256)16×16 terms. 12
  12. EBM: MLE • In MLE, we seek to maximize the

    log-likelihood function ⇒ equivalent to minimizing the Kullback-Leibler divergence KL(pD ||qθ ) • The derivative of the log-likelihood for a single example x with respect to θ ∂ log pθ (x) ∂θ = Epθ(x )) ∂Eθ (x ) ∂θ − ∂Eθ (x) ∂θ (12) − ∂KL(pD ||qθ ) ∂θ = ∂Eθ (x) ∂θ − Epθ(x )) ∂Eθ (x ) ∂θ (13) • Epθ(x )) ∂Eθ(x ) ∂θ is intractable. • Can be approximated through samples (Langevin Dynamics or MCMC). 13
  13. EBM MLE Sampling: SGLD • Stochastic Gradient Langevin Dynamics (SGLD)

    [1]–[3] use of the gradient of Eθ (.) to undergo sampling such as xk = xk−1 − α 2 ∂Eθ (xk−1 ) ∂θ + k (14) where x0 ∼ p0 (x) and k ∼ N(0, α) • SGDLD sampling define a distribution qθ such that xk ∼ qθ . • As as K → ∞ and α → 0 then qθ ∼ pθ . • Samples are generated from the distribution defined by Eθ (.) 14
  14. EBM: Noise contrastive estimation Given pθ(x) = exp −Eθ(x) Z(θ)

    (15) Can we learn Z(θ) instead of computing it ? =⇒ c = log Z(θ) [4], [5]. • pθ (x) = exp [−Eθ (x) − c] c is now treated as a free parameter. • Introduce a noise distribution q(x) turn EBM estimation into classification problem J(θ) = EpD log pθ (x) pθ (x) + q(x) + Eq log q(x) pθ (x) + q(x) (16) • Strictly requirements on q(x) 1 Analytically tractable expression density. 2 Easy to draw samples from. 3 Close to data distribution ⇒ Flow Contrastive Estimation [5]. 15
  15. DNN-EBM: Generative modeling EBM is used to model the underlying

    data distribution [3], [5]1 • EBM does not require an explicit neural network to generate samples (unlike GANs, VAEs, and Flow-based models). Figure 5: Comparison of image generation techniques on unconditional CIFAR-10 dataset 2 EBMs are effective generative models for multi-dimensional inputs like images [3], [5]. 1http://www.stat.ucla.edu/ ruiqigao/fce/main.html 2https://github.com/openai/ebm_code_release 16
  16. DNN-EBM: Semi-supervised learning EBMs can be generalized to perform semi-supervised

    learning. EBM tends to learn a smoothly connected cluster, which is often what we desire in semi-supervised learning [5]. 17
  17. DNN-EBM: Classification • Joint Energy based Model applying SGLD3 [2]

    • Hybrid Discriminative Generative Energy-based Model(HDGE)4: optimize Supervised learning and contrastive learning: [6] . EBM results into improved uncertainty quantification, model-calibrated out-of-distribution detection (OOD), and robustness to adversarial examples. 3https://wgrathwohl.github.io/JEM/ 4https://github.com/lhao499/HDGE 18
  18. DNN-EBM: Model calibration For calibrated model the predictive confidence arg

    maxy p(y|x), aligns with its misclassification rate. • when predicts label y with 0.9 confidence it should have a 90% chance of being correct. • important feature for a model to have when deployed in real-world scenarios. • Usually evaluated in terms of the Expected Calibration Error (ECE) EBMs significantly improves the calibration of classifier 19
  19. DNN-EBM: Adversial Attack • DNN are sensitive to perturbation-based adversarial

    examples. • DNN-EBMs exhibit adversarial robustness without explicit adversarial training. 21
  20. DNN-EBM: compositional learning Human intelligence is capable to compose complex

    concepts out of simpler ideas ⇒ rapid learning and adaptation of knowledge. • DNN not good at compositional learning. • EBM exhibit compositional learning by directly combining probability distributions [3], [7], [8]5. 5https://energy-based-model.github.io/compositional-generation- inference/ 22
  21. Conclusion • Energy-based models very flexible class of models. •

    Parameterized energy function with DNN provide a unified framework for modeling high-dimensional probability distributions. • Explore, extend, and understand their applicability in industrial applications. 23
  22. References I Max Welling and Yee Whye Teh. “Bayesian Learning

    via Stochastic Gradient Langevin Dynamics”. In: Proceedings of the 28th International Conference on International Conference on Machine Learning. ICML’11. Bellevue, Washington, USA: Omnipress, 2011, pp. 681–688. isbn: 9781450306195. Will Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen, et al. YOUR CLASSIFIER IS SECRETLY AN ENERGY BASED MODEL AND YOU SHOULD TREAT IT LIKE ONE. Tech. rep. arXiv: 1912.03263v2. Yilun Du and Igor Mordatch. “Implicit Generation and Generalization in Energy-Based Models”. In: NeurIPS (2019). arXiv: 1903.08689. url: http://arxiv.org/abs/1903.08689.
  23. References II Michael U. Gutmann and Aapo Hyvärinen. “Noise-Contrastive Estimation

    of Unnormalized Statistical Models, with Applications to Natural Image Statistics”. In: Journal of Machine Learning Research 13.11 (2012), pp. 307–361. url: http://jmlr.org/papers/v13/gutmann12a.html. Ruiqi Gao, Erik Nijkamp, Diederik P. Kingma, et al. “Flow Contrastive Estimation of Energy-Based Models”. In: (2020), pp. 7515–7525. doi: 10.1109/cvpr42600.2020.00754. arXiv: 1912.00589. Hao Liu and Pieter Abbeel. “Hybrid Discriminative-Generative Training via Contrastive Learning”. In: (2020). arXiv: 2007.09070. url: http://arxiv.org/abs/2007.09070.
  24. References III Yilun Du, Shuang Li, and Igor Mordatch. “Compositional

    Visual Generation and Inference with Energy Based Models”. In: (2020). arXiv: 2004.06030. url: http://arxiv.org/abs/2004.06030. Igor Mordatch. “Concept learning with energy-based models”. In: 6th International Conference on Learning Representations, ICLR 2018 - Workshop Track Proceedings (2018). arXiv: 1811.02486.