Incremental code optimization method based on combination of DevOps and AI

By configuring Webhook and AI modules in the DevOps process, real-time monitoring of code submissions and generating optimization suggestions, and adjusting model parameters in combination with the feedback mechanism, the problems of low efficiency, insufficient integration and lack of feedback in the existing technology are solved, and efficient and intelligent code optimization is achieved.

CN120492022APending Publication Date: 2025-08-15INSPUR TIANYUAN COMM INFORMATION SYST CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510554154.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

In the existing technology, code optimization depends on developer experience and is inefficient. DevOps toolchain lacks support for code quality optimization. AI code optimization tools and DevOps processes lack deep integration, and an effective feedback mechanism, resulting in the disconnection of optimization suggestions from actual development needs.

Method used

By configuring Webhook services in the DevOps process, monitoring code submissions in real time, using AI modules to perform semantic understanding and pattern recognition, generating optimization suggestions, and introducing feedback mechanisms to adjust model parameters to achieve automated and intelligent code optimization.

Benefits of technology

It improves the efficiency and quality of code optimization, realizes the automated generation and continuous optimization of code optimization suggestions, adapts to the personalized needs of different projects and teams, and improves the efficiency and code quality of software development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005382936080000051
    Figure BDA0005382936080000051
  • Figure BDA0005382936080000061
    Figure BDA0005382936080000061
  • Figure BDA0005382936080000062
    Figure BDA0005382936080000062
Patent Text Reader

Abstract

The invention provides an incremental code optimization method based on the combination of DevOps and AI, belongs to the technical field of software development and optimization, and provides an incremental code optimization scheme based on GitLab and AI large models aiming at the requirement of code quality improvement in modern software development. According to the scheme, code submission operation is monitored through the Webhook technology of GitLab, incremental code changes are captured in real time, and contrastive analysis is conducted on the incremental code changes and original codes. By means of the strong analysis capability of the AI large model, the system can quickly identify potential problems in codes and generate targeted optimization suggestions. The optimization suggestions are notified to a submitter through mails, the submitter can evaluate the suggestions, and meanwhile, the codes before and after optimization are comprehensively evaluated regularly. Based on real evaluation feedback, the system further adjusts parameters and a knowledge base of the AI large model, and continuous optimization and improvement of the model are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development and optimization, and in particular to an incremental code optimization method based on the combination of DevOps and AI. Background Art

[0002] With the rapid development of the software development industry, code quality and development efficiency have become critical factors influencing the success of software projects. In traditional software development processes, code optimization often relies on developer experience and manual inspections, an approach with numerous limitations. First, manual code review is time-consuming and labor-intensive, making it difficult to cover all potential issues in large code bases and prone to missing performance bottlenecks, security vulnerabilities, or coding style issues. Second, differences in developer experience can lead to subjective and inconsistent optimization recommendations, making it difficult to establish a standardized optimization process. Furthermore, code optimization is often concentrated in the later stages of a project, making continuous optimization difficult to achieve. This can lead to performance issues and maintenance difficulties even after software delivery.

[0003] In recent years, the rise of the DevOps concept has driven the deep integration of software development and operations. Through practices like continuous integration (CI) and continuous deployment (CD), software development has become more automated and efficient. However, despite significant progress in code delivery efficiency, DevOps still faces challenges in optimizing code quality. While existing DevOps toolchains can automate code building, testing, and deployment, they lack support for in-depth analysis and optimization of code quality.

[0004] At the same time, the development of artificial intelligence (AI) technology has brought new opportunities for code optimization. AI models possess powerful natural language processing and code understanding capabilities, enabling them to quickly identify code issues and generate optimization recommendations. However, the application of AI in code optimization is still in its early stages and lacks deep integration with DevOps processes. Most AI code optimization tools exist only as standalone code review tools or plug-ins, failing to seamlessly integrate with existing DevOps workflows, making it difficult to achieve automated and continuous code optimization.

[0005] Furthermore, most existing AI code optimization solutions lack effective feedback mechanisms. The quality of optimization suggestions often relies on the model's initial training data, lacking the ability to dynamically adjust optimization results in actual development scenarios. This can lead to optimization suggestions being out of sync with actual development needs, failing to meet the personalized requirements of different projects and teams.

