# 可逆神经网络

可逆神经网络是一种输入到输出的映射为双射、且其逆映射可微的神经网络，因此该网络能够精确地变换概率密度，并可沿任一方向运行。这种架构将简单的基分布转换为复杂的分布，同时保持似然可闭式求解，从而支持生成建模、密度估计以及数据的无损或可逆变换。

| 关键事实 | 详情 |
|---|---|
| 定义形式 | 流定义 \( x = T(u) \)，其中 \( u \) 来自基分布，\( T \) 是可微双射 <sup>[1](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)</sup> |
| 精确似然 | 密度由变量替换公式得出，无需近似或采样 <sup>[1](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)</sup> |
| 行列式代价 | 一般雅可比行列式的计算代价为 \( O(D^{3}) \)；实用架构通过设计降低此代价，例如耦合层的对数行列式计算为 \( O(D) \)，而连续流的行列式瓶颈为 \( O(D^{2}) \) <sup>[1](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)</sup> |
| 对称代价 | 在 RealNVP 风格的耦合层中，前向与逆向传播的计算代价相同，采样在输入维度上并行化 <sup>[2](https://doi.org/10.48550/arxiv.1605.08803)</sup> |
| 似然基准 | 在 CIFAR-10 上，NITS-CONV 达到 2.97 比特/维度，而 Glow 为 3.35，RealNVP 为 3.49 <sup>[3](https://ar5iv.labs.arxiv.org/html/2206.11172)</sup> |
| 已知失效模式 | 基于耦合的网络在分布外数据上可能在数值上不可逆，导致计算出的似然失去意义 <sup>[4](https://proceedings.mlr.press/v130/behrmann21a/behrmann21a.pdf)</sup> |

## 工作原理

模型定义 \( x = T(u) \)，其中 \( u \) 从简单的基分布中抽取，\( T \) 是可逆可微变换。\( x \) 的密度由变量替换公式给出，

\[ p_{X}(x) = p_{U}(u) \, \bigl| \det J_{T}(u) \bigr|^{-1}, \qquad u = T^{-1}(x), \]

因此评估一个数据点的似然仅需基密度和 \( T \) 在对应潜点处的雅可比行列式。<sup>[1](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)</sup> 训练最大化对数似然，即基对数密度加上对数行列式体积校正项。<sup>[5](https://arxiv.org/html/1908.09257v4)</sup>

实际困难在于行列式。对任意网络计算其代价为维度 \( D \) 下的 \( O(D^{3}) \)，因此可逆架构被约束为使行列式计算廉价。组合 \( K \) 层时，各层的行列式相乘，\( \det J_{T_{2} \circ T_{1}}(u) = \det J_{T_{2}}(T_{1}(u)) \cdot \det J_{T_{1}}(u) \)，因此由廉价层组成的深层网络仍然廉价。<sup>[1](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)</sup> 三角雅可比将对数行列式简化为对角线上的求和，\( \log | \det | = \sum \log | \mathrm{diag} | \)。<sup>[6](https://doi.org/10.48550/arxiv.1807.03039)</sup> 具有仿射耦合和可逆线性层的基于耦合的网络是微分同胚的通用近似器，因此这些约束在原则上不会从根本上限制表达能力。

## 实现方法

主流方案使用耦合层。仿射耦合将输入 \( x \) 分成两块，保持第一块不变而变换第二块，

\[ x'_{1:d} = x_{1:d}, \qquad x'_{d+1:D} = x_{d+1:D} \odot \exp(s(x_{1:d})) + t(x_{1:d}), \]

其中 \( s \) 和 \( t \) 是任意神经网络。雅可比为三角矩阵，其对数行列式为对 \( s \) 输出的简单求和；由于逆过程从不需要求 \( s \) 或 \( t \) 的逆，这些子网络可以任意复杂。<sup>[2](https://doi.org/10.48550/arxiv.1605.08803)</sup><sup> • </sup><sup>[7](https://export.arxiv.org/pdf/2510.09534)</sup> 由于一个耦合层保持部分输入不变，各层以交替模式组合，使每个分量都被更新。<sup>[2](https://doi.org/10.48550/arxiv.1605.08803)</sup>

Glow（Kingma 与 Dhariwal，2018）将每一步组织为 actnorm——一种逐通道缩放和偏置的仿射归一化，以数据相关方式初始化；可逆 \( 1 \times 1 \) 卷积；以及仿射耦合层，以多尺度架构排列。<sup>[6](https://doi.org/10.48550/arxiv.1807.03039)</sup> 训练通过最大似然进行；采样运行逆过程，对耦合层而言其代价与前向过程相同。<sup>[2](https://doi.org/10.48550/arxiv.1605.08803)</sup>

## 起源

NICE（Dinh、Krueger 与 Bengio，2014）以加性耦合和精确似然训练确立了耦合层模板。<sup>[5](https://arxiv.org/html/1908.09257v4)</sup><sup> • </sup><sup>[6](https://doi.org/10.48550/arxiv.1807.03039)</sup> RealNVP（Dinh、Sohl-Dickstein 与 Bengio，2016，arXiv）以仿射耦合扩展了它，给出非体积保持的变换，具备精确似然、采样和潜变量推断。<sup>[2](https://doi.org/10.48550/arxiv.1605.08803)</sup> Glow（Kingma 与 Dhariwal，2018，arXiv）加入了 actnorm 和可学习的可逆 \( 1 \times 1 \) 卷积。<sup>[6](https://doi.org/10.48550/arxiv.1807.03039)</sup> 与此同时，Rezende 与 Mohamed（2015，arXiv）将可逆映射序列引入变分推断，其平面流和径向流的对数行列式可通过矩阵行列式引理在 \( O(D) \) 时间内计算。<sup>[8](https://doi.org/10.48550/arxiv.1505.05770)</sup>

## 变体

**基于耦合的流**（NICE、RealNVP、Glow、Flow++）划分维度并计算精确、廉价的行列式；密度评估和采样都很快。<sup>[1](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)</sup> Flow++（Ho 及其同事，2019，arXiv）以变分去量化和架构设计改进了这一家族。<sup>[9](https://doi.org/10.48550/arxiv.1902.00275)</sup>

**自回归流**逐维分解密度，给出下三角雅可比，其对角线给出行列式；MAF 适合快速密度评估，IAF 适合快速采样，而神经自回归流（Huang 及其同事，2018，arXiv）用在充分条件下构成双射的深度网络替代固定的逐维变换。<sup>[1](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)</sup><sup> • </sup><sup>[10](https://doi.org/10.48550/arxiv.1804.00779)</sup>

**残差可逆网络**（Behrmann 及其同事，2018，arXiv）通过谱归一化强制每个块的利普希茨常数小于一来使标准 ResNet 块可逆，无需维度划分且允许自由形式的雅可比；前向过程是解析的，而逆过程使用不动点迭代，对数行列式因精确计算代价为 \( O(d^{3}) \) 而采用可处理的随机近似。<sup>[11](https://doi.org/10.48550/arxiv.1811.00995)</sup>

**连续流**如 FFJORD 在 ODE 下演化数据，使用 Hutchinson 迹估计器获得无偏的 \( O(D) \) 对数密度估计，架构不受限制；连续时间将行列式瓶颈从 \( O(D^{3}) \) 降至 \( O(D^{2}) \)，代价是需要数值 ODE 求解器。<sup>[12](https://arxiv.org/pdf/1810.01367)</sup>

**流匹配。** 流匹配（Lipman 及其同事，2022，arXiv）通过回归固定条件概率路径的向量场，使连续归一化流无需模拟即可训练；条件流匹配目标在不知道目标场的情况下给出等价梯度，最优传输路径产生更直的轨迹、更快的训练和采样以及更好的泛化。<sup>[13](https://doi.org/10.48550/arxiv.2210.02747)</sup> 相关表述包括小批量最优传输（Tong 及其同事，2023，arXiv）、随机插值（Albergo 与 Vanden-Eijnden，2022，arXiv）和整流流（Liu、Gong 与 Liu，2022，arXiv）。<sup>[14](https://doi.org/10.48550/arxiv.2302.00482)</sup><sup> • </sup><sup>[15](https://doi.org/10.48550/arxiv.2209.15571)</sup><sup> • </sup><sup>[16](https://doi.org/10.48550/arxiv.2209.03003)</sup> 在架构方面，BiFlow（Lu 及其同事，2025，arXiv）学习一个单独的反向模型，使前向流无需精确解析逆，提高了 ImageNet 生成质量，同时相比因果解码将采样加速最多两个数量级，而因果解码这一瓶颈同样影响基于 Transformer 的自回归流如 TARFlow。<sup>[17](https://doi.org/10.48550/arxiv.2512.10953)</sup>

## 应用

除图像合成外，已发表的用途包括噪声、视频、音频和图生成，以及物理问题。<sup>[5](https://arxiv.org/html/1908.09257v4)</sup> 对于贝叶斯逆问题，Ardizzone 及其同事（2018，arXiv）用 RealNVP 风格耦合块构建 INN，将完整后验 \( p(x \mid y) \) 表示为具有高斯形潜变量的确定性函数 \( x = g(y, z) \)，在医学和天体物理的校准误差上匹配或超越 cVAE、cVAE-IAF、Dropout 和 ABC，双向训练效果最佳。<sup>[18](https://doi.org/10.48550/arxiv.1808.04730)</sup> BayesFlow（Radev 及其同事，2020，[IEEE Transactions on Neural Networks and Learning Systems](https://www.edgepedia.org/zh/ieee-transactions-on-neural-networks-and-learning-systems)）将汇总网络与条件归一化流耦合，用于从模拟数据进行摊销[贝叶斯推断](https://www.edgepedia.org/zh/bayesian-inference)。<sup>[19](https://doi.org/10.1109/tnnls.2020.3042395)</sup> INN 也被应用于流行病学、光学、地球物理和油藏工程中的逆问题，通过将计算转移到训练阶段，它们可以超越需要反复计算似然的 MCMC。<sup>[20](https://arxiv.org/pdf/2602.20480)</sup> 对于无损压缩，iVPF 在毫秒级完成压缩，而 bits-back 编码将约 90% 的延迟花在编码操作上。<sup>[21](https://openaccess.thecvf.com/content/CVPR2021/papers/Zhang_iVPF_Numerical_Invertible_Volume_Preserving_Flow_for_Efficient_Lossless_Compression_CVPR_2021_paper.pdf)</sup> FMPE（Dax 及其同事，2023，arXiv）使用连续流和无约束架构进行基于模拟的推断，相比同类离散流，训练时间减少 30%，引力波推断精度提高。<sup>[22](https://doi.org/10.48550/arxiv.2305.17161)</sup> 《自然·机器智能》2026 年的一篇综述梳理了流匹配在小分子、蛋白质和 DNA/RNA 的生物分子建模以及单细胞和多细胞建模中的应用，包括用于单细胞表型建模的 CellFlow（Klein 及其同事，2025，bioRxiv）。<sup>[23](https://www.nature.com/articles/s42256-026-01220-0)</sup><sup> • </sup><sup>[24](https://doi.org/10.1101/2025.04.11.648220)</sup>

## 局限与替代方案

**逆爆炸。** 基于耦合的 INN 在分布外数据上可能在数值上不可逆，因此在那里计算的似然没有意义，因为变量替换公式不再适用。在 CIFAR-10 实验中，残差流始终稳定可逆，而 Glow 在除 SVHN 外的所有分布外数据集上不可逆，因此基于 Glow 似然的异常检测可能不可靠。最大似然目标本身有帮助，因为最小化负对数似然最大化雅可比奇异值对数之和，显式正则化器可缓解不稳定性。<sup>[4](https://proceedings.mlr.press/v130/behrmann21a/behrmann21a.pdf)</sup>

**拓扑与内存。** 严格双射性强制输入、输出和所有中间空间共享维度和拓扑，当目标分布与光滑基密度结构不同时构成约束。<sup>[25](https://ar5iv.labs.arxiv.org/html/2309.04433)</sup> 仿射耦合模型因逆爆炸而不适合节省内存的梯度计算，i-ResNet 则因求逆需要昂贵的不动点迭代而不适合。<sup>[4](https://proceedings.mlr.press/v130/behrmann21a/behrmann21a.pdf)</sup>

**替代方案。** 普通流和 VAE 都在单次网络传递中采样，流给出精确似然。随机和扩散归一化流通过噪声增加表达能力但失去精确似然；扩散归一化流需要 MCMC 采样，尽管离散化步骤比扩散概率模型少。<sup>[25](https://ar5iv.labs.arxiv.org/html/2309.04433)</sup> 具有块三角传输映射的流匹配后验采样器完全避免可逆性约束，同时在 2-Wasserstein 距离中带有渐近一致性保证。<sup>[7](https://export.arxiv.org/pdf/2510.09534)</sup>

## References

1. [Normalizing Flows for Probabilistic Modeling and Inference (JMLR)](http://www.jmlr.org/papers/volume22/19-1028/19-1028.pdf)
2. [Dinh, Laurent, Sohl-Dickstein, Jascha, Bengio, Samy (2016). Density Estimation Using Real NVP. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1605.08803)
3. [Neural Inverse Transform Sampler (NITS)](https://ar5iv.labs.arxiv.org/html/2206.11172)
4. [Understanding and Mitigating Exploding Inverses in Invertible Neural Networks](https://proceedings.mlr.press/v130/behrmann21a/behrmann21a.pdf)
5. [Normalizing Flows: An Introduction and Review of Current Methods](https://arxiv.org/html/1908.09257v4)
6. [Kingma, Diederik P., Dhariwal, Prafulla (2018). Glow: Generative Flow with Invertible 1x1 Convolutions. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1807.03039)
7. [Conditional Flow Matching for Bayesian Posterior Inference](https://export.arxiv.org/pdf/2510.09534)
8. [Rezende, Danilo Jimenez, Mohamed, Shakir (2015). Variational Inference with Normalizing Flows. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1505.05770)
9. [Ho, Jonathan and colleagues (2019). Flow++: Improving Flow-Based Generative Models with Variational Dequantization and Architecture Design. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1902.00275)
10. [Huang, Chin-Wei and colleagues (2018). Neural Autoregressive Flows. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1804.00779)
11. [Behrmann, Jens and colleagues (2018). Invertible Residual Networks. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1811.00995)
12. [FFJORD: Free-form Jacobian of Reversible Dynamics](https://arxiv.org/pdf/1810.01367)
13. [Lipman, Yaron and colleagues (2022). Flow Matching for Generative Modeling. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2210.02747)
14. [Tong, Alexander and colleagues (2023). Improving and generalizing flow-based generative models with minibatch optimal transport. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2302.00482)
15. [Albergo, Michael S., Vanden-Eijnden, Eric (2022). Building Normalizing Flows with Stochastic Interpolants. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2209.15571)
16. [Liu, Xingchao, Gong, Chengyue, Liu, Qiang (2022). Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2209.03003)
17. [Lu, Yiyang and colleagues (2025). Bidirectional Normalizing Flow: From Data to Noise and Back. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2512.10953)
18. [Ardizzone, Lynton and colleagues (2018). Analyzing Inverse Problems with Invertible Neural Networks. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1808.04730)
19. [Stefan T. Radev and colleagues (2020). BayesFlow: Learning Complex Stochastic Models With Invertible Neural Networks. IEEE Transactions on Neural Networks and Learning Systems.](https://doi.org/10.1109/tnnls.2020.3042395)
20. [Revisiting invertible neural networks and normalizing flows: theory and practice (arXiv preprint)](https://arxiv.org/pdf/2602.20480)
21. [iVPF: Numerical Invertible Volume Preserving Flow for Efficient Lossless Compression (CVPR 2021)](https://openaccess.thecvf.com/content/CVPR2021/papers/Zhang_iVPF_Numerical_Invertible_Volume_Preserving_Flow_for_Efficient_Lossless_Compression_CVPR_2021_paper.pdf)
22. [Dax, Maximilian and colleagues (2023). Flow Matching for Scalable Simulation-Based Inference. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2305.17161)
23. [Flow matching for generative modelling in bioinformatics and computational biology (Nature Machine Intelligence review)](https://www.nature.com/articles/s42256-026-01220-0)
24. [Dominik Klein and colleagues (2025). CellFlow enables generative single-cell phenotype modeling with flow matching. bioRxiv (Cold Spring Harbor Laboratory).](https://doi.org/10.1101/2025.04.11.648220)
25. [Variations and Relaxations of Normalizing Flows](https://ar5iv.labs.arxiv.org/html/2309.04433)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Titles I to Z

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/invertible-neural-network

English original: https://www.edgepedia.org/invertible-neural-network
