Overview
To make deep learning models run fast, compilers use Tensor Program Optimization (TPO) to search for the best way to execute mathematical operations on specific hardware. Modern TPO relies on machine learning "cost models" to predict which program configurations will be fastest.
However, training these cost models presents a Catch-22: to build a model that avoids slow hardware measurements, you first need to perform millions of slow hardware measurements to create a training dataset. For a single high-end GPU, this data collection can swallow over 4,000 GPU hours.
BALTO (Biased-diversity-based Active Learning for Tensor program Optimization) reduces the massive cost of training these hardware performance models by 20x. By replacing random sampling with a specialized active learning strategy, it achieves state-of-the-art optimization results using only 5% of the typical hardware measurements.
The "Sea of Slowness" Problem
The authors identify a key inefficiency in existing TPO datasets: random sampling produces a massive redundancy of low-performance programs. High-performance programs are rare (often <10% of the search space). Models trained on this randomly sampled data become experts at predicting slow programs but struggle to distinguish between "good" and "great" ones.
Because model accuracy isn't just about the raw number of samples, but the distribution of those samples, forcing a balanced distribution of performance levels allows a model to learn more from 50,000 carefully chosen samples than random sampling learns from 1,000,000.
The BALTO Framework
The core of BALTO is an Active Learning (AL) framework. Instead of measuring programs at random, BALTO iteratively selects the most "informative" programs to measure on actual hardware.
The authors introduce specific innovations to make AL work effectively for TPO:
- Output-Diversity-Based Selection: Standard AL often looks for diversity in input features. BALTO instead prioritizes diversity in predicted performance, ensuring the model sees a wide range of execution speeds rather than just a cluster of slow programs.
- Biased-Diversity Scheme: Early in training, models often suffer from "performance overestimation" because they haven't seen the true hardware limits yet. If you use a naive active learning approach, this overestimation leads the model to pick the wrong samples, stalling the learning process. To fix this, BALTO uses a weighted selection (based on a greedy k-center algorithm) that "biases" the search toward programs predicted to be high-performing.
- Adaptive Switching: The system uses KL-divergence to monitor the distribution of measured programs. It automatically switches between "biased" selection (to find high-performance regions) and "standard" diversity selection (to refine the model overall) as training progresses.
Datasets and Evaluation
The researchers evaluated BALTO using the TenSet dataset, which contains approximately 8.6 million performance records across six diverse hardware platforms, including NVIDIA GPUs (T4, K80) and various CPUs (Intel Platinum, AMD EPYC, ARM Graviton2). For end-to-end evaluation, they tested on five popular neural networks: ResNet-50, MobileNet-v2, ResNext-50, BERT-tiny, and BERT-base.
Key Results
- 20x Data Reduction: BALTO achieves the same (or better) model accuracy as the state-of-the-art TenSet baseline while requiring only 5% of the hardware measurements.
- Superior Optimization: On an NVIDIA T4 GPU, the tensor programs optimized by BALTO actually outperformed those from TenSet by 1.06%, proving that a more efficient training process can lead to better end-results due to higher model accuracy in critical regions.
- Generalization: The approach proved effective across different ML architectures (XGBoost and MLP) and vastly different hardware types (from x86 CPUs to ARM and NVIDIA GPUs).
- Integration: When integrated with MetaScheduler (a popular TPO framework), BALTO reduced pre-training overhead by 20x and single-task optimization time by 10x.
Limitations and Future Work
While BALTO significantly optimizes the "pre-training" phase (building a model before optimizing a specific network), the authors note that these techniques could also be applied to "online-trained" models—models that learn on-the-fly during a single optimization run. Additionally, while the selection algorithm is computationally efficient, it adds a small layer of complexity to the compiler pipeline compared to simple random sampling. Future work may explore even more sophisticated acquisition functions to further bridge the gap between predicted and actual hardware performance.
Summary updated