A coupling flow with mixture-CDF blocks normally captures cross-dim dependence via the conditioner. But when the conditioner is zero-initialised — specifically, when the final Dense of the conditioner has kernel — something interesting happens: the flow collapses into a plain diagonal Gaussianization flow.
This notebook:
Recaps the four objects at play (the mixture-CDF primitive, the diagonal Gaussianization flow, iterative vs parametric training, the coupling flow).
Works through the math showing the equivalence (Lemmas 1–3 → Theorem → Corollary).
Verifies it empirically: build matched diagonal and coupling flows, IG-initialise both, compare pushforwards element-wise.
Shows that a single gradient step is enough for the coupling flow to break the equivalence — its conditioner starts modulating on and the flow becomes strictly more expressive.
The upshot: IG init on a coupling flow gives you the best of both worlds — a well-understood RBIG starting point and a conditioner waiting to do cross-dim work once training begins.
1. Mathematical recap¶
Self-contained summary of the pieces so this notebook stands on its own.
Notation and shapes¶
— data dimensionality, — mixture components per marginal, — batch size, — number of blocks in the flow.
Random vector on (what we have data from). Latent (what we want the flow to land on).
Bijective map with Jacobian .
Change of variables (the one identity behind everything)¶
For a bijection and any base density ,
Training minimises the negative of this averaged over data — the NLL.
1-D mixture-CDF Gaussianization (the primitive)¶
Classical probability integral transform: if has strictly increasing CDF , then , so . We approximate with a mixture of normals,
Parameter shapes: (weights on the simplex), , . The forward map and its log-derivative are
Inverse uses monotone bisection on .
Diagonal marginal Gaussianization layer (MixtureGaussianCDF)¶
Lift the 1-D primitive to dims by applying it independently per dim. Parameters are tensors of shape :
Forward: for each . Jacobian is diagonal, so
Rotation layer¶
Orthogonal — either a Householder product with , or a fixed (frozen) matrix. , so rotations contribute zero to the flow’s log-det. Their role is to redistribute non-Gaussianity across dims between marginal blocks — a marginal layer can only Gaussianize dim-by-dim, so the rotation “mixes” structure that’s otherwise stuck in single dims.
A full Gaussianization flow: blocks of (rotation, marginal)¶
with total log-det (rotations drop out).
Iterative Gaussianization — RBIG (Laparra & Malo 2011)¶
Greedy, non-gradient fit. Walk through the flow one block at a time. Starting with :
Fit PCA, rotate: .
Fit per-dim GMM via EM on each column of → of shape .
Apply the marginal transform:
marg.Increment and repeat.
Laparra & Malo show the negentropy decreases at a geometric rate under mild conditions. Remarkably, this already gives a decent density estimator — before any gradient descent. gauss_flows.fit_rbig implements this exactly.
Parametric Gaussianization¶
Same architecture as above. All parameters are learned jointly by gradient descent on the NLL. Gradient flows through the whole composition, so later blocks can compensate for finite- approximation errors in earlier blocks — something RBIG fundamentally cannot do.
Coupling flow (the MixtureGaussianCDFCoupling layer)¶
Swap the diagonal marginal for a conditional transform. Pick a mask . It splits into an “identity” half (indices where , size ) and a “transformed” half (indices where , size ).
A conditioner maps to the mixture parameters that will Gaussianize . Decompose it through its final Dense as
where is the output of the MLP body, , . The output is reshaped to per channel and split into — one mixture per -dim, depending on .
The forward map:
Jacobian is block-triangular (top half is the identity on , bottom-left carries , bottom-right is diagonal). Only the bottom-right diagonal enters the determinant:
Same form as the diagonal marginal’s log-det — only difference is that the mixture params are functions of instead of fixed.
fit_rbig_coupling stacks blocks of : the Flip between the two couplings swaps halves so both halves get transformed within each block.
The equivalence we’re going to prove¶
A diagonal Gaussianization flow is strictly less expressive than a coupling flow — the coupling has the freedom to modulate its mixture on (through ); the diagonal cannot. But when the conditioner’s final Dense has , the function collapses: is the same for every , and the coupling layer reduces exactly to a diagonal marginal with params unpacked from . This is the regime fit_rbig_coupling puts the coupling flow into.
2. The setup — coupling layer, decomposed¶
With the recap in hand, zoom in on a single coupling layer. Input (batch , dim ). Mask picks the “identity” dims and “transformed” dims. Write and for the two halves.
The conditioner final-Dense decomposition repeated here for convenience:
RBIG init sets and to the per-dim GMM fit.
Lemma 1 — the conditioner becomes a constant¶
With ,
Every example sees the same mixture parameters. The forward pass on is therefore
a function of alone.
Lemma 2 — the log-det collapses to a diagonal¶
The coupling Jacobian is block-triangular:
The off-diagonal block carries through the chain rule, but with we get , so too. The matrix is now block-diagonal, and
Which is exactly what a diagonal MixtureGaussianCDF layer would produce on the same -indices with the same mixture params.
Lemma 3 — two complementary-mask layers pair into one full- marginal (pedantic)¶
A single coupling layer only transforms the -dim half. fit_rbig_coupling uses pairs [couple, flip, couple, flip] inside each block, which is the flowjax equivalent of the Keras [couple(m), couple(~m)]. Claim: with zero-kernel init, one such pair equals one full- diagonal marginal layer. Proof by index chase.
Let the first layer use mask with index set , , , . Its zero-kernel parameters pack into a bias encoding per--dim params for . Forward:
The second layer uses . Its index sets are swapped: , . With its zero-kernel bias encoding params for , forward:
Now substitute in terms of . For we have (unchanged by layer 2). For we have (untouched by layer 1), so . Combining:
Each dimension is Gaussianized independently by its own mixture, with no cross-dim interaction — the definition of a full- diagonal marginal layer. Take its parameters to be
and the coupling pair equals MixtureGaussianCDF with those parameters. Log-dets add the same way:
Key implementation detail: fit_rbig_coupling tracks the flip-induced dim permutation and seeds each coupling’s GMM EM by the original dim index, so the two branches of the pair fit the same mixture on the same original dim the diagonal flow would.
Theorem — full-flow equivalence at zero-kernel init¶
A coupling flow
with zero-kernel init on every coupling layer reduces, by Lemma 3 applied block-by-block, to
provided the rotations and marginal parameters are matched. fit_rbig and fit_rbig_coupling walk both kinds of flow with the same per-block PCA and per-dim GMM fits (seeded by (block_idx, original_dim_idx)), so the matching holds automatically.
Corollary — both flows equal RBIG¶
Classical RBIG produces exactly the sequence of transforms that fit_rbig assigns, so
Time for a numerical check.
from __future__ import annotations
import equinox as eqx
import jax
import jax.numpy as jnp
import jax.random as jr
import matplotlib.pyplot as plt
import numpy as np
import paramax
import seaborn as sns
from pipekit_train import ArrayDataset, EarlyStopping, History, TrainingLoop
from pipekit_train.backends.equinox import EquinoxModelOp
from sklearn.datasets import make_moons
from gauss_flows_maps.bijections import MixtureGaussianCDFCoupling
from gauss_flows_models.inference import (
fit_rbig,
fit_rbig_coupling,
negative_log_likelihood,
)
# --- global plot styling ------------------------------------------------------
sns.set_theme(context="poster", style="whitegrid", palette="deep", font_scale=0.85)
plt.rcParams.update(
{
"figure.dpi": 110,
"savefig.dpi": 110,
"savefig.bbox": "tight",
"savefig.pad_inches": 0.2,
"figure.constrained_layout.use": True,
"figure.constrained_layout.h_pad": 0.1,
"figure.constrained_layout.w_pad": 0.1,
"axes.grid.which": "both",
"grid.linewidth": 0.7,
"grid.alpha": 0.5,
"axes.edgecolor": "0.25",
"axes.linewidth": 1.1,
"axes.titleweight": "semibold",
"axes.labelpad": 6,
}
)
def style_axes(ax, *, aspect=None, grid=True):
if grid:
ax.minorticks_on()
ax.grid(True, which="major", linewidth=0.8, alpha=0.6)
ax.grid(True, which="minor", linewidth=0.4, alpha=0.3)
if aspect is not None:
ax.set_aspect(aspect)
return ax
palette = sns.color_palette("deep")
COLOR_CPL = palette[0]
COLOR_DIAG = palette[2]
COLOR_DELTA = palette[3]/home/azureuser/localfiles/geo_repos/geo_ml/gauss_flows-fit/.venv/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
3. Matched flows on two moons¶
Two-moons again but with noise=0.1 — the equivalence demo cares about flow-vs-flow agreement, not about how hard the dataset is to Gaussianize. A slightly noisier moons distribution makes RBIG blocks reach a cleanly-Gaussian pushforward, so when we overlay the diag and coupling pushforwards below you see a single recognisable 2D Gaussian blob rather than leftover crescent structure. Both flows use components per dim. They see identical PCA and GMM fits by construction — fit_rbig_coupling seeds each coupling’s per--dim EM by the original dim index and, crucially, propagates state between blocks through the same numerical path as fit_rbig (see _push_forward_b_half_diag). The two routes still round differently in float32, and every later block refits its mixtures by EM on a state that carries that difference, so the gap between the flows grows with depth (section 4).
X_raw, _ = make_moons(n_samples=5000, noise=0.1, random_state=0)
X = (X_raw - X_raw.mean(axis=0)) / X_raw.std(axis=0)
X = jnp.asarray(X, dtype=jnp.float32)
N_BLOCKS = 4
N_COMPONENTS = 8
flow_diag = fit_rbig(X, n_layers=N_BLOCKS, n_components=N_COMPONENTS, random_state=0)
flow_cpl = fit_rbig_coupling(
X, jr.key(0), n_layers=N_BLOCKS, n_components=N_COMPONENTS, random_state=0
)
def _count_params(dist):
return sum(
int(np.prod(p.shape))
for p in jax.tree_util.tree_leaves(eqx.filter(dist, eqx.is_inexact_array))
)
print(f"diagonal flow inexact params : {_count_params(flow_diag)}")
print(f"coupling flow inexact params : {_count_params(flow_cpl)}")diagonal flow inexact params : 212
coupling flow inexact params : 46804
The coupling flow has many more parameters — each block carries two conditioner MLPs on top of the tensors. At RBIG init all of that extra capacity is inert because the final Dense has . Training is what lights it up.
4. Element-wise equality check¶
The Theorem says for every . Evaluate both on the whole training set and compute:
per-sample error
per-sample log-prob difference
Expected: not float32 epsilon. The diagonal and coupling forward paths are mathematically identical but use slightly different numerical routes (different log-pdf expressions, different scale parameterisations), so each block hands the next a slightly different state. The next block fits its GMMs by EM on that state, and EM can settle on slightly different mixtures, so the difference grows with each block rather than staying at rounding level.
# In flowjax, flow.bijection is defined so that `base -> data`. The forward
# map data -> base (what we call f(x) in the math above) is `bijection.inverse`.
Z_diag = np.asarray(jax.vmap(flow_diag.bijection.inverse)(X))
Z_cpl = np.asarray(jax.vmap(flow_cpl.bijection.inverse)(X))
err = np.linalg.norm(Z_cpl - Z_diag, axis=-1)
lp_diag = np.asarray(jax.vmap(flow_diag.log_prob)(X))
lp_cpl = np.asarray(jax.vmap(flow_cpl.log_prob)(X))
lp_err = np.abs(lp_cpl - lp_diag)
print("pushforward difference ||z_cpl - z_diag||_2")
print(f" median : {np.median(err):.2e}")
print(f" 95th% : {np.percentile(err, 95):.2e}")
print(f" max : {err.max():.2e}")
print()
print("log-prob difference |log p_cpl(x) - log p_diag(x)|")
print(f" median : {np.median(lp_err):.2e}")
print(f" 95th% : {np.percentile(lp_err, 95):.2e}")
print(f" max : {lp_err.max():.2e}")pushforward difference ||z_cpl - z_diag||_2
median : 2.66e-02
95th% : 7.45e-02
max : 8.05e-01
log-prob difference |log p_cpl(x) - log p_diag(x)|
median : 8.36e-02
95th% : 3.03e-01
max : 3.04e+00
Visualise the pushforwards overlaid¶
If the two flows are equivalent, plotting both pushforwards in the same axes should show a single indistinguishable point cloud. The right panel is the scatter of the pointwise error vectors — should sit on the origin to within float precision.
fig, axes = plt.subplots(1, 2, figsize=(14, 7))
ax = axes[0]
ax.scatter(
Z_diag[:, 0],
Z_diag[:, 1],
s=12,
alpha=0.55,
color=COLOR_DIAG,
label="diagonal flow",
)
ax.scatter(
Z_cpl[:, 0], Z_cpl[:, 1], s=5, alpha=0.35, color=COLOR_CPL, label="coupling flow"
)
ax.set_xlabel("$z_1$")
ax.set_ylabel("$z_2$")
ax.set_title("Pushforwards overlaid")
ax.set_xlim(-4, 4)
ax.set_ylim(-4, 4)
ax.legend(loc="upper left", frameon=True)
style_axes(ax, aspect="equal")
ax = axes[1]
delta = Z_cpl - Z_diag
lim = max(1e-5, float(np.max(np.abs(delta))) * 1.2)
ax.scatter(delta[:, 0], delta[:, 1], s=10, alpha=0.6, color=COLOR_DELTA)
ax.axhline(0, color="black", linewidth=0.8, alpha=0.6)
ax.axvline(0, color="black", linewidth=0.8, alpha=0.6)
ax.set_xlim(-lim, lim)
ax.set_ylim(-lim, lim)
ax.set_xlabel(r"$\Delta z_1$")
ax.set_ylabel(r"$\Delta z_2$")
ax.set_title(r"$\Delta z = z_{\mathrm{cpl}} - z_{\mathrm{diag}}$")
style_axes(ax, aspect="equal")
plt.show()findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.
findfont: Failed to find font weight semibold for DejaVu Sans, now using 700.

