Lune

ISSTA2024Top-tier venue

CLAP: Learning Transferable Binary Code Representations with Natural Language Supervision

Hao Wang, Zeyu Gao, Chao Zhang, Zihan Sha, Mingyang Sun, Yuchen Zhou, Wenyu Zhu, Wenju Sun, Han Qiu, Xi Xiao

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. We release our pre-trained model and code at https://github.com/Hustcw/CLAP .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

19 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • ShieldedCode: Learning Robust Representations for Virtual Machine Protected Code cites Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler Optimization
  • ShieldedCode: Learning Robust Representations for Virtual Machine Protected Code cites Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection
  • Virtual Compiler Is All You Need For Assembly Code Search cites Learning Transferable Visual Models From Natural Language Supervision
  • Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler Optimization cites Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection
  • Improving ML-based Binary Function Similarity Detection by Assessing and Deprioritizing Control Flow Graph Features cites Order Matters: Semantic-Aware Neural Networks for Binary Code Similarity Detection
  • Improving ML-based Binary Function Similarity Detection by Assessing and Deprioritizing Control Flow Graph Features cites Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler Optimization
  • Improving ML-based Binary Function Similarity Detection by Assessing and Deprioritizing Control Flow Graph Features cites Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection
  • vSim: Semantics-Aware Value Extraction for Efficient Binary Code Similarity Analysis cites Order Matters: Semantic-Aware Neural Networks for Binary Code Similarity Detection
  • vSim: Semantics-Aware Value Extraction for Efficient Binary Code Similarity Analysis cites Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler Optimization
  • vSim: Semantics-Aware Value Extraction for Efficient Binary Code Similarity Analysis cites Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection
  • vSim: Semantics-Aware Value Extraction for Efficient Binary Code Similarity Analysis cites Improving ML-based Binary Function Similarity Detection by Assessing and Deprioritizing Control Flow Graph Features
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers19

  1. Improving ML-based Binary Function Similarity Detection by Assessing and Deprioritizing Control Flow Graph FeaturesJialai Wang, Chao Zhang, Longfei Chen, Yi Rong et al.USENIX Security 2024 · 15 citations
  2. SK2Decompile: LLM-based Two-Phase Binary Decompilation from Skeleton to SkinHanzhuo Tan, Weihao Li, Xiaolong Tian, Siyi Wang et al.ICLR 2026 · 10 citations
  3. ShieldedCode: Learning Robust Representations for Virtual Machine Protected CodeMingqiao Mo, Yunlong Tan, Hao Zhang, Heng Zhang et al.ICLR 2026 · 10 citations
  4. Virtual Compiler Is All You Need For Assembly Code SearchZeyu Gao, Hao Wang, Yuanda Wang, Chao ZhangACL 2024 · 3 citations
  5. vSim: Semantics-Aware Value Extraction for Efficient Binary Code Similarity AnalysisHuaijin Wang, Zhiqiang LinNDSS 2026 · 3 citations

Builds on11

  1. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
  2. Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity DetectionXiaojun Xu, Chang Liu, Qian Feng, Heng Yin et al.CCS 2017 · 682 citations
  3. Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler OptimizationSteven H. H. Ding, Benjamin C. M. Fung, Philippe CharlandS&P 2019 · 447 citations
  4. Order Matters: Semantic-Aware Neural Networks for Binary Code Similarity DetectionZeping Yu, Rui Cao, Qiyi Tang, Sen Nie et al.AAAI 2020 · 265 citations
  5. Neural Nets Can Learn Function Type Signatures From BinariesZheng Leong Chua, Shiqi Shen, Prateek Saxena, Zhenkai LiangUSENIX Security 2017 · 175 citations

Related papers

  1. Understanding Transferable Representation Learning and Zero-shot Transfer in CLIPZixiang Chen, Yihe Deng, Yuanzhi Li, Quanquan GuICLR 2024 · 21 citations
  2. Is a Caption Worth a Thousand Images? A Study on Representation LearningShibani Santurkar, Yann Dubois, Rohan Taori, Percy Liang et al.ICLR 2023 · 9 citations
  3. PalmTree: Learning an Assembly Language Model for Instruction EmbeddingXuezixiang Li, Yu Qu, Heng YinCCS 2021 · 139 citations
  4. Towards Better Code Understanding in Decoder-Only Models with Contrastive LearningJiayi Lin, Yanlin Wang, Yibiao Yang, Lei Zhang et al.AAAI 2026 · 2 citations
  5. Advancing Multi-grained Alignment for Contrastive Language-Audio Pre-trainingYiming Li, Zhifang Guo, Xiangdong Wang, Hong LiuACM MM 2024 · 9 citations
Dusk over the sea between two cliffs drawn in fine vertical lines