Skip to content

Conversation

@penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Nov 13, 2025

There are two commits in this PR:

  1. Replace LogDensityFunction with FastLDF (that's not controversial);

  2. Remove SimpleVarInfo (which might be controversial).

SVI

I would argue that the main purpose of SVI was for performance when evaluating a model with NamedTuple or Dict parameters:

retval, svi = DynamicPPL.evaluate!!(model, SimpleVarInfo(params)) # using DefaultContext

However, exactly the same thing can be accomplished now with the combination of InitFromParams + OnlyAccsVarInfo:

# it's a one-liner now:
retval, oavi = DynamicPPL.fast_evaluate!!(model, InitFromParams(params, nothing), DynamicPPL.default_accumulators())

# Which expands to this:
ctx = InitContext(InitFromParams(params), nothing))
oavi = OnlyAccsVarInfo(DynamicPPL.default_accumulators())
model = setleafcontext(model, ctx)
retval, oavi = DynamicPPL.evaluate!!(model, oavi)

Indeed, this strategy is on par with SVI for the NamedTuple case and faster than SVI for the Dict case (see benchmarks on #1125; performance characteristics on this PR are the same).

The other context in which SVI was useful was evaluation with vector parameters, but that's handled by FastLDF. Thus, my conclusion is that SVI is no longer needed.

Furthermore, because SVI is gone, I believe DynamicTransformation, StaticTransformation, and maybe_invlink_before_eval!! can also go. However, we'll leave that for another time.

I looked through GitHub for usage of SimpleVarInfo, and it's only in DPPL, Turing, Mooncake benchmarks (trivially fixed once FastLDF is released), and https://github.com/epimap/Epimap.jl-public and https://github.com/marius311/MuseInference.jl, which haven't been updated in a while.

Miscellany

I'm lumping these into a single PR, but also happy to split them up. The two commits are completely standalone though. The main purpose of lumping them is so that I have a single branch to test Turing CI against.

@penelopeysm penelopeysm marked this pull request as draft November 13, 2025 22:17
@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

Benchmark Report for Commit 6f5df1a

Computer Information

Julia Version 1.11.7
Commit f2b3dbda30a (2025-09-08 12:10 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results


@github-actions
Copy link
Contributor

DynamicPPL.jl documentation for PR #1139 is available at:
https://TuringLang.github.io/DynamicPPL.jl/previews/PR1139/

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.15%. Comparing base (2fad97b) to head (6f5df1a).

Files with missing lines Patch % Lines
src/fasteval.jl 62.50% 3 Missing ⚠️
src/test_utils/model_interface.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           py/params-from-ldf    #1139      +/-   ##
======================================================
- Coverage               81.53%   77.15%   -4.38%     
======================================================
  Files                      42       40       -2     
  Lines                    3953     3725     -228     
======================================================
- Hits                     3223     2874     -349     
- Misses                    730      851     +121     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@penelopeysm penelopeysm force-pushed the py/not-experimental branch 2 times, most recently from c4f93fe to c1ee6cc Compare November 14, 2025 00:37
@penelopeysm penelopeysm force-pushed the py/not-experimental branch 2 times, most recently from d86ff22 to be27184 Compare November 14, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants