arXiv:2610.23546cs.SEOct 2026

Manuscript Offprint

arXiv:2610.23546

Recall-Oriented Precise Binary-to-Source Function Matching

Junlin Li, Jianjun Huang, Wei You, Bin Liang

JUNLIN LI, Renmin University of China, China

JIANJUN HUANG, Renmin University of China, China

WEI YOU, Renmin University of China, China

BIN LIANG, Renmin University of China, China

Binary-to-source function matching supports software composition analysis by identifying reused third-party code, but existing embedding-based approaches restrict subsequent refinement to initially retrieved candidates. When the correct source function is absent from this set, selecting or filtering the available candidates cannot recover the match. Inlining further complicates the retrieval by combining multiple source functions into one binary function. In this paper, we propose BScout to improve matching precision and uncover additional matches. BScout uses the positional information of existing matches to supplement candidates for unresolved binary functions, extending the search beyond the initial candidate set, and adopts composition-aware training to address the inlined composition matching. Large language models are adopted to select and review matches, while positional information also helps filter inconsistent results. Experiments show that BScout is effective in binary-to-source function matching. BScout achieves overall higher precision, recall and F1 scores than BinaryAI and SBridge with acceptable analysis costs. Particularly, on large stripped binaries, BScout outperforms the competitors with a precision increment of 32% and approximately 2.9 times the recall.

CCS Concepts: • Software and its engineering → Software libraries and repositories; Software maintenance tools.

Additional Key Words and Phrases: Binary-to-source function matching, Composition-aware retrieval, Candidate supplementation

1 Introduction

Modern software extensively reuses open-source projects and third-party code [3]. When the software source code is unavailable, matching the binary to reference source code can provide evidence for software composition analysis (SCA) [19], license compliance checking [6], and vulnerability analysis [24, 42]. Binary-to-source function matching [45] is the fundamental technique for conducting the analysis, which addresses the problem of retrieving the corresponding source function from a reference corpus of source functions for each binary query function in a given binary file.

There have been a lot of binary-to-source function matching approaches. B2SFinder [7] utilizes the syntactic features, e.g., string literals, which can be redundant across a large number of third-party libraries (TPLs) and harm the matching precision [19]. Beyond the syntactic features, SBridge [42] leverages structural and semantic features to achieve more accurate matching, but the time cost on a large corpus is unacceptable. Embedding-based matching is a solution to address both the efficiency and effectiveness pits of the above feature-engineering approaches. It leverages the ability of deep learning to automatically learn the features from the code and improve the matching efficiency based on vector similarity measurement [19, 45]. BinaryAI [19] is the state-of-the-art (SOTA) method in this area. However, existing embedding-based methods such as BinaryAI [19] and CodeCMR [45] overlook a common phenomenon in C/C++ programs, i.e., the inlining mechanism combines more than one source function into one binary function [1], preventing them precisely and completely pinpointing the correct binary-source function matches. Furthermore, they restrict

Authors' Contact Information: Junlin Li, lijunlin@ruc.edu.cn, Renmin University of China, Beijing, China; Jianjun Huang, hjj@ruc.edu.cn, Renmin University of China, Beijing, China; Wei You, youwei@ruc.edu.cn, Renmin University of China, Beijing, China; Bin Liang, liangb@ruc.edu.cn, Renmin University of China, Beijing, China.

Li et al.

their final results within the scope of the embedding-based matching results, losing the potential of finding more correct matches.

In this paper, we present BScout, a binary-to-source function-level matching approach that guarantees high precision and attempts to uncover more results beyond the embedding-based matching. BScout adopts embedding-based matching to enforce acceptable efficiency for large-scale matching tasks. BScout decompiles binary functions and parses source functions, converting each function into an embedding vector using a trained embedding model, measuring the binary-source function embedding similarity and emitting a set of candidates for each binary function. Then BScout adopts a large language model (LLM) and the positional information of the functions to iteratively refine the candidates, including filtering out improper matches and digging out new candidates for unmatched binary functions. At the end, BScout outputs a 1-to-1 mapping showing the binary-source function-level matching.

BScout addresses the two shortcomings of existing similar embedding-based approaches from the following two aspects. First, we propose a composition-aware training, enforcing the embedding model to recognize each inclined composition in the binary function by weighting all the compositions and the major contributors. In addition, we design a chunk-based full-function embedding approach on top of the transformer-based model, to support and accelerate long function handling and training. Second, we leverage the positional information not only to filter the matches but also to supplement additional candidates for unresolved binary functions. Such functions may have their matches outside the given candidates or rejected in the LLM selection steps. It is the essential effort in this study to expand matching results beyond the embedding-based matching results.

We evaluated BScout on a public dataset [42] and a manually collected dataset with large software as binary and popular TPLs as source corpus. BScout has shown great improvement for retrieving inclined compositions for multi-source functions and uncovers 10,032 correct matches beyond the initial candidates. On the datasets, it achieves the best comprehensive performance, high precision in all cases and enhanced recall over the embedding-based matching results. It also outperforms the SOTA competitors, BinaryAI [19] and SBridge [42] on each dataset with significant precision improvement (at least ↑32%\uparrow32\%) and observable higher recall (about 2.9 times on large stripped binaries). Even if a small, locally deployed LLM is adopted, BScout shows obviously better performance. The efficiency and cost are also acceptable, making a large-scale matching affordable.

Our paper makes the following contributions.

(1) We propose a binary-to-source function matching method, BScout. It leverages LLMs and the positional information to refine the embedding-based matching results, ensuring high precision and no recall degradation.

(2) We design a composition-aware training for a transformer-based model to cope with the inlining mechanism that can make the binary function differ significantly from the corresponding source functions. More importantly, we present a method to supplement candidates and boost recall after the embedding-based matching.

(3) We evaluate BScout on real-world datasets. It always achieves sufficiently high precision and best overall recall and comprehensive matching performance. BScout outperforms SOTA approaches with acceptable time and monetary cost.

References (22)