# US 2021/0081310 A1 · Methods and apparatus for self-supervised software defect detection

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

- Number: US 2021/0081310 A1
- Document ID: US20210081310A1
- Status: Published application
- Kind: A1
- Application number: 17/107,542
- Filed: 2020-11-30
- Published: 2021-03-18
- Earliest claimed: 2020-11-30
- Assignees: Intel Corporation
- Applicants: Intel Corporation
- Inventors: Justin Gottschlich
- Web page: https://patentgrep.com/patent/US20210081310A1

## CPC

- G06F 8/75: Structural analysis for program understanding
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 8/42: {Syntactic analysis}
- G06F 8/71: Version control (security arrangements therefor G06F21/57); Configuration management
- G06F 11/3604: Analysis of software for verifying properties of programs (testing of software G06F11/3668)
- G06F 11/362: Debugging of software
- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06F 11/3692: {for test results analysis}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods, apparatus, systems and articles of manufacture for self-supervised software defect detection are disclosed. An example apparatus includes a control structure miner to identify a plurality of code snippets in an instruction repository, the code snippets to represent control structures, the control structure miner to identify types of control structures of the code snippets; a cluster generator to generate a plurality of clusters of code snippets, respective ones of the clusters of the code snippets corresponding to different types of control structures; and a snippet ranker to label at least one code snippet of corresponding ones of the clusters of the code snippets as at least one reference code snippet, the at least one reference code snippets to be compared against a test code snippet to detect the defect in the software.

## Claims

### Claim 1

An apparatus to detect a defect in software, the apparatus comprising:
a control structure miner to identify a plurality of code snippets in an instruction repository, the code snippets to represent control structures, the control structure miner to identify types of control structures of the code snippets;
a cluster generator to generate a plurality of clusters of code snippets, the clusters of the code snippets corresponding to different types of control structures; and
a snippet ranker to label at least one code snippet of at least one of the clusters of the code snippets as at least one reference code snippet, the at least one reference code snippet to be compared against a test code snippet to detect the defect in the software.

### Claim 2 (depends on 1)

The apparatus of claim 1, wherein the clusters of the at least one cluster represent corresponding variants of the type of control structure.

### Claim 3 (depends on 1)

The apparatus of claim 1, wherein the cluster generator is to generate the clusters based on a pairwise similarity analysis.

### Claim 4 (depends on 1)

The apparatus of claim 1, wherein the snippet ranker is to label the at least one code snippet as the reference code snippet in response to a ranking based on a semantic analysis and a syntactic analysis.

### Claim 5 (depends on 1)

The apparatus of claim 1, wherein the control structure miner is to identify a control structure type of the test code snippet, and further including a syntax comparator to compare the test code snippet against the code snippets having the same type of control structure and that is labeled as the at least one reference code snippet, and identify the defect when there is a minor deviation between the test code snippet and the at least one reference code snippet.

### Claim 6 (depends on 5)

The apparatus of claim 5, further including a defect presenter to cause presentation of the identification of the defect.

### Claim 7 (depends on 1)

The apparatus of claim 1, further including:
a programming language selector to determine a programming language of the test code snippet; and
a control structure data store to include the plurality of code snippets organized by the programming language.

### Claim 8

At least one non-transitory computer readable medium comprising instructions that, when executed, cause at least one processor to at least:
identify a plurality of code snippets in an instruction repository, the code snippets to represent control structures;
identify types of control structures of the code snippets;
generate a plurality of clusters of code snippets, the clusters of the code snippets corresponding to different types of control structures; and
label at least one code snippet of at least one of the clusters of the code snippets as at least one reference code snippet, the at least one reference code snippets to be compared against a test code snippet to detect a defect.

### Claim 9 (depends on 8)

The at least one non-transitory computer readable storage medium of claim 8, wherein the clusters of the at least one cluster represent corresponding variants of the type of control structure.

### Claim 10 (depends on 8)

The at least one non-transitory computer readable storage medium of claim 8, wherein the instructions, when executed, cause the at least one processor to generate the clusters based on a pairwise similarity analysis.

### Claim 11 (depends on 8)

The at least one non-transitory computer readable storage medium of claim 8, wherein the instructions, when executed, cause the at least one processor to label the at least one code snippet as the reference code snippet in response to a ranking based on a semantic analysis and a syntactic analysis.

### Claim 12 (depends on 8)

The at least one non-transitory computer readable storage medium of claim 8, wherein the instructions, when executed, cause the at least one processor to at least:
identify a control structure type of the code snippet to analyze;
compare the test code snippet against the code snippets having the same type of control structure and that is labeled as the at least one reference code snippet; and
identify the defect when there is a minor deviation between the test code snippet and the at least one reference code snippet.

### Claim 13 (depends on 12)

The at least one non-transitory computer readable storage medium of claim 12, wherein the instructions, when executed, cause the at least one processor to cause presentation of the identification of the defect.

### Claim 14 (depends on 13)

The at least one non-transitory computer readable storage medium of claim 13, wherein the instructions, when executed, cause the at least one processor to apply a proposed correction to the code snippet to analyze based on the at least one reference code snippet.

### Claim 15

An apparatus comprising:
at least one storage device; and
at least one processor to execute instructions to:
identify a plurality of code snippets in an instruction repository, the code snippets to represent control structures;
identify types of control structures of the code snippets;
generate a plurality of clusters of code snippets, the clusters of the code snippets corresponding to different types of control structures; and
label at least one code snippet of at least one of the clusters of the code snippets as at least one reference code snippet, the at least one reference code snippet to be compared against a test code snippet to detect a defect.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the clusters of the at least one cluster represent corresponding variants of the type of control structure.

### Claim 17 (depends on 15)

The apparatus of claim 15, wherein the at least one processor is to generate the clusters based on a pairwise similarity analysis.

### Claim 18 (depends on 15)

The apparatus m of claim 15, wherein the at least one processor is to label the at least one code snippet as the reference code snippet in response to a ranking based on a semantic analysis and a syntactic analysis.

### Claim 19 (depends on 15)

The apparatus of claim 15, wherein the at least one processor is to at least:
identify a control structure type of the code snippet to analyze;
compare the test code snippet against the code snippets having the same type of control structure and that is labeled as the at least one reference code snippet; and
identify the defect when there is a minor deviation between the test code snippet and the at least one reference code snippet.

### Claim 20 (depends on 19)

The apparatus of claim 19, wherein the at least one processor is to cause presentation of the identification of the defect.

### Claim 21 (depends on 20)

The apparatus of claim 20, wherein the at least one processor is to apply a proposed correction to the code snippet to analyze based on the at least one reference code snippet.

### Claim 22

A method for detecting a defect in software, the method comprising:
identifying a plurality of code snippets in an instruction repository, the code snippets to represent control structures;
identifying types of control structures of the code snippets;
generating a plurality of clusters of code snippets, the clusters of the code snippets corresponding to different types of control structures; and
labeling at least one code snippet of at least one of the clusters of the code snippets as at least one reference code snippet, the at least one reference code snippet to be compared against a test code snippet to detect a defect.

### Claim 23 (depends on 22)

The method of claim 22, wherein the clusters of the at least one cluster represent corresponding variants of the type of control structure.

### Claim 24 (depends on 22)

The method of claim 22, wherein the generating of the clusters is based at least one cluster is performed based on a pairwise similarity analysis.

### Claim 25 (depends on 22)

The method of claim 22, wherein the labeling of the at least one code snippet as the reference code snippet is performed in response to a ranking based on a semantic analysis and a syntactic analysis.

### Claim at position 26

26-35. (canceled)
