A Hybrid Machine Learning Model for Code Optimization

Yacine Hakimi, Riyadh Baghdadi, Yacine Challal

Research output: Contribution to journalArticlepeer-review


The complexity of programming modern heterogeneous systems raises huge challenges. Over the past two decades, researchers have aimed to alleviate these difficulties by employing classical Machine Learning and Deep Learning techniques within compilers to optimize code automatically. This work presents a novel approach to optimize code using at the same time Classical Machine Learning and Deep Learning techniques by maximizing their benefits while mitigating their drawbacks. Our proposed model extracts features from the code using Deep Learning and then applies Classical Machine Learning to map these features to specific outputs for various tasks. The effectiveness of our model is evaluated on three downstream tasks: device mapping, optimal thread coarsening, and algorithm classification. Our experimental results demonstrate that our model outperforms previous models in device mapping with an average accuracy of 91.60% on two datasets and in optimal thread coarsening task where we are the first to achieve a positive speedup on all four platforms while achieving a comparable result of 91.48% in the algorithm classification task. Notably, our approach yields better results even with a small dataset without requiring a pre-training phase or a complex code representation, offering the advantage of reducing training time and data volume requirements.

Original languageEnglish (US)
Pages (from-to)309-331
Number of pages23
JournalInternational Journal of Parallel Programming
Issue number6
StatePublished - Dec 2023


  • Algorithm classification
  • Code mapping
  • Code optimizations
  • Deep learning
  • Heterogeneous platforms
  • Machine learning
  • Thread coarsening

ASJC Scopus subject areas

  • Software
  • Theoretical Computer Science
  • Information Systems


Dive into the research topics of 'A Hybrid Machine Learning Model for Code Optimization'. Together they form a unique fingerprint.

Cite this