Code Edit Embeddings Using Graph Paths for Commit Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing deep learning applications struggle to effectively represent code changes (commits) due to the dynamic nature of codebases, necessitating a method to analyze temporal components in software development.

Innovation Solution

A path-based model that combines multiple graph structures (AST, CFG, DFG) to extract meaningful paths, encoding changes in syntax, control flow, and data flow, using an attention mechanism to focus on relevant code edits, generating commit vector representations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If multiple graph structures (AST, CFG, DFG) are combined to represent code changes, then the representation completeness and accuracy are improved, but the computational complexity and processing time increase

Engineering Contradiction:
Improvecode change representation accuracyVSAvoidmodel structural complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent combines multiple graph structures (AST, CFG, DFG) into a unified path-based representation model. Different graph types capture different aspects of code changes: AST for syntactic structure, CFG for control flow, and DFG for data flow. By merging these representations and extracting paths from each, the model achieves comprehensive code change representation while managing complexity through modular processing of each graph type separately

Inventive Principle:
Principle #5Merging (Combining)

Solution Approach 2:

The model segments the code change representation task by extracting paths from different graph structures separately and then integrating them. Instead of processing the entire codebase as a single complex structure, the patent divides it into manageable path segments from AST, CFG, and DFG, which are then combined to form the complete commit embedding. This segmentation reduces the overwhelming complexity of handling all code aspects simultaneously

Inventive Principle:
Principle #1Segmentation

2Loss of information

If path-based extraction from multiple graph structures is used, then the ability to capture semantic information is improved, but the processing time and computational resources increase

Engineering Contradiction:
Improvesemantic information retentionVSAvoidprocessing time
Core Design Contradiction:
Loss of informationVSLoss of time

Solution Approach 1:

The patent extracts only the relevant path information from each graph structure rather than processing the entire graph. By identifying and extracting meaningful paths from AST, CFG, and DFG that are specific to the code changes in a commit, the model captures essential semantic information while avoiding the computational overhead of analyzing the complete graph structures. This selective extraction focuses resources on the most informative elements

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The model applies partial action by focusing computational effort only on the paths that are actually modified in the commit rather than analyzing all possible paths in the codebase. This approach processes only the necessary portion of the graph structures relevant to the specific code change, reducing processing time while maintaining semantic information quality for the changed elements

Inventive Principle:
Principle #16Partial or excessive action

3Adaptability or versatility

If commit vector representations are generated for language-agnostic code analysis, then the versatility and applicability are improved, but the difficulty of detecting and measuring code changes increases

Engineering Contradiction:
Improvelanguage-agnostic capabilityVSAvoidcode change detection complexity
Core Design Contradiction:
Adaptability or versatilityVSDifficulty of detecting and measuring

Solution Approach 1:

The patent creates a universal path-based representation model that works across multiple programming languages by leveraging common graph structure concepts (AST, CFG, DFG) that exist in most programming languages. The model extracts paths based on structural and semantic patterns rather than language-specific syntax, enabling language-agnostic code analysis. This universal approach allows the same model to process code changes in different languages without requiring language-specific customization

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The model transforms code changes into a standardized vector representation format that captures essential change characteristics regardless of the source language. By converting diverse code changes into a common parameter space (path-based embeddings), the model simplifies the detection and measurement of code changes. This parameter transformation enables uniform processing of different types of code changes across languages, reducing the complexity of detecting and measuring variations in code structures

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS12474922B2System for learning embeddings of code edits
Publication Date: 2025.11.18 SAP SE
  • US12474922B2 patent drawing
  • US12474922B2 patent drawing
  • US12474922B2 patent drawing

AI summary

Systems and methods are provided for analyzing a commit comprising an updated version of software code against a previous version of software code to determine a plurality of methods in the commit that have been changed, identifying a previous version and an updated version for each method that has been changed, and generating graphical representations of each previous version and each updated version of each method that has been changed. The systems and methods further provide for extracting path contexts from each graphical representation for each previous version and each updated version of each method, determining path contexts that are different by comparing each path context for each previous version with an associated updated version of each method, and encoding each path context that is different to generate at least one commit vector representation of the commit.