一句话:提出 Ocelot,将无监督学习实现中的非确定性与不一致性检查归约为 Z3 可满足性求解,并生成见证数据集以复现错误。
无监督学习(UL)实现广泛使用,但常存在非确定性与不一致性问题,且缺乏规约使其难以验证或测试;当同一数据集上结果发散时,错误隐蔽且难以定位。本文提出 Ocelot,将非确定性/不一致性检查归约为 Z3 可满足性求解。给定 UL 实现的 Python 代码,Ocelot 自动分离出非确定性的“内核”(变量与代码片段),并据此构建 Z3 规约;Z3 找到的解作为“见证”数据集,通常很小,可可靠复现错误。Ocelot 在流行实现(Scikit-learn、MATLAB、R)的聚类算法(Affinity Propagation、DBSCAN、HAC、K-means)和异常检测算法(Isolation Forest、Local Outlier Factor)中暴露了非确定性与不一致性来源,并揭示了这些实现演化中的回归(语义变化)。
Unsupervised Learning (UL) implementations are widely used, but prone to issues such as nondeterminism and inconsistency, which makes them unreliable and exploitable. Moreover, the lack of a specification (or ground truth) makes UL implementations hard to verify or test: when they produce diverging results on a dataset, they do so subtly and silently, which gives users a false sense of security, and complicates developers’ job of tracing the error to its root cause. We introduce an approach, Ocelot, that reduces nondeterminism/inconsistency checking to satisfiability checking in Z3. Given the Python code of an UL implementation, Ocelot automatically isolates a nondeterministic “kernel” (variables and code), which forms the basis for a Z3 specification. A Z3-found solution acts as a “witness” dataset – a typically small dataset that can be used to reliably reproduce the error. Ocelot has exposed sources of nondeterminism and inconsistency in popular implementations (Scikit-learn, MATLAB, and R) of well-known Clustering algorithms (Affinity Propagation, DBSCAN, HAC, and K-means) and Anomaly Detection algorithms (Isolation Forest, Local Outlier Factor). Moreover, Ocelot has exposed regressions (changes in semantics) in the evolution of these implementations.