AI Code Fixing Pipeline for Automated Vulnerability Patching

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing technologies lack an efficient and automated method for patching flawed program code, particularly in large-scale software development where manual intervention is time-consuming and prone to errors.

Innovation Solution

A generative AI-driven code fixing pipeline that utilizes a transformer-based large language model (LLM) to generate code modifications by fine-tuning the model with a training dataset of prompts and expected responses, and then integrating it into a pipeline with a cybersecurity scanner, prompt generator, and refiner to produce refined candidate patches.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If manual intervention is used to patch flawed program code, then developers can review and fix vulnerabilities, but the process is time-consuming and prone to errors

Engineering Contradiction:
Improveaccuracy of code patchingVSAvoidtime required for manual code review and patching
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system enables automated self-service code patching by training an LLM to generate security patches autonomously. The model learns from training datasets containing vulnerable code and corresponding fixed code, then automatically generates patches for new vulnerabilities without requiring manual developer intervention for each patch creation task.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent replaces the mechanical manual process of code review and patching with an AI-based system. The LLM-based automated patch generation system substitutes human developers' manual efforts, using machine learning models to analyze vulnerable code and generate corrections automatically.

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

2Productivity

If automated patch generation is implemented, then efficiency is improved, but the complexity of the system increases

Engineering Contradiction:
Improvespeed of code patchingVSAvoidcomplexity of automated patch generation system
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The LLM-based system serves multiple functions: it can analyze various types of code vulnerabilities, generate patches for different programming languages, and adapt to different security standards. This multi-functionality consolidates what would otherwise require multiple specialized tools into a single unified system.

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

Solution Approach 2:

The system performs preliminary training in advance by pre-training and fine-tuning the LLM on large datasets of vulnerable and fixed code. This preliminary action prepares the model to automatically generate accurate patches without requiring complex real-time analysis during actual patching operations.

Inventive Principle:
Principle #10Preliminary action

3Measurement precision

If comprehensive training datasets are used for fine-tuning, then the accuracy of generated patches is improved, but the training time and computational resources increase

Engineering Contradiction:
Improvequality of generated code patchesVSAvoidtime required for model training
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The system performs comprehensive pre-training and fine-tuning in advance using large training datasets. This preliminary action ensures the LLM is thoroughly trained on code patterns and vulnerability fixes before deployment, enabling high-quality patch generation without requiring extensive training during operational use.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The training process is designed to be continuous and iterative, with the model being progressively fine-tuned on increasingly specialized datasets. This continuous training approach allows the system to accumulate knowledge over time while maintaining productive operations.

Inventive Principle:
Principle #20Continuity of useful action

Data Source

PatentUS20250110855A1Auto-fixing code vulnerabilities with artificial intelligence
Publication Date: 2025.04.03 VERACODE INC
  • US20250110855A1 patent drawing
  • US20250110855A1 patent drawing
  • US20250110855A1 patent drawing

AI summary

A generative artificial intelligence (AI) driven code fixing pipeline has been created that uses a large language model (LLM) to recommend fixes for vulnerabilities detected in program code. A scanner generates indications of flaws in program code and weakness types for those flaws. One or more example code pairs are retrieved based on weakness type and programming language, an example code pair including an example flaw and an example fix of that flaw. The LLM is then prompted with a code fragment corresponding to a detected vulnerability, context for the code fragment, and the one or more example code pairs to generate a modification of existing program code that fixes the vulnerability.