Ariadne: Analysis for Machine Learning Program

Julian Dolby, Avraham Shinnar, Allison Allain, Jenna M. Reinen

Abstract

Machine learning (ML) development in Python often suffers from "silent" bugs—logical errors that do not cause crashes but lead to scientifically invalid results. This paper presents Ariadne, a static analysis tool built on the WALA framework. Ariadne introduces a specialized tensor type system to track dimensions, sizes, and semantic labels, allowing it to verify the logical consistency of operations like reshape and conv2d. Preliminary evaluations on six TensorFlow programs demonstrate that Ariadne can efficiently verify complex data flows and catch subtle errors without false positives.

Introduction

Machine learning development is currently dominated by Python, a dynamic language that prioritizes speed of development over strict error checking. This creates a unique danger: ML code is statistical by nature. If a developer swaps the height and width dimensions of a tensor, the code might not crash; instead, it will "successfully" run and produce plausible-looking but completely meaningless results. In fields like clinical neuroscience, where ML is used to identify diseases from brain scans, these silent errors can lead to false discoveries. Ariadne aims to bridge this gap by bringing "whole-program" analysis to the flexible world of TensorFlow and Python.

Methodology

Ariadne builds upon IBM’s WALA (Watson Libraries for Analysis) framework. Its architecture includes several novel components:

  • Python Front-End: Support for Python is achieved by using Jython to generate Abstract Syntax Trees (ASTs), which are then translated into WALA’s internal representation (IR).
  • Tensor Type System: A formal system tracks tensor dimensions, numeric sizes, and semantic labels (e.g., "batch," "height," "channel"). This allows the tool to detect if data is being misinterpreted even if the mathematical dimensions match (e.g., swapping two dimensions of size 28).
  • Library Modeling: Since analyzing the entire TensorFlow source code is impractical, "Synthetic IR" (modeled via XML) describes how TensorFlow functions transform tensor types.
  • Dataflow Analysis: Ariadne tracks tensors through variables, function calls, and heap objects to ensure API requirements (e.g., "this convolution needs a 4D input") match actual data.

Evaluation

The researchers evaluated Ariadne on six representative TensorFlow programs, ranging from standard MNIST classifiers to real-world neuroimaging scripts used for 3D fMRI brain scans.

Table 1: Coverage of TensorFlow operations across the evaluation dataset.

As shown in Table 1, the evaluation covered a variety of critical operations including reshape, conv2d, conv3d, and placeholder (labeled as place). The tool successfully verified the correct usage of these operations across all test programs with no false positives. Notably, the analysis for each program took only a few seconds on a standard laptop, suggesting high viability for integration into developer IDEs. Ariadne's ability to track dimensions symbolically allows it to verify operations even when runtime parameters like batch size are unknown.

Conclusion

While currently limited to a subset of the TensorFlow API, Ariadne demonstrates the potential for static analysis to bring order to the "Wild West" of ML development. By catching logical swaps and verifying symbolic dimensions, it provides a safety net for researchers in high-stakes fields. Future work will expand the library modeling and type system to handle more complex Python structures and a broader range of ML frameworks.

Summary updated

BibTeX
@inproceedings{dolby2018ariadne,
  author = {Julian Dolby and Avraham Shinnar and Allison Allain and Jenna M. Reinen},
  title = {{Ariadne: Analysis for Machine Learning Program}},
  booktitle = {MAPL@PLDI},
  year = {2018},
  url = {https://openreview.net/forum?id=HRapZG13NRq},
}
Figure