[论文解读] Learning Nonlinear Loop Invariants with Gated Continuous Logic Networks (Extended Version)
本文提出门控连续逻辑网络(G-CLNs),一种通过结合门控机制、Dropout 和一种新型分段偏置二次单元(PBQU)激活函数来提升鲁棒性和收敛性的神经架构,以学习通用非线性循环不变量。该方法在 27 个非线性循环不变量问题中解决了 26 个——比先前工作多解决了 3 个问题——且在二次问题上实现了 97.5% 的收敛率,显著优于基线 CLN 模型。
Verifying real-world programs often requires inferring loop invariants with nonlinear constraints. This is especially true in programs that perform many numerical operations, such as control systems for avionics or industrial plants. Recently, data-driven methods for loop invariant inference have shown promise, especially on linear invariants. However, applying data-driven inference to nonlinear loop invariants is challenging due to the large numbers of and magnitudes of high-order terms, the potential for overfitting on a small number of samples, and the large space of possible inequality bounds. In this paper, we introduce a new neural architecture for general SMT learning, the Gated Continuous Logic Network (G-CLN), and apply it to nonlinear loop invariant learning. G-CLNs extend the Continuous Logic Network (CLN) architecture with gating units and dropout, which allow the model to robustly learn general invariants over large numbers of terms. To address overfitting that arises from finite program sampling, we introduce fractional sampling---a sound relaxation of loop semantics to continuous functions that facilitates unbounded sampling on real domain. We additionally design a new CLN activation function, the Piecewise Biased Quadratic Unit (PBQU), for naturally learning tight inequality bounds. We incorporate these methods into a nonlinear loop invariant inference system that can learn general nonlinear loop invariants. We evaluate our system on a benchmark of nonlinear loop invariants and show it solves 26 out of 27 problems, 3 more than prior work, with an average runtime of 53.3 seconds. We further demonstrate the generic learning ability of G-CLNs by solving all 124 problems in the linear Code2Inv benchmark. We also perform a quantitative stability evaluation and show G-CLNs have a convergence rate of $97.5\%$ on quadratic problems, a $39.2\%$ improvement over CLN models.
研究动机与目标
- 解决在真实世界数值程序(尤其是航空电子系统和工业控制系统)中学习非线性循环不变量的挑战。
- 克服数据驱动不变量推断中的局限性,如过拟合、庞大的搜索空间以及弱不等式边界。
- 开发一种通用神经架构,可在不依赖固定公式模板的情况下推断复杂非线性不变量。
- 通过架构创新与采样技术,提升高阶多项式不变量训练的稳定性与收敛性。
- 实现从有限程序轨迹中对非线性不等式约束进行可靠、可扩展且精确的学习。
提出的方法
- 提出门控连续逻辑网络(G-CLNs),一种基于 CLNs 的增强型神经架构,通过引入门控单元、Dropout(特别是项 Dropout)和批量归一化,以提升训练稳定性和泛化能力。
- 提出分数采样(Fractional Sampling),一种对循环语义的合理松弛方法,可在实数域上实现密集且无界的采样,从而缓解因有限整数样本导致的过拟合问题。
- 设计分段偏置二次单元(PBQU),一种自定义激活函数,通过建模分段二次行为,自然地学习紧密的非线性不等式边界。
- 利用 SMT 公式的可微分松弛来通过梯度下降训练 G-CLNs,从而实现从程序轨迹端到端学习逻辑不变量。
- 应用权重归一化与正则化,以防止高阶项在优化过程中占主导地位,避免退化解的出现。
- 将 G-CLN 框架集成到完整的不变量推断系统中,支持非线性循环中的等式与不等式约束。
实验结果
研究问题
- RQ1如何设计一种神经网络架构,使其在不依赖预定义公式模板的前提下,稳健地学习通用非线性循环不变量?
- RQ2何种采样策略能够有效且可靠地从有限程序轨迹中学习非线性不变量,同时避免过拟合?
- RQ3如何构建一种神经激活函数,使其能自然地学习紧密且与验证相关的不等式边界?
- RQ4为实现复杂非线性不变量问题的高收敛率,需要哪些架构与训练改进?
- RQ5所提出方法在可扩展性与准确性方面,相较于先前数据驱动方法,在非线性和线性不变量基准测试中的表现如何?
主要发现
- G-CLN 系统成功解决了基准测试中 27 个非线性循环不变量问题中的 26 个,比先前工作多解决了 3 个问题。
- 分数采样通过在实数域上实现密集采样,使高阶多项式不变量(最高达 6 阶)的学习成为可能。
- 该系统在二次问题上实现了 97.5% 的收敛率,相较于基线 CLN 模型提升了 39.2%。
- 数据归一化与项 Dropout 对防止高阶项主导训练过程以及避免退化解至关重要。
- G-CLN 框架具有良好的泛化能力,在 30 秒内成功解决了 Code2Inv 线性不变量基准中全部 124 个理论上可解的问题。
- 定量稳定性评估表明,门控机制与正则化显著提升了模型收敛性,尤其是在权重初始化不佳的情况下。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。