Skip to content

News 5 #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion news/posts/2025-03-14-newsletter-2/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ Separately, we are planning to merge the benchmarking utilities in [TuringBenchm

**SSMProblems**

The SSMProblems.jl and GeneralisedFilters.jl packages have now been merged into a single repository: https://github.com/TuringLang/SSMProblems.jl. This won't affect you if you are using the packages from the Julia General registry, but if you're looking to develop off the main branch you may have to use a different URL, or specify a subdirectory in `Pkg.add`.
The SSMProblems.jl and GeneralisedFilters.jl packages have now been merged into a single repository: [https://github.com/TuringLang/SSMProblems.jl](https://github.com/TuringLang/SSMProblems.jl). This won't affect you if you are using the packages from the Julia General registry, but if you're looking to develop off the main branch you may have to use a different URL, or specify a subdirectory in `Pkg.add`.

**Smaller bits**

Other code changes that have been merged:

- Some old code in AdvancedHMC.jl has been cleaned up quite a bit. See the [0.7.0 release](https://github.com/TuringLang/AdvancedHMC.jl/releases/tag/v0.7.0) for more information.
- Turing's Gibbs sampler [now supports warmup steps properly](https://github.com/TuringLang/Turing.jl/pull/2502). We're still thinking about how to properly encode the scenario where different sub-samplers have different numbers of warmup steps, if you have any ideas, do get in touch on that PR.
- We are going to formally remove support for Zygote as an AD backend. We don't test it thoroughly in Turing's test suite. You can of course still use Zygote yourself, simply load `ADTypes.AutoZygote()` — although we can't guarantee that we will fix any bugs that arise.
57 changes: 57 additions & 0 deletions news/posts/2025-04-25-newsletter-5/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Turing.jl Newsletter 5
description: The fortnightly newsletter for the Turing.jl probabilistic programming language
categories:
- Newsletter
author:
- name: The TuringLang team
url: /team/
date: 2025-04-25
---

**DynamicPPL 0.36**

A new minor version of DynamicPPL brings with it a few changes especially to the behaviour of submodels. These have not yet percolated up to Turing.jl, but will soon be. Firstly, prefixing behaviour is changed: consider these models

```julia
@model function inner()
x ~ Normal()
end
@model function outer()
a = [0.0]
a[1] ~ to_submodel(inner())
end
```

If you ran this model, you would find that the single random variable was called `a[1].x` — but this isn't the `x` field of the `1`st element of `a`, it's actually a variable whose name is literally just `Symbol("a[1].x")`. DynamicPPL changes this behaviour such that the variable is correctly recognised as the `x` field of the `1`st element of `a`. This means that if you are trying to, for example, condition on the variable, you can do:

```julia
outer() | (@varname(a[1].x) => 1.0)
```

On the topic of conditioning, you can now also correctly condition or fix variables in a model before using it as a submodel, as this example demonstrates:

```julia
@model function inner()
x ~ Normal()
end
@model function outer()
a ~ to_submodel(inner() | (@varname(x) => 1))
end
```

Previously, if you wanted to do this, you would have to condition on `@varname(a.x)`, meaning that you'd need to know the prefix before conditioning it. The current system allows for more modular construction of nested models.

For more complete details, please see [the release notes](https://github.com/TuringLang/DynamicPPL.jl/releases/tag/v0.36.0).

**TuringBenchmarking.jl**

DynamicPPL 0.36 also brings new functionality that can be used for testing and benchmarking automatic differentiation on Turing models. This is what powers the [ADTests table](https://turinglang.org/ADTests/), which we shared last time round. (Psst — there are more examples now than before!)

For more information, see the docstring of `DynamicPPL.TestUtils.AD.run_ad` in [the DynamicPPL docs](https://turinglang.org/DynamicPPL.jl/stable/api/#DynamicPPL.TestUtils.AD.run_ad).

As a corollary of this, the AD benchmarking functionalities in TuringBenchmarking.jl are not really needed anymore. If you are using this package, we recommend that you switch over to use the functionality that's directly built into DynamicPPL.

**AdvancedHMC compatibility with ComponentArrays**

AdvancedHMC had a fairly long-standing issue where it couldn't always be used with ComponentArrays as the position / momentum. This has now been fixed; you can take a look at [the test suite](https://github.com/TuringLang/AdvancedHMC.jl/blob/459ebb8a10cc1bc7dbbc27ed79afa796c607697a/test/hamiltonian.jl#L77-L100) to see examples of how they can be used together.