Repository navigation
Description
Description
I'm observing different outputs between v1.5.0 and v.1.4.1 for the same inputs when using models (such as flows.NSF) that use AutoregressiveTransform internally. When using these models, our rough evaluation sequence is to transform to latent space, flip a boolean context value and then transform back in order to map from one context (simulation) to another (real data). Due to a change in the default value of the slope parameter here, the results differ between the two versions. The slope parameter doesn't appear to be exposed to the user, so currently our solution to use older models with newer versions of zuko is to pin the package to the version used in training.
As this is somewhat brittle and would prevent future updates, would it be possible to make such options available to the user?
Reproduce
import torch
import zuko
print(f"zuko v{zuko.__version__}")
FLIP_CONDITIONAL = True
flow = zuko.flows.NSF(features=2, context=2, transforms=1)
flow = flow.type(torch.float64)
x = torch.tensor([[1., 2.]], dtype=torch.float64)
c = torch.tensor([[1., 0.]], dtype=torch.float64)
transform = flow(c).transform
with torch.no_grad():
# To latent space
y = transform(x)
# Flip condition
c2 = c.clone()
if FLIP_CONDITIONAL:
c2[:, -1] = 1.0 - c2[:, -1]
# Back to data space
transform2 = flow(c2).transform
x_back = transform2.inv(y)
print(f"x: {x}")
print(f"y = transform(x): {y}")
print(f"c: {c}")
print(f"c2 (used for inverse): {c2}")
print(f"x_back = transform.inv(y): {x_back}") # Different values between v1.4.1 and v.1.5.0Expected behavior
Consistent behaviour between to versions differing only in their MINOR versions, as in https://semver.org/
Causes and solution
Change to the default value of slope here. When creating a flows.NSF object, this parameter isn't exposed to the user so the value is effectively hardcoded.
Environment
- Zuko version: 1.4.1 and 1.5.0
- PyTorch version: 2.10.0+cu128
- Python version: 3.12.12
- OS: Observed on Fedora 43, Rocky 9.7, RHEL 9.7
Activity
[-]Different behaviour for `AutoregressiveTransform` betwween versions[/-][+]Different behaviour for `AutoregressiveTransform` between versions[/+][-]Different behaviour for `AutoregressiveTransform` between versions[/-][+]Different behaviour for NSF between versions[/+]francois-rozet commentedon Mar 7, 2026
Hi @runtingt, thank you for the bug report. I am sorry for the issues caused by the latest release. I have implemented your proposed solution in #77. Could you please check if the solution suits your needs?
runtingt commentedon Mar 9, 2026
Yep this is great thank you for the super quick fix! Would it be possible to get a new release with this in place?
francois-rozet commentedon Mar 14, 2026
I forgot to mention Zuko 1.6.0 is out 😉