Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4bf2fce
remove the bijectors extension and relevant tests, benchmarks
Red-Portal Nov 21, 2025
9dc43bb
fix remove use of Bijectors in tests
Red-Portal Nov 21, 2025
9479ed4
fix typo in HISTORY
Red-Portal Nov 21, 2025
0142a82
bump AdvancedVI version
Red-Portal Nov 21, 2025
bb47ced
run formatter
Red-Portal Nov 21, 2025
6fa2bc3
run formatter
Red-Portal Nov 21, 2025
d6157f1
Merge branch 'remove_bijectors' of github.com:TuringLang/AdvancedVI.j…
Red-Portal Nov 21, 2025
e201345
fix removed include to removed file
Red-Portal Nov 21, 2025
66a22a5
fix remove erroenous references to bijector
Red-Portal Nov 21, 2025
f5f7fcb
fix missing comma
Red-Portal Nov 21, 2025
7a6e902
fix remove include to removed file
Red-Portal Nov 21, 2025
2a1755a
update READMe
Red-Portal Nov 21, 2025
f23eb7a
fix move benchmark model to main file
Red-Portal Nov 21, 2025
4d8d95e
update docs to the new recommended use of Bijectors
Red-Portal Nov 22, 2025
fba3d9f
run formatter
Red-Portal Nov 22, 2025
4daaa79
run formatter
Red-Portal Nov 22, 2025
a0f13d5
run formatter
Red-Portal Nov 22, 2025
9a64db7
run formatter
Red-Portal Nov 22, 2025
048a310
add constraint tutorial
Red-Portal Nov 22, 2025
69ae57a
fix missing import in docs
Red-Portal Nov 22, 2025
af4ad18
run furmatter to constrained
Red-Portal Nov 22, 2025
0386029
Merge branch 'remove_bijectors' of github.com:TuringLang/AdvancedVI.j…
Red-Portal Nov 22, 2025
f9d7f0b
fix typo
Red-Portal Nov 22, 2025
d6dede2
fix bins in normalizing flow tutorial
Red-Portal Nov 22, 2025
c7e8c44
fix formatting
Red-Portal Nov 22, 2025
373abdd
run formatter
Red-Portal Nov 22, 2025
6a5c7ba
revert changes to documentation
Red-Portal Nov 22, 2025
c05e2f5
Merge branch 'remove_bijectors' of github.com:TuringLang/AdvancedVI.j…
Red-Portal Nov 22, 2025
8c657e0
revert changes to the README
Red-Portal Nov 22, 2025
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
11 changes: 11 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Release 0.7

## Removal of special treatment to `Bijectors.TransformedDistribution`

Previously, `KLMinRepGradDescent`, `KLMinRepGradProxDescent`, `KLMinScoreGradDescent` only required the support of the target log-density problem to match that of `q`.
This was implemented by giving a special treatment to `q <: Bijectors.TransformedDistribution` through the `Bijectors` extension.
This, however, resulted in a multiplicative complexity in maintaining the relevant bits.
Since this is not the only way to deal with constrained supports, `Bijectors` extension is now removed.
In addition, `KLMinRepGradDescent`, `KLMinRepGradProxDescent`, `KLMinScoreGradDescent` now expect an unconstrained target log-density problem.
Instead, a tutorial has been added to the documentation on how to deal with a target log-density problem with constrained support.

# Release 0.6

## New Algorithms
Expand Down
6 changes: 1 addition & 5 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AdvancedVI"
uuid = "b5ca4192-6429-45e5-a2d9-87aec30a685c"
version = "0.6"
version = "0.7"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand All @@ -20,21 +20,18 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[weakdeps]
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"

[extensions]
AdvancedVIBijectorsExt = ["Bijectors", "Optimisers"]
AdvancedVIEnzymeExt = ["Enzyme", "ChainRulesCore"]
AdvancedVIMooncakeExt = ["Mooncake", "ChainRulesCore"]
AdvancedVIReverseDiffExt = ["ReverseDiff", "ChainRulesCore"]

[compat]
ADTypes = "1"
Accessors = "0.1"
Bijectors = "0.13, 0.14, 0.15"
ChainRulesCore = "1"
DiffResults = "1"
DifferentiationInterface = "0.6, 0.7"
Expand All @@ -54,7 +51,6 @@ StatsBase = "0.32, 0.33, 0.34"
julia = "1.10, 1.11.2"

[extras]
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand Down
4 changes: 1 addition & 3 deletions bench/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
AdvancedVI = "b5ca4192-6429-45e5-a2d9-87aec30a685c"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
Expand All @@ -20,9 +19,8 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
ADTypes = "1"
AdvancedVI = "0.6"
AdvancedVI = "0.7"
BenchmarkTools = "1"
Bijectors = "0.13, 0.14, 0.15"
Distributions = "0.25.111"
DistributionsAD = "0.6"
Enzyme = "0.13.7"
Expand Down
40 changes: 30 additions & 10 deletions bench/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using ADTypes
using AdvancedVI
using BenchmarkTools
using Bijectors
using Distributions
using DistributionsAD
using Enzyme, ForwardDiff, ReverseDiff, Zygote, Mooncake
Expand All @@ -17,8 +16,34 @@ BLAS.set_num_threads(min(4, Threads.nthreads()))
@info sprint(versioninfo)
@info "BLAS threads: $(BLAS.get_num_threads())"

include("normallognormal.jl")
include("unconstrdist.jl")
struct Dist{D<:ContinuousMultivariateDistribution}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content of unconstrdist.jl have been moved here.

dist::D
end

function LogDensityProblems.logdensity(model::Dist, x)
return logpdf(model.dist, x)
end

function LogDensityProblems.logdensity_and_gradient(model::Dist, θ)
return (
LogDensityProblems.logdensity(model, θ),
ForwardDiff.gradient(Base.Fix1(LogDensityProblems.logdensity, model), θ),
)
end

function LogDensityProblems.dimension(model::Dist)
return length(model.dist)
end

function LogDensityProblems.capabilities(::Type{<:Dist})
return LogDensityProblems.LogDensityOrder{0}()
end

function normal(; n_dims=10, realtype=Float64)
μ = fill(realtype(5), n_dims)
Σ = Diagonal(ones(realtype, n_dims))
return Dist(MvNormal(μ, Σ))
end

const SUITES = BenchmarkGroup()

Expand All @@ -33,10 +58,7 @@ end
begin
T = Float64

for (probname, prob) in [
("normal + bijector", normallognormal(; n_dims=10, realtype=T))
("normal", normal(; n_dims=10, realtype=T))
]
for (probname, prob) in [("normal", normal(; n_dims=10, realtype=T))]
max_iter = 10^4
d = LogDensityProblems.dimension(prob)
opt = Optimisers.Adam(T(1e-3))
Expand All @@ -59,9 +81,7 @@ begin
),
]

b = Bijectors.bijector(prob)
binv = inverse(b)
q = Bijectors.TransformedDistribution(family, binv)
q = family
alg = KLMinRepGradDescent(adtype; optimizer=opt, entropy, operator=ClipScale())

SUITES[probname][objname][familyname][adname] = begin
Expand Down
44 changes: 0 additions & 44 deletions bench/normallognormal.jl

This file was deleted.

33 changes: 0 additions & 33 deletions bench/unconstrdist.jl

This file was deleted.

2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
[compat]
ADTypes = "1"
Accessors = "0.1"
AdvancedVI = "0.6"
AdvancedVI = "0.7"
Bijectors = "0.13.6, 0.14, 0.15"
DataFrames = "1"
DifferentiationInterface = "0.7"
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ makedocs(;
"Scaling to Large Datasets" => "tutorials/subsampling.md",
"Stan Models" => "tutorials/stan.md",
"Normalizing Flows" => "tutorials/flows.md",
"Dealing with Constrained Posteriors" => "tutorials/constrained.md",
],
"Algorithms" => [
"`KLMinRepGradDescent`" => "klminrepgraddescent.md",
Expand Down
Loading
Loading