Combining Learning and Optimization for Transprecision Computing

Andrea Borghesi, Giuseppe Tagliavini, Michele Lombardi, Luca Benini, Michela Milano · DOI

Introduction

In the era of green computing, energy efficiency is a primary design constraint. Transprecision computing has emerged as a promising paradigm to address this, based on the observation that many applications—ranging from signal processing to financial modeling—do not require high-precision floating-point arithmetic for every intermediate calculation. By strategically reducing the bit-width of specific variables (e.g., from 64-bit to 16-bit or 8-bit), significant gains in execution speed and energy savings can be realized.

However, the "precision-tuning problem" is notoriously difficult. For a program with dozens of variables, the search space of possible bit-width configurations is astronomical. Furthermore, the relationship between bit-width and the final output error is often non-linear, non-smooth, and non-monotonic, making traditional optimization techniques like gradient descent inapplicable. Static analysis often proves too conservative, while simple heuristics frequently fail to find the most efficient configurations.

The SmartFPTuner Framework

To overcome these challenges, researchers from the University of Bologna developed SmartFPTuner, a hybrid framework that combines Machine Learning (ML) with Mathematical Programming (MP). This approach leverages Empirical Model Learning (EML) to bridge the gap between data-driven error modeling and formal optimization.

The SmartFPTuner framework combines ML models with an MP solver for iterative refinement.

The framework operates in three main stages:

  1. Characterizing Error with ML: Instead of deriving complex analytical error bounds, the system "learns" the error behavior using two distinct models. A Decision Tree Classifier ($ML_C$) is trained to identify "catastrophic" configurations—those that lead to runtime failures like overflows or divisions by zero. Simultaneously, a Neural Network Regressor ($ML_R$) predicts the magnitude of the numerical error for valid configurations.
  2. Optimization via Mathematical Programming: These ML models are embedded directly into an MP solver as constraints. The solver then searches for the configuration that minimizes the total bit-width (a proxy for energy and area) while ensuring the predicted error remains below a user-defined target ($E_{target}$).
  3. Refinement (SmartFPTuner+): To ensure the highest quality solutions, the authors introduced a refinement phase. This phase uses a localized search algorithm to "polish" the output of the MP solver, correcting for any minor inaccuracies in the ML models' predictions.

Key Innovations and Insights

A critical challenge in training the regressor was the vast range of error magnitudes, which can span from $10^{-1}$ to $10^{-20}$. Standard ML models struggle to distinguish between such small values. The authors addressed this by training the models on the negative logarithm of the error. This log-scaling magnifies small differences, allowing the Neural Network to become highly sensitive to the fine-grained precision requirements of the application.

Log-scaling the error allows the ML models to better distinguish between high-precision configurations.

Additionally, the framework incorporates structural pruning. By analyzing the program's dependency graph, the authors added logical constraints to the MP model. For instance, if a variable $A$ is assigned to variable $B$, the optimizer is constrained such that $A$ does not have a higher precision than $B$. This domain-specific knowledge significantly reduces the search space, accelerating the optimization process.

Experimental Results

The researchers evaluated SmartFPTuner across seven numerical benchmarks, including the Fast Walsh Transform (FWT), Black-Scholes option pricing, and Jacobi 2D heat grids. Training data was generated using Latin Hypercube Sampling (LHS) to ensure a diverse and representative dataset for the ML models.

The results demonstrate the framework's efficiency and effectiveness:

  • Speed: The base SmartFPTuner achieved a 55% reduction in solution time compared to state-of-the-art (SoA) tuning tools.
  • Quality: The extended SmartFPTuner+ outperformed SoA tools in solution quality by 3% while maintaining a 6.5% average execution speedup.
  • Hardware Impact: When deployed on the PULPissimo platform—an ultra-low-power RISC-V architecture—the optimized configurations resulted in energy savings of approximately 40% compared to standard fixed-precision execution.

Conclusion and Future Directions

SmartFPTuner represents a significant step forward in automated precision tuning by successfully integrating ML-based error modeling into a formal optimization loop. While the current approach assumes a single representative input set, it demonstrates remarkable robustness and transfer learning potential. Future work will focus on generalizing the models across multiple input samples and scaling the framework to handle large-scale, complex software systems.

Summary updated

BibTeX
@inproceedings{borghesi2020combining,
  author = {Andrea Borghesi and Giuseppe Tagliavini and Michele Lombardi and Luca Benini and Michela Milano},
  title = {{Combining Learning and Optimization for Transprecision Computing}},
  booktitle = {CF},
  year = {2020},
  doi = {10.1145/3387902.3392615},
}
Figure