Skip to content

Fix: exit retry loop in get_belief after a successful attempt#7

Open
borisshapa wants to merge 1 commit into
allenai:mainfrom
borisshapa:fix/belief-retry-break
Open

Fix: exit retry loop in get_belief after a successful attempt#7
borisshapa wants to merge 1 commit into
allenai:mainfrom
borisshapa:fix/belief-retry-break

Conversation

@borisshapa

@borisshapa borisshapa commented Jul 15, 2026

Copy link
Copy Markdown

Summary

The retry loop in get_belief() (src/beliefs.py) has no break on success, so every belief elicitation runs all n_retries (default 3) attempts even when the first one succeeds. Each attempt queries the LLM with n_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 break after a successful attempt, so retries only happen on exceptions — which appears to be the original intent, given the except branch'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.

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
borisshapa force-pushed the fix/belief-retry-break branch from 8f2d6c0 to 37a5077 Compare July 15, 2026 09:48
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