With blocks the two pushforwards differ by a few hundredths in the median and the log-probs by under a tenth, with a few points much further apart. That is far above float32 rounding: the later blocks’ EM fits amplify the small difference that the two numerical routes hand them, so this run shows the flows agreeing closely over most of the data, not to float precision. The conditioner itself contributes nothing at init, as the zero-kernel check below confirms, and the flip-aware seeding means both branches fit their mixture on the same original dim.
Conditioner kernel sanity check¶
Dig into each coupling in the flow and read out on its conditioner’s final Dense. All should be exactly zero at RBIG init.
def iter_couplings(flow):
chain = flow.bijection.bijection # Invert -> Chain
for bij in chain.bijections:
if isinstance(bij, MixtureGaussianCDFCoupling):
yield bij
max_W_init = [
float(jnp.max(jnp.abs(bij._coupling.conditioner.layers[-1].weight)))
for bij in iter_couplings(flow_cpl)
]
print("max |W| on each coupling's final Dense at RBIG init:")
for i, w in enumerate(max_W_init):
print(f" coupling {i:>2d}: {w:.2e}")
print(f"overall max |W| = {max(max_W_init):.2e}")max |W| on each coupling's final Dense at RBIG init:
coupling 0: 0.00e+00
coupling 1: 0.00e+00
coupling 2: 0.00e+00
coupling 3: 0.00e+00
coupling 4: 0.00e+00
coupling 5: 0.00e+00
coupling 6: 0.00e+00
coupling 7: 0.00e+00
overall max |W| = 0.00e+00
5. Training breaks the equivalence¶
One gradient step of the coupling flow sets its final-Dense kernels to nonzero values. The conditioner stops being constant-in-, and the layer becomes a genuinely conditional transform. From that point on, diverges from .
Train only the coupling flow (the diagonal flow stays frozen as the reference). Re-check the pointwise error after a handful of epochs.
class FlowNLL:
"""pipekit-train's task: gauss_flows's negative log-likelihood of a batch."""
def loss_fn(self, flow, batch, key):
x, condition = batch
# an unconditional dataset has no targets, ()
condition = None if isinstance(condition, tuple) else condition
loss = negative_log_likelihood(flow, x, key=key, condition=condition)
return loss, {"loss": loss}
def fit_flow(
key,
flow,
x,
*,
condition=None,
learning_rate=5e-3,
clip_norm=None,
max_epochs=100,
max_patience=10,
batch_size=256,
val_prop=0.1,
):
"""Fit `flow` to the rows of `x` by maximum likelihood with pipekit-train.
A fraction `val_prop` of the rows is held out. Training stops after
`max_patience` epochs without a lower validation loss, and the flow of the
best epoch is returned with the per-epoch train and validation losses.
"""
split_key, loop_key = jr.split(key)
# one shuffle, then the last val_prop of the rows held out
order = np.asarray(jr.permutation(split_key, len(x)))
n_train = len(x) - round(val_prop * len(x))
train_rows, val_rows = order[:n_train], order[n_train:]
def rows(a, idx):
return () if a is None else np.asarray(a)[idx]
batch_size = min(batch_size, n_train)
steps_per_epoch = n_train // batch_size
optimizer = {"name": "adam", "lr": learning_rate}
if clip_norm is not None:
optimizer["clip_norm"] = clip_norm
# paramax.NonTrainable leaves (fixed rotations) stay out of the optimiser
trainable = jax.tree.map(
eqx.is_inexact_array,
flow,
is_leaf=lambda leaf: isinstance(leaf, paramax.NonTrainable),
)
history = History()
trained, _ = TrainingLoop(
EquinoxModelOp(flow, trainable=trainable),
ArrayDataset(rows(x, train_rows), rows(condition, train_rows)),
val_dataset=ArrayDataset(rows(x, val_rows), rows(condition, val_rows)),
task=FlowNLL(),
optimizer_config=optimizer,
max_steps=max_epochs * steps_per_epoch,
steps_per_epoch=steps_per_epoch,
eval_every_n_steps=steps_per_epoch,
log_every_n_steps=steps_per_epoch,
batch_size=batch_size,
seed=int(jr.randint(loop_key, (), 0, 2**31 - 1)),
callbacks=(
history,
EarlyStopping("loss", patience=max_patience, restore_best=True),
),
).run()
# the mean training loss of each epoch, and the validation loss after it
step_losses = np.array([metrics["loss"] for _, metrics in history.train])
n_epochs = len(step_losses) // steps_per_epoch
epoch_losses = step_losses[: n_epochs * steps_per_epoch].reshape(n_epochs, -1)
val_losses = np.array([metrics["loss"] for _, metrics in history.eval])
return trained.module, {"train": epoch_losses.mean(axis=1), "val": val_losses}flow_cpl_trained, losses = fit_flow(
jr.key(1),
flow_cpl,
X,
learning_rate=3e-4,
max_epochs=20,
max_patience=20,
batch_size=512,
val_prop=0.1,
)
Z_cpl_trained = np.asarray(jax.vmap(flow_cpl_trained.bijection.inverse)(X))
err_trained = np.linalg.norm(Z_cpl_trained - Z_diag, axis=-1)
lp_cpl_trained = np.asarray(jax.vmap(flow_cpl_trained.log_prob)(X))
lp_err_trained = np.abs(lp_cpl_trained - lp_diag)
print("after 20 epochs of coupling-flow training:")
print()
print("pushforward difference ||z_cpl - z_diag||_2")
print(f" median : {np.median(err_trained):.2e}")
print(f" 95th% : {np.percentile(err_trained, 95):.2e}")
print(f" max : {err_trained.max():.2e}")
print()
print("log-prob difference |log p_cpl(x) - log p_diag(x)|")
print(f" median : {np.median(lp_err_trained):.2e}")
print(f" 95th% : {np.percentile(lp_err_trained, 95):.2e}")
print(f" max : {lp_err_trained.max():.2e}")
print()
print(f"mean log-likelihood diagonal (frozen) = {lp_diag.mean():+.3f} nats/sample")
print(
f"mean log-likelihood coupling (trained) = {lp_cpl_trained.mean():+.3f} nats/sample"
)after 20 epochs of coupling-flow training:
pushforward difference ||z_cpl - z_diag||_2
median : 1.47e-01
95th% : 4.57e-01
max : 3.00e+00
log-prob difference |log p_cpl(x) - log p_diag(x)|
median : 5.01e-01
95th% : 1.48e+00
max : 1.06e+01
mean log-likelihood diagonal (frozen) = -2.172 nats/sample
mean log-likelihood coupling (trained) = -1.836 nats/sample
Conditioner kernel after training¶
Same readout as above, but after gradient steps. The zero-init is gone — every coupling now has a nonzero , which means the conditioner is no longer constant-in-.
max_W_trained = [
float(jnp.max(jnp.abs(bij._coupling.conditioner.layers[-1].weight)))
for bij in iter_couplings(flow_cpl_trained)
]
print("max |W| on each coupling's final Dense after training:")
for i, w in enumerate(max_W_trained):
print(f" coupling {i:>2d}: {w:.2e}")
print(f"overall max |W| = {max(max_W_trained):.2e}")max |W| on each coupling's final Dense after training:
coupling 0: 2.86e-02
coupling 1: 3.76e-02
coupling 2: 2.39e-02
coupling 3: 3.89e-02
coupling 4: 2.35e-02
coupling 5: 3.60e-02
coupling 6: 2.61e-02
coupling 7: 3.33e-02
overall max |W| = 3.89e-02
Visualise the divergence¶
Same two panels, after training. Now the overlay shows two visibly different point clouds, and fills a non-trivial region of the plane — the conditioner has learnt cross-dim structure the diagonal flow cannot express.
fig, axes = plt.subplots(1, 2, figsize=(14, 7))
ax = axes[0]
ax.scatter(
Z_diag[:, 0],
Z_diag[:, 1],
s=12,
alpha=0.55,
color=COLOR_DIAG,
label="diagonal (frozen)",
)
ax.scatter(
Z_cpl_trained[:, 0],
Z_cpl_trained[:, 1],
s=5,
alpha=0.35,
color=COLOR_CPL,
label="coupling (trained)",
)
ax.set_xlabel("$z_1$")
ax.set_ylabel("$z_2$")
ax.set_title("Pushforwards overlaid (after training)")
ax.set_xlim(-4, 4)
ax.set_ylim(-4, 4)
ax.legend(loc="upper left", frameon=True)
style_axes(ax, aspect="equal")
ax = axes[1]
delta_trained = Z_cpl_trained - Z_diag
lim = max(0.05, float(np.max(np.abs(delta_trained))) * 1.1)
ax.scatter(delta_trained[:, 0], delta_trained[:, 1], s=10, alpha=0.6, color=COLOR_DELTA)
ax.axhline(0, color="black", linewidth=0.8, alpha=0.6)
ax.axvline(0, color="black", linewidth=0.8, alpha=0.6)
ax.set_xlim(-lim, lim)
ax.set_ylim(-lim, lim)
ax.set_xlabel(r"$\Delta z_1$")
ax.set_ylabel(r"$\Delta z_2$")
ax.set_title(r"$\Delta z$ after training — equivalence is broken")
style_axes(ax, aspect="equal")
plt.show()
Error magnitudes side-by-side¶
One bar chart comparing the pointwise error and log-prob difference, before vs after training. Log scale on the y-axis because the errors span several orders of magnitude across points.
stats = {
"at init (W=0)": (err, lp_err),
"after 20 epochs": (err_trained, lp_err_trained),
}
labels = list(stats.keys())
err_medians = [np.median(stats[k][0]) for k in labels]
err_maxs = [stats[k][0].max() for k in labels]
lp_medians = [np.median(stats[k][1]) for k in labels]
lp_maxs = [stats[k][1].max() for k in labels]
fig, axes = plt.subplots(1, 2, figsize=(14, 5.5))
width = 0.35
x = np.arange(len(labels))
ax = axes[0]
ax.bar(x - width / 2, err_medians, width, label="median", color=palette[0])
ax.bar(x + width / 2, err_maxs, width, label="max", color=palette[1])
ax.set_yscale("log")
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.set_ylabel(r"$\|z_\mathrm{cpl} - z_\mathrm{diag}\|_2$")
ax.set_title("Pushforward error")
ax.legend(loc="upper left", frameon=True)
style_axes(ax)
ax = axes[1]
ax.bar(x - width / 2, lp_medians, width, label="median", color=palette[0])
ax.bar(x + width / 2, lp_maxs, width, label="max", color=palette[1])
ax.set_yscale("log")
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.set_ylabel(r"$|\log p_\mathrm{cpl}(x) - \log p_\mathrm{diag}(x)|$")
ax.set_title("Log-prob error")
ax.legend(loc="upper left", frameon=True)
style_axes(ax)
plt.show()
Takeaways¶
At zero-kernel init the coupling flow is a reparameterisation of a diagonal Gaussianization flow, which itself is the parametric form of RBIG. Three different architectures, one function. Numerically, each block’s EM refit amplifies the float32 rounding difference between the two routes, so after four blocks they agree to a few hundredths in the median rather than to float precision.
The only freedom unused at init is the conditioner’s final kernel . Training lets that kernel grow, which is exactly what turns a diagonal Gaussianization into a genuinely conditional coupling flow.
Practical implication: when using
fit_rbig_coupling, you can think of the first forward pass as “here is RBIG” and of training as “now refine RBIG with cross-dim modulation”. The warm-start doesn’t constrain the eventual model — only the starting point.