Skip to content

Return log-densities + divergent transition info from impulse.infer#2958

Open
penelopeysm wants to merge 4 commits into
EnzymeAD:mainfrom
penelopeysm:py/logdens
Open

Return log-densities + divergent transition info from impulse.infer#2958
penelopeysm wants to merge 4 commits into
EnzymeAD:mainfrom
penelopeysm:py/logdens

Conversation

@penelopeysm

@penelopeysm penelopeysm commented Jul 19, 2026

Copy link
Copy Markdown

Currently infer only returns a single diagnostic, a boolean which indicates whether or not the transition was accepted. Naturally, it's often useful to have more info :)
Right now (some of) this info is already calculated but is thrown away. This PR is a pretty mechanical way of surfacing that. The diagnostics tensor is expanded to include a second column which indicates whether the transition is divergent, plus a separate new tensor containing the logdensities is returned.
This is a bit ugly and not incredibly generalisable, but since it's quite closely tied to the sampling algorithm and infer only admits two algorithms, I think it's fine for now. My feeling is that properly generalising diagnostics only really makes sense in the context of broader programmable inference APIs.
This ofc needs changes in Reactant as well which I'll push separately. I have tested this locally end to end and it all works as intendeds

@wsmoses
wsmoses requested a review from sbrantq July 20, 2026 01:16
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.

1 participant