Automatic Identification of Parallelizable Loops Using Transformer-Based Source Code Representations

Izavan dos S. Correia, Henrique C. T. Santos, Tiago A. E. Ferreira
3/31/2026
cs.SEcs.AI
transformer-attention

No confident code implementation found for this paper.

Abstract

Automatic parallelization remains a challenging problem in software engineering, particularly in identifying code regions where loops can be safely executed in parallel on modern multi-core architectures. Traditional static analysis techniques, such as dependence analysis and polyhedral models, often struggle with irregular or dynamically structured code.

Show full abstract

In this work, we propose a Transformer-based approach to classify the parallelization potential of source code, focusing on distinguishing independent (parallelizable) loops from undefined ones. We adopt DistilBERT to process source code sequences using subword tokenization, enabling the model to capture contextual syntactic and semantic patterns without handcrafted features. The approach is evaluated on a balanced dataset combining synthetically generated loops and manually annotated real-world code, using 10-fold cross-validation and multiple performance metrics. Results show consistently high performance, with mean accuracy above 99\% and low false positive rates, demonstrating robustness and reliability. Compared to prior token-based methods, the proposed approach simplifies preprocessing while improving generalization and maintaining computational efficiency. These findings highlight the potential of lightweight Transformer models for practical identification of parallelization opportunities at the loop level.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{correia2026automatic,
  title  = {Automatic Identification of Parallelizable Loops Using Transformer-Based Source Code Representations},
  author = {Izavan dos S. Correia and Henrique C. T. Santos and Tiago A. E. Ferreira},
  year   = {2026},
  eprint = {2603.30040},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.30040v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2603.30040.svg)](https://codeofpaper.com/paper/2603.30040)

Discussion