Skip to content

Normalization in the forward function of FlowMatchingEstimator is wrong. #1462

Closed

Description

@jaivardhankapoor

🐛 Bug Description

Adding z-scoring in the forward function of FlowMatchingEstimator results in progressive affine transformation while sampling, leading to shifted posteriors.

🔄 Steps to Reproduce

  1. Go to branch test_flowmatching_zscoring_bug of this fork
  2. Set up the package and run pytest -n 4 --bm --bm-mode fmpe, once by changing DEBUG_ZSCORE_STYLE between None and "independent" in sbi/neural_nets/factory.py. This changes whether z-scoring is used or not.

✅ Expected Behavior

Both methods should not have significant performance differences between Multivariate Gaussians (whether shifted posterior or not)

❌ Observed Behavior

No z-scoring results in the following test performance

                                      linear_mvg_2d  linear_mvg_2d_shifted 
---------------------------------------------------------------------------
FMPE{'density_estimator': 'mlp'}          0.512              0.673         
FMPE{'density_estimator': 'resnet'}       0.531              0.676        

Z-scoring results in the following test performance

                                      linear_mvg_2d  linear_mvg_2d_shifted 
---------------------------------------------------------------------------
FMPE{'density_estimator': 'mlp'}          0.513              0.886         
FMPE{'density_estimator': 'resnet'}       0.534              0.869         

📌 Recommendation

Z-scoring should be removed from FlowMatchingEstimator to FMPE class in inference/trainers.

Activity

  1. added
    bug
    on Mar 17, 2025
  2. janfb commented on Mar 25, 2025

    @janfb
    Contributor

    @jaivardhankapoor wasn't this fixed in #1492?

  3. StarostinV commented on Mar 25, 2025

    @StarostinV
    Collaborator

    @jaivardhankapoor wasn't this fixed in #1492?

    No, but it is fixed now in #1497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions