TL;DR
This paper introduces CrossedWires, a novel dataset and benchmark designed to highlight significant accuracy discrepancies between PyTorch and TensorFlow models, even when they share identical architectures and hyperparameters. This work aims to improve the reproducibility and reliability of deep learning by providing a resource to study framework-induced semantic differences.
What Problem Does This Paper Address?
In the rapidly evolving field of deep learning, researchers and engineers often assume that using the same neural network architecture, hyperparameters, and optimization algorithms across different deep learning frameworks (like PyTorch and TensorFlow) should yield consistent results. However, anecdotal evidence and community discussions suggest this is not always the case. This lack of reproducibility is a significant hurdle, especially as deep learning models are increasingly deployed in critical applications such as safety-critical systems and scientific workflows. The core problem is the absence of a standardized benchmark that systematically quantifies and exposes these framework-dependent performance variations, making it difficult to understand, predict, and mitigate them.
Methods
The authors developed a systematic approach to generate their dataset. They utilized the HyperSpace library for hyperparameter optimization (HPO) and Ray Tune for parallel execution. The HPO strategy was designed to maximize the difference in test set accuracy between PyTorch and TensorFlow models for a given architecture and hyperparameter set. They explored a 4-dimensional hyperparameter space, tuning the learning rate, batch size, number of training epochs, and the epsilon parameter in the Adam optimizer. This methodical search aimed to uncover configurations where framework differences would manifest most strongly. The entire process was orchestrated by their custom SpaceRay library, which integrates HyperSpace and Ray Tune.
Datasets
The primary dataset introduced is CrossedWires. It consists of:
- Models: 2400 total models (1200 each for PyTorch and TensorFlow).
- Architectures: Three popular computer vision architectures: VGG16, ResNet50, and DenseNet121.
- Training Data: The CIFAR-10 image classification dataset.
- Hyperparameter Configurations: 400 unique hyperparameter sets explored for each architecture.
This dataset is unique in its focus on exposing framework-level semantic differences rather than just architectural or algorithmic ones. It includes performance statistics, training curves, and model weights for all generated models.
Key Insights and Ideas
- Frameworks Matter, A Lot: Even with identical architectures and hyperparameters, PyTorch and TensorFlow can produce models with vastly different performance, sometimes differing by over 68%. This highlights that the "semantic" behavior of a model is not solely determined by its code structure but also by the underlying framework's implementation.
- Architecture-Specific Divergence: The degree and nature of the accuracy difference are not uniform across different network architectures. What causes divergence in VGG might not be the same for DenseNet, suggesting that hyperparameter tuning strategies need to be architecture-aware.
- Hyperparameter Sensitivity Varies: Certain hyperparameters, like Adam's epsilon, have a much stronger influence on framework divergence for some architectures (e.g., VGG) than others (e.g., DenseNet). This implies that a "one-size-fits-all" approach to hyperparameter optimization across frameworks and architectures is unlikely to be optimal.
- Reproducibility is a Challenge: The findings underscore the difficulty in achieving true reproducibility in deep learning, as subtle differences in framework implementations can lead to significant performance variations.
Key Results
- The CrossedWires dataset contains 1200 pairs of syntactically identical models (PyTorch vs. TensorFlow) trained on CIFAR-10 using VGG16, ResNet50, and DenseNet121 architectures.
- The maximum observed test accuracy difference between PyTorch and TensorFlow models for identical configurations reached 68.1% for VGG16, 45.2% for ResNet50, and 45.7% for DenseNet121.
- Across all tested configurations, 52.3% of the model pairs diverged by at least 5% in test accuracy.
- Analysis of mutual information revealed that hyperparameters like Adam epsilon and epochs play different roles in driving framework divergence depending on the network architecture.
Limitations and Future Work
- Limited Architectures and Dataset: The current dataset focuses on three specific CNN architectures and the CIFAR-10 dataset. The authors acknowledge that this is a starting point and that extending the dataset to include other model types (e.g., MLPs, Transformers like BERT/GPT) and datasets (e.g., ImageNet, Fashion-MNIST) is crucial.
- Exploration Scope: While a 4-dimensional hyperparameter space was explored, the authors note that larger and more complex hyperparameter spaces might reveal further insights.
- "Living Dataset" Vision: The authors envision CrossedWires as a "living dataset," actively inviting contributions from the community to expand its scope to include more frameworks, datasets, and architectures. This collaborative approach is seen as essential for building more robust and reproducible deep learning models.
- Interoperability Tools: The insights gained could spur the development of tools and algorithms that improve interoperability and reliability across different deep learning frameworks and hardware platforms.
Summary updated