10 July 2026 in ACM Transactions on Software Engineering and Methodology
Bytecode is an instruction set designed for efficient execution by a program interpreter. Unlike human-readable source code, bytecode is more challenging for programmers and researchers to understand. Bytecode is widely used in various software tasks, including malware and clone detection. To quickly and accurately understand the meaning of bytecode and further assist programmers in those software activities, we propose a bytecode comment generation approach called ByteCue, using a neural language model. Specifically, to obtain the structured information of the bytecode, we first generate the control flow graph (CFG) of the bytecode, simultaneously parsing the APIs called in the bytecode and serializing them. Then, we propose a Transformer-based model to learn the bytecode features for comment generation. By collecting JAR packages from well-known open source projects in the Maven repository, we ultimately created a dataset at the method level of size 122k. The experiment indicates that our approach surpasses state-of-the-art baselines in bytecode comment generation, achieving an average increase of 17.5% on BLEU-4 metrics, 16.1% on METEOR, and 8.6% on ROUGE-L, demonstrating its effectiveness and superiority. User studies show that ByteCue also surpasses existing methods in terms of informativeness and naturalness, further highlighting its practical value.