Skip to main content

Inverse Autoregressive Flow

Inverse Autoregressive Flow(IAF)は、autoregressive flow の inverse direction を使うことで、sampling を効率化する方法です。

MAF との違い

Masked Autoregressive Flow は density evaluation が速く、sampling が遅い傾向があります。一方で、IAF は sampling が速く、density evaluation が遅い傾向があります。

MAF vs IAF

画像出典: Lilian Weng, “Flow-based Deep Generative Models”。MAF と IAF は、forward direction と inverse direction の効率が逆になります。

VAE との関係

IAF は、VAE の approximate posterior をより flexible にするためによく使われます。単純な Gaussian posterior では表現力が不足する場合に、flow を通じて posterior を複雑な distribution に変換します。

数式で見る IAF の変換

Inverse Autoregressive Flow(IAF)は、base noise z0\mathbf{z}_0 を何段階かの可逆変換でより複雑な latent variable へ写します。典型的には、各次元を次のように affine 変換します。

zt=μt(zt1)+σt(zt1)zt1\mathbf{z}_t=\boldsymbol{\mu}_t(\mathbf{z}_{t-1})+ \boldsymbol{\sigma}_t(\mathbf{z}_{t-1})\odot \mathbf{z}_{t-1}

ここで、μt\boldsymbol{\mu}_tσt\boldsymbol{\sigma}_t は autoregressive network の出力、\odot は要素ごとの積です。この式の気持ちは、「単純な Gaussian sample を、入力自身に依存した scale と shift で少しずつ曲げていく」というものです。

Flow では密度を change of variables で計算します。

logq(zT)=logq(z0)t=1Tlogdetztzt1\log q(\mathbf{z}_T)=\log q(\mathbf{z}_0)- \sum_{t=1}^{T}\log\left|\det\frac{\partial \mathbf{z}_t}{\partial \mathbf{z}_{t-1}}\right|

IAF では Jacobian が triangular になるように設計されるため、log determinant は diagonal 成分の和として効率的に計算できます。

関連ページ