[0006] In actual development, code optimization requires a combination of developer feedback and expert evaluation. However, current AI optimization solutions rarely provide this feedback mechanism. Developers' evaluations of optimization suggestions cannot be effectively fed back into the model, resulting in the model's inability to self-optimize based on actual usage. Furthermore, the lack of a regular expert evaluation mechanism makes it difficult to objectively verify optimization results.

[0007] In summary, existing technologies for code optimization have the following shortcomings: First, manual code review is inefficient and relies on developer experience; second, DevOps tool chains lack support for code quality optimization; third, AI code optimization tools lack deep integration with DevOps processes; and fourth, there is a lack of effective feedback mechanisms, resulting in a disconnect between optimization suggestions and actual development needs. Therefore, an incremental code optimization solution that combines DevOps practices and AI technology is needed to achieve automated, intelligent, and continuous code optimization, thereby improving software development efficiency and code quality. Summary of the Invention

[0008] In response to the need to improve code quality in modern software development, the present invention provides an incremental code optimization method based on the combination of DevOps and AI, aiming to improve code quality, optimize development processes, reduce maintenance costs, and improve software delivery efficiency through automated and intelligent means.

[0009] The present invention first configures a webhook service within the DevOps process to monitor changes in the codebase in real time. Once a code submission is detected, the system automatically triggers the code analysis process. By analyzing all code submissions and the current incremental code, the AI module uses machine learning algorithms to perform semantic understanding and pattern recognition on the code, quickly identifying potential performance bottlenecks, security vulnerabilities, and coding style issues. Based on the AI analysis results, the system generates targeted optimization suggestions and stores the optimization solutions in a database.

[0010] Furthermore, this invention introduces a feedback mechanism that evaluates the quality of generated code and further adjusts the parameters of the AI model to achieve a more precise optimization strategy. This approach not only improves the efficiency and quality of code optimization but also seamlessly integrates with DevOps processes to automatically generate code optimization suggestions, providing software development teams with an efficient and intelligent code optimization solution.

[0011] The technical solution of the present invention is:

[0012] An incremental code optimization system based on the combination of DevOps and AI, including:

[0013] a. Code scanning module, which is used to monitor code submissions in the code library in real time and trigger the code analysis process;

[0014] b. The AI analysis module uses machine learning algorithms to perform semantic understanding and pattern recognition on the code, identifying potential performance bottlenecks, security vulnerabilities, and code logic and style issues for the submitted code.

[0015] c. Optimize the notification module, generate optimization suggestions based on AI analysis results, and send email notifications to the code submitter;

[0016] d. Feedback adjustment module, which allows code submitters to score AI-generated optimization suggestions, monitor the scoring results, and adjust AI model parameters to achieve more accurate optimization strategies.

[0017] Further,

[0018] The AI analysis module uses deep learning algorithms, including recurrent neural networks (RNNs) or long short-term memory networks (LSTMs), to improve the accuracy of code analysis.

[0019] Further,

[0020] The feedback adjustment module collects optimization suggestion scoring data through monitoring tools and adjusts the AI model based on data feedback to achieve continuous optimization.

[0021] Going further,

[0022] This invention integrates GitLab's Webhook function, AI large-scale model analysis, and feedback adjustment mechanism to achieve real-time monitoring of code submissions, automatic optimization suggestion generation, developer feedback collection, and dynamic adjustment of model parameters, thereby achieving the purpose of continuous code optimization.

[0023] 1. Code submission monitoring and code incremental capture

[0024] GitLab's webhook feature monitors commits in the code repository in real time. Whenever new code is committed, the webhook triggers an event, capturing the incremental code. The system compares the incremental code with the original code, extracting the changes for subsequent analysis. This process provides real-time awareness of code changes and ensures timely optimization recommendations.

[0025] 2. AI large model analysis and optimization suggestion generation

[0026] The comparison results of the captured incremental code with the original code are fed into a large AI model. Based on deep learning algorithms, this model performs semantic understanding, pattern recognition, and static analysis of the code, quickly identifying potential performance bottlenecks, security vulnerabilities, code logic, and coding style issues. Based on the analysis results, the AI model generates targeted optimization suggestions, including but not limited to code refactoring, performance optimization, and security hardening. These optimization suggestions are presented to the submitter in a clear and understandable manner, helping them quickly understand and adopt them.

[0027] 3. Feedback mechanism and optimization suggestion evaluation

[0028] After receiving an optimization suggestion, the submitter can evaluate it through the system interface or by email, providing feedback on their satisfaction and feasibility. Furthermore, technical experts will regularly conduct comprehensive reviews of the code before and after optimization to verify the authenticity and effectiveness of the optimization results from a technical perspective. This feedback will be collected and stored as an important basis for subsequent model adjustments.

[0029] 4. Dynamic adjustment of model parameters and knowledge base

[0030] Based on feedback from submitters and experts, the system dynamically adjusts the parameters and knowledge base of the large AI model. Through machine learning's reinforcement learning mechanism, the model continuously optimizes its parameters based on actual optimization results, improving the quality of its analysis and recommendations. Simultaneously, code examples and their evaluation results before and after optimization are updated in the knowledge base, enriching the model's training data and enabling it to better adapt to the needs of different projects and development scenarios. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0032] This invention uses GitLab's Webhook technology to monitor code submission operations, capture incremental code changes in real time, and compare and analyze them with the original code. With the powerful analytical capabilities of the AI large model, the system can quickly identify potential problems in the code and generate targeted optimization suggestions. The optimization suggestions are notified to the submitter via email, and the submitter can evaluate the suggestions. At the same time, technical experts are organized to conduct regular comprehensive evaluations of the code before and after optimization. Based on real evaluation feedback, the system further adjusts the parameters and knowledge base of the AI large model to achieve continuous optimization and improvement of the model.

[0033] The workflow is as follows:

[0034] (1) GitLab Webhook integration and code commit monitoring

[0035] This feature is implemented based on GitLab's Webhook feature. First, configure the Webhook on GitLab, and then write the specific Webhook receiving interface.

[0036] 1. GitLab Webhook Configuration

[0037] In your GitLab project, go to the project's Settings page and find the Webhooks option.

[0038] Add a new Webhook and configure its URL to point to the code submission receiving interface of this system, for example, http: / / your-server.com / code-commit-webhook.

[0039] Select the trigger event type as "Push events" to trigger the webhook when the code is submitted.

[0040] 2. Code submission monitoring

[0041] Write a Webhook receiving interface, for example, use the Spring Boot framework to create a Webhook receiving interface to capture the POST request sent by GitLab.

[0042] Considering that large models take a long time to process, we recommend using asynchronous processing to directly record the Push event requests sent by GitLab into the task list.

[0043] Task List:

[0044]

[0045] List of messages received by Webhook:

[0046]

[0047] (2) Code comparison and incremental code extraction

[0048] The background rotates the task list every minute. If there is a task in progress, the rotation is terminated. If there is no task in progress, the tasks in the message list received by the Webhook with the status of not yet executed are taken out and traversed.

[0049] Write code to retrieve relevant code information based on the Push event. For example, in Java, you can use the GitLab API to retrieve the list of commits corresponding to the current Push. By traversing the list, you can obtain multiple diffs corresponding to each commit. Call the GitLab interface to retrieve the entire content of the code file corresponding to the CommitId. Based on the diffs, you can obtain the specific additions, deletions, and modifications to the file content in the current commit.

[0050] Here are some pseudo-code snippets for reference:

[0051]

[0052]

[0053]

[0054] (3) Optimization suggestion generation and notification

[0055] The full text of the code file in the second step, i.e. fileContent in the sample code, and the incremental code information, i.e. diffStr in the sample code, are concatenated with appropriate prompt words and sent as parameters to the large model. The large model interface is called to obtain the analysis results.

[0056] Reference word format:

[0057]

[0058]

[0059]

[0060] Through prompt words, the response structure returned by the large model is limited, including file path, segmented description of change points, code before optimization, code after optimization, description of modification points, and evaluation and scoring functions.

[0061] Based on the actual content returned, an email template is filled in and the optimization suggestions are sent to the code submitter for review. The submitter can score the content of the optimization suggestions based on the actual situation. If the suggestions are considered reasonable, the code can be further modified.

[0062] (4) Feedback Collection Module

[0063] Feedback collection for optimization suggestions includes evaluation by code submitters and expert assessment.

[0064] 1. Submitter feedback collection interface

[0065] Responsible for receiving developers' evaluation of optimization suggestions and saving the evaluation information to the database.

[0066] 2. Expert evaluation mechanism

[0067] Regularly evaluate the code before and after optimization and feed the results back into the system. For quick review and scoring, a separate page can be provided to display code snippets before and after optimization, along with descriptions of recommended changes.

[0068] (5) Model parameter adjustment module

[0069] The model parameter adjustment module is a key component of this solution's continuous optimization. Its core function is to dynamically adjust the parameters and knowledge base of the large AI model based on feedback from developers and experts to improve model accuracy and the quality of optimization recommendations. Through continuous learning and feedback mechanisms, the model can better adapt to different development scenarios and project requirements, thereby achieving intelligent code optimization.

[0070] 1. Feedback data collection and preprocessing

[0071] Collect developer feedback from the submitter feedback collection module, including information such as satisfaction, feasibility, and adoption. Obtain expert code quality ratings and comments before and after optimization from the expert evaluation module. Clean and pre-process the collected feedback data to remove invalid or duplicate data. Convert the feedback data into a format suitable for model training.

[0072] 2. Model parameter adjustment

[0073] Adjust the model's parameters based on developer feedback. For example, if a particular optimization suggestion receives low satisfaction, adjust the model's weights or thresholds to reduce the generation of similar suggestions.

[0074] Adjust the model's parameters based on the evaluation results. For example, if the optimized code scores low, adjust the model's optimization strategy or knowledge base.

[0075] 3. Knowledge Base Update

[0076] Based on the feedback, the code cases before and after optimization and their evaluation results are updated to the knowledge base.

[0077] The knowledge base can be a database or file system, which is used to store historical data required for model training.

[0078] The data in the knowledge base will be used for subsequent model training to help the model better adapt to different development scenarios and project requirements.

[0079] The above description is only a preferred embodiment of the present invention and is only used to illustrate the technical solution of the present invention, and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.

Claims

1. An incremental code optimization system based on the combination of DevOps and AI, characterized by: include: a. Code scanning module, which is used to monitor code submissions in the code library in real time and trigger the code analysis process; b. The AI analysis module uses machine learning algorithms to perform semantic understanding and pattern recognition on the code, identifying potential performance bottlenecks, security vulnerabilities, and code logic and style issues for the submitted code. c. Optimize the notification module, generate optimization suggestions based on AI analysis results, and send email notifications to the code submitter; d. Feedback adjustment module, which allows code submitters to score AI-generated optimization suggestions, monitor the scoring results, and adjust AI model parameters to achieve more accurate optimization strategies.

2. The system according to claim 1, wherein: Use GitLab's Webhook feature to monitor commit operations in the code base in real time. Whenever new code is committed, the Webhook triggers an event to capture the incremental code submitted. Compare the incremental code with the original code and extract the changed parts for subsequent analysis.

3. The system according to claim 1, wherein: The AI analysis module uses a deep learning algorithm, including a recurrent neural network or a long short-term memory network.

4. The system according to claim 3, characterized in that The comparison results between the captured incremental code and the original code are input into the AI big model; based on the deep learning algorithm, the code is semantically understood, pattern recognized, and statically analyzed to quickly identify potential problems.

5. The system according to claim 1, wherein: Optimization suggestions, including code refactoring, performance optimization, and security reinforcement.

6. The system according to claim 1, wherein: The feedback adjustment module collects optimization suggestion scoring data through monitoring tools and adjusts the AI model based on data feedback to achieve continuous optimization.

7. The system according to claim 6, characterized in that After receiving the optimization suggestion, the submitter will evaluate the suggestion through the system interface or email reply, and provide feedback on their satisfaction and feasibility of the optimization suggestion. At the same time, a comprehensive evaluation of the code before and after optimization will be conducted regularly to verify the authenticity and effectiveness of the optimization effect from a technical perspective. This feedback information will be collected and stored as an important basis for subsequent model adjustments.

8. The system according to claim 1, wherein: The parameters and knowledge base of the large AI model are dynamically adjusted based on feedback. Through the reinforcement learning mechanism of machine learning, the model can continuously optimize its own parameters based on the actual optimization results, improving the quality of analysis and suggestions. At the same time, the code cases before and after optimization and their evaluation results are updated to the knowledge base to enrich the model's training data.

Citation Information

Cited By

  • AI-driven multi-industry DevOps whole-process intelligentization method and device and medium

    CN120872422A