OMPILOT: Harnessing Transformer Models for Auto Parallelization to Shared Memory Computing Paradigms

Arijit Bhattacharjee, Ali TehraniJamsaz, Le Chen, Niranjan Hasabnis, Mihai Capota, Nesreen K. Ahmed, Ali JannesariarXiv 2025 · DOI

Introduction

As the era of single-core processor scaling reaches its limits, the burden of performance gains has shifted to parallel programming. OpenMP remains the gold standard for shared-memory parallelism in C++, utilizing compiler directives (#pragma) to distribute workloads across multi-core architectures. However, manual parallelization is fraught with complexity; developers must navigate intricate loop-carried dependencies and synchronization issues to avoid race conditions.

Traditional auto-parallelization tools, such as those built into GCC or LLVM, are often too conservative, missing optimization opportunities due to rigid rule sets. Conversely, modern Large Language Models (LLMs) introduce a different set of challenges. They are highly sensitive to natural language prompts and often produce conversational filler or inconsistent code. Furthermore, standard evaluation metrics like BLEU or CodeBLEU fail to capture the semantic criticality of OpenMP directives, where a single missing reduction clause can render a program incorrect despite high textual similarity.

Listing 1: OpenAI o3-mini Prompt Sensitivity illustrates how slight variations in natural language prompts can lead to inconsistent OpenMP parallelization results in general-purpose LLMs.

The OMPILOT Architecture

To address these limitations, the authors present OMPILOT, a specialized 0.8B parameter encoder-decoder transformer designed specifically for C++ to OpenMP translation. Unlike general-purpose models, OMPILOT operates without a natural language prompt layer, directly mapping sequential code to its parallelized counterpart. This design choice eliminates prompt sensitivity and significantly reduces computational overhead.

The OMPILOT training and inference pipeline, featuring unsupervised pre-training with novel syntax annotation and supervised fine-tuning, followed by evaluation using the OMPBLEU metric.

The model's training regimen incorporates several key innovations:

  • Syntax Structure Annotation (SSA): By leveraging Abstract Syntax Trees (ASTs), the model explicitly tags OpenMP constructs. This helps the transformer internalize code hierarchy and variable scoping rules essential for correct parallelization.
  • Weighted Token Cross-Entropy Loss: Recognizing that OpenMP keywords are sparse in typical codebases, the authors implemented a custom loss function. This function disproportionately penalizes errors on critical tokens like pragma, parallel, and reduction, forcing the model to prioritize parallel semantics over generic syntax.
  • Pre-training Tasks: The model utilizes Masked Language Modeling (MLM) and Denoising Auto-Encoding (DAE) to build a robust understanding of C++ structure before fine-tuning on parallelization tasks.

OMPBLEU: A Semantic-Aware Metric

A core contribution of this work is OMPBLEU, a composite metric tailored for the rigors of High-Performance Computing (HPC). Standard metrics often assign high scores to code that is textually similar but semantically broken. OMPBLEU evaluates eight distinct factors to ensure functional correctness:

  1. Weighted Clause Importance: Prioritizes critical clauses like reduction.
  2. Variable Usage Consistency: Ensures variables are scoped correctly (e.g., private vs. shared).
  3. Pragma Location: Verifies that directives are attached to the appropriate loops.
  4. Compilability: Checks if the generated code is syntactically valid for a compiler.

This metric provides a much higher correlation with actual program correctness than traditional NLP-based scores.

Experimental Results and Performance

OMPILOT was trained on a filtered version of the StackV2 C++ dataset, comprising 150,000 unpaired OpenMP functions. Evaluation was conducted on a specialized dataset from Lawrence Livermore National Laboratory (LLNL) and the XSBench proxy application.

Accuracy and Clause Detection

OMPILOT achieved an OMPBLEU score of 79.17, significantly outperforming much larger models. For comparison, OpenAI’s o3-mini scored 72.23, while Codestral 22B and StarCoder2 15B trailed at 68.39 and 65.58, respectively. Crucially, OMPILOT correctly identified 67% of critical OpenMP clauses, a task where baseline models frequently failed.

Efficiency and Real-World Speedup

The lightweight nature of the 0.8B parameter model translates to massive efficiency gains. OMPILOT’s inference is approximately 28x faster than larger general-purpose models, consuming only 1.96 Wh of energy compared to up to 140 Wh for competitors.

In real-world testing on the XSBench benchmark, OMPILOT-generated code achieved a 12.3x speedup on 32 threads. This surpasses the performance of code generated by o3-mini (10.9x) and Qwen2.5-Coder (8.7x), demonstrating that domain-specific optimization can yield superior runtime performance.

Conclusion

OMPILOT demonstrates that for specialized tasks like auto-parallelization, smaller, targeted models can outperform massive, general-purpose LLMs. By removing the prompt bottleneck and introducing semantic-aware training and evaluation (OMPBLEU), the authors provide a scalable path forward for automating HPC development. Future work will focus on expanding the library of supported OpenMP clauses and addressing the scarcity of high-quality paired datasets for parallel programming.

Summary updated

BibTeX
@misc{bhattacharjee2025ompilot,
  author = {Arijit Bhattacharjee and Ali TehraniJamsaz and Le Chen and Niranjan Hasabnis and Mihai Capota and Nesreen K. Ahmed and Ali Jannesari},
  title = {{OMPILOT: Harnessing Transformer Models for Auto Parallelization to Shared Memory Computing Paradigms}},
  year = {2025},
  eprint = {2511.03866},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.03866},
}
Figure