# Prior score for compositional inference with rejection sampling

**URL:** <https://discuss.bayesflow.org/t/prior-score-for-compositional-inference-with-rejection-sampling/281>\
**Category:** General\
**Created:** [October 8, 2026, 4:15pm UTC](https://discuss.bayesflow.org/t/prior-score-for-compositional-inference-with-rejection-sampling/281 "2026-10-08T16:15:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianj](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@brianj](https://discuss.bayesflow.org/u/brianj)\
**Post date:** [October 8, 2026, 4:15pm UTC](https://discuss.bayesflow.org/t/prior-score-for-compositional-inference-with-rejection-sampling/281/1 "2026-10-08T16:15:06Z")

</div>

Hi and thanks for a great package!

I plan to do compositional inference with a hierarchical model, using a DiffusionModel as the inference network. I’m working with Bayesflow 2.0.14.

I have a simulator which does some rejection for unrealistic outputs to save compute, with almost half of simulations exiting early. It is challenging to set the priors to avoid sampling in the rejected region because the probability of acceptance depends on many parameters + their interactions.

I don’t think this rejection is a problem in the case of a typical Bayesflow modeling approach, but I’m worried about the prior score being affected in the case of compositional sampling. I don’t think the prior score will be affected in the region of the true parameters because the rejected datasets will be far different from the real data. However, if I understand the diffusion modeling approach correctly, the prior score is still relevant to some extent when the parameters may be far from their final values.

Can I ignore the effect of rejection on the score of the prior? If so, is there an intuitive reason why? How does this affect future inference where I may want to change the prior? Is the unconditional score (used when compute\_prior\_score is absent in compositional\_workflow) implicitly using the prior that the network was trained on? That is, do I only need to input the compute\_prior\_score function if I want to change the prior?

Lots of questions haha and feel free to point me to a paper if the answer is in there, but I’ve given it a shot and still haven’t figured it out. Thanks for your time!

---

<div class="post-metadata">

**Author:** ![KLDivergence](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.bayesflow.org/kldivergence/32/15_2.png) [@KLDivergence](https://discuss.bayesflow.org/u/KLDivergence)\
**Post date:** [October 8, 2026, 9:25pm UTC](https://discuss.bayesflow.org/t/prior-score-for-compositional-inference-with-rejection-sampling/281/2 "2026-10-08T21:25:41Z")

</div>

That’s an interesting question. Technically, you can’t ignore the correction if the rejection function depends on the parameters, because you implicitly change the prior and you need some sort of importance sampling to get the density under the original prior. In your case, using the unconditional (learned) score would be the way to go, as it will use the learned time-dependent prior.
