Variational PT
We describe here the implementation of Variational PT, Surjanovic et al., 2022 included in Pigeons. Both the basic variational PT and stabilized variants introduced in Surjanovic et al., 2022 are available.
Basic variational PT
Enable variational PT by supplier the variational
option to pigeons(...)
:
using DynamicPPL
using Pigeons
pigeons(
target = Pigeons.toy_turing_unid_target(100, 50),
variational = GaussianReference(first_tuning_round = 5))
┌ Info: Neither traces, disk, nor online recorders included.
│ You may not have access to your samples (unless you are using a custom recorder, or maybe you just want log(Z)).
└ To add recorders, use e.g. pigeons(target = ..., record = [traces; record_default()])
──────────────────────────────────────────────────────────────────────────────────────────────────
scans Λ time(s) allc(B) log(Z₁/Z₀) min(α) mean(α) min(αₑ) mean(αₑ)
────────── ────────── ────────── ────────── ────────── ────────── ────────── ────────── ──────────
2 3.24 0.00142 1.09e+06 -8.14 0.00178 0.64 1 1
4 1.64 0.0024 2.13e+06 -5.04 0.0352 0.818 1 1
8 1.17 0.00427 4.15e+06 -4.42 0.708 0.871 1 1
16 1.2 0.00823 8.71e+06 -4.03 0.549 0.867 1 1
32 1.11 0.0162 1.7e+07 -4.77 0.754 0.877 1 1
64 1.08 0.0679 3.65e+07 -4.84 0.754 0.879 1 1
128 1.06 0.0604 7.26e+07 -4.97 0.804 0.882 1 1
256 1.05 0.175 1.45e+08 -4.96 0.858 0.884 1 1
512 1.04 0.285 2.89e+08 -5.01 0.868 0.885 1 1
1.02e+03 0.994 0.608 5.78e+08 -4.98 0.876 0.89 1 1
──────────────────────────────────────────────────────────────────────────────────────────────────
Note variational fitting only starts at first_tuning_round
. The fixed reference is used before that point.
Stabilized variational PT
Surjanovic et al., 2022 describes situations where the variational fitting can cause catastrophic forgetting of modes. This is remediated by using both a fixed and a variational reference each linked to two copies of the target, which are also swapped according to a non-reversible swapping scheme.
Enable stabilized variational PT by adding the n_chains_variational
option to pigeons(...)
:
pigeons(
target = Pigeons.toy_turing_unid_target(100, 50),
variational = GaussianReference(first_tuning_round = 5),
n_chains_variational = 10)
┌ Info: Neither traces, disk, nor online recorders included.
│ You may not have access to your samples (unless you are using a custom recorder, or maybe you just want log(Z)).
└ To add recorders, use e.g. pigeons(target = ..., record = [traces; record_default()])
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
scans Λ Λ_var time(s) allc(B) log(Z₁/Z₀) min(α) mean(α) min(αₑ) mean(αₑ)
────────── ────────── ────────── ────────── ────────── ────────── ────────── ────────── ────────── ──────────
2 1.39 3.24 0.00222 2.22e+06 -8.14 0.00178 0.756 1 1
4 2.4 1.55 0.00433 4.41e+06 -5.27 0.0352 0.792 1 1
8 1.65 1.71 0.00822 8.52e+06 -4.4 0.331 0.823 1 1
16 1.76 1.86 0.0163 1.73e+07 -4.51 0.545 0.81 1 1
32 1.4 1.64 0.0376 3.49e+07 -4.95 0.636 0.84 1 1
64 1.58 0.96 0.0987 7.04e+07 -4.83 0.711 0.866 1 1
128 1.55 0.919 0.134 1.41e+08 -4.86 0.776 0.87 1 1
256 1.4 1.04 0.328 2.81e+08 -4.97 0.812 0.872 1 1
512 1.48 1.02 0.622 5.63e+08 -5 0.809 0.868 1 1
1.02e+03 1.5 1.06 1.2 1.13e+09 -4.99 0.8 0.865 1 1
─────────────────────────────────────────────────────────────────────────────────────────────────────────────