NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

TLP: A Deep Learning-Based Cost Model for Tensor Program Tuning

Yi Zhai, Yu Zhang, Shuo Liu, Xiaomeng Chu, Jie Peng, Jianmin Ji, Yanyong Zhang

Optimizing deep learning models for specific hardware is a high-stakes game of hide-and-seek. To make a model run fast, compilers must search through millions of possible "schedules"—different ways to tile, fuse, or reorder computations. Traditionally, this process is agonizingly slow because measuring the actual speed of every candidate on real hardware is expensive.

In their paper, "TLP: A Deep Learning-based Cost Model for Tensor Program Tuning," researchers from the University of Science and Technology of China introduce a paradigm shift. Instead of analyzing the resulting code, they treat the optimization instructions themselves as a language, applying Natural Language Processing (NLP) techniques to predict performance with unprecedented speed and accuracy.

TL;DR

TLP transforms tensor program tuning into an NLP regression task by extracting features directly from schedule primitives rather than source code. By combining this approach with Multi-Task Learning (MTL-TLP), the authors achieve up to a 16.7x speedup in hardware-specific tuning and enable effective performance prediction across different platforms using only a fraction of the target data.

What Problem Does This Paper Address?

Deep learning compilers like TVM use "cost models" to predict how fast a specific version of a program will run. However, current models face two major hurdles:

  1. Brittle Feature Engineering: Most models rely on experts to manually pick features from the program's source code or Abstract Syntax Tree (AST). This is laborious and often fails to capture the nuances of different hardware like CPUs vs. GPUs.
  2. Cross-Hardware Unavailability: A model trained to predict performance on an Intel CPU is often useless for an ARM CPU or an NVIDIA GPU. Collecting enough data to train a new model for every new piece of hardware is prohibitively time-consuming.

Methods

The authors propose TLP (Tensor Language Processing). The key insight is that the "schedule primitives"—commands like split, reorder, and fuse that tell the compiler how to transform code—contain all the necessary information to predict performance.

Figure 2: Subgraph, a fused dense + ReLU activation, applies combinations of different schedule primitives to generate tensor programs.

TLP Feature Extraction

Instead of complex code analysis, TLP uses a simple, dense encoding for these primitives:

  • Primitive Type: Encoded as a one-hot vector.
  • Numeric Parameters: Raw values (e.g., tiling factors).
  • Character Parameters: Mapped to tokens, similar to words in NLP.
Figure 4: The specification of TLP feature extraction.

This sequence of encoded primitives is fed into a neural network "backbone" (using Self-Attention or LSTM) to capture contextual relationships, followed by residual blocks to predict a normalized latency score.

MTL-TLP (Multi-Task Learning)

To solve the cross-hardware problem, the authors use Multi-Task Learning. They design a model with a shared backbone that learns hardware-independent performance patterns and multiple "heads," each dedicated to a specific hardware platform. This allows the model to leverage massive datasets from "source" hardware to improve predictions on a "target" platform where data is scarce.

Datasets

The study utilizes two primary datasets:

  • TenSet: A massive open-source dataset containing 51.57 million tensor programs and their latencies across 6 hardware platforms (various Intel, AMD, and ARM CPUs, plus NVIDIA GPUs).
  • TenSet-TLP: A new dataset collected by the authors specifically for this work, featuring ~8.65 million data points from an Intel i7-10510U CPU.

Key Insights and Ideas

  • Primitives as the "Source of Truth": The shift from analyzing what the code is to how it's being optimized is the paper's "aha moment." Schedule primitives are a much more direct and less noisy representation of optimization intent than raw source code.
  • Density Over Sparsity: Code-based features are often sparse and high-dimensional. TLP’s primitive-based features are dense and information-rich, making them significantly easier for neural networks to process.
  • Compiler-Inspired Architecture: MTL-TLP mirrors the design of modern compilers. Just as compilers have high-level (hardware-independent) and low-level (hardware-dependent) intermediate representations, MTL-TLP uses shared and task-specific parameters to capture these distinct layers of performance.
  • Extreme Data Efficiency: Perhaps most impressively, MTL-TLP can outperform state-of-the-art models on new hardware using only 7% of the target data. This drastically lowers the cost of supporting new hardware architectures.

Key Results

The authors integrated TLP into the popular Ansor tuning framework and found:

  • Search Speedup: TLP speeds up the average search time by 9.1x on CPU and 3.0x on GPU compared to the previous state-of-the-art (TenSet MLP).
  • End-to-End Efficiency: Compared to the standard Ansor framework, TLP is 16.7x faster on CPU and 16.0x faster on GPU at finding high-performance programs.
  • Inference Speed: TLP is roughly 1.7x to 1.8x faster at making predictions than TenSet MLP because it bypasses the need to generate full tensor program source code during the search process.

Limitations and Future Work

While MTL-TLP is highly efficient, the authors note that collecting even the "small" amount of data required (500k points) still takes tens of hours on a single machine. Reducing this cold-start time further is a key area for future research.

Additionally, now that tensor tuning is framed as an NLP task, the authors suggest that even more powerful NLP techniques—such as pre-trained Transformers or large language models—could be applied to further push the boundaries of automated code optimization.

Summary updated

BibTeX
@inproceedings{zhai2023tlp,
  author = {Yi Zhai and Yu Zhang and Shuo Liu and Xiaomeng Chu and Jie Peng and Jianmin Ji and Yanyong Zhang},
  title = {{TLP: A Deep Learning-Based Cost Model for Tensor Program Tuning}},
  booktitle = {ASPLOS},
  year = {2023},
  doi = {10.1145/3575693.3575737},
}
Figure