Modern software analysis faces a "surface noise" problem. A single algorithm can look entirely different depending on whether it is written in Java or C++, compiled for x86 or ARM, or optimized for speed versus size. Traditional methods that rely on high-level source code or raw assembly often fail to see past these superficial differences. To solve this, researchers have moved toward modeling the "DNA" of a program: its Intermediate Representation (IR).
The Brittle Nature of Syntax
When we analyze code as text, we are distracted by "syntactic sugar"—variable names, formatting, and language-specific keywords. Even early attempts at language-independent detection, such as the character n-gram approach by Barrón-Cedeño et al., treated code as a sequence of symbols to bypass syntax. However, to truly understand a program's behavior, models must capture its underlying logic.
Compilers already solve part of this problem. They translate high-level source code into a standardized IR (like LLVM-IR) before generating machine code. By performing analysis at this level, Ben-Nun et al. demonstrated that models can capture code semantics in a way that outperforms specialized models trained on source code. This abstraction allows a single model to process multiple programming languages uniformly.
Lifting Logic from the Machine
The challenge is even greater for binary files, where the original source code is lost. Different hardware architectures use different instruction sets, making a "sort" function on an ARM processor look nothing like the same function on x86.
To bridge this gap, researchers "lift" binary code into an architecture-agnostic IR. Li et al. utilized a uniform IR of simple arithmetic and logic operations to decouple symbolic execution engines from specific hardware. Similarly, Wang 0226 et al. and Galstyan et al. showed that representing binaries through platform-independent IRs allows models to ignore architecture-specific noise and focus on the functional logic. This is particularly effective for security tasks; for instance, Patrick-Evans et al. found that an IR layer makes binary analysis robust against variations introduced by different compiler optimization levels.
Programs as Graphs of Flow
If the IR provides the vocabulary, the Contextual Flow Graph provides the grammar. Rather than treating code as a linear sequence, modern approaches represent programs as graphs where nodes are IR instructions and edges represent the flow of data and control.
- Data Flow: How values move from one operation to another.
- Control Flow: The logic branches and loops that define execution order.
Cummins et al. introduced ProGraML, which uses these graph-based IR representations to bridge compiler theory and deep learning. By focusing on these flows, models can identify core algorithms regardless of their structural implementation, a concept further refined by Long et al. through multi-view graphs. This structural focus allows Cohen et al. to detect complex code obfuscation that would otherwise fool signature-based tools.
Achieving Cross-Language Generalization
The ultimate goal of IR abstraction is a "zero-shot" capability where a model trained on one language can understand another. By converting code into a unified format like LLVM-IR, Lei et al. and El Karchi et al. have successfully detected vulnerabilities and errors across diverse languages.
The authors of OSCAR (Peng et al.) take this further by leveraging static analysis to capture how a program changes a computer's state. By focusing on these operational semantics, the model learns the fundamental machine operations that remain consistent whether the code was originally written in C++ or Rust. In this framework, the specific programming language becomes a mere detail, while the underlying logic—the true essence of the program—becomes the primary signal.
Key Foundational Work
DeSoCoRe: Detecting Source Code Re-Use across Programming Languages (2012) — contributed 1 concept elements to this direction.
Architecture- and OS-Independent Binary-Level Dynamic Test Generation (2009) — contributed 1 concept elements to this direction.