Weakly Supervised Unit Test Quality Scoring via Generative Models

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Inadequate code inspection can lead to significant disruptions, loss of customer confidence, and potential life-threatening issues due to poorly developed and poorly inspected code, as existing unit test methods fail to ensure robust application performance.

Innovation Solution

A system and method for weakly supervised unit test quality scoring using a generative model that parses code snippets via an abstract syntax tree, applies binary labeling functions to create a labelling matrix, trains a probabilistic generative model for pseudo-labels, and builds a discriminative model for accurate unit test scoring, providing actionable explanations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional unit test methods are used, then implementation is simple, but code inspection quality is inadequate

Engineering Contradiction:
Improvecode inspection qualityVSAvoidsystem complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent introduces an intermediary machine learning model that acts as a mediator between the code snippets and the quality assessment process. This model transforms raw code into structured representations with quality scores, bridging the gap between simple traditional methods and complex manual inspection, thereby improving code inspection quality without requiring direct human involvement in every case.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent replaces manual code inspection mechanisms with an automated machine learning-based system. The mechanical process of human reviewers examining code is substituted with an electronic system that uses trained models to automatically assess code quality, maintaining or improving inspection quality while reducing system complexity in terms of human resource requirements.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Measurement precision

If manual code inspection is performed, then code quality assessment is thorough, but time consumption increases

Engineering Contradiction:
Improvecode quality assessment accuracyVSAvoidinspection time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent performs preliminary actions by pre-training machine learning models on large datasets of code before actual inspection. This preliminary training phase enables the models to quickly and accurately assess code quality during actual inspection, achieving thorough assessment accuracy without the time consumption of manual review for each code snippet.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent creates copies of code snippets and processes them through the machine learning model, which learns from multiple examples and variations. The model captures patterns from numerous code examples, enabling accurate quality assessment that replicates or exceeds manual inspection thoroughness while operating at automated speed, significantly reducing inspection time.

Inventive Principle:
Principle #26Copying

3Productivity

If automated testing is implemented, then productivity increases, but test quality may be insufficient

Engineering Contradiction:
Improvetesting throughputVSAvoidunit test quality
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent implements feedback mechanisms where the machine learning model continuously learns from the results of unit tests and code quality assessments. The model receives feedback about which tests are high-quality and which are not, adjusting its assessments accordingly. This feedback loop enables automated testing to maintain high productivity while improving test quality over time through iterative learning.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The patent changes key parameters of the testing system by introducing learned quality scores and probabilistic assessments instead of simple pass/fail criteria. By adjusting the confidence thresholds and quality metrics dynamically based on learned patterns, the system maintains high productivity through automation while ensuring sufficient test quality through intelligent parameter adjustment.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS20230401469A1Systems and methods for weakly supervised unit test quality scoring
Publication Date: 2023.12.14 JPMORGAN CHASE BANK NA
  • US20230401469A1 patent drawing
  • US20230401469A1 patent drawing
  • US20230401469A1 patent drawing

AI summary

Systems and methods for weakly supervised unit test quality scoring are disclosed. According to one embodiment, a method may include: parsing, by a generative model computer program, a plurality of code snippets in a repository using an abstract syntax tree; receiving, by the generative model computer program, a plurality of binary labelling functions from a labelling function repository; creating, by the generative model computer program, a labelling matrix by applying the binary labelling functions to the parsed code snippets; training, by the generative model computer program, a probabilistic generative model using the labelling matrix resulting in a vector of pseudo-labels; building, by a unit test scoring computer program, a discriminative model, wherein the discriminative model receives an array of real value inputs; and training, by the unit test scoring computer program, the discriminative model using the parsed code snippets, the vector of pseudo labels, and the abstract syntax tree.