cs.SEMar 31, 2026

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

Authors: Izavan dos S. Correia, Henrique C. T. Santos, Tiago A. E. Ferreira

Organizations: Graduate Program in Applied Informatics (PPGIA), Federal Rural University of Pernambuco (UFRPE), Recife, Pernambuco, Brazil. · Undergraduate Program in Analysis and Systems Development (TADS), Federal Institute of Pernambuco (IFPE), Recife, Pernambuco, Brazil.

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. 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.

Figures & tables

Explore similar work

CardsList
  1. LoopCoder-v2: Only Loop Once for Efficient Test-Time Computation Scaling

    Jun 16, 2026Jian Yang, Shawn Guo, Wei Zhang +16Efficient Transformer InferenceTest-Time Scaling

  2. LoopAhead: Speculating Ahead for Faster Decoding in Looped Language Models

    Oct 15, 2026Zixuan Liu, Nan Xue, Rui Bao +4Speculative DecodingLLM Inference Acceleration

  3. Parallel Recursive LSTM

    May 16, 2026Tristan Gaudreault, Yongyi MaoRecurrent Neural NetworksLanguage Modeling