Multi-Signal Code Pattern Matching with Graph Propagation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current code inspection methods inadequately classify and flag sensitive patterns in code, leading to potential disruptions, loss of customer confidence, and even life-threatening issues due to poorly inspected code.

Innovation Solution

A system and method for multi-signal pattern matching with graph propagation, which retrieves code snippets, generates tree and syntax representations, performs string-based and syntax tree matching, combines scores, and uses a machine learning classifier to classify and identify code snippets of interest, while propagating dependencies in a graph to flag potentially impactful code.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If multiple matching methods (string-based, parser/syntax tree, syntax, property) are combined to improve code snippet identification accuracy, then the classification precision improves, but the computational complexity and processing time increase

Engineering Contradiction:
Improvecode snippet classification accuracyVSAvoidmatching system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The code inspection system is divided into multiple independent matching modules: string-based matching, parser/syntax tree matching, syntax matching, and property matching. Each module handles a specific aspect of code analysis independently, allowing the system to achieve high classification accuracy through combined results while maintaining manageable complexity through modular design. The graph propagation component further segments the problem by identifying and propagating dependencies among code snippets.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system merges results from four different matching methods by combining their scores to identify code snippets of interest. This integration of multiple matching approaches enables the system to leverage the strengths of each method (string matching for quick filtering, syntax tree matching for structural analysis, syntax matching for grammatical correctness, and property matching for semantic properties) to achieve superior overall accuracy compared to any single method alone.

Inventive Principle:
Principle #5Merging (Combining)

2Reliability

If graph propagation is used to propagate dependencies between code snippets, then the detection completeness improves by identifying related code, but the processing time and computational resources increase

Engineering Contradiction:
Improvedetection completenessVSAvoidprocessing time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs graph propagation to identify dependencies between code snippets before final classification and flagging. By pre-computing the dependency graph and propagating signals through it, the system prepares the structural relationships in advance, enabling more complete detection of related code snippets without significantly increasing the time required for the main inspection task.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The graph propagation mechanism acts as an intermediary between the initial code snippet matching and the final classification results. It mediates by propagating dependency signals across the codebase, allowing the system to identify indirectly related code snippets that would not be detected by direct matching alone, thereby improving detection completeness while managing computational overhead through targeted propagation.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Measurement precision

If machine learning classifier is trained with user feedback to improve classification accuracy, then the model performance improves, but the training time and resource requirements increase

Engineering Contradiction:
Improveclassification accuracyVSAvoidtraining time
Core Design Contradiction:
Measurement precisionVSDuration of action of moving object

Solution Approach 1:

The system implements a feedback mechanism where user corrections and annotations of classified code snippets are collected and used to retrain the machine learning classifier. This continuous feedback loop allows the model to learn from real-world usage patterns and improve its classification accuracy over time, transforming user interactions into training data that progressively enhances model performance without requiring extensive manual retraining sessions.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS12197911B2Systems and methods for multi-signal pattern matching with graph propagation
Publication Date: 2025.01.14 JPMORGAN CHASE BANK NA
  • US12197911B2 patent drawing
  • US12197911B2 patent drawing

AI summary

A method may include: retrieving a plurality of code snippets from code repositories; generating a syntax representation, a property representation for each of the code snippets; receiving a query comprising a query code snippet, natural language keywords, and/or a string pattern; performing string-based matching and parser/syntax tree matching on the query and the tree representations, syntax matching on the query and the syntax representations, and property matching on the query and the property representations, wherein each of the matchings results in a score; combining the scores of the string-based matching, the parser/syntax tree matching, the syntax matching, and/or the property matching; identifying a plurality of code snippets of interest based on the combined scores; classifying the code snippets of interest using a machine learning classifier; outputting a list of the code snippets of interest with their classifications; and training the machine learning classifier based on user feedback.