1 of 32

Optimization in

Neural Networks

Chris Choy

Ph.D. at CVGL

http://chrischoy.org

2 of 32

Optimization of a Neural Network

Examples

3 of 32

Optimization in a Neural Network

4 of 32

Table of Contents

  • Papers
    • OptNet: Differentiable Optimization as a Layer in Neural Networks
    • Fast Bilateral Solver
    • Conditional Random Fields as Recurrent Neural Networks
  • Summary
  • Conclusion

5 of 32

Amos & Kolter,

OptNet: Differentiable Optimization as a Layer in Neural Networks, ICLR’17

6 of 32

OptNet: Introduction

  • Neural Networks
    • A linear transformation (conv, fc) followed by a simple nonlinear operation (ReLU)
  • Individual layer with richer behavior
    • Can reduce the overall depth of the network (Not verified in the paper)
  • To this end
    • Propose a layer that can solve small quadratic programs
  • Advantages
    • Developed custom primal dual interior point QP (batch) solver
    • 100x times faster in the custom batch solver

7 of 32

OptNet

Amos et al., OptNet: Differentiable Optimization as a Layer in Neural Networks

8 of 32

  • Parameters Q, q, A, b, G, and h are also differentiable and can be optimized
  • Gradient of the eq at its solution.
    • by taking the matrix differential of the KKT cond.
    • https://github.com/locuslab/qpth/blob/master/qpth/qp.py#L124

9 of 32

KKT Condition

Then, the Lagrangian is

Stationarity, primal feasibility, complementary slackness

10 of 32

Matrix Differential

Diagonal matrix

11 of 32

Properties

  • Efficient batch solver: faster than non-batch solver Gurubi and CPLEX
  • Thm.1
    • Subdifferentiable
  • Thm.2
    • n-dim element-wise piecewise linear f with k linear region → an OptNet with O(nk) params.
  • Thm.3
    • Exists a function that can be specified by an OptNet layer that can be approximated using exponentiallly many units.
  • Caveats:
    • Cubic complexity (num vars. & constraints)
      • Dim less than 1k
    • Structure in data
      • Sparsity, Teoplitz …
    • More tuning

12 of 32

Experiment 2: Total Variation Denoising

  • y: observations
  • encourages differences to be sparse
    • piecewise constant function.
  • FC Net: Regress y
  • TV: vary lambda, choose best
  • OptNet: Random init D
  • OptNet TV: init to prev D

13 of 32

Experiment 3: MNIST

  • Show it is possible to include an OptNet layer into a nnet
  • Potentially learn constraints and dependencies over the latent space
  • FC600-FC10-FC10-Softmax
  • FC600-FC10-Optnet10-Softmax
  • No marginal improvement
  • No analysis

14 of 32

Experiment 4: Sudoku

  • One-hot encoding
  • CNN, OptNet do not know the rule
  • Caveat
    • Unstable
    • No analysis on the learned constraints

15 of 32

Barron & Poole,

Fast Bilateral Solver, ECCV’16

16 of 32

Optimization in a Neural Network: Bilateral Solver

17 of 32

Gaussian Blur vs. Bilateral Filter

18 of 32

Bilateral Filtering

  • Spatial coorindates: x, y
  • Color coordinates: YUV
  • Bilateral Space: spatial + color spaces

Evidence (Unary)

Smoothness (Pairwise)

19 of 32

20 of 32

Differentiation at the solution

CRF-as-RNN

Bilateral Solver

Method

Iterative Mean Field Update

Quadratic Solution w/ CG

Memory footprint

Large

Small

Speed

Slow

Fast

Iterative?

Yes

(No)

21 of 32

Depth Superresolution

Stereo: Middlebury V3

Depth Superresolution

22 of 32

Filtering & Colorization

23 of 32

Semantic Segmentation

24 of 32

Zheng et al.,

Conditional Random Fields as Recurrent Neural Networks, ICCV‘15

25 of 32

Optimization in a Neural Network: Bilateral Solver

26 of 32

Fully Connected CRF with Gaussian Edge Potential

27 of 32

Fully Connected CRF

28 of 32

Meanfield Approximation and Iterative Update Eq.

29 of 32

CRF as RNN

  • Unary potential
    • CNN prediction
  • Meanfield Iteration
    • RNN

30 of 32

Experiments

31 of 32

Conclusion

Neural Network:

OptNet:

Fast Bilateral Solver:

CRF as RNN:

32 of 32

Conclusion

  • Complex operation beyond linear multiplications
  • Optimization
    • Iterative methods
      • Fixed point, Newton, Cutting Plane, Conjugate Gradient, ...
  • Backprop through the solver
    • Backprop through iterative methods
    • CRF as RNN
  • Gradient at the solution
    • Given the solution, compute gradient for the rest of the vars.
    • OptNet
    • Fast Bilateral Solver