Uncovering Pretraining Code in LLMs: A Syntax-Aware Attribution Approach

Authors

  • Yuanheng Li Tongji University
  • Zhuoyang Chen Tongji University
  • Xiaoyun Liu Tongji University
  • Yuhao Wang Tongji University
  • Mingwei Liu Sun Yat-sen University
  • Yang Shi Tongji University
  • Kaifeng Huang Tongji University
  • Shengjie Zhao Tongji University

DOI:

https://doi.org/10.1609/aaai.v40i1.37038

Abstract

As large language models (LLMs) become increasingly capable, concerns over the unauthorized use of copyrighted and licensed content in their training data have grown, especially in the context of code. Open-source code, often protected by open source licenses (e.g, GPL), poses legal and ethical challenges when used in pretraining. Detecting whether specific code samples were included in LLM training data is thus critical for transparency, accountability, and copyright compliance. We propose SynPrune, a syntax-pruned membership inference attack method tailored for code. Unlike prior MIA approaches that treat code as plain text, SynPrune leverages the structured and rule-governed nature of programming languages. Specifically, it identifies and excludes consequent tokens that are syntactically required and not reflective of authorship, from attribution when computing membership scores. Experimental results show that SynPrune consistently outperforms the state-of-the-arts. Our method is also robust across varying function lengths and syntax categories.

Downloads

Published

2026-03-14

How to Cite

Li, Y., Chen, Z., Liu, X., Wang, Y., Liu, M., Shi, Y., … Zhao, S. (2026). Uncovering Pretraining Code in LLMs: A Syntax-Aware Attribution Approach. Proceedings of the AAAI Conference on Artificial Intelligence, 40(1), 721–729. https://doi.org/10.1609/aaai.v40i1.37038

Issue

Section

AAAI Technical Track on Application Domains I