arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2507.23186cs.LGcs.PL
收藏

NaN-Propagation:一种黑盒计算函数中稀疏性检测的新方法

NaN-Propagation: A Novel Method for Sparsity Detection in Black-Box Computational Functions

Massachusetts Institute of Technology(麻省理工学院)

Peter Sharpe

AI总结:

针对黑盒函数稀疏性检测中有限差分法假阴性多的问题,提出利用IEEE 754 NaN污染特性追踪输入输出依赖的NaN-propagation方法,可跨语言运行,实现1.52倍加速并发现更多依赖,优于现有方法。

摘要:

在对函数梯度进行数值计算时,稀疏性检测可通过雅可比着色与压缩实现大幅计算加速。但针对黑盒函数的稀疏性检测技术十分有限,现有基于有限差分的方法会因巧合的零梯度出现假阴性问题。这些假阴性会悄无声息地破坏梯度计算,导致难以诊断的错误。我们提出NaN-propagation(NaN传播)方法,该方法利用IEEE 754非数值(Not-a-Number)值的全域污染特性,通过浮点数值计算追踪输入-输出依赖关系。通过系统性地用NaN污染输入并观测哪些输出变为NaN,该方法重构出保守的稀疏性模式,消除了假阴性的一个主要来源。我们在航空航天机翼重量模型上验证了该方法,实现了1.52倍的加速,同时发现了数十个传统方法遗漏的依赖关系——由于梯度计算通常是优化工作流的瓶颈,这是一项显著的实际改进。该技术利用IEEE 754合规性,可跨编程语言和数学库运行,无需修改现有黑盒代码。此外,通过直接位操作实现的NaN有效载荷编码等高级策略可实现优于线性的时间复杂度,相比现有黑盒稀疏性检测方法带来速度提升。我们还提出了实用算法,以缓解工程应用中常见的分支代码执行带来的挑战。

英文摘要:

When numerically evaluating a function's gradient, sparsity detection can enable substantial computational speedups through Jacobian coloring and compression. However, sparsity detection techniques for black-box functions are limited, and existing finite-difference-based methods suffer from false negatives due to coincidental zero gradients. These false negatives can silently corrupt gradient calculations, leading to difficult-to-diagnose errors. We introduce NaN-propagation, which exploits the universal contamination property of IEEE 754 Not-a-Number values to trace input-output dependencies through floating-point numerical computations. By systematically contaminating inputs with NaN and observing which outputs become NaN, the method reconstructs conservative sparsity patterns that eliminate a major source of false negatives. We demonstrate this approach on an aerospace wing weight model, achieving a 1.52x speedup while uncovering dozens of dependencies missed by conventional methods -- a significant practical improvement since gradient computation is often the bottleneck in optimization workflows. The technique leverages IEEE 754 compliance to work across programming languages and math libraries without requiring modifications to existing black-box codes. Furthermore, advanced strategies such as NaN payload encoding via direct bit manipulation enable faster-than-linear time complexity, yielding speed improvements over existing black-box sparsity detection methods. Practical algorithms are also proposed to mitigate challenges from branching code execution common in engineering applications.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