WhyGen: Explaining ML-powered Code Generation by Referring to Training Examples
Weixiang Yan, Yuanchun Li

TL;DR
WhyGen is a tool that explains AI-generated code by referencing training examples, helping users understand the origin of generated code and addressing legal and ethical concerns about data recitation.
Contribution
Introducing WhyGen, a novel method that uses inference fingerprints and a database of training examples to explain code generation decisions in deep learning models.
Findings
Achieves 81.21% top-10 accuracy in identifying relevant training examples.
Effectively explains generated code by linking it to training data.
Helps mitigate legal and ethical concerns in AI code generation.
Abstract
Deep learning has demonstrated great abilities in various code generation tasks. However, despite the great convenience for some developers, many are concerned that the code generators may recite or closely mimic copyrighted training data without user awareness, leading to legal and ethical concerns. To ease this problem, we introduce a tool, named WhyGen, to explain the generated code by referring to training examples. Specifically, we first introduce a data structure, named inference fingerprint, to represent the decision process of the model when generating a prediction. The fingerprints of all training examples are collected offline and saved to a database. When the model is used at runtime for code generation, the most relevant training examples can be retrieved by querying the fingerprint database. Our experiments have shown that WhyGen is able to precisely notify the users about…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Machine Learning and Data Classification · Software Testing and Debugging Techniques
