# US 2026/0093815 A1 · Detecting Artificial Intelligence Generated Computer Code

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2026/0093815 A1
- Document ID: US20260093815A1
- Status: Published application
- Kind: A1
- Application number: 19/411,925
- Filed: 2025-12-08
- Published: 2026-04-02
- Earliest claimed: 2024-06-03
- Assignees: NEC Laboratories America, Inc.
- Applicants: NEC Laboratories America, Inc.
- Inventors: Wei Cheng; Haifeng Chen; Xianjun Yang
- Web page: https://patentgrep.com/patent/US20260093815A1

## CPC

- G06F 21/57: Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
- G06F 8/30: Creation or generation of source code
- G06F 8/75: Structural analysis for program understanding
- G06F 11/3624: {by performing operations on the source code, e.g. via a compiler}
- G06N 7/01: Probabilistic graphical models, e.g. probabilistic networks
- G06N 20/00: Machine learning
- G06F 2221/033: Test or assess software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## 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.

## Claims

### Claim 1

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.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, further comprising flagging the candidate code as AI-generated to detect malicious code for a decision-making entity to perform an action.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein the action is securing a healthcare management system handling patient vital data by patching the flagged candidate code for potential security risks.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein calculating the first value comprises predicting a probability of generating a remainder code given a prefix code of the candidate code.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein introducing perturbations comprises masking one or more portions of the candidate code to obtain the perturbed codes.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein calculating the set of second values comprises predicting probabilities of generating remainder filled codes given respective prefix filled codes of the machine-filled codes.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein analyzing the difference comprises comparing a value derived from the difference against a detection threshold.

### Claim 8

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.

### Claim 9 (depends on 8)

The system of claim 8, further comprising the processor device flagging the candidate code as AI-generated to detect malicious code for a decision-making entity to perform an action.

### Claim 10 (depends on 9)

The system of claim 9, wherein the processor device performs the action securing a healthcare management system handling patient vital data by patching the flagged candidate code for potential security risks.

### Claim 11 (depends on 8)

The system of claim 8, wherein calculating the first value by the processor device comprises predicting a probability of generating a remainder code given a prefix code of the candidate code.

### Claim 12 (depends on 8)

The system of claim 8, wherein introducing perturbations by the processor device comprises masking one or more portions of the candidate code to obtain the perturbed codes.

### Claim 13 (depends on 8)

The system of claim 8, wherein calculating the set of second values by the processor device comprises predicting probabilities of generating remainder filled codes given respective prefix filled codes of the machine-filled codes.

### Claim 14 (depends on 8)

The system of claim 8, wherein analyzing the difference by the processor device comprises comparing a value derived from the difference against a detection threshold.

### Claim 15

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.

### Claim 16 (depends on 15)

The non-transitory computer program product of claim 15, the program code further causing the computer to perform flagging the candidate code as AI-generated to detect malicious code for a decision-making entity to perform an action.

### Claim 17 (depends on 16)

The non-transitory computer program product of claim 16, wherein the action is securing a healthcare management system handling patient vital data by patching the flagged candidate code for potential security risks.

### Claim 18 (depends on 15)

The non-transitory computer program product of claim 15, wherein calculating the first value comprises predicting a probability of generating a remainder code given a prefix code of the candidate code.

### Claim 19 (depends on 15)

The non-transitory computer program product of claim 15, wherein calculating the set of second values comprises predicting probabilities of generating remainder filled codes given respective prefix filled codes of the machine-filled codes.

### Claim 20 (depends on 15)

The non-transitory computer program product of claim 15, wherein analyzing the difference comprises comparing a value derived from the difference against a detection threshold.
