Skip to main content
QUICK REVIEW

[Paper Review] DOBF: A Deobfuscation Pre-Training Objective for Programming Languages

Baptiste Rozière, Marie-Anne Lachaux|arXiv (Cornell University)|Feb 15, 2021
Software Engineering ResearchComputer Science58 references17 citations
TL;DR

This paper proposes DOBF, a novel pre-training objective for programming languages that trains models to deobfuscate source code by recovering original variable and function names from obfuscated versions. By leveraging the structural semantics of code, DOBF outperforms BERT-style MLM and existing code models on downstream tasks like code search, translation, and summarization, achieving up to 12.2% relative improvement and enabling full deobfuscation and meaningful name suggestion.

ABSTRACT

Recent advances in self-supervised learning have dramatically improved the state of the art on a wide variety of tasks. However, research in language model pre-training has mostly focused on natural languages, and it is unclear whether models like BERT and its variants provide the best pre-training when applied to other modalities, such as source code. In this paper, we introduce a new pre-training objective, DOBF, that leverages the structural aspect of programming languages and pre-trains a model to recover the original version of obfuscated source code. We show that models pre-trained with DOBF significantly outperform existing approaches on multiple downstream tasks, providing relative improvements of up to 13% in unsupervised code translation, and 24% in natural language code search. Incidentally, we found that our pre-trained model is able to de-obfuscate fully obfuscated source files, and to suggest descriptive variable names.

Motivation & Objective

  • To address the limitations of standard masked language modeling (MLM) in programming language pre-training, which fails to leverage code-specific structural properties.
  • To improve pre-training for code by introducing a deobfuscation objective that recovers meaningful identifiers from obfuscated code.
  • To enable models to learn deeper semantic representations of code through a more semantically meaningful noise function than random masking.
  • To demonstrate that deobfuscation pre-training yields state-of-the-art performance across multiple code understanding tasks without requiring natural language-aligned data.
  • To explore whether structured noise based on code semantics can outperform unstructured noise in self-supervised pre-training.

Proposed method

  • The DOBF objective trains a sequence-to-sequence model to reconstruct original source code from obfuscated versions where all variable and function names are replaced with generic tokens like 'VAR_1', 'VAR_2', etc.
  • Obfuscation is applied with a probability of 0.5 per identifier, ensuring that all occurrences of a given variable are uniformly masked with the same placeholder token.
  • The model is pre-trained using a denoising autoencoding objective, where the input is the obfuscated code and the target is the original source code.
  • DOBF is combined with a denoising auto-encoding (DAE) objective to further improve representation learning, training the model to recover corrupted sequences through token removal and shuffling.
  • Models are initialized either from random weights or from a pre-trained MLM checkpoint (e.g., RoBERTa) to evaluate the impact of initialization on performance.
  • The approach is evaluated on multiple programming languages and tasks, including unsupervised code translation, natural language code search, code summarization, and clone detection.

Experimental results

Research questions

  • RQ1Can a deobfuscation-based pre-training objective outperform standard masked language modeling on programming language representation learning?
  • RQ2Does pre-training with DOBF improve performance on downstream code understanding tasks such as code search and translation?
  • RQ3Can models pre-trained with DOBF successfully deobfuscate fully obfuscated source code and suggest meaningful variable names?
  • RQ4Is DOBF more effective than MLM and other pre-training objectives when no natural language-aligned code data is used?
  • RQ5Can combining DOBF with other objectives like DAE further enhance model performance on code-related tasks?

Key findings

  • DOBF pre-training achieves a 12.2% relative improvement in unsupervised code translation accuracy compared to baseline models.
  • On natural language code search, DOBF improves performance by 5.3% relative to existing methods, outperforming CodeBERT and GraphCodeBERT.
  • The DOBF+DAE model achieves a 6.8% improvement in computational accuracy for unsupervised code translation from Java to Python with beam size 10.
  • Even when initialized randomly, DOBF outperforms MLM on clone detection, indicating that the deobfuscation objective itself provides strong inductive bias.
  • Models pre-trained with DOBF are capable of deobfuscating fully obfuscated source files and suggesting descriptive variable names, demonstrating practical utility beyond pre-training.
  • DOBF initialized with MLM and combined with DAE yields higher performance than DOBF alone or MLM on all evaluated tasks, showing complementary benefits of structured and unstructured noise.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.