Evading Membership Inference in Code LLMs via Semantically Equivalent Transformations

A causal study of how semantically equivalent code transformations weaken membership inference on code LLMs โ€” ICSE 2026

Sep 2024 โ€“ May 2025 ยท Published at ICSE 2026 (Yang et al., 2026)

The success of Large Language Models for Code (LLMs4Code) relies on vast amounts of code data, including public open-source repositories (e.g., GitHub) and private, confidential company code. This raises concerns about intellectual property compliance and the potential unauthorized use of license-restricted code.

Membership Inference (MI) techniques have been proposed to detect such unauthorized usage. However, their effectiveness can be undermined by semantically equivalent code transformation (SECT) rules, which modify code syntax while preserving semantics.


๐Ÿ”Ž Research Questions

  • How does each transformation rule impact membership inference?
  • How do combined transformation rules impact membership inference?
  • To what extent does each transformation rule impact the success of MI?

๐Ÿ› ๏ธ Methodology

We conducted a systematic investigation across multiple transformation rules, evaluating their effect on MI detection:

  1. Applied SECT rules (e.g., RenameVariable, control-flow rewrites, syntactic variations).
  2. Fine-tuned LLMs on transformed datasets and measured accuracy & MI success rates.
  3. Conducted causal analysis to validate which transformations directly influence MI effectiveness.

๐Ÿ“Š Key Findings

  • Model accuracy drops by only 1.5% at worst per transformation rule, showing that transformed datasets remain strong substitutes for fine-tuning.
  • RenameVariable rule reduces MI success by 10.19%, making it the most effective transformation in obscuring restricted code presence.
  • Causal analysis confirms that variable renaming has the strongest causal effect in disrupting MI detection.
  • Combining multiple rules does not further reduce MI effectiveness beyond single-rule transformations.

Tech Stack: Python, Java, PyTorch, Hugging Face, DeepSpeed, CUDA, SFT, Causal Inference

Examples of model fine-tuning pipelines.

References

2026

  1. How Do Semantically Equivalent Code Transformations Impact Membership Inference on LLMs for Code?
    Hua Yang, Alejandro Velasco, Thanh Le-Cong, and 3 more authors
    In Proceedings of the 48th IEEE/ACM International Conference on Software Engineering (ICSE), 2026