Skip to content

Importance reweighting for heterogeneous proposal buffer #48

@cweniger

Description

@cweniger

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:

  1. Reweighting handles the multi-round mixing (heterogeneous buffer)
  2. gamma_correct handles the proposal-vs-prior bias (single analytical correction)

Each fixes exactly one thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions