Bayesian inference with probabilistic programming.
2,254
stars
3,118
commits
Julia
primary language
Sep 7, 2026
updated
Bayesian inference with probabilistic programming
Turing.jl is a general-purpose probabilistic programming package for Bayesian and
likelihood-based inference. Implemented in Julia, it is designed to interoperate with the
language's scientific computing ecosystem. Models can be written with
@model, in BUGS syntax via
JuliaBUGS.jl, or graphically with
DoodlePPL, and support MCMC, variational
inference, maximum likelihood and MAP estimation, and customised inference through Turing's
log-density and gradient interface.
Turing's preferred automatic differentiation backends for gradient-based algorithms are ForwardDiff.jl and Mooncake.jl. Other backends, such as Enzyme.jl, are available through DifferentiationInterface.jl.
Install Julia 1.10.8 or later from the official Julia website. Then open a Julia REPL and run:
julia> using Pkg; Pkg.add("Turing")
The following example places priors on an intercept, slope, and residual scale, then samples the posterior distribution of these parameters:
julia> using Random, Turing
julia> rng = Xoshiro(1)
julia> @model function linear_regression(x)
# Priors
α ~ Normal(0, 1)
β ~ Normal(0, 1)
σ ~ truncated(Cauchy(0, 3); lower=0)
# Likelihood
μ = α .+ β .* x
y ~ MvNormal(μ, σ^2 * I)
end
julia> x = range(-1, 1; length=20)
julia> y = 1 .+ 2 .* x .+ 0.2 .* randn(rng, length(x))
julia> posterior = linear_regression(x) | (; y = y)
julia> chain = sample(rng, posterior, NUTS(), 1000)
The example generates synthetic observations, conditions the model on them with
| (; y = y), and draws 1,000 posterior samples of α, β, and σ using the
No-U-Turn sampler.
See the TuringLang tutorials,
Turing.jl API reference, and
TuringLang newsletter. Changes are recorded in
HISTORY.md; published
releases are available on the GitHub releases
page.
For technical discussion, use the #turing channel on Julia
Slack (request an
invitation) or the turing tag on Julia
Discourse.
Turing is grant-funded research software that prioritises correctness and stability over broad feature coverage. New features are often developed through research projects or collaborations. Reproducible reports of incorrect results or unexpected failures in documented functionality guide further work.
Discuss proposed features in an issue before implementation. Focused bug fixes and small changes may be submitted directly as pull requests. Maintainers can transfer bug reports filed in the wrong TuringLang repository.
Pull requests for non-breaking changes target main; breaking changes target
breaking. Reviewer privileges are reserved for sustained, substantive contributors
and people invited by a team member. If an issue or pull request has received no
response, ping @TuringLang/maintainers.
If you use Turing.jl in published work, please cite:
Turing.jl: A General-Purpose Probabilistic Programming Language
Tor Erlend Fjelde, Kai Xu, David Widmann, Mohamed Tarek, Cameron Pfiffer, Martin Trapp, Seth D. Axen, Xianda Sun, Markus Hauru, Penelope Yong, Will Tebbutt, Zoubin Ghahramani, Hong Ge
ACM Transactions on Probabilistic Machine Learning, 1(3):1–48, 2025.
Turing: A Language for Flexible Probabilistic Inference
Hong Ge, Kai Xu, Zoubin Ghahramani
Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics, PMLR 84:1682–1690, 2018.
@article{10.1145/3711897,
author = {Fjelde, Tor Erlend and Xu, Kai and Widmann, David and Tarek, Mohamed and Pfiffer, Cameron and Trapp, Martin and Axen, Seth D. and Sun, Xianda and Hauru, Markus and Yong, Penelope and Tebbutt, Will and Ghahramani, Zoubin and Ge, Hong},
title = {Turing.jl: A General-Purpose Probabilistic Programming Language},
journal = {ACM Trans. Probab. Mach. Learn.},
year = {2025},
volume = {1},
number = {3},
pages = {1--48},
month = aug,
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
doi = {10.1145/3711897},
url = {https://doi.org/10.1145/3711897},
}
@inproceedings{pmlr-v84-ge18b,
author = {Ge, Hong and Xu, Kai and Ghahramani, Zoubin},
title = {Turing: A Language for Flexible Probabilistic Inference},
booktitle = {Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics},
editor = {Storkey, Amos and Perez-Cruz, Fernando},
series = {Proceedings of Machine Learning Research},
volume = {84},
pages = {1682--1690},
year = {2018},
month = {09--11 Apr},
publisher = {PMLR},
pdf = {http://proceedings.mlr.press/v84/ge18b/ge18b.pdf},
url = {https://proceedings.mlr.press/v84/ge18b.html},
}
(top 30 of 102)
Julia
100.0%
Bayesian inference with probabilistic programming.
2,254
stars
3,118
commits
Julia
primary language
Sep 7, 2026
updated
Bayesian inference with probabilistic programming
Turing.jl is a general-purpose probabilistic programming package for Bayesian and
likelihood-based inference. Implemented in Julia, it is designed to interoperate with the
language's scientific computing ecosystem. Models can be written with
@model, in BUGS syntax via
JuliaBUGS.jl, or graphically with
DoodlePPL, and support MCMC, variational
inference, maximum likelihood and MAP estimation, and customised inference through Turing's
log-density and gradient interface.
Turing's preferred automatic differentiation backends for gradient-based algorithms are ForwardDiff.jl and Mooncake.jl. Other backends, such as Enzyme.jl, are available through DifferentiationInterface.jl.
Install Julia 1.10.8 or later from the official Julia website. Then open a Julia REPL and run:
julia> using Pkg; Pkg.add("Turing")
The following example places priors on an intercept, slope, and residual scale, then samples the posterior distribution of these parameters:
julia> using Random, Turing
julia> rng = Xoshiro(1)
julia> @model function linear_regression(x)
# Priors
α ~ Normal(0, 1)
β ~ Normal(0, 1)
σ ~ truncated(Cauchy(0, 3); lower=0)
# Likelihood
μ = α .+ β .* x
y ~ MvNormal(μ, σ^2 * I)
end
julia> x = range(-1, 1; length=20)
julia> y = 1 .+ 2 .* x .+ 0.2 .* randn(rng, length(x))
julia> posterior = linear_regression(x) | (; y = y)
julia> chain = sample(rng, posterior, NUTS(), 1000)
The example generates synthetic observations, conditions the model on them with
| (; y = y), and draws 1,000 posterior samples of α, β, and σ using the
No-U-Turn sampler.
See the TuringLang tutorials,
Turing.jl API reference, and
TuringLang newsletter. Changes are recorded in
HISTORY.md; published
releases are available on the GitHub releases
page.
For technical discussion, use the #turing channel on Julia
Slack (request an
invitation) or the turing tag on Julia
Discourse.
Turing is grant-funded research software that prioritises correctness and stability over broad feature coverage. New features are often developed through research projects or collaborations. Reproducible reports of incorrect results or unexpected failures in documented functionality guide further work.
Discuss proposed features in an issue before implementation. Focused bug fixes and small changes may be submitted directly as pull requests. Maintainers can transfer bug reports filed in the wrong TuringLang repository.
Pull requests for non-breaking changes target main; breaking changes target
breaking. Reviewer privileges are reserved for sustained, substantive contributors
and people invited by a team member. If an issue or pull request has received no
response, ping @TuringLang/maintainers.
If you use Turing.jl in published work, please cite:
Turing.jl: A General-Purpose Probabilistic Programming Language
Tor Erlend Fjelde, Kai Xu, David Widmann, Mohamed Tarek, Cameron Pfiffer, Martin Trapp, Seth D. Axen, Xianda Sun, Markus Hauru, Penelope Yong, Will Tebbutt, Zoubin Ghahramani, Hong Ge
ACM Transactions on Probabilistic Machine Learning, 1(3):1–48, 2025.
Turing: A Language for Flexible Probabilistic Inference
Hong Ge, Kai Xu, Zoubin Ghahramani
Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics, PMLR 84:1682–1690, 2018.
@article{10.1145/3711897,
author = {Fjelde, Tor Erlend and Xu, Kai and Widmann, David and Tarek, Mohamed and Pfiffer, Cameron and Trapp, Martin and Axen, Seth D. and Sun, Xianda and Hauru, Markus and Yong, Penelope and Tebbutt, Will and Ghahramani, Zoubin and Ge, Hong},
title = {Turing.jl: A General-Purpose Probabilistic Programming Language},
journal = {ACM Trans. Probab. Mach. Learn.},
year = {2025},
volume = {1},
number = {3},
pages = {1--48},
month = aug,
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
doi = {10.1145/3711897},
url = {https://doi.org/10.1145/3711897},
}
@inproceedings{pmlr-v84-ge18b,
author = {Ge, Hong and Xu, Kai and Ghahramani, Zoubin},
title = {Turing: A Language for Flexible Probabilistic Inference},
booktitle = {Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics},
editor = {Storkey, Amos and Perez-Cruz, Fernando},
series = {Proceedings of Machine Learning Research},
volume = {84},
pages = {1682--1690},
year = {2018},
month = {09--11 Apr},
publisher = {PMLR},
pdf = {http://proceedings.mlr.press/v84/ge18b/ge18b.pdf},
url = {https://proceedings.mlr.press/v84/ge18b.html},
}
(top 30 of 102)
Julia
100.0%