Problem
During targeted SBI with zooming (simulate_when_full: true), the training buffer accumulates samples from different proposal rounds. Older samples come from wider proposals, newer ones from narrower proposals. The training loss treats all samples equally, so the learned _residual_cov reflects a mixture of proposals rather than the current one.
Proposed Fix
Reweight the training loss for each sample by current_proposal(theta) / original_proposal(theta):
original_proposal(theta): already stored as log_prob per sample in the buffer
current_proposal(theta): compute from the current model at training time
This makes the training loss consistent with the current proposal distribution, so mu(x) and Sigma reflect the conditional distribution under the current proposal exactly.
Context
A complementary analytical correction (gamma_correct = (1+gamma)/gamma) was added to sample_posterior to undo the proposal-vs-prior bias at sampling time. With reweighting:
- Reweighting handles the multi-round mixing (heterogeneous buffer)
- gamma_correct handles the proposal-vs-prior bias (single analytical correction)
Each fixes exactly one thing.
Problem
During targeted SBI with zooming (
simulate_when_full: true), the training buffer accumulates samples from different proposal rounds. Older samples come from wider proposals, newer ones from narrower proposals. The training loss treats all samples equally, so the learned_residual_covreflects a mixture of proposals rather than the current one.Proposed Fix
Reweight the training loss for each sample by
current_proposal(theta) / original_proposal(theta):original_proposal(theta): already stored aslog_probper sample in the buffercurrent_proposal(theta): compute from the current model at training timeThis makes the training loss consistent with the current proposal distribution, so
mu(x)andSigmareflect the conditional distribution under the current proposal exactly.Context
A complementary analytical correction (
gamma_correct = (1+gamma)/gamma) was added tosample_posteriorto undo the proposal-vs-prior bias at sampling time. With reweighting:Each fixes exactly one thing.