CLAP: Learning Transferable Binary Code Representations with Natural Language Supervision
Open Access
- 11 September 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 503-515
Abstract
Binary code representation learning has shown significant performance in binary analysis tasks. But existing solutions often have poor transferability, particularly in few-shot and zero-shot scenarios where few or no training samples are available for the tasks. To address this problem, we present CLAP (Contrastive Language-Assembly Pre-training), which employs natural language supervision to learn better representations of binary code (i.e., assembly code) and get better transferability. At the core, our approach boosts superior transfer learning capabilities by effectively aligning binary code with their semantics explanations (in natural language), resulting a model able to generate better embeddings for binary code. To enable this alignment training, we then propose an efficient dataset engine that could automatically generate a large and diverse dataset comprising of binary code and corresponding natural language explanations. We have generated 195 million pairs of binary code and explanations and trained a prototype of CLAP. The evaluations of CLAP across various downstream tasks in binary analysis all demonstrate exceptional performance. Notably, without any task-specific training, CLAP is often competitive with a fully supervised baseline, showing excellent transferability.Keywords
This publication has 22 references indexed in Scilit:
- BinaryAI: Binary Software Composition Analysis via Intelligent Binary Source Code Matching2024
- Practical Binary Code Similarity Detection with BERT-based Transferable Similarity Learning2022
- jTrans: jump-aware transformer for binary code similarity detection2022
- Investigating Graph Embedding Methods for Cross-Platform Binary Code Similarity Detection2022
- PalmTree: Learning an Assembly Language Model for Instruction Embedding2021
- Codee: A Tensor Embedding Scheme for Binary Code SearchIEEE Transactions on Software Engineering, 2021
- Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler Optimization2019
- αDiff: cross-version binary code similarity detection with DNN2018
- Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection2017
- Gradient-based learning applied to document recognitionProceedings of the IEEE, 1998