Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## contexts #1504 +/- ##
============================================
- Coverage 90.20% 90.20% -0.01%
============================================
Files 49 49
Lines 7058 7056 -2
============================================
- Hits 6367 6365 -2
Misses 691 691 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The new required RNG argument breaks the documented six-argument logdensity_internal interface.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds explicit RNG propagation to LogDensityFunction, addressing #721 by preserving model-body randomness across construction, evaluation, AD, and sampling.
Changes:
- Stores and propagates an explicit RNG through density-related workflows.
- Adds ForwardDiff/Mooncake and nested-model coverage.
- Documents stochastic-density behavior and limitations.
File summaries
| File | Description |
|---|---|
src/logdensityfunction.jl |
Adds RNG storage and propagation. |
src/chains.jl |
Uses the LDF RNG during parameter/stat evaluation. |
src/subsample.jl |
Propagates RNG into subsampled LDFs. |
src/accumulators/fixed_transforms.jl |
Supports RNG-controlled transform extraction. |
src/test_utils/ad.jl |
Propagates RNG through AD test utilities. |
ext/DynamicPPLMooncakeExt.jl |
Marks RNG state as non-differentiable. |
test/logdensityfunction.jl |
Tests RNG behavior and nested models. |
docs/src/ldf/overview.md |
Documents stochastic density evaluation. |
docs/src/evaluation.md |
Links evaluation semantics to RNG guidance. |
HISTORY.md |
Records the new API behavior. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
DynamicPPL.jl documentation for PR #1504 is available at: |
BenchmarksPerformance Ratio: gradient time divided by log-density time. Primal times are for main (94e4e4a) and this PR (2dc046b). For very small models the gradient ratios vary across runs and machines, so compare the raw timings instead. The benchmarks are meant for DynamicPPL developers and mainly catch obvious allocation and type-stability regressions; see the benchmark notes for details. EnvironmentJulia Version 1.13.1 Commit 96ca370cf0e (2026-09-25 19:34 UTC) Build Info: Official https://julialang.org release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 4 × AMD EPYC 9V74 80-Core Processor WORD_SIZE: 64 LLVM: libLLVM-20.1.8 (ORCJIT, znver4) GC: Built with stock GC Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores) |
0da944f to
b809bf5
Compare
764b28e to
45e0ed5
Compare
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
Assisted-by: Codex <codex@openai.com>
This adds an
rngkeyword toLogDensityFunctionand passes the same generator through construction, density evaluation, AD preparation and default parameter sampling. Withldf = LogDensityFunction(m; rng=Xoshiro(42)),rand(ldf)and model-body calls torand(__context__.rng)share that generator. During density evaluation, LHS variables read the supplied parameters, and only body calls through__context__.rngadvance the generator. Construction and AD preparation may consume draws, so repeated evaluations of a model that draws randomness need not return identical densities.DynamicPPL.logdensity_internalnow takesrngas an optional final positional argument, defaulting toRandom.default_rng().Closes #721.