arXiv:2611.09177cs.AINov 2026

Manuscript Offprint

arXiv:2611.09177

Analyzing Code Provenance in LLMs for Programming Education

Subhankar Maity, Faiza Belbachir, Omar Boucelma, Guilherme Medeiros Machado

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Subhankar Maity¹, Faiza Belbachir¹, Omar Boucelma², and Guilherme Medeiros Machado¹

¹ LyRIDS, ECE Research Center, Paris, France

² Aix Marseille Univ, Université de Toulon, CNRS, LIS, Marseille, France {smaity, fbelbachir, gmedeirosmachado}@ece.fr, omar.boucelma@univ-amu.fr

Abstract. Large language models (LLMs) play an increasing role in programming education, challenging traditional assessment methods as they can generate fully functional code instantly. This disrupts the reliability of student submissions as indicators of learning and effort. To address this issue, code provenance is essential for tracing the origins of code and distinguishing student-authored, AI-generated, and externally sourced components. We extend the Min-K% probability approach by incorporating synthetic non-member code generation and apply it to Python code for membership inference and provenance tracking. Evaluations cover free LLMs such as GPT-2, DistilGPT-2, and DialoGPT, as well as state-of-the-art commercial models including GPT-5, Gemini 2.5, Mistral, DeepSeek, and LLaMA 3.3. Before evaluating our approach on higher-education student assignments, we validate its feasibility using Stack Overflow data. The results show that free models enable more sensitive code memorization detection than commercial models. By systematically comparing these LLMs, we assess trade-offs between detection accuracy and privacy protection, taking an initial step toward effective assessment of AI-assisted programming education through combined provenance detection and process visibility.

Keywords: LLMs · Programming Education · Generative AI · Code Provenance · Automated Assessment

1 Introduction

The increasing integration of LLMs into education, alongside their use in industry and consumer services, underscores the need for transparency in training data provenance [13]. In educational contexts, it is essential for instructors to understand which data inform the model outputs. Such understanding builds trust and helps prevent unintended misuse, including biased or unfair grading. The enormous scale and diversity of datasets fueling LLM development complicate efforts to identify whether specific data samples have contributed to model learning, intensifying debates over intellectual property, data privacy, and ethical AI use [24]. These challenges are especially acute in education, where programming

S. Maity et al.

courses increasingly grapple with sophisticated forms of code plagiarism, often involving AI-generated or online-sourced solutions [9]. Traditional plagiarism detection mechanisms struggle against such sophisticated methods, jeopardizing academic integrity and legal compliance [20]. However, the motivation goes beyond plagiarism detection. We are in a transition period in which LLMs are significantly reshaping how learning is observed and assessed [13]. Before the advent of generative AI, programming assessments primarily focused on evaluating the final student code for correctness and style, following established summative or formative assessment approaches [29]. These traditional methods, grounded in product-based evaluation, emphasized the assessment of completed programming assignments rather than the learning journey itself. Coding exercises reliably reflected students' understanding, effort, and problem-solving skills [15]. However, there is now a growing need to shift towards assessing the learning process itself, how students develop, modify, and integrate code over time. As LLMs can generate fully functional solutions instantly, code provenance, which tracks the origin and evolution of code segments, becomes essential for gaining deeper insight into student learning and supporting authentic process-oriented assessment.

This shift demands a fundamental change in assessment practices, from focusing solely on final product correctness to emphasizing the student's learning process. New formative assessment modalities are needed to make student thinking visible and support scalable instructor workflows. Code provenance technique offers a transformative solution by providing an overview of AI usage patterns across classes, acting as a pedagogical filter [4]. This enables instructors to prioritize formative feedback, identify students relying heavily on AI, or pinpoint widespread conceptual outsourcing, facilitating targeted interventions previously infeasible at scale. For example, an instructor could quickly identify students who rely almost exclusively on AI-generated code or pinpoint a specific programming concept (e.g., data structures, recursion, etc.) that a large portion of the class is outsourcing to AI. This enables a targeted intervention and makes the widespread adoption of formative assessment practices feasible for the first time. In this way, code provenance is not just an integrity tool; it serves as gate for a more effective and scalable homework assessment in the age of generative AI. Despite advances in membership inference for text data such as Wikipedia and copyright-protected books [26], research specifically addressing code remains sparse. Code data presents unique challenges compared to natural language text due to its structured syntax, dynamic behavior, and legal sensitivities [18]. These characteristics make provenance analysis especially crucial given the growing role of code generation in LLMs. Unlike plain text, code relies on precise formatting, hierarchical structure, and functional dependencies, which complicate traditional membership inference methods. To address this gap, we present the first comprehensive study applying membership inference attacks not only for code plagiarism detection but also for establishing a practical framework for scalable, process-oriented assessment methods. By systematically comparing free and commercial LLMs using the proposed method, this research takes an initial step toward assessing the trade-offs between detection accuracy and privacy protection in programming education. The central research question guiding this study is: To what extent can membership inference attacks on LLMs effectively detect code provenance to enable pedagogically meaningful, process-oriented assessment in AI-assisted programming education? This investigation aims to inform ongoing efforts to enhance assessment practices through a proof-of-concept in AI-assisted programming education. Specifically, this study makes the following contributions.

  • We extend the Min-K% probability approach by introducing a method for generating synthetic non-member code, specifically tailored to Python code data for provenance tracing of LLMs. These adaptations account for the unique structural and semantic characteristics of code data in educational settings, ensuring the method's applicability beyond text to programming code. Furthermore, the approach can be readily extended to other programming languages.
  • We evaluate multiple free models, including variants of GPT-2, Distil GPT-2, and DialoGPT, alongside state-of-the-art commercial models such as GPT-5, Gemini 2.5, Mistral, DeepSeek, and LLaMA 3.3 using the proposed methodology.
  • To verify the applicability of this method in real-world educational settings, we conduct a proof-of-concept experiment on Python programming assignments from higher-education students. This experiment evaluates the extent of memorization in general-purpose LLMs, as these models are most commonly used by students for programming tasks.
  • We fill a critical gap in the literature by analyzing the trade-offs between privacy protection and detection effectiveness that educational institutions face when choosing between free and paid AI models.

References (32)