PalmTree
A BERT-based language model for assembly code that produces general-purpose instruction embeddings.
Language · 622 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Language
- Parameters
- 4M
- Operations
- 622
- Framework
- PyTorch
- Recurrent
- No
- Published
- ACM CCS 2021
- Cited by
- 188 (as of 27 October 2026)
- Authors
- Xuezixiang Li, Qu Yu, Heng Yin
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m19239
- Graph hash
- 42f862a76112198add25a5e64feef0c430a6264058237c195661a52f3e3d0cca
- Skeleton hash
- b41f2085ea7243fd57acbf9413ea2f1d26e8a8bfd754d0f6f0f2329b6e741ce4
- Architecture hash
- f7d1fc42ed57f720ee7965c2f36dd0a9b84ae94063cb2578086d920ef8258d6f
- Diagram SHA-256
- 6450a72fb4624d343bdf02951b32af19e9b163f4507435be3c902ce5010d5a47
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
PalmTree is a pre-trained language model for assembly code: it turns each machine instruction into a vector that binary analysis tools can use as input. It is based on BERT but pre-trained with tasks designed around the characteristics of assembly language. Each instruction is treated as a sentence, and its operands are broken down into more basic tokens.
Training combines three tasks: masked language modeling, Context Window Prediction and Def-Use Prediction. Context Window Prediction predicts whether two instructions co-occur within a sliding window in the control flow. The window is used instead of strict adjacency because compiler optimizations can reorder instructions. Def-Use Prediction trains the model to predict whether two instructions have a def-use relation, which brings in data dependency.
The model keeps BERT's 12 layers but uses 8 attention heads and a hidden dimension of 128, chosen for efficiency and training cost. An instruction's embedding is the mean of the hidden states of the second last layer. The paper's pre-training dataset contains 3,266 binaries and 2.25 billion instructions. The official repository currently supports x86.
Key idea. PalmTree pre-trains a BERT-based assembly language model with three tasks that capture internal instruction formats, control flow context and data flow dependency to produce general-purpose instruction embeddings.
- PalmTree
- assembly language model
- instruction embedding
- binary analysis
- x86 assembly
- binary code similarity
- pre-trained language model
- context window prediction
- def-use prediction
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{li2021palmtreelearningassemblylanguage,
title={PalmTree: Learning an Assembly Language Model for Instruction Embedding},
author={Xuezixiang Li and Qu Yu and Heng Yin},
year={2021},
eprint={2103.03809},
archivePrefix={arXiv},
primaryClass={cs.LG},
doi={https://doi.org/10.1145/3460120.3484587},
url={https://arxiv.org/abs/2103.03809},
}