← all repositories
thu-ml/zhusuan

TensorFlow-era toolkit for when neural nets need to doubt themselves

ZhuSuan layers Bayesian inference primitives over TensorFlow so you can train generative models that know what they don't know.

2.2k stars Python ML FrameworksOther AI
zhusuan
Velocity · 7d
+0.6
★ / day
Trend
steady
star history

What it does

ZhuSuan is a probabilistic programming library that sits on top of TensorFlow and provides building blocks for Bayesian deep learning. It lets you construct generative models and run inference using variational methods, importance sampling, or MCMC — all with the familiar TensorFlow graph semantics. The README is upfront that this is pre-1.0 software: install from source, bring your own TensorFlow (CPU or GPU), and expect some assembly.

The interesting bit

The library treats inference algorithms as pluggable components. You can swap SGVB for VIMCO or REINFORCE in a variational setup, or switch from Hamiltonian Monte Carlo to stochastic gradient Langevin dynamics without rewriting your model — a flexibility that was genuinely unusual in the TF 1.x ecosystem.

Key highlights

  • Four inference families: VI with programmable posteriors, adaptive importance sampling, HMC with parallel chains and auto-tuning, and SGMCMC (SGLD, PSGLD, SGHMC, SGNHT)
  • Gradient estimators include SGVB, REINFORCE, and VIMCO for discrete latent variables
  • Example zoo covers VAEs, Bayesian neural nets, sigmoid belief networks, topic models, and Gaussian processes
  • Published white paper (arXiv:1709.05870) with formal treatment of the design
  • Requires TensorFlow 1.13+; does not force a CPU/GPU choice on you

Caveats

  • Pre-1.0 and explicitly “still under development”; no stable release as of the README’s last update
  • Tied to TensorFlow 1.x graph mode, which places it in a distinctly earlier era of deep learning frameworks
  • Sparse documentation beyond the white paper and API reference; examples are the primary learning resource

Verdict

Worth a look if you’re maintaining legacy Bayesian deep learning experiments or need a reference implementation of VIMCO and adaptive IS. Skip it if you’re starting fresh — the TF 1.x dependency and pre-release status make it a museum piece rather than a foundation.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.