arXiv:2610.26906cs.CROct 2026

Manuscript Offprint

arXiv:2610.26906

InterType: Breaking the Single-Function Barrier in Neural Binary Type Inference

Shan Wang, Tianming Cui, Stephen McCamant, Antonia Zhai, Pen-Chung Yew

Shan Wang

University of Minnesota Twin Cities

Minneapolis, MN, USA

wang5692@umn.edu

Tianming Cui

University of Minnesota Twin Cities

Minneapolis, MN, USA

cuixx327@umn.edu

Stephen McCamant

University of Minnesota Twin Cities

Minneapolis, MN, USA

smccaman@umn.edu

Antonia Zhai

University of Minnesota Twin Cities

Minneapolis, MN, USA

zhai@umn.edu

Abstract

Variable type recovery is a critical task in binary reverse engineering, enabling downstream applications such as vulnerability discovery, malware analysis, and security enforcement. While recent Transformer-based models have demonstrated strong performance in type inference by learning instruction-level semantics, they predominantly operate within single-function boundaries (i.e., intra-procedural analysis), ignoring the rich type constraints that propagate across function calls. Empirical studies have shown that nearly 44% of variables in real-world binaries propagate across function boundaries as arguments or return values, representing a significant source of type information that intra-procedural models cannot exploit. In this paper, we propose InterType, a method that embeds inter-procedural analysis into a pre-trained Transformer model for binary type recovery. Our approach builds on CodeArt, a state-of-the-art Transformer model for stripped binary analysis, and extends it by incorporating caller-callee data flow dependencies during fine-tuning. Specifically, we extract data flow dependence for each caller-callee pair from disassembled binaries and construct training instances that provide the model with cross-function context. By exposing the Transformer to inter-procedural variable propagation patterns, our model learns to resolve types that depend on cross-function data flow. We evaluate InterType on the coreutils benchmark compiled with optimization levels O0 through O3. On O1 binaries, InterType improves recall by 2.76 percentage points, from 89.00% for the intra-procedural CodeArt baseline to 91.76%, corresponding to a 25.1% reduction in recall error rate (1 – recall).

Pen-Chung Yew

University of Minnesota Twin Cities

Minneapolis, MN, USA

yew@umn.edu

CCS Concepts: • Software and its engineering → Software reverse engineering; Compilers; • Computing methodologies → Neural networks.

Keywords: binary analysis, type recovery, Transformer, inter-procedural analysis, reverse engineering

1 Introduction

Binary reverse engineering is a fundamental activity in software security, enabling analysts to understand the behavior of programs when source code is unavailable. Among the many tasks in reverse engineering, variable type recovery—the process of inferring the original source-level types (e.g., int, char*) of variables in compiled, stripped binaries—is particularly important. Accurate type information dramatically improves the readability of decompiled code, transforming opaque register and memory operations into meaningful, typed expressions that human analysts can reason about.

Type recovery is critical across multiple security-relevant domains. In vulnerability discovery, knowing that a variable is a pointer to a heap-allocated structure rather than a plain integer enables detection of use-after-free and type-confusion vulnerabilities [9]. In malware analysis, recovered types reveal the data structures used by malicious code, such as command-and-control protocol buffers or encryption key schedules, accelerating the understanding of malware behavior. For security enforcement mechanisms such as Control-Flow Integrity (CFI) [1], precise function type signatures are essential for constructing accurate call graphs and validating indirect control transfers.

Limitations of Intra-Procedural Models. Recent advances in machine learning have produced increasingly capable models for binary type inference. Transformer-based approaches such as StateFormer [15], DIRTY [3], and CodeArt [18] have demonstrated strong performance by learning instruction-level semantics from large corpora of binary code. CodeArt, in particular, introduces attention regularization through Masked Dependence Modeling (MDM) to align the model's attention with data-flow dependencies, achieving state-of-the-art results on stripped binary analysis.

However, these models share a fundamental limitation: they operate exclusively within single-function boundaries. Each function is processed in isolation, and the model has no visibility into how variables are passed to callees as arguments, how return values flow back to callers, or how a variable's type is constrained by its usage in distant functions. This intra-procedural design means that when a variable's type can only be disambiguated through its usage in a callee function—or through a chain of calls—the model lacks the necessary context and defaults to generic type predictions (e.g., void* instead of specific pointers).

Motivating Example. To illustrate this limitation concretely, consider the __stream variable used internally by the do_decode function in the base32 utility from GNU Coreutils (compiled at optimization level O1). This variable represents a standard FILE structure stream used for file I/O operations. In the base32 binary, the caller function do_decode maintains a pointer to this stream in the r15 register, and passes it to an I/O routine (e.g., fread_unlocked) via the rcx register.

As shown in Figure 1, the example specifically analyzes the variable __stream stored in the r15 register within the do_decode function of the base32 binary. The intra-procedural CodeArt model analyzing the caller only sees an opaque pointer being passed into the rcx argument register. Lacking visibility into the subroutine, CodeArt incorrectly predicts the base(char)* type (a generic byte buffer) for the __stream variable. In contrast, when inter-procedural analysis is applied, InterType merges the control flow graphs, gaining visibility into how the pointer is used inside the callee. By observing the callee dereferencing the pointer at specific field offsets (e.g., [rcx], [rcx+8]) to access the file stream's internal buffers, InterType recognizes the signature of a structure. Crucially, this structural type constraint propagates backward across the function boundary to the caller, empowering InterType to correctly predict struct* for the __stream variable in r15. This directly demonstrates that inter-procedural data flow analysis can successfully resolve types where intra-procedural analysis fails.

The Need for Inter-Procedural Analysis. The importance of cross-function type propagation is well established. An empirical study by ByteTR [10] on the TYDA dataset—comprising over 163,000 binaries across four architectures and four optimization levels—found that nearly 44% of variables propagate across function boundaries as arguments or return values. This means that intra-procedural models are fundamentally unable to access nearly half of the available type constraints. The study further reported an 8.46% improvement in type prediction precision when extending intra-procedural analysis to a two-level direct caller–callee pair, and an additional 2.08% improvement when extending to three levels. ByteTR counts function levels, so its depth 2 corresponds to one call edge.

While some approaches have attempted to capture inter-procedural information, they rely on Graph Neural Networks (GNNs) to propagate type constraints along variable propagation graphs. ByteTR [10] constructs inter-procedural variable propagation graphs and uses Gated Graph Neural Networks (GGNNs) for type prediction. This approach demonstrates the value of representing cross-function dependencies explicitly. We investigate how to incorporate such dependencies into the learned assembly representations of a pre-trained Transformer.

LLM-based Methods for Structure Recovery. A separate line of work has explored leveraging large language models (LLMs) for binary type recovery, with a particular focus on recovering composite structure types. ReSym [20] fine-tunes StarCoder to predict variable types and structure field layouts from decompiled code, using a Prolog-based aggregation algorithm to cross-check results across multiple LLM queries. TypeForge [19] constructs Type Flow Graphs from stripped binaries and employs an LLM-based double-elimination framework to select best-fit composite type declarations by comparing the readability of decompiled-code variants. Both pipelines therefore depend on decompiler output for their LLM-based prediction or selection stages. InterType instead takes stripped binaries as input and infers types from disassembled instructions and extracted data-flow dependencies, without requiring decompiled

Caller (do_decode) Intra-Procedural View

do_decode: ; ... prepare for file reading ... mov rcx, r15 ; pass '__stream' to rcx mov edx, 1 ; mov rsi, r14 ; call fread_unlocked ; call I/O routine ; ...

CodeArt Prediction: base(char)* (Incorrect)

Callee (fread_unlocked) Inter-Procedural View

fread_unlocked: ; ... perform stream operations ... mov rax, [rcx] ; read stream field cmp [rcx+8], rax ; another stream field jle loc_fill_buffer ; mov [rcx], rax ; ; ...

InterType Prediction: struct* (Correct)

Figure 1. Side-by-side assembly demonstrating backward type propagation. The intra-procedural model only sees the caller preparing an ambiguous pointer argument, resulting in an incorrect base(char)* prediction. The inter-procedural model incorporates the callee's explicit structural field accesses, correctly deducing that the caller's __stream variable stored in register r15 is a struct*.

code. ReSym and TypeForge address structure recovery, while our study focuses on token-level classification over a fixed type vocabulary. We use CodeArt's approximately 109M-parameter pre-trained Transformer to examine the effect of adding inter-procedural context within an existing type-classification pipeline.

Our Approach and Contributions. In this paper, we propose InterType, a method that bridges this gap by embedding inter-procedural analysis directly into a Transformer-based model. We build on the pre-trained CodeArt model and extend it with inter-procedural context during fine-tuning. Our key insight is that by merging caller and callee control flow graphs before reaching definition analysis, the analysis naturally discovers data flow paths that cross function boundaries—argument passing and return value propagation. The resulting inter-procedural dependency edges are encoded as graph-pattern entries in CodeArt's MaskBuilder, the same mechanism that encodes intra-procedural data flow. These graph-pattern entries enable bidirectional attention between caller argument-setup instructions and callee parameter-use instructions, allowing the Transformer's self-attention to propagate type constraints across function boundaries. Although we evaluate our inter-procedural binary analysis technique only on type recovery, encoding cross-function data flow edges as graph-pattern attention mask entries may also benefit other Transformer-based binary analysis tasks, including function signature recovery, variable name prediction, and vulnerability detection.

Our contributions are as follows:

  1. We propose InterType, a method that embeds inter-procedural caller-callee data flow analysis into a pre-trained Transformer model for binary type recovery by merging caller-callee CFGs and running reaching definition analysis on the composite graph.

  2. We show that inter-procedural data flow edges, once extracted from the merged CFG, are directly encoded as graph-pattern entries in the MaskBuilder's structured attention mask, enabling bidirectional cross-function attention between caller and callee instructions.

  3. We evaluate InterType on the coreutils benchmark across multiple optimization levels (O0–O3). On O1 binaries, recall improves by 2.76 percentage points, from 89.00% to 91.76%, corresponding to a 25.1% reduction in recall error rate compared to the intra-procedural CodeArt baseline.

  4. We provide interpretability analysis through real-world case studies comparing InterType with CodeArt, demonstrating the practical benefit of our inter-procedural transformer based approach for type recovery.