Skip to content

Conversation

@penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Nov 8, 2025

This has no real impact on DynamicPPL, but using this in Turing should lead to some nice speedups because this:

  1. is faster to evaluate than regular unflatten + evaluate!!;
  2. avoids deepcopying VarInfo.

Closes #1119.

Since the intention of this is to replace Turing.Inference.Transition with ParamsWithStats, I also added the necessary AbstractMCMC.bundle_samples method here. MCMCChainsExt is the natural place for it to live (it could be defined in Turing, but that would be piracy).

@penelopeysm penelopeysm changed the base branch from main to py/fastldf November 8, 2025 17:50
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

Benchmark Report for Commit 2fad97b

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 × Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, icelake-server)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results

┌───────────────────────┬───────┬─────────────┬───────────────────┬────────┬────────────────┬─────────────────┐
│                 Model │   Dim │  AD Backend │           VarInfo │ Linked │ t(eval)/t(ref) │ t(grad)/t(eval) │
├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼────────────────┼─────────────────┤
│ Simple assume observe │     1 │ forwarddiff │             typed │  false │            6.2 │             1.9 │
│           Smorgasbord │   201 │ forwarddiff │             typed │  false │          746.6 │            42.0 │
│           Smorgasbord │   201 │ forwarddiff │ simple_namedtuple │   true │          407.7 │            58.1 │
│           Smorgasbord │   201 │ forwarddiff │           untyped │   true │          794.6 │            40.7 │
│           Smorgasbord │   201 │ forwarddiff │       simple_dict │   true │         6633.4 │            26.6 │
│           Smorgasbord │   201 │ forwarddiff │      typed_vector │   true │          752.9 │            43.3 │
│           Smorgasbord │   201 │ forwarddiff │    untyped_vector │   true │          748.1 │            39.6 │
│           Smorgasbord │   201 │ reversediff │             typed │   true │          843.0 │            48.6 │
│           Smorgasbord │   201 │    mooncake │             typed │   true │          716.1 │             5.5 │
│           Smorgasbord │   201 │      enzyme │             typed │   true │          845.6 │             4.3 │
│    Loop univariate 1k │  1000 │    mooncake │             typed │   true │         3405.3 │             6.6 │
│       Multivariate 1k │  1000 │    mooncake │             typed │   true │         1178.3 │             7.2 │
│   Loop univariate 10k │ 10000 │    mooncake │             typed │   true │        36183.5 │             6.2 │
│      Multivariate 10k │ 10000 │    mooncake │             typed │   true │        10837.3 │             7.9 │
│               Dynamic │    10 │    mooncake │             typed │   true │          129.5 │             8.1 │
│              Submodel │     1 │    mooncake │             typed │   true │            8.4 │             6.1 │
│                   LDA │    12 │ reversediff │             typed │   true │          854.6 │             2.2 │
└───────────────────────┴───────┴─────────────┴───────────────────┴────────┴────────────────┴─────────────────┘

@penelopeysm penelopeysm mentioned this pull request Nov 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

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

@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

❌ Patch coverage is 72.72727% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.53%. Comparing base (ce80713) to head (2fad97b).

Files with missing lines Patch % Lines
ext/DynamicPPLMCMCChainsExt.jl 0.00% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           breaking    #1129      +/-   ##
============================================
- Coverage     81.72%   81.53%   -0.19%     
============================================
  Files            42       42              
  Lines          3928     3953      +25     
============================================
+ Hits           3210     3223      +13     
- Misses          718      730      +12     

☔ 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 marked this pull request as ready for review November 13, 2025 16:46
@penelopeysm penelopeysm changed the base branch from py/fastldf to breaking November 13, 2025 16:46
@penelopeysm penelopeysm changed the title Allow generation of ParamsWithStats from FastLDF plus parameters Allow generation of ParamsWithStats from FastLDF plus parameters, and also bundle_samples Nov 13, 2025
@penelopeysm penelopeysm requested a review from sunxd3 November 13, 2025 18:46
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.

Implement ParamsWithStats(::FastLDF, ::AbstractVector{<:Real})

2 participants