Gen

Gen is a general-purpose probabilistic programming system, embedded in Julia.


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 Julia 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


First, 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


Gen is an open-source academic project

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)


Institutions using Gen


The Gen team

Gen was created by Marco Cusumano-Towner at the MIT Probabilistic Computing Project, which is led by Vikash Mansinghka. Gen continues to actively grow with the help of a core research and engineering team that includes Ben Zinberg, Alex Lew, Tan Zhi-Xuan, and George Matheos, as well as a number of open-source contributors.