An open-source stack for generative modeling and probabilistic inference

Why Gen

Gen automates the implementation details of probabilistic inference algorithms

Gen’s inference library gives users building blocks for writing efficient probabilistic inference algorithms that are tailored to their models, while automating the tricky math and the low-level implementation details. Gen helps users write hybrid algorithms that combine neural networks, variational inference, sequential Monte Carlo samplers, and Markov chain Monte Carlo.

Gen allows users to flexibly navigate performance trade-offs

Gen features an easy-to-use modeling language for writing down generative models, inference models, variational families, and proposal distributions using ordinary code. But it also lets users migrate parts of their model or inference algorithm to specialized modeling languages for which it can generate especially fast code. Users can also hand-code parts of their models that demand better performance.

Gen supports custom hybrid inference algorithms

Neural network inference is fast, but can be inaccurate on out-of-distribution data, and requires expensive training. Model-based inference is more computationally expensive, but does not require retraining, and can be more accurate. Gen supports custom hybrid inference algorithms that benefit from the strengths of both approaches.

Users write custom inference algorithms without extending the compiler

Instead of an inference engine that tightly couples inference algorithms with language compiler details, Gen gives users a flexible API for implementing an open-ended set of inference and learning algorithms. This API includes automatic differentiation (AD), but goes far beyond AD and includes many other operations that are needed for model-based inference algorithms.

Efficient inference in models with stochastic structure

Generative models and inference models in Gen can have dynamic computation graphs. Gen’s unique support for custom reversible jump and involutive MCMC algorithms allows for more efficient inference in generative models with stochastic structure.

Installing Gen

We maintain a Julia implementation of the Gen architecture, and we are currently working on porting Gen to other languages. To install the Julia implementation of Gen, download Julia. Then, install the Gen package with the Julia package manager:

From the Julia REPL, type ] to enter the Pkg REPL mode and then run:

pkg> add Gen

Institutions using Gen

The Gen.jl team

Gen.jl was created by Marco Cusumano-Towner the MIT Probabilistic Computing Project, which is led by Vikash Mansinghka. Gen.jl has grown and is maintained through the help of a core research and engineering team that includes Alex Lew, Tan Zhi-Xuan, George Matheos, McCoy Becker, and Feras Saad, as well as a number of open-source contributors. The Gen architecture is described in Marco’s PhD thesis.

If you use Gen in your research, please cite our PLDI paper:

Gen: A General-Purpose Probabilistic Programming System with Programmable Inference. Cusumano-Towner, M. F.; Saad, F. A.; Lew, A.; and Mansinghka, V. K. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ‘19). (pdf) (bibtex)