# CLAP: Learning Transferable Binary Code Representations with Natural Language Supervision

> CLAP (Contrastive Language-Assembly Pre-training) learns assembly-function embeddings aligned with natural-language explanations. A dataset engine compiles Ubuntu C/C++ packages with GCC and Clang at O0–O3 and Os, has GPT-3.5 explain about 2.6 million matching source functions, and fine-tunes a Vicuna-13B “shadow model” on half of those explanations to label more code, yielding 195 million assembly–explanation pairs. A 110M-parameter assembly encoder, using address rebasing, a WordPiece tokenizer and jump-aware embeddings, is first pre-trained on assembly and then contrastively aligned with a text encoder. The embeddings support zero-shot classification by matching code against text prompts. On BinaryCorp-3M similarity search in pools of 10,000 functions, zero-shot CLAP reports 0.836 average recall@1 against 0.571 for fine-tuned jTrans.

- Authors: Hao Wang; Zeyu Gao; Chao Zhang; Zihan Sha; Mingyang Sun; Yuchen Zhou; Wenyu Zhu; Wenju Sun; Han Qiu; Xi Xiao
- Venue: ACM ISSTA 2024
- Status: Conference paper
- Publication / posting date: September 11, 2024
- Date source: ACM's Crossref deposit records print and online publication on 2024-09-11; the September 16–20 ISSTA 2024 conference dates and the arXiv date are not substituted for it.
- First arXiv submission: February 26, 2024
- arXiv: 2402.16928
- Reviewed arXiv version: v1
- DOI: 10.1145/3650212.3652145
- Sources reviewed: 2026-10-19
- Added to the catalog: 2026-10-27
- Original paper: <https://dl.acm.org/doi/10.1145/3650212.3652145>
- PDF: <https://arxiv.org/pdf/2402.16928v1>
- Code: <https://github.com/Hustcw/CLAP>
- BibTeX: <https://awesomerea.org/papers/citations/paper-clap.bib>
- Catalog page: <https://awesomerea.org/papers/paper-clap/>
- Record JSON: <https://awesomerea.org/papers/paper-clap/record.json>
- Chinese version: [简体中文](https://awesomerea.org/zh/papers/paper-clap/index.md)

## Scope and limitations

Training explanations are generated by GPT-3.5 and a fine-tuned Vicuna model from source code, not written by humans; five experts scored 50 explanations per model, mostly as acceptable. The authors name the Ubuntu-only build environment and the GPT-3.5 explanations as possible sources of bias. Functions are disassembled with IDA Pro 7.6, and functions with fewer than three basic blocks are excluded. Similarity results use BinaryCorp-3M optimization-level pairs, where baselines get a linear probe and jTrans is also fully fine-tuned while CLAP is not; crypto identification (17 algorithms, about 70K functions labeled by name and package metadata) and protocol categorization (18 types) use datasets the authors built from Ubuntu packages, where fine-tuned CLAP beats the baselines while zero-shot CLAP trails the best baseline on crypto. The malware and sorting results are single case studies. Training used 32 A100 GPUs. CLAP produces embeddings and label scores; it is not a decompiler or a malware detector.

## Why it fits this collection

Adds assembly representation learning aligned with natural language, which supports zero-shot and few-shot function labeling and similarity search in binary analysis, complementing jTrans and the LLM-based decompilation and summarization records.

## Publication and review notes

Crossref records the ISSTA '24 proceedings article, pages 503–515, and a CC BY-NC-SA 4.0 license; its ten-author order matches arXiv. The ACM landing page refused automated access, so publication facts follow Crossref and the reviewed text is arXiv v1 (2024-02-26), the only version, which carries the ISSTA 2024 header with a placeholder DOI. Table 1 gives zero-shot CLAP an average recall@1 of 0.836, while the introduction states 83.3%. The paper links Hustcw/CLAP. At the reviewed 2024-09-28 commit the repository has no license file and holds a case-study notebook, IDA databases and rebased assembly for a bubble sort, SHA-3 and a malware sample identified by its VirusTotal hash, prompt files, human-evaluation screenshots and an IDA processing script; it does not include training code or the 195-million-pair dataset. The README links the Hugging Face models hustcw/clap-asm and hustcw/clap-text, whose cards declare MIT and which load with trust_remote_code.

## Primary sources

1. <https://dl.acm.org/doi/10.1145/3650212.3652145>
2. <https://api.crossref.org/works/10.1145/3650212.3652145>
3. <https://arxiv.org/abs/2402.16928>
4. <https://arxiv.org/pdf/2402.16928v1>
5. <https://github.com/Hustcw/CLAP/tree/18e38ded87bdf49e3f7eeb87c0329d1ca9f6a21b>
6. <https://github.com/Hustcw/CLAP/blob/18e38ded87bdf49e3f7eeb87c0329d1ca9f6a21b/README.md>
7. <https://huggingface.co/hustcw/clap-asm/blob/620f4beba2edce172e8f35e263399716494950c9/README.md>
8. <https://huggingface.co/hustcw/clap-text/blob/3c4bfe1a936fd9f9140892c4d1d813e4a23301f8/README.md>

## About this entry

Reviewed against the paper and its primary sources. Cite the original authors using the linked paper or BibTeX.
Original editorial content: MIT. Linked projects, papers and assets retain their own rights and licenses.
