Detecting Artificial Intelligence Generated Computer Code
AssigneeNEC Laboratories America, Inc.
InventorsWei Cheng, Haifeng Chen, Xianjun Yang
Life of this patent
Estimating the term…
Abstract
Systems and methods for detecting artificial intelligence (AI) generated computer code. Lines of code can be masked from a candidate code to obtain perturbed codes. Missing code can be generated from the perturbed codes by employing an AI code generator model to obtain machine-filled codes. Probabilities of the candidate code probability and the machine-filled codes as AI-generated can be predicted by employing a surrogate model. The candidate code can be distinguished as AI-generated by comparing the probabilities against a detection threshold to obtain detection results.
Claims20
A computer-implemented method for detecting artificial intelligence (AI) generated computer code, comprising:
- introducing perturbations into a candidate code to obtain perturbed codes;
- obtaining machine-filled codes by employing an AI code generator model to fill the perturbations;
- calculating a first value for the candidate code and a set of second values for the machine-filled codes using a surrogate model, the values being indicative of an AI-generation likelihood;
- and
- distinguishing the candidate code as AI-generated by analyzing a difference between the first value and the set of second values.
A system for detecting artificial intelligence (AI) generated computer code, comprising:
- a memory;
- and
- one or more processor devices in communication with the memory configured to:
- introduce perturbations into a candidate code to obtain perturbed codes;
- obtain machine-filled codes by employing an AI code generator model to fill the perturbations;
- calculate a first value for the candidate code and a set of second values for the machine-filled codes using a surrogate model, the values being indicative of an AI-generation likelihood;
- and
- distinguish the candidate code as AI-generated by analyzing a difference between the first value and the set of second values.
A non-transitory computer program product comprising a computer-readable storage medium including program code for detecting artificial intelligence (AI) generated computer code, wherein the program code when executed on a computer causes the computer to perform:
- introducing perturbations into a candidate code to obtain perturbed codes;
- obtaining machine-filled codes by employing an AI code generator model to fill the perturbations;
- calculating a first value for the candidate code and a set of second values for the machine-filled codes using a surrogate model, the values being indicative of an AI-generation likelihood;
- and
- distinguishing the candidate code as AI-generated by analyzing a difference between the first value and the set of second values.
Dependencies are inferred from the claim text.