Fix: exit retry loop in get_belief after a successful attempt#7
Open
borisshapa wants to merge 1 commit into
Open
Fix: exit retry loop in get_belief after a successful attempt#7borisshapa wants to merge 1 commit into
borisshapa wants to merge 1 commit into
Conversation
The retry loop in get_belief() had no break on success, so every belief elicitation ran all n_retries (default 3) attempts, querying the LLM 3x with n_samples each time and keeping only the last result. This made every prior/posterior computation 3x slower and 3x more expensive with no effect on the outcome.
borisshapa
force-pushed
the
fix/belief-retry-break
branch
from
July 15, 2026 09:48
8f2d6c0 to
37a5077
Compare
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
The retry loop in
get_belief()(src/beliefs.py) has nobreakon success, so every belief elicitation runs alln_retries(default 3) attempts even when the first one succeeds. Each attempt queries the LLM withn_samples(default 30) completions, and only the last attempt's result is kept.In effect, every prior and posterior computation costs 3x the LLM calls and 3x the wall-clock time it should, with no impact on the result (the earlier successful responses are simply discarded and resampled).
Fix
Add
breakafter a successful attempt, so retries only happen on exceptions — which appears to be the original intent, given theexceptbranch's retry messaging.How this was found
While tracing a full run of the pipeline we noticed each belief distribution was logged three times with fresh samples, e.g. a single node's prior elicitation produced three consecutive 30-sample batches before the pipeline moved on.