Skip to content

refactor!: drop the LogDensityProblems/DynamicPPL/as_turing ext + ConvolvedDistributions re-export#238

Closed
seabbs-bot wants to merge 1 commit into
mainfrom
refactor/drop-redundant-inference-glue-220-233-228
Closed

refactor!: drop the LogDensityProblems/DynamicPPL/as_turing ext + ConvolvedDistributions re-export#238
seabbs-bot wants to merge 1 commit into
mainfrom
refactor/drop-redundant-inference-glue-220-233-228

Conversation

@seabbs-bot

Copy link
Copy Markdown
Collaborator

Summary

CD's own PPL-neutral ComposedLogDensity/as_logdensity/logdensity/to_constrained core (src/composers/logdensity.jl) is unchanged — only the LogDensityProblems/DynamicPPL-facing wrappers around it move to DI.

Notable choices

  • test/composers/turing_ext.jl is ported, not deleted: it is the live regression guard for the params_table/codec ordering coupling (Unify params_table onto the generated codec walk + add the shared-tag/as_turing ordering guard test (#178 follow-up) #192), exercised via a real NUTS round trip. It now calls DistributionsInference.as_turing, added as a git-pinned test dep (test/Project.toml, matching the existing ModifiedDistributions/EpiAwarePackageTools pattern for unregistered EpiAware packages).
  • Two testitems whose entire premise was the old re-export ("re-exported ConvolvedDistributions surface is reachable", "product / Product reachable via ComposedDistributions (#139)") are deleted rather than patched.
  • docs/src/getting-started/inference.md and faq.md are rewritten to point external-sampler/Turing consumption at DistributionsInference, keeping CD's own PPL-neutral density and to_constrained sections unchanged.
  • NEWS.md carries two breaking-change entries, following this repo's existing convention (see the LD#51 extension-removal entry already there for precedent).

Test plan

  • julia --project=. -e 'using Pkg; Pkg.test(test_args=["skip_quality"])' — green (full suite, excluding the QA-only testset and the separately-CI'd :ad-tagged items).
  • Package loads cleanly with every weakdep present; confirmed the removed extensions no longer register (Base.get_extension checks) and as_turing/product/etc. are genuinely gone from ComposedDistributions, while chain_to_params/convolved (unexported) remain.
  • JuliaFormatter clean on all changed files (pre-commit hook passed).

This was opened by a bot. Please ping @seabbs for any questions.

…volvedDistributions re-export (#220, #233, #228)

DistributionsInference.jl now hosts the LogDensityProblems interface
(hard dependency there) and the generic as_turing model over the same
fit protocol, superseding ComposedDistributions' own weakdep
extensions (#220, #233); CD's own PPL-neutral ComposedLogDensity/
as_logdensity/logdensity core is unchanged. test/composers/turing_ext.jl
is ported to call DistributionsInference.as_turing rather than deleted,
since it is the live regression guard for the params_table/codec
ordering coupling (#192) -- verified DI's dotted VarName naming is
byte-identical to the removed CD-native stub, so a chain sampled from
DI's as_turing still round-trips through CD's own untouched
chain_to_params/update(tree, chain).

Also drops the ConvolvedDistributions re-export (#228): 14
ConvolvedDistributions-owned names were part of CD's advertised API
purely by re-export, so every upstream change was silently a CD API
change too. CD's own composer code keeps its internal, unexported
using of the 8 names it actually calls; callers reach
ConvolvedDistributions' own surface with an explicit
`using ConvolvedDistributions`.

Co-authored-by: Sam Abbott <contact@samabbott.co.uk>
@github-actions

Copy link
Copy Markdown
Contributor

Try this Pull Request!

Option 1: Julia Package Manager

Open Julia and type:

import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/EpiAware/ComposedDistributions.jl", rev="refactor/drop-redundant-inference-glue-220-233-228")
using ComposedDistributions

Option 2: Local Checkout

If you have the repo locally:

git checkout refactor/drop-redundant-inference-glue-220-233-228
julia --project=. -e "using Pkg; Pkg.instantiate()"

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark comparison vs base

Minimum time per call. Buckets are PR time as a % of base, so lower is faster (🟢 faster, ⚪ within 5%, 🔴 slower). Counts of benchmarks per bucket:

Group 🟢 <50% 🟢 50–75% 🟢 75–95% ⚪ 95–105% 🔴 105–125% 🔴 125–150% 🔴 >150%
Evaluation · · 2 14 1 · ·
ForwardDiff · · · 3 3 · ·
ReverseDiff (tape) · · · 6 · · ·
Mooncake reverse · · · 6 · · ·
Enzyme reverse · · · 5 1 · ·
Evaluation — 17 benchmarks (by time change)
Benchmark base PR time memory
Composition / Sequential / construct 1.38 μs 1.6 μs 🔴 1.16× ⚪ 1.0×
Composition / Nested / compose 3.14 μs 2.8 μs 🟢 0.89× ⚪ 1.0×
Composition / Resolve / logpdf 140.0 ns 130.0 ns 🟢 0.93×
Composition / Sequential / rand 1.26 μs 1.31 μs ⚪ 1.04× ⚪ 1.0×
Composition / Parallel / rand 1.26 μs 1.3 μs ⚪ 1.03× ⚪ 1.0×
Composition / Compete / logccdf 330.0 ns 320.0 ns ⚪ 0.97×
Composition / Parallel / construct 1.47 μs 1.5 μs ⚪ 1.02× ⚪ 1.0×
Composition / Nested / rand 4.7 μs 4.62 μs ⚪ 0.98× ⚪ 1.0×
Composition / Nested / logpdf 1.58 μs 1.6 μs ⚪ 1.01× ⚪ 1.0×
Composition / Choose / construct 20.0 ns 20.0 ns ⚪ 1.0×
Composition / Choose / logpdf 49.0 ns 49.0 ns ⚪ 1.0×
Composition / Compete / construct 20.0 ns 20.0 ns ⚪ 1.0×
Composition / Compete / rand 510.0 ns 510.0 ns ⚪ 1.0× ⚪ 1.0×
Composition / Parallel / logpdf 100.0 ns 100.0 ns ⚪ 1.0× ⚪ 1.0×
Composition / Resolve / construct 29.0 ns 29.0 ns ⚪ 1.0×
Composition / Resolve / rand 500.0 ns 500.0 ns ⚪ 1.0× ⚪ 1.0×
Composition / Sequential / logpdf 100.0 ns 100.0 ns ⚪ 1.0× ⚪ 1.0×
AD gradients — 24 benchmarks (by time change)
Benchmark base PR time memory
AD gradients / Pool non-centred reconstruction logpdf / ForwardDiff 992.0 ns 1.09 μs 🔴 1.1× ⚪ 1.0×
AD gradients / Choose selected-branch logpdf / ForwardDiff 681.0 ns 741.0 ns 🔴 1.09× ⚪ 1.0×
AD gradients / Choose selected-branch logpdf / Enzyme reverse 3.22 μs 3.4 μs 🔴 1.06× ⚪ 1.0×
AD gradients / Resolve mixture marginal logpdf / ForwardDiff 6.6 μs 6.93 μs 🔴 1.05× ⚪ 1.0×
AD gradients / Sequential Gamma+LogNormal logpdf / ForwardDiff 10.32 μs 10.78 μs ⚪ 1.04× ⚪ 1.0×
AD gradients / Resolve mixture marginal logpdf / Mooncake reverse 96.64 μs 92.55 μs ⚪ 0.96× ⚪ 1.0×
AD gradients / Compete racing-hazard marginal logpdf / Mooncake reverse 51.4 μs 53.42 μs ⚪ 1.04× ⚪ 1.0×
AD gradients / Sequential Gamma+LogNormal logpdf / Mooncake reverse 376.92 μs 366.76 μs ⚪ 0.97× ⚪ 1.0×
AD gradients / Choose selected-branch logpdf / Mooncake reverse 16.48 μs 16.87 μs ⚪ 1.02× ⚪ 1.0×
AD gradients / Compete racing-hazard marginal logpdf / ForwardDiff 8.06 μs 7.86 μs ⚪ 0.98× ⚪ 1.0×
AD gradients / Resolve mixture marginal logpdf / Enzyme reverse 21.11 μs 21.53 μs ⚪ 1.02× ⚪ 1.0×
AD gradients / Pool non-centred reconstruction logpdf / Enzyme reverse 2.0 μs 1.96 μs ⚪ 0.98× ⚪ 1.0×
AD gradients / Sequential Gamma+LogNormal logpdf / ReverseDiff (tape) 27.15 μs 27.63 μs ⚪ 1.02× ⚪ 1.0×
AD gradients / Resolve stick-breaking branch-prob logpdf / Enzyme reverse 21.24 μs 21.61 μs ⚪ 1.02× ⚪ 1.0×
AD gradients / Resolve stick-breaking branch-prob logpdf / ForwardDiff 6.83 μs 6.94 μs ⚪ 1.02× ⚪ 1.0×
AD gradients / Compete racing-hazard marginal logpdf / Enzyme reverse 9.8 μs 9.94 μs ⚪ 1.01× ⚪ 1.0×
AD gradients / Resolve stick-breaking branch-prob logpdf / Mooncake reverse 98.42 μs 97.13 μs ⚪ 0.99× ⚪ 1.0×
AD gradients / Pool non-centred reconstruction logpdf / Mooncake reverse 21.12 μs 21.31 μs ⚪ 1.01× ⚪ 1.0×
AD gradients / Sequential Gamma+LogNormal logpdf / Enzyme reverse 106.45 μs 107.28 μs ⚪ 1.01× ⚪ 1.0×
AD gradients / Resolve mixture marginal logpdf / ReverseDiff (tape) 64.03 μs 63.75 μs ⚪ 1.0× ⚪ 1.0×
AD gradients / Choose selected-branch logpdf / ReverseDiff (tape) 13.86 μs 13.82 μs ⚪ 1.0× ⚪ 1.0×
AD gradients / Pool non-centred reconstruction logpdf / ReverseDiff (tape) 27.08 μs 27.15 μs ⚪ 1.0× ⚪ 1.0×
AD gradients / Compete racing-hazard marginal logpdf / ReverseDiff (tape) 49.68 μs 49.58 μs ⚪ 1.0× ⚪ 1.0×
AD gradients / Resolve stick-breaking branch-prob logpdf / ReverseDiff (tape) 55.87 μs 55.82 μs ⚪ 1.0× ⚪ 1.0×

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
ad-enzyme-forward 0.00% <ø> (ø)
ad-forwarddiff 21.83% <ø> (ø)
ad-mooncake-forward 0.00% <ø> (ø)
ad-mooncake-reverse 21.88% <ø> (ø)
ad-reversediff 21.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seabbs-bot

Copy link
Copy Markdown
Collaborator Author

Superseded by #241, now merged (8b28660) — same #220/#233/#228 scope plus the #226 CD-side change, the ConvolvedDistributions dep-declaration fix this PR's review round diagnosed, and the DI#32 test port. Closing.

This was opened by a bot. Please ping @seabbs for any questions.

@seabbs-bot seabbs-bot closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant