towards verified stochastic variational inference for
play

Towards Verified Stochastic Variational Inference for Probabilistic - PowerPoint PPT Presentation

Towards Verified Stochastic Variational Inference for Probabilistic Programs Wonyeol Lee 1 Hangyeol Yu 1 Xavier Rival 2 Hongseok Yang 1 1 KAIST, South Korea 2 INRIA/ENS/CNRS, France POPL 2020 Probabilistic c Programming Example 1: def p():


  1. Towards Verified Stochastic Variational Inference for Probabilistic Programs Wonyeol Lee 1 Hangyeol Yu 1 Xavier Rival 2 Hongseok Yang 1 1 KAIST, South Korea 2 INRIA/ENS/CNRS, France POPL 2020

  2. Probabilistic c Programming • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) 2

  3. Probabilistic c Programming • Example 1: def p(): # model_eg1 z = pyro.sample ( “z” , Normal(0., 5.) ) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) 3

  4. Probabilistic c Programming • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample ( “x” , Normal( 1., 1.), obs=0. ) else: pyro.sample ( “x” , Normal(-2., 1.), obs=0. ) 4

  5. Probabilistic c Programming • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.) , obs=0.) else: pyro.sample(“x”, Normal(-2., 1.) , obs=0.) 5

  6. Probabilistic c Programming • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) density prior " ! posterior " ! # ! 6

  7. Probabilistic c Programming • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) density prior " ! posterior # $ % ! 7

  8. Stoch chastic c Va Variational Inference ce • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) ≈ density def q θ (): # guide_eg1 θ = pyro.param ( “θ” , 0.) z = pyro.sample(“z”, Normal(θ, 1.)) prior " ! posterior " ! # ! 8

  9. Stoch chastic c Va Variational Inference ce • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) ≈ density def q θ (): # guide_eg1 θ = pyro.param(“θ”, 0.) z = pyro.sample (“z”, Normal(θ, 1.) ) prior " ! posterior " ! # ! 9

  10. Stoch chastic c Va Variational Inference ce • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) ≈ density def q θ (): # guide_eg1 θ = pyro.param( “θ” , 0.) z = pyro.sample(“z”, Normal(θ, 1.)) prior " ! posterior " ! # ! 10

  11. Stoch chastic c Va Variational Inference ce • Example 1: def p(): # model_eg1 z = pyro.sample(“z”, Normal(0., 5.)) if (z > 0): pyro.sample(“x”, Normal( 1., 1.), obs=0.) else: pyro.sample(“x”, Normal(-2., 1.), obs=0.) ≈ density def q θ (): # guide_eg1 θ = pyro.param(“θ”, 0.) z = pyro.sample(“z”, Normal(θ, 1.)) prior ' $ posterior ' $ ( guide ! " ($) with optimal & $ 11

  12. Stoch chastic c Va Variational Inference ce • Typical optimization objective: argmin ' KL * ' + || - + . . 1 2 3 ≜ 0 1 2 3 log 6 3|7 12

  13. Stoch chastic c Va Variational Inference ce • Typical optimization objective: argmin # KL # . 2 3 4 ≜ 1 2 3 4 log 7 4|8 • Notation: KL # = KL % # & || ( & ) . 13

  14. Stoch chastic c Va Variational Inference ce • Typical optimization objective: argmin # KL # . ? @ A ≜ > ? @ A log D A|E • Notation: KL # = KL % # & || ( & ) . • Optimization by stochastic gradient descent: * +,- ← * + − 0.01× 4 # KL # | #5# 6 . 14

  15. Stoch chastic c Va Variational Inference ce • Typical optimization objective: argmin # KL # . ? @ A ≜ > ? @ A log D A|E • Notation: KL # = KL % # & || ( & ) . • Optimization by stochastic gradient descent: * +,- ← * + − 0.01× 4 # KL # | #5# 6 . 15

  16. Stoch chastic c Va Variational Inference ce • Typical optimization objective: argmin # KL # . ? @ A ≜ > ? @ A log D A|E • Notation: KL # = KL % # & || ( & ) . • Optimization by stochastic gradient descent: * +,- ← * + − 0.01× 4 # KL # | #5# 6 . 16

  17. Stoch chastic c Va Variational Inference ce • Typical optimization objective: argmin # KL # ? @ A ≜ > ? @ A log D A|E • Notation: Wh What t can an go wrong? g? KL # = KL % # & || ( & ) . • Optimization by stochastic gradient descent: * +,- ← * + − 0.01× 4 # KL # | #5# 6 . 17

  18. Issues in Stoch chastic c Variational Inference ce Issue 1: Undefined KL # • Typical optimization objective: argmin # KL # ? @ A ≜ > ? @ A log D A|E • Notation: KL # = KL % # & || ( & ) . • Optimization by stochastic gradient descent: * +,- ← * + − 0.01× 4 # KL # | #5# 6 . 18

  19. Issues in Stoch chastic c Variational Inference ce Issue 1: Undefined KL # • Typical optimization objective: argmin # KL # ? @ A ≜ > ? @ A log D A|E • Notation: KL # = KL % # & || ( & ) . • Optimization by stochastic gradient descent: * +,- ← * + − 0.01× 4 # KL # | #5# 6 . Issue 2: Undefined 4 # KL # 19

  20. Issues in Stoch chastic c Variational Inference ce Issue 1: Undefined KL # • Typical optimization objective: argmin # KL # ? @ A ≜ > ? @ A log D A|E • Notation: KL # = KL % # & || ( & ) . Issue 3: Wrong estimate • Optimization by stochastic gradient descent: * +,- ← * + − 0.01× 4 # KL # | #5# 6 . Issue 2: Undefined 4 # KL # 20

  21. Is Issue e 1: 1: Undefined ed KL # & ' ( KL # = % & ' ( log , (|. & ' ( = ∫ 01 2 # 1 log , (|. KL # could be undefined for two reasons. 21

  22. Is Issue e 1: 1: Undefined ed KL # & ' ( KL # = % & ' ( log , (|. & ' ( = ∫ 01 2 # 1 log , (|. KL # could be undefined for two reasons. (a) Undefined integrand: 2 # 1 ≠ 0 and 5 1 6 = 0 for some 1 . 22

  23. Is Issue e 1: 1: Undefined ed KL # & ' ( KL # = % & ' ( log , (|. & ' ( = ∫ 01 2 # 1 log , (|. KL # could be undefined for two reasons. (a) Undefined integrand: 2 # 1 ≠ 0 and 5 1 6 = 0 for some 1 . (b) Undefined integral: ∫ 01 ⋯ is not integrable. 23

  24. Is Issue e 1: 1: Examp mple • Example 2: Bayesian regression (from Pyro webpage). def p(): # model_eg2 ... sigma = pyro.sample(“sigma”, Uniform(0., 10.)) ... pyro.sample(“obs”, Normal(..., sigma), obs=...) def q θ (): # guide_eg2 ... sigma = pyro.sample(“sigma”, Normal(θ, 0.05)) • KL # is undefined. • [Q] How to fix it? 24

  25. Is Issue e 1: 1: Examp mple • Example 2: Bayesian regression (from Pyro webpage). def p(): # model_eg2 ... sigma = pyro.sample(“sigma”, Uniform(0., 10.)) ... pyro.sample(“obs”, Normal(..., sigma), obs=...) def q θ (): # guide_eg2 ... sigma = pyro.sample(“sigma”, Normal(θ, 0.05)) • KL # is undefined. • [Q] How to fix it? 25

  26. Is Issue e 1: 1: Examp mple • Example 2: Bayesian regression (from Pyro webpage). def p(): # model_eg2 ... sigma = pyro.sample(“sigma”, Uniform(0., 10.) ) ... pyro.sample(“obs”, Normal(..., sigma), obs=...) def q θ (): # guide_eg2 ... sigma = pyro.sample(“sigma”, Normal(θ, 0.05) ) • KL # is undefined. [Q] How to fix it? 26

  27. Issue Is e 1: 1: Examp mple • Example 2: Bayesian regression (from Pyro webpage). def p(): # model_eg2 ... sigma = pyro.sample(“sigma”, Uniform(0., 10.)) ... pyro.sample(“obs”, Normal(..., sigma), obs=...) $ # % ≠ 0 and ( % ) = 0 for % < 0 . def q θ (): # guide_eg2 ... sigma = pyro.sample(“sigma”, Normal(θ, 0.05)) • KL # is undefined. Reason: (a) undefined integrand. • [Q] How to fix it? 27

  28. Is Issue e 1: 1: Examp mple • Example 2: Bayesian regression (from Pyro webpage). def p(): # model_eg2 ... sigma = pyro.sample(“sigma”, Uniform(0., 10.)) ... pyro.sample(“obs”, Normal(..., sigma), obs=...) def q θ (): # guide_eg2 ... sigma = pyro.sample(“sigma”, Normal(θ, 0.05)) • KL # is undefined. Reason: (a) undefined integrand. • [Q] How to fix model? 28

  29. Is Issue e 1: 1: Examp mple • Example 2: Bayesian regression (from Pyro webpage). def p(): # model_eg2’ ... Normal(5., 5.) sigma = pyro.sample(“sigma”, Uniform(0., 10.)) ... abs(sigma) pyro.sample(“obs”, Normal(..., sigma), obs=...) def q θ (): # guide_eg2 ... sigma = pyro.sample(“sigma”, Normal(θ, 0.05)) • [Q] How to fix model? 29

  30. Issue Is e 1: 1: Examp mple • Example 2: Bayesian regression (from Pyro webpage). def p(): # model_eg2’ ... Normal(5., 5.) sigma = pyro.sample(“sigma”, Uniform(0., 10.)) ... abs(sigma) pyro.sample(“obs”, Normal(..., sigma), obs=...) def q θ (): # guide_eg2 ... sigma = pyro.sample(“sigma”, Normal(θ, 0.05)) • KL # is still undefined. • [Q] How to fix model? 30

Recommend


More recommend