This paper presents a comprehensive empirical study evaluating how well Large Language Models (LLMs) can understand stripped binary code. By testing 16 LLMs across various architectures and optimization levels, the authors demonstrate that LLMs—especially code-specific ones—significantly outperform traditional deep learning models in recovering function names and generating natural language code summaries.
TL;DR
The authors introduce a new benchmark to evaluate LLMs on binary code understanding tasks like function name recovery and code summarization. Their study reveals that while LLMs outperform specialized deep learning models in generalization, their effectiveness varies significantly across different hardware architectures and is heavily influenced by the presence of remaining symbolic information.
What Problem Does This Paper Address?
Binary code analysis is a cornerstone of software security, essential for malware detection and vulnerability discovery. However, compiled and "stripped" binaries are essentially black boxes; they lack the comments, variable names, and function names that make source code readable.
As illustrated in Figure 1, reverse engineers use decompilers to turn binary back into C-like pseudo-code, but this output is often cryptic and lacks semantic context. While specialized deep learning (DL) models have been developed to fill this gap, they often struggle to generalize to new, unseen code. This paper investigates whether the massive reasoning and linguistic capabilities of LLMs can bridge this "semantic gap" more effectively than specialized tools.
Methods
The researchers developed an automated pipeline to construct a robust evaluation benchmark. They compiled real-world C projects across four architectures (x86, x64, ARM, MIPS) and four optimization levels (O0, O1, O2, O3). They then stripped the symbols and used IDA Pro to generate pseudo-code.
The study evaluated three categories of models:
- Code-Domain LLMs: Models pre-trained specifically on source code (e.g., CodeLlama, DeepSeek-Coder, WizardCoder).
- General-Domain LLMs: Broad-purpose models (e.g., ChatGPT, Llama-2, Mistral).
- DL-based Expert Models: Specialized models designed specifically for binary tasks (e.g., BinT5, HexT5).
The models were tested on two primary tasks: Function Name Recovery (predicting the original name of a stripped function) and Binary Code Summarization (generating a concise natural language description of the function's purpose).
Datasets
- Evaluation Benchmark: The authors selected 12 high-quality, real-world C projects (including FFmpeg, OpenSSL, Redis, and Curl). From these, they curated a dataset of 2,000 functions, each represented across 7 different compilation settings, totaling 14,000 evaluation samples.
- Fine-tuning Dataset: To test the impact of domain-specific training, they built a separate dataset of 30,000 functions from 51 GNU projects (like binutils and coreutils).
Key Insights and Ideas
- Generalization is the LLM Superpower: Unlike specialized DL models that often overfit to their training data, LLMs demonstrated superior adaptability to unseen code samples.
- MIPS is the "Easiest" Architecture: LLMs performed best on MIPS binaries. The authors attribute this to MIPS's simplified instruction set and unified calling conventions, which create more predictable patterns for the models to recognize.
- Robustness to Optimization: Surprisingly, compiler optimization levels (O0 vs. O3) had a negligible impact on LLM performance. This suggests that LLMs are capable of looking past structural code changes to grasp underlying logic.
- The "Symbolic Anchor" Effect: The performance of LLMs improved drastically as the number of remaining symbols (like strings or library call identifiers) increased. These act as critical semantic clues that help the model "anchor" its reasoning.
Key Results
- Top Performers: CodeLlama-34b emerged as the leader for function name recovery (achieving an F1-score of ~26.75 on x64), while ChatGPT dominated the summarization task (BLEU-4 of 7.69).
- Few-Shot vs. Zero-Shot: Providing just two examples in the prompt (few-shot) improved function naming F1-scores by an average of 5 points.
- Fine-Tuning Gains: Fine-tuning smaller LLMs (7B-13B parameters) led to significant jumps in performance, with Llama-2-13b seeing a nearly 7-point increase in its naming F1-score.
- Speed vs. Accuracy: While specialized DL models are much faster (inferring in ~0.03s), LLM inference times (1s to 10s per function) were deemed acceptable for real-world reverse engineering workflows.
Limitations and Future Work
- Metric Mismatch: The authors acknowledge that standard NLP metrics like BLEU and ROUGE might not perfectly capture the utility of a summary for a human reverse engineer, who might care more about specific technical keywords than grammatical fluency.
- The Obfuscation Gap: The study did not include obfuscated or encrypted code, which is common in malware and significantly harder to analyze.
- Isolated Analysis: The current evaluation looks at functions in isolation. Future work should explore how LLMs handle inter-procedural relationships and the overall program structure.
- Context Window Constraints: Long, complex functions can exceed the context window of many LLMs, leading to truncated inputs and lost information.
Summary updated