Numeric Array Source Code Representation for ML Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Machine Learning models cannot directly process source code written in high-level programming languages, as they are trained on numerical data, leading to difficulties in performing intelligent analysis such as vulnerability prediction, code review, and completion.

Innovation Solution

Converting source code into a binary Abstract Syntax Tree (AST) representation and then into a numeric array representation, allowing Machine Learning algorithms to analyze and process the source code effectively while preserving semantic information.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If source code is processed directly using Machine Learning models, then the analysis can be performed, but Machine Learning models cannot directly process source code written in high-level programming languages because they are trained on numerical data

Engineering Contradiction:
Improveability of ML models to process source codeVSAvoiddifficulty in performing intelligent analysis
Core Design Contradiction:
Adaptability or versatilityVSEase of manufacture

Solution Approach 1:

The patent introduces an intermediary conversion process that transforms source code into numerical representations. Specifically, source code is converted into Abstract Syntax Trees (AST), which are then transformed into numerical arrays that ML models can process. This intermediary representation bridges the gap between textual source code and numerical data requirements of ML models, enabling vulnerability prediction and code analysis without requiring direct processing of high-level programming languages by ML models.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent changes the parameter representation of source code from textual form to numerical form. By converting source code elements into numerical values through AST representation and subsequent numerical transformation, the system adapts the data format to match ML model requirements. This parameter change enables the source code to be processed by ML models while preserving the semantic information necessary for intelligent analysis.

Inventive Principle:
Principle #35Parameter changes

2Productivity

If source code is converted into numeric array representations through binary AST, then Machine Learning algorithms can analyze the source code effectively, but the conversion process adds complexity to the system

Engineering Contradiction:
Improveefficiency of ML analysis on source codeVSAvoidcomplexity of conversion process
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent segments the source code analysis process into distinct stages: source code parsing into Abstract Syntax Trees, AST transformation into numerical representations, and ML model processing. By dividing the complex conversion process into manageable segments, each with a specific function, the system achieves efficient ML analysis while organizing the complexity into modular, manageable components. This segmentation allows for specialized processing at each stage and facilitates implementation and optimization.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS12111934B2Methods of evaluating source code using numeric array representations of source code elements
Publication Date: 2024.10.08 TELEFONAKTIEBOLAGET LM ERICSSON (PUBL)
  • US12111934B2 patent drawing
  • US12111934B2 patent drawing
  • US12111934B2 patent drawing

AI summary

Source code evaluation is provided. The source code includes a plurality of source code elements, and one of the source code elements is selected. A plurality of tokens is generated based on the source code element, and a binary AST representation is generated based on the plurality of tokens. The binary AST representation includes a plurality of binary AST nodes including binary AST token and null nodes. Each of the binary AST token nodes is based on a respective one of the plurality of tokens. Each of the binary AST token and null nodes is encoded into a respective numeric value. A numeric array representation of the source code element is generated based on the binary AST representation. The numeric values are mapped to locations in the numeric array representation based on respective locations of the binary AST token and null nodes in the binary AST representation.