# US 2026/0093814 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/0093814 A1
- Document ID: US20260093814A1
- Status: Published application
- Kind: A1
- Application number: 19/411,914
- 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/US20260093814A1

## 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:
masking one or more portions of a candidate code to obtain perturbed codes;
generating missing code for the perturbed codes by employing an AI code generator model to obtain machine-filled codes;
predicting probabilities of the candidate code and the machine-filled codes as AI-generated by employing a surrogate model; and
distinguishing the candidate code as AI-generated by comparing the probabilities against a detection threshold to obtain detection results.

### 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 predicting probabilities further comprises predicting the candidate code probability by predicting the probability of generating a remainder code given a prefix code.

### Claim 5 (depends on 4)

The computer-implemented method of claim 4, wherein distinguishing the candidate code further comprises comparing n-gram divergence of a prefix code and a remainder code and n-gram divergence of prefix filled codes and remainder filled codes.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein predicting probabilities further comprises predicting machine-filled codes probabilities by predicting the probability of generating a remainder filled code given a prefix filled code.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein distinguishing the candidate code further comprises computing a difference between the candidate code probability and the machine-filled codes probabilities.

### 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:
mask one or more portions of a candidate code to obtain perturbed codes;
generate missing code from the perturbed codes by employing an AI code generator model to obtain machine-filled codes;
predict probabilities of the candidate code and the machine-filled codes as AI-generated by employing a surrogate model; and
distinguish the candidate code as AI-generated by comparing the probabilities against a detection threshold to obtain detection results.

### 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 predicting probabilities by the processor device further comprises predicting the candidate code probability by predicting the probability of generating a remainder code given a prefix code.

### Claim 12 (depends on 11)

The system of claim 11, wherein distinguishing the candidate code by the processor device further comprises comparing n-gram divergence of a prefix code and a remainder code and n-gram divergence of prefix filled codes and remainder filled codes.

### Claim 13 (depends on 8)

The system of claim 8, wherein predicting probabilities by the processor device further comprises predicting machine-filled codes probabilities by predicting the probability of generating a remainder filled code given a prefix filled code.

### Claim 14 (depends on 8)

The system of claim 8, wherein distinguishing the candidate code by the processor device further comprises computing a difference between the candidate code probability and the machine-filled codes probabilities.

### 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:
masking one or more portions of a candidate code to obtain perturbed codes;
generating missing code from the perturbed codes by employing an AI code generator model to obtain machine-filled codes;
predicting probabilities of the candidate code and the machine-filled codes as AI-generated by employing a surrogate model;
and
distinguishing the candidate code as AI-generated by comparing the probabilities against a detection threshold to obtain detection results.

### Claim 16 (depends on 15)

The non-transitory computer program product of claim 15, further comprising 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 predicting probabilities further comprises predicting the candidate code probability by predicting the probability of generating a remainder code given a prefix code.

### Claim 19 (depends on 15)

The non-transitory computer program product of claim 15, wherein predicting probabilities further comprises predicting machine-filled codes probabilities by predicting the probability of generating a remainder filled code given a prefix filled code.

### Claim 20 (depends on 18)

The non-transitory computer program product of claim 18, wherein distinguishing the candidate code further comprises computing a difference between the candidate code probability and the machine-filled codes probabilities.
