NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

IRCoder: Intermediate Representations Make Language Models Robust Multilingual Code Generators

Indraneil Paul, Goran Glavas, Iryna Gurevych

Abstract

Large Language Models for code (Code-LMs) often struggle with the "curse of multilinguality," where performance on low-resource programming languages lags significantly behind dominant languages like Python or Java. This paper introduces IRCoder, a family of models that addresses this gap by grounding source code in compiler Intermediate Representations (IR). By leveraging LLVM IR as a language-agnostic "interlingua," IRCoder achieves superior cross-lingual transfer, enhanced robustness to syntactic perturbations, and improved performance across a wide array of coding tasks.

Introduction

While state-of-the-art Code-LMs such as DeepSeekCoder and StarCoder demonstrate impressive capabilities, their training data is heavily skewed toward a handful of popular languages. This imbalance hinders the model's ability to generalize logic across different syntaxes—a challenge known as cross-lingual transfer. Current models primarily learn from raw source code, which is often cluttered with superficial syntactic variations and "syntactic sugar."

IRCoder proposes a shift in training paradigm: instead of treating code as mere text, it treats code as logic grounded in compiler IR. By using LLVM IR, which captures the underlying data flow and control logic of a program regardless of the source language, IRCoder learns a more fundamental representation of computation.

Methodology: IR as the Universal Logic

The core innovation of IRCoder is the use of LLVM IR as a bridge between disparate programming languages. When code is compiled, the compiler translates high-level syntax into a middle-end IR that is platform-independent and language-agnostic. This representation strips away stylistic choices and focuses on the explicit execution logic.

The Training Pipeline

The researchers developed a three-stage pipeline to create IRCoder:

  1. Compilation: Self-contained source code files are compiled into human-readable LLVM IR.
  2. Alignment: Existing state-of-the-art Code-LMs (ranging from 1.1B to 7.3B parameters) undergo continued causal language modeling on these representations.
  3. Grounding: The models are trained on paired data using specific tokens: [Source Code] <s2l> [IR] and [IR] <l2s> [Source Code]. This bidirectional mapping forces the model to translate between high-level syntax and low-level logic, effectively "grounding" the source code in its functional equivalent.

The SLTrans Dataset

To facilitate this training, the authors introduced SLTrans, a massive parallel dataset. SLTrans contains nearly 4 million pairs of source code and corresponding LLVM IR across 12 programming languages, including C, C++, Rust, Go, and Swift. Totaling 26.2 billion tokens, this dataset provides the necessary scale for the model to learn the nuances of how different high-level constructs map to shared logical structures.

Experimental Results

IRCoder was evaluated against several rigorous benchmarks, demonstrating consistent improvements over base models:

  • Multilingual Performance (Multipl-E): IRCoder models showed sizeable gains across the board. Notably, the DeepSeekCoder 1.3B variant achieved a +2.17 point increase in average pass@1 performance.
  • Robustness (ReCode): One of the most significant advantages of IR grounding is robustness. On the ReCode benchmark, which tests performance against "human-like" perturbations (such as changing variable names or reformatting), IRCoder proved far less susceptible to being distracted by superficial changes compared to standard models.
  • Instruction Following (HumanEvalFixDocs): The models demonstrated an improved ability to follow complex instructions, such as fixing bugs based on docstrings, particularly in the larger parameter variants.
  • Code Understanding: Gains were also observed in code-to-text tasks, such as generating commit messages or docstrings (CodeXGLUE & Commit Chronicle), suggesting that IR grounding enhances the model's semantic understanding of the code.

Discussion and Limitations

Despite its successes, the IRCoder approach faces specific challenges:

  • Verbosity: LLVM IR is significantly more verbose than source code, which can consume a large portion of the model's context window and increase computational overhead.
  • Toolchain Dependency: The method relies on a mature compiler toolchain. This limits its immediate applicability to very new languages or those without robust LLVM support.
  • Platform Leaks: While IR is largely platform-agnostic, certain constants (like memory layout details) can occasionally leak into the representation, necessitating careful data cleaning.

Conclusion

IRCoder demonstrates that compiler Intermediate Representations are a powerful tool for overcoming the limitations of syntax-based code modeling. By grounding source code in a shared logical interlingua, IRCoder achieves better cross-lingual transfer and greater robustness to the variations found in real-world code. This work paves the way for more resilient and truly multilingual AI assistants for software engineering.

Summary updated

BibTeX
@inproceedings{paul2024ircoder,
  author = {Indraneil Paul and Goran Glavas and Iryna Gurevych},
  title = {{IRCoder: Intermediate Representations Make Language Models Robust Multilingual Code Generators}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.802},
}
Figure