# 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

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).

@inproceedings{Cusumano-Towner:2019:GGP:3314221.3314642,
author = {Cusumano-Towner, Marco F. and Saad, Feras A. and Lew, Alexander K. and Mansinghka, Vikash K.},
title = {Gen: A General-purpose Probabilistic Programming System with Programmable Inference},
booktitle = {Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation},
series = {PLDI 2019},
year = {2019},
isbn = {978-1-4503-6712-7},
location = {Phoenix, AZ, USA},
pages = {221--236},
numpages = {16},
url = {http://doi.acm.org/10.1145/3314221.3314642},
doi = {10.1145/3314221.3314642},
acmid = {3314642},
publisher = {ACM},
address = {New York, NY, USA},
keywords = {Markov chain Monte Carlo, Probabilistic programming, sequential Monte Carlo, variational inference},
}


# The Gen team

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