Support callable and per-state policy temperatures - #520
Merged
josephdviviano merged 1 commit intoApr 27, 2026
Conversation
alstn12088
force-pushed
the
codex/callable-temperature
branch
from
April 26, 2026 05:22
b4af07a to
2162a02
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #520 +/- ##
==========================================
+ Coverage 73.91% 74.43% +0.52%
==========================================
Files 59 59
Lines 9730 9906 +176
Branches 1340 1367 +27
==========================================
+ Hits 7192 7374 +182
+ Misses 2095 2073 -22
- Partials 443 459 +16
🚀 New features to boost your workflow:
|
Collaborator
|
great work - thanks. forcing the merge to bypass the weird claude review issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends discrete policy sampling so callers can provide a state-dependent sampling temperature instead of only a scalar temperature.
Concretely, it:
PolicyMixinandRecurrentPolicyMixinacceptpolicy_kwargs["temperature"]as a callable(states_active, estimator_outputs)LogitBasedEstimator/DiscretePolicyEstimatortemperature to be either a scalar float or a tensorMotivation
The downstream
gfn-communitiesnovelty-guidance work needs local, per-state adaptive temperature during trajectory sampling. The sampler already threadstemperaturethroughpolicy_kwargs; this change makes that hook expressive enough for per-step, state-conditioned temperature without forcing downstream code to fork the sampler or estimator stack.Behavioral Compatibility
temperature=1.0andtemperature=<float>behavior is unchanged.temperatureis not callable, the old path is used.Testing
Local smoke run from the downstream environment:
Output:
Downstream Dependency
This PR is required by the
gfn-communitiesadaptive-temperature novelty guidance implementation. The downstream core PR intentionally keeps the submodule pointer unchanged until this lands inGFNOrg/torchgfn; after merge, the submodule pointer should be updated in a follow-up.