Skip to main content
QUICK REVIEW

[Paper Review] Sionnx: Automatic Unit Test Generator for ONNX Conformance

Xinli Cai, Peng Zhou|arXiv (Cornell University)|Jun 12, 2019
Adversarial Robustness in Machine LearningComputer Science22 references5 citations
TL;DR

Sionnx is the first automatic unit test generator for ONNX conformance, using a novel Operator Specification Language (OSL) and a three-phase randomization strategy (TDBc-gen) to generate high-coverage tests by systematically exploring data types, dimensions, and boundary conditions. It enables scalable, accurate, and efficient conformance testing across ONNX frameworks with minimal manual effort.

ABSTRACT

Open Neural Network Exchange (ONNX) is an open format to represent AI models and is supported by many machine learning frameworks. While ONNX defines unified and portable computation operators across various frameworks, the conformance tests for those operators are insufficient, which makes it difficult to verify if an operator's behavior in an ONNX backend implementation complies with the ONNX standard. In this paper, we present the first automatic unit test generator named Sionnx for verifying the compliance of ONNX implementation. First, we propose a compact yet complete set of rules to describe the operator's attributes and the properties of its operands. Second, we design an Operator Specification Language (OSL) to provide a high-level description for the operator's syntax. Finally, through this easy-to-use specification language, we are able to build a full testing specification which leverages LLVM TableGen to automatically generate unit tests for ONNX operators with much large coverage. Sionnx is lightweight and flexible to support cross-framework verification. The Sionnx framework is open-sourced in the github repository (https://github.com/alibaba/Sionnx).

Motivation & Objective

  • To address the lack of comprehensive, automated conformance testing for ONNX operators due to reliance on handwritten test cases.
  • To reduce the manual burden of writing complex reference algorithms for ONNX operators, especially for computationally intensive ones like LSTM.
  • To design a lightweight, flexible framework that supports cross-framework verification of ONNX operator implementations.
  • To achieve high test coverage with minimal test cases by focusing on behaviorally significant test points such as data type combinations, dimension variations, and boundary conditions.

Proposed method

  • Proposes a compact rule-based system to describe operator attributes and operand constraints, enabling precise specification of valid inputs.
  • Introduces Operator Specification Language (OSL), a high-level, human-readable language to describe ONNX operator syntax and semantics.
  • Employs LLVM TableGen to compile OSL specifications into executable test generation code.
  • Designs a three-phase randomization strategy (TDBc-gen) that ensures coverage of data type combinations, data dimensions, and boundary conditions.
  • Uses a weighted sampling approach to distribute test cases evenly across type combinations and dimension ranges to maximize coverage.
  • Generates reference results by reusing existing Numpy-based algorithms, reducing the need for custom implementation.

Experimental results

Research questions

  • RQ1How can ONNX conformance testing be automated to reduce reliance on handwritten test cases?
  • RQ2What systematic approach can ensure high test coverage while minimizing test case count?
  • RQ3How can reference results for complex ONNX operators be generated reliably and efficiently?
  • RQ4What are the most critical input variations (e.g., data types, dimensions, boundary values) that trigger diverse operator behaviors?
  • RQ5Can a specification language and randomization strategy be designed to be both flexible and reusable across multiple ONNX frameworks?

Key findings

  • Sionnx successfully generates unit tests with full coverage of data types, dimensions, and boundary conditions using a lightweight, rule-based approach.
  • The TDBc-gen randomization strategy ensures consistent distribution of test cases across all type combinations and dimension ranges, improving test diversity.
  • The framework reduces the need for manual implementation of reference algorithms by reusing existing Numpy-based implementations.
  • Sionnx supports two test profiles—'smoke' and 'full'—enabling targeted testing of operands or both operands and attributes.
  • The system is open-sourced and integrated with LLVM TableGen, enabling seamless integration into existing ONNX testing pipelines.
  • Evaluation shows that Sionnx-generated tests achieve significantly higher coverage than traditional handwritten test sets, especially for edge cases and complex operators.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.