An artificial intelligence-based technology development assistance method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-09
- Publication Date
- 2026-08-07
AI Technical Summary
然而,在开发者对既有代码进行非线性的、跨多文件的复杂修改过程中,代码的语义依赖链和数据控制流会发生剧烈变化,此时开发者的认知负担显著增加,容易出现修改遗漏或引入新缺陷的情况
Smart Images

Figure CN122526548A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software engineering technology, and in particular to a method and system for developing AI-assisted technologies. Background Technology
[0002] In the field of software engineering, AI-assisted development methods are widely used in integrated development environments (IDEs) to assist developers in tasks such as code writing, debugging, modification, and refactoring. Existing AI-assisted development systems typically analyze developers' historical operational data to build personalized user profiles, and then recommend code snippets, automatically complete syntax structures, or provide suggestions for fixing common errors based on these profiles. The focus of these methods is to leverage the pre-trained knowledge of large language models on massive amounts of code corpora to achieve natural language responses or code prediction to developers' real-time input. However, during complex, non-linear modifications across multiple files, the semantic dependency chains and data control flow of existing code undergo drastic changes. This significantly increases the cognitive burden on developers, making it easier for modifications to be overlooked or for new defects to be introduced.
[0003] In existing technologies, AI-assisted methods based on user profiles and general code models lack the ability to quantify the semantic perturbation effects caused by code modifications in real time, making it difficult to directly assess the impact of current code changes on the developer's cognitive burden. These methods cannot proactively identify high-cognitive-risk areas arising from broken dependency chains or semantic inconsistencies during code modification, leading to a mismatch between the assistance content and the actual difficulties faced by the developer. Furthermore, existing methods lack the ability to continuously monitor and discern deviations from subsequent developer modifications, making it difficult to trigger recalculation and re-guidance in a timely manner when the developer deviates from the optimal path. This results in a one-off, passive response in the assistance process, failing to create a convergent, closed-loop debugging experience. Therefore, there is an urgent need to develop an AI-assisted technology development method based on cognitive perturbation tracking and counterfactual intervention to address the lack of proactive prediction, causal guidance, and closed-loop convergence capabilities in existing technologies, thereby improving the accuracy and effectiveness of AI assistance in complex code modification scenarios. Summary of the Invention
[0004] This invention provides an artificial intelligence-based collaborative technology development method and system to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides an artificial intelligence-based collaborative technology development method, comprising: L1: Vector coupling is performed on the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice, and the coupling results are summarized into a perturbation potential energy field distribution map; L2: Based on the perturbation potential energy field distribution map, identify the high-risk code region in the coupling result where the cognitive mismatch potential energy exceeds the first dynamic threshold; L3: Based on the difference between the target intervention path of the high-risk code area and the developer's current actual modification operation, generate a differentiated assistance message, and continuously monitor the developer's subsequent code modification sequence after receiving the differentiated assistance message until the developer's subsequent code modification sequence is stable.
[0006] In a preferred embodiment, the vector coupling of the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice includes: The system captures developers' modifications to the target code in the integrated development environment in real time, extracts the scope of code modifications corresponding to the modifications, and constructs an initial perturbation slice of the scope of code modifications based on the abstract syntax tree of the target code. Extract the fan-in number, fan-out number, and nesting depth of the code nodes in the abstract syntax tree from the initial perturbation slice, and perform non-linear weighting to obtain the structural perturbation value of the code nodes; Obtain the Levenstein edit distance between the variable name in each code node and the variable names of all other code nodes, divide the distance intervals according to the numerical value, and generate the semantic perturbation value of the code node based on the edit distance frequency in each distance interval; The cognitive mismatch potential energy of the code node is calculated based on the structural perturbation value and the semantic perturbation value. The formula for calculating the cognitive mismatch potential energy is as follows:
[0007] in, This represents the cognitive mismatch potential energy of the code node. The pre-defined structural weight coefficients for the code file type where the code node is located. The semantic weight coefficients preset for the code file type where the code node is located. This represents the structural disturbance value. This is the semantic perturbation value. As a preset nonlinear factor, The nesting depth of code nodes. It is the natural logarithm function; The cognitive mismatch potential energy is arranged in the original order in the initial perturbation slice, and the perturbation potential energy field distribution map is generated with the cognitive mismatch potential energy of each code node as the potential energy height of the code node in two-dimensional space.
[0008] In a preferred embodiment, the summarization of the coupling results into a perturbation potential energy field distribution map includes: Obtain the cognitive mismatch potential energy of each code node in the initial perturbation slice, and associate each code node with its original coordinate position in the abstract syntax tree; Using the starting and ending line numbers in the original coordinate positions as the horizontal axis interval and the reciprocal of the nesting level in the original coordinate positions as the vertical axis reference, the cognitive mismatch potential energy of each code node is mapped to the potential energy high point on a two-dimensional plane. If two adjacent code nodes in the initial perturbation slice have a direct data dependency or control dependency in the abstract syntax tree, then the potential energy high points of the two code nodes are connected on the two-dimensional plane to obtain a potential energy ridge. All potential energy high points and potential energy ridges are superimposed on the same two-dimensional plane and filled with a grid to form a perturbation potential energy field distribution map.
[0009] In a preferred embodiment, the formula for calculating the first dynamic threshold is:
[0010] in, The first dynamic threshold, This is a preset proportional coefficient. The preset attenuation coefficient, This represents the total number of code nodes in the initial perturbation slice. The preset power index, It is an exponential function. This represents the developer's historical average modification rate. The interquartile range is used to determine the mismatch potential energy. The preset reference interquartile range, This represents the median of the cognitive mismatch potential energy of all code nodes in the initial perturbation slice.
[0011] In a preferred embodiment, identifying high-risk code regions in the coupling result where the cognitive mismatch potential energy exceeds a first dynamic threshold based on the perturbation potential energy field distribution map includes: The grids in the perturbation potential energy field distribution map whose cognitive mismatch potential energy is greater than the first dynamic threshold are identified as the initial high-risk grid set. Candidate high-risk nodes are determined based on the original coordinate positions of the code nodes corresponding to the grids in the initial high-risk grid set in the abstract syntax tree; If two candidate high-risk nodes have a direct data dependency edge or control dependency edge in the abstract syntax tree, then these two candidate high-risk nodes are assigned to the same connected component. For the same connected component, if the arithmetic mean of the cognitive mismatch potential energy of candidate high-risk nodes is greater than the preset risk density threshold, then the original coordinate range of all code nodes in the connected component will be marked as a high-risk code region. If the arithmetic mean is less than or equal to the risk density threshold, the connected component is split into individual candidate high-risk nodes, and only the candidate high-risk nodes whose cognitive mismatch potential exceeds the first dynamic threshold and are ranked high are retained as independent high-risk code regions.
[0012] In a preferred embodiment, the target intervention path includes: Enumerate all possible code rewriting methods within the high-risk code region, with each rewriting method corresponding to a hypothetical code evolution path; For each hypothetical path, the updated structural perturbation value and semantic perturbation value are calculated node by node, and vector coupling is performed again to obtain the residual cognitive mismatch potential energy. The residual potential energy of all nodes of the hypothetical path is normalized according to the number of rewriting steps to obtain the path residual potential energy. The hypothetical path with the minimum residual potential energy is selected as the initial candidate path. Check whether the initial candidate path meets the preset engineering feasibility constraints. If it does, it is determined as the target intervention path. Otherwise, check the next candidate path in order of path residual potential energy from small to large until a target intervention path that meets the constraints is found.
[0013] In a preferred embodiment, generating a differentiated assistance message based on the difference between the target intervention path of the high-risk code region and the developer's current actual modification operation includes: Obtain each expected modification operation defined in the target intervention path, as well as the sequence of actual modification operations that the developer has currently executed in the high-risk code area. Compare the expected modification operations with the sequence of actual modification operations operation by operation to identify the types of differences between them. For each type of difference, the corresponding message generation rule is retrieved from the preset difference-assistance template library; Based on the retrieved message generation rules, combined with the expected operations related to the difference type in the target intervention path and the actual modification operations of the developer, a differentiated assistance message is generated.
[0014] In a preferred embodiment, the continuous monitoring of the sequence of subsequent code modifications made by the developer after receiving the differentiated assistance message includes: Real-time capture of every code modification operation performed by the developer on the high-risk code region and adjacent code regions in the integrated development environment, and recording the operation type, modification location and modification content of each modification operation in chronological order as the subsequent code modification sequence; Whenever a new modification record is added to the subsequent code modification sequence, the subsequent code modification sequence is compared with all the expected modification operations that have not yet been completed in the target intervention path to obtain the deviation of the current sequence from the target intervention path.
[0015] In a preferred embodiment, the developer's subsequent code modification sequence is stable, including: If the deviation is less than or equal to the deviation tolerance threshold of the target intervention path, it is determined that the current subsequent code modification sequence is in a stable state, and monitoring is stopped. If the deviation is greater than the deviation tolerance threshold, it is determined that the current state is unstable, triggering a dynamic recalculation of the perturbation potential field. After the recalculation is completed, the generation of the target intervention path and the output of the differentiated assistance message are re-executed, and the updated subsequent code modification sequence is monitored until the deviation drops to less than or equal to the deviation tolerance threshold.
[0016] To address the above problems, the present invention also provides an artificial intelligence-based assisted technology development system, the system comprising: The vector coupling module is used to perform vector coupling on the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice, and summarize the coupling results into a perturbation potential energy field distribution map; The code region identification module is used to identify high-risk code regions in the coupling result whose cognitive mismatch potential energy exceeds a first dynamic threshold based on the perturbation potential energy field distribution map. The code modification monitoring module is used to generate differentiated assistance messages based on the difference between the target intervention path of the high-risk code area and the developer's current actual modification operation, and to continuously monitor the developer's subsequent code modification sequence after receiving the differentiated assistance message until the developer's subsequent code modification sequence is stable.
[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention, by constructing an initial perturbation slice and calculating the structural and semantic perturbation values of code nodes, further employs vector coupling to generate a perturbation potential energy field distribution map, achieving for the first time dynamic quantification of the cognitive mismatch potential energy of developers during code modification. The structural perturbation value is calculated using the fan-in, fan-out, and nesting depth of code nodes, while the semantic perturbation value is calculated using the edit distance distribution between variable names. These two values are then nonlinearly weighted and fused to generate the cognitive mismatch potential energy of each node, and all nodes are mapped to a two-dimensional potential energy field distribution map in their original order. This technique overcomes the shortcomings of existing AI-assisted development methods that rely solely on historical user profiles and cannot perceive the semantic impact caused by current code modifications. It effectively solves the problem of mismatch between the assisted content and the actual cognitive difficulties of developers, significantly improving the accuracy of identifying high-risk code regions.
[0018] 2. This invention targets identified high-risk code regions by enumerating hypothetical code evolution paths and calculating path residual potential energy. It automatically selects the path with the minimum residual potential energy as the target intervention path and generates differentiated assistance messages based on the difference between the developer's actual modification and the expected modification. The system continuously monitors the developer's subsequent code modification sequence after receiving the assistance message. By calculating the sequence deviation and comparing it with a deviation tolerance threshold, it dynamically triggers the recalculation of the perturbation potential energy field and the regeneration of the intervention path until the modification sequence converges to a stable state. This closed-loop mechanism overcomes the shortcomings of existing technologies in lacking causal guidance and continuous monitoring capabilities. Therefore, it significantly improves the accuracy, adaptability, and effectiveness of AI assistance in complex code modification scenarios, reducing the cognitive burden on developers and the risk of defects introduced due to modification omissions or semantic inconsistencies. Attached Figure Description
[0019] Figure 1 A flowchart illustrating an artificial intelligence-based collaborative technology development method according to an embodiment of the present invention; Figure 2 A functional block diagram of an artificial intelligence-based assisted technology development system provided in an embodiment of the present invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0020] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0021] This application provides a method for developing AI-based collaborative technologies. The executing entity of this AI-based collaborative technology development method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the AI-based collaborative technology development method can be executed by software or hardware installed on a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and AI platforms.
[0022] Reference Figure 1 The diagram shown is a flowchart illustrating an artificial intelligence-based collaborative technology development method according to an embodiment of the present invention. In this embodiment, the artificial intelligence-based collaborative technology development method includes: L1: Vector coupling is performed on the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice, and the coupling results are summarized into a perturbation potential energy field distribution map; In this embodiment of the invention, the vector coupling of the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice includes: The system captures developers' modifications to the target code in the integrated development environment in real time, extracts the scope of code modifications corresponding to the modifications, and constructs an initial perturbation slice of the scope of code modifications based on the abstract syntax tree of the target code. Extract the fan-in number, fan-out number, and nesting depth of the code nodes in the abstract syntax tree from the initial perturbation slice, and perform non-linear weighting to obtain the structural perturbation value of the code nodes; Obtain the Levenstein edit distance between the variable name in each code node and the variable names of all other code nodes, divide the distance intervals according to the numerical value, and generate the semantic perturbation value of the code node based on the edit distance frequency in each distance interval; The cognitive mismatch potential energy of the code node is calculated based on the structural perturbation value and the semantic perturbation value. The formula for calculating the cognitive mismatch potential energy is as follows:
[0023] in, This represents the cognitive mismatch potential energy of the code node. The pre-defined structural weight coefficients for the code file type where the code node is located. The semantic weight coefficients preset for the code file type where the code node is located. This represents the structural disturbance value. This is the semantic perturbation value. As a preset nonlinear factor, The nesting depth of code nodes. It is the natural logarithm function; The cognitive mismatch potential energy is arranged in the original order in the initial perturbation slice, and the perturbation potential energy field distribution map is generated with the cognitive mismatch potential energy of each code node as the potential energy height of the code node in two-dimensional space.
[0024] The coupling results are summarized into a perturbation potential energy field distribution diagram, including: Obtain the cognitive mismatch potential energy of each code node in the initial perturbation slice, and associate each code node with its original coordinate position in the abstract syntax tree; Using the starting and ending line numbers in the original coordinate positions as the horizontal axis interval and the reciprocal of the nesting level in the original coordinate positions as the vertical axis reference, the cognitive mismatch potential energy of each code node is mapped to the potential energy high point on a two-dimensional plane. If two adjacent code nodes in the initial perturbation slice have a direct data dependency or control dependency in the abstract syntax tree, then the potential energy high points of the two code nodes are connected on the two-dimensional plane to obtain a potential energy ridge. All potential energy high points and potential energy ridges are superimposed on the same two-dimensional plane and filled with a grid to form a perturbation potential energy field distribution map.
[0025] In the integrated development environment, the modification operations performed by the developer on the target code are captured in real time. The scope covered by the modified code lines is extracted from the modification operations as the code modification scope. Then, based on the abstract syntax tree of the target code, all code nodes within the code modification scope, as well as all upstream and downstream code nodes that have data dependencies or control dependencies with the modification scope, are extracted together and combined into an initial perturbation slice.
[0026] For each code node in the initial perturbation slice, the number of times the code node is depended on by other code nodes is counted from the abstract syntax tree as the fan-in number, and the number of times the code node depends on other code nodes is counted as the fan-out number. At the same time, the nesting depth of the code node in the abstract syntax tree is recorded. The fan-in number, fan-out number, and nesting depth are fused and calculated according to a pre-set non-linear weight. The fused result is the structural perturbation value of the code node.
[0027] For the same code node, iterate through every variable name contained in the code node, calculate the Levenstein edit distance between each variable name and every variable name appearing in all other code nodes in the target code, divide all the calculated edit distances into several consecutive distance intervals in ascending order of value, count the frequency of edit distances in each distance interval, and generate a value based on the frequency distribution of each distance interval. This value is the semantic perturbation value of the code node.
[0028] The structural perturbation value and semantic perturbation value calculated for the same code node are vector-coupled, that is, these two values are used as two components of a two-dimensional vector. The coupling result is then nonlinearly modulated by combining the nesting depth of the code node. The value obtained after modulation is the cognitive mismatch potential energy of the code node.
[0029] The cognitive mismatch potential of a code node represents the degree to which that node disturbs the developer's cognitive burden during code modification. The pre-defined structural weight coefficients for the code file types where code nodes reside are set as follows: based on different programming language file types, such as object-oriented language files, functional language files, or scripting language files, a large amount of historical code modification data is collected, the contribution ratio of structural perturbation values to the actual defect introduction rate in each file type is statistically analyzed, the optimal structural weight coefficients corresponding to each file type are determined through multiple regression analysis, and the coefficients are mapped to the file types and stored in the system.
[0030] The semantic weight coefficients for the code file types where code nodes reside are preset. The method for setting these coefficients is as follows: For the same group of file types, analyze the correlation between semantic perturbation values and the time required for developers to understand the code. Assign higher semantic weights to file types with strong variable naming conventions and dense semantic information, and lower semantic weights to file types with arbitrary variable naming or ambiguous semantics. Finally, determine a fixed weight for each file type. value.
[0031] For code files written in object-oriented programming languages, the complex dependencies caused by class inheritance and method overriding mechanisms make structural perturbations more significant in terms of cognitive mismatch. The value is set to 1.2. The value is set to 0.8. For code files written in functional programming languages, the immutability of variables and the purity of functions make semantic information more crucial for understanding the code. The value is set to 0.9. The value is set to 1.1. For code files written in scripting languages, due to the flexible structure and free variable naming of scripting languages, the impact of structural and semantic perturbations is roughly balanced. The value is set to 1.0. The value is set to 1.0.
[0032] The above and The values all fall within the range of 0.5 to 1.5. For other code file types not included in the above categories, and All values use the default value of 1.0. In practical applications, system administrators can adjust the values within the above range according to the actual characteristics of the project. and Fine-tuning: When the class inheritance hierarchy in the codebase is deep or the dependencies between modules are complex, appropriately increase... The value of makes structural perturbations have a higher weight in the cognitive mismatch potential energy; when the variable naming conventions of the codebase are clear and the semantic information is rich, appropriately increasing The value of makes semantic perturbations have a higher weight in the cognitive mismatch potential. This adjustment only changes and The relative proportions do not change the overall calculation logic of the formula.
[0033] Structural perturbation values are obtained by fusing the fan-in, fan-out, and nesting depth of code nodes using non-linear weights. Semantic perturbation values are generated by the frequency distribution of Levenstein edit distances between variable names in code nodes and variable names in other nodes.
[0034] The preset non-linear factor is set by collecting actual error rate data of code nodes at different nesting depths and determining it by fitting a non-linear growth curve between nesting depth and error rate. The value of is such that when the nesting depth exceeds the common range, To accurately reflect the accelerating upward trend of the error rate, the least squares method is typically used for fitting. The optimal value is the nesting depth of a code node, which is the number of ancestor nodes that the node traverses from the root node in the abstract syntax tree. This can be directly extracted from the structure of the abstract syntax tree.
[0035] Multiply the preset structural weight coefficients by the structural perturbation value to obtain the first product; multiply the preset semantic weight coefficients by the semantic perturbation value to obtain the second product; add the first product and the second product to obtain the weighted sum. Then calculate the denominator: calculate The square of and The sum of squares is then taken, and the square root of this sum is used to obtain the normalization factor. Dividing the weighted sum by the normalization factor yields the structural semantic coupling basis values. Next, the nested modulation factor is calculated: first, the nonlinear factor is calculated. Multiplying by the nesting depth, and then adding 1 to this product yields an intermediate sum. Taking the natural logarithm of this intermediate sum gives the logarithmic result, and finally adding 1 to this logarithmic result gives the nested modulation coefficients. Finally, multiplying the structural semantic coupling basis value by the nested modulation coefficients yields the cognitive mismatch potential energy of the code node. In this calculation process, as the structural or semantic perturbation value increases, the cognitive mismatch potential energy increases accordingly; as the nesting depth increases, the growth of the coefficients after logarithmic modulation gradually slows down but still maintains an upward trend.
[0036] The cognitive mismatch potential energy of all code nodes in the initial perturbation slice is arranged in the original order of appearance of these code nodes in the abstract syntax tree. Then, a position is assigned to each code node in the two-dimensional space, and the cognitive mismatch potential energy of the code node is used as the potential energy height at that position. This generates a perturbation potential energy field distribution map that reflects the distribution of potential energy height.
[0037] Obtain the cognitive mismatch potential energy of each code node in the initial perturbation slice, and associate each code node with its original code position information in the abstract syntax tree. The original coordinate position includes the starting line number, ending line number, and nesting level of the code node.
[0038] For each code node, its starting and ending line numbers are used as the range on the horizontal axis, and the reciprocal of the nesting level of the code node is used as the reference height on the vertical axis. The cognitive mismatch potential energy of the code node is used as the offset on the vertical axis and superimposed on the reference height to determine a point on the two-dimensional plane. This point is the potential energy high point corresponding to the code node.
[0039] Examine any two adjacent code nodes in the initial perturbation slice and determine whether they have a direct data dependency or a direct control dependency in the abstract syntax tree. If such a dependency exists, connect the potential energy high points of the two code nodes with a line segment on the two-dimensional plane. This line segment is called the potential energy ridge.
[0040] All potential energy high points corresponding to all code nodes in the initial perturbation slice and all potential energy ridges that satisfy the dependency relationship are plotted on the same two-dimensional plane. Then, the grid cells on the plane that are not covered by potential energy high points or potential energy ridges are filled. When filling, the value of each grid cell is determined by linear interpolation based on the values of adjacent potential energy high points and potential energy ridges, and finally a complete perturbation potential energy field distribution map is formed.
[0041] The beneficial effects are as follows: By quantifying the structural and semantic perturbations caused by code modifications in different dimensions and coupling them into cognitive mismatch potential energy, this invention can accurately locate high-risk areas where developers face the highest cognitive burden when modifying code. Furthermore, by mapping the potential energy height of each code node to a two-dimensional plane and connecting dependencies to form potential energy ridges, this invention ultimately generates a complete perturbation potential energy field distribution map. This provides a clear and quantifiable spatial distribution basis for subsequent proactive identification of high-risk areas, thereby significantly improving the targeting and effectiveness of AI assistance in complex code modification scenarios.
[0042] L2: Based on the perturbation potential energy field distribution map, identify the high-risk code region in the coupling result where the cognitive mismatch potential energy exceeds the first dynamic threshold; In this embodiment of the invention, the formula for calculating the first dynamic threshold is:
[0043] in, The first dynamic threshold, This is a preset proportional coefficient. The preset attenuation coefficient, This represents the total number of code nodes in the initial perturbation slice. The preset power index, It is an exponential function. This represents the developer's historical average modification rate. The interquartile range is used to determine the mismatch potential energy. The preset reference interquartile range, This represents the median of the cognitive mismatch potential energy of all code nodes in the initial perturbation slice.
[0044] The step of identifying high-risk code regions in the coupling result where the cognitive mismatch potential energy exceeds a first dynamic threshold based on the perturbation potential energy field distribution map includes: The grids in the perturbation potential energy field distribution map whose cognitive mismatch potential energy is greater than the first dynamic threshold are identified as the initial high-risk grid set. Candidate high-risk nodes are determined based on the original coordinate positions of the code nodes corresponding to the grids in the initial high-risk grid set in the abstract syntax tree; If two candidate high-risk nodes have a direct data dependency edge or control dependency edge in the abstract syntax tree, then these two candidate high-risk nodes are assigned to the same connected component. For the same connected component, if the arithmetic mean of the cognitive mismatch potential energy of candidate high-risk nodes is greater than the preset risk density threshold, then the original coordinate range of all code nodes in the connected component will be marked as a high-risk code region. If the arithmetic mean is less than or equal to the risk density threshold, the connected component is split into individual candidate high-risk nodes, and only the candidate high-risk nodes whose cognitive mismatch potential exceeds the first dynamic threshold and are ranked high are retained as independent high-risk code regions.
[0045] The first dynamic threshold is a dynamic threshold used to determine whether a code node belongs to a high-risk area.
[0046] The preset proportional coefficient is set by collecting multiple open-source software projects of different sizes and programming languages. For each project, the historical records of code modifications completed by developers are collected. The correspondence between the total number of code nodes in the initial perturbation slice and the area where the modification error actually occurred is statistically analyzed. The coefficient value that maximizes the accuracy of the judgment is obtained through linear regression fitting, and the coefficient is then fixed into the system.
[0047] The preset decay coefficient is set by analyzing the correlation between the developer's historical average modification rate and code modification quality, collecting a large amount of modification rate data and the corresponding defect introduction rate, and obtaining the decay coefficient value that minimizes the prediction error through an exponential decay model. This value is stored in the system configuration.
[0048] The total number of code nodes in the initial perturbation slice is obtained directly from the constructed initial perturbation slice. The preset power exponent is set by testing different power exponent values on multiple sample items, calculating the precision and recall of the first dynamic threshold for identifying high-risk areas under each value, and selecting the value that maximizes the harmonic mean of precision and recall as the preset power exponent.
[0049] The developer's historical average modification rate is calculated by statistically analyzing the time spent on each code modification operation by the developer over a period of time, as well as the number of code nodes involved in each modification, and dividing the total number of modified nodes by the total time spent.
[0050] The interquartile range of the cognitive mismatch potential energy of all code nodes in the current initial perturbation slice, i.e. the difference between the third quartile and the first quartile, reflects the degree of dispersion of the potential energy value.
[0051] The preset reference interquartile range (IQR) is set as follows: During the system training phase, a large number of cognitive mismatch potential energy distribution samples under normal code modification scenarios are collected. The IQR of each sample is calculated, and the median of all sample IQRs is taken as the reference IQR for normalization of the current IQR. The extent of the impact. The median of the cognitive mismatch potential energy of all code nodes in the initial perturbation slice is the potential energy value located in the middle after being sorted by numerical value. In the perturbation potential energy field distribution map, each grid cell carries a cognitive mismatch potential energy value. The system compares this value with a first dynamic threshold. The first dynamic threshold is a dynamic judgment boundary calculated in real time based on the total number of code nodes in the current initial perturbation slice, the developer's historical average modification rate, and the median and interquartile range of the cognitive mismatch potential energy of all code nodes. This threshold will automatically adjust its level according to different code modification scenarios. All grid cells with cognitive mismatch potential energy values greater than this dynamic threshold are selected, and the set of these grid cells is marked as the initial high-risk grid set.
[0052] For each grid cell in the initial high-risk grid set, the system searches for the code node corresponding to the grid cell in the abstract syntax tree and obtains the original coordinate position of the code node, which includes the start line number, end line number, and nesting level. Then, all grid cells belonging to the same code node are merged together, and each unique code node obtained after merging is called a candidate high-risk node.
[0053] The system traverses all candidate high-risk nodes and checks whether any two candidate high-risk nodes have a direct data dependency edge in the abstract syntax tree, i.e., the output of one node serves as the input of another node, or whether there is a direct control dependency edge, i.e., the execution condition of one node determines whether another node is executed. If either of the above dependencies exists, the two candidate high-risk nodes are assigned to the same connected component. A connected component is a set of nodes that are interconnected through dependencies.
[0054] For the same connected component, the system calculates the arithmetic mean of the cognitive mismatch potential energy of all candidate high-risk nodes within the component. Then, it compares this arithmetic mean with a pre-set risk density threshold. The risk density threshold is a fixed value pre-determined by analyzing the statistical characteristics of high-risk areas in a large number of historical code modification records. This value represents the minimum average cognitive mismatch potential energy density required to classify a code region as a high-risk region. The method for setting it is as follows: collect code region samples that developers have repeatedly modified or introduced defects in multiple software projects, calculate the average cognitive mismatch potential energy of code nodes in these sample regions, and take the lower quartile of the average of all samples as the risk density threshold. Only when the value exceeds this threshold is the region considered high-risk. If the arithmetic mean is greater than the risk density threshold, the original coordinate range of all code nodes covered by the connected component is marked as a high-risk code region.
[0055] If the arithmetic mean of the cognitive mismatch potential energy of all candidate high-risk nodes within the same connected component is less than or equal to the risk density threshold, the connected component is split into individual candidate high-risk nodes. Then, only those nodes whose cognitive mismatch potential energy exceeds the first dynamic threshold are retained from these candidate high-risk nodes. These retained nodes are sorted from largest to smallest according to their cognitive mismatch potential energy values. The nodes at the top of the sorted list, representing a preset proportion, are taken as independent high-risk code regions. The top proportion is determined through offline experiments: the overlap between the high-risk regions identified at different proportions and the regions that developers actually find difficult to modify is tested on a validation dataset. The proportion with the highest overlap is selected as the preset value, thereby ensuring that the retained nodes neither miss any truly high-risk nodes nor cause excessive redundancy.
[0056] The beneficial effects are as follows: This invention obtains an initial high-risk grid set by comparing the grid cells in the perturbation potential energy field distribution map with a first dynamic threshold, then maps them as candidate high-risk nodes, and constructs connected components using dependencies. Finally, based on the relationship between the arithmetic mean of the cognitive mismatch potential energy within the connected component and the risk density threshold, either the entire connected component is marked as a high-risk code region, or it is split and only the top-ranked high-risk nodes are retained as independent regions. This achieves adaptive, multi-level identification of high-risk code regions, avoids the problem of missed detection or over-detection caused by a single threshold judgment, and significantly improves the accuracy and flexibility of high-risk region identification.
[0057] L3: Based on the difference between the target intervention path of the high-risk code area and the developer's current actual modification operation, generate a differentiated assistance message, and continuously monitor the developer's subsequent code modification sequence after receiving the differentiated assistance message until the developer's subsequent code modification sequence is stable.
[0058] In this embodiment of the invention, the target intervention path includes: Enumerate all possible code rewriting methods within the high-risk code region, with each rewriting method corresponding to a hypothetical code evolution path; For each hypothetical path, the updated structural perturbation value and semantic perturbation value are calculated node by node, and vector coupling is performed again to obtain the residual cognitive mismatch potential energy. The residual potential energy of all nodes of the hypothetical path is normalized according to the number of rewriting steps to obtain the path residual potential energy. The hypothetical path with the minimum residual potential energy is selected as the initial candidate path. Check whether the initial candidate path meets the preset engineering feasibility constraints. If it does, it is determined as the target intervention path. Otherwise, check the next candidate path in order of path residual potential energy from small to large until a target intervention path that meets the constraints is found.
[0059] The step of generating differentiated assistance messages based on the difference between the target intervention path for the high-risk code region and the developer's current actual modification operation includes: Obtain each expected modification operation defined in the target intervention path, as well as the sequence of actual modification operations that the developer has currently executed in the high-risk code area. Compare the expected modification operations with the sequence of actual modification operations operation by operation to identify the types of differences between them. For each type of difference, the corresponding message generation rule is retrieved from the preset difference-assistance template library; Based on the retrieved message generation rules, combined with the expected operations related to the difference type in the target intervention path and the actual modification operations of the developer, a differentiated assistance message is generated.
[0060] The continuous monitoring of the sequence of subsequent code modifications made by the developer after receiving the differentiated assistance message includes: Real-time capture of every code modification operation performed by the developer on the high-risk code region and adjacent code regions in the integrated development environment, and recording the operation type, modification location and modification content of each modification operation in chronological order as the subsequent code modification sequence; Whenever a new modification record is added to the subsequent code modification sequence, the subsequent code modification sequence is compared with all the expected modification operations that have not yet been completed in the target intervention path to obtain the deviation of the current sequence from the target intervention path.
[0061] The developer's subsequent code modification sequence is stable, including: If the deviation is less than or equal to the deviation tolerance threshold of the target intervention path, it is determined that the current subsequent code modification sequence is in a stable state, and monitoring is stopped. If the deviation is greater than the deviation tolerance threshold, it is determined that the current state is unstable, triggering a dynamic recalculation of the perturbation potential field. After the recalculation is completed, the generation of the target intervention path and the output of the differentiated assistance message are re-executed, and the updated subsequent code modification sequence is monitored until the deviation drops to less than or equal to the deviation tolerance threshold.
[0062] When determining the target intervention path, the system first enumerates all possible code rewriting methods for high-risk code regions. Each rewriting method corresponds to a hypothetical code evolution path starting from the current code state until the modification of that region is completed. For each hypothetical path, the system recalculates the structural perturbation value and semantic perturbation value of each node according to the modification order defined by the path, and then vector-couples these two values again to obtain the residual cognitive mismatch potential energy of the modified node. The residual cognitive mismatch potential energy of all nodes in the path is then normalized according to the number of modification steps included in the path, i.e., the sum of residual potential energy is divided by the number of modification steps to obtain the path residual potential energy. The system selects the path with the smallest path residual potential energy from all hypothetical paths as the initial candidate path.
[0063] The system then checks whether the initial candidate paths meet the preset engineering feasibility constraints. These constraints include three preset conditions: First, each code rewriting method in the path must not introduce syntax errors; that is, the modified code must pass the compiler's basic syntax checks. Second, the modifications in the path must not break existing unit test cases; that is, all previously passed unit tests must still pass after the modification. Third, the number of code modification steps in the path cannot exceed a preset multiple of the total number of code nodes in the high-risk code region. This multiple is determined by analyzing the distribution of the ratio of actual steps to the number of nodes in a large number of successful historical modification cases, and taking its upper limit as the preset multiple. If the initial candidate path meets all these constraints, it is identified as the target intervention path; otherwise, the next candidate path is checked sequentially according to the path residual potential energy from smallest to largest, until the first path that meets all engineering feasibility constraints is found as the target intervention path.
[0064] When generating differentiated assistance messages, the system obtains each expected modification operation defined in the target intervention path, and at the same time obtains the actual modification operation sequence that the developer has already executed in the high-risk code area. The expected operations and the actual operation sequence are compared operation by operation to identify the type of difference between the two.
[0065] There are three types of discrepancies: missing expected operations, meaning that there is a modification operation in the target intervention path but the developer has not yet executed it; reversed expected operation order, meaning that the developer executed the correct modification operation but the order is inconsistent with the order defined in the path; and additional unexpected operations, meaning that the developer executed other modification operations that were not defined in the target intervention path.
[0066] For each type of discrepancy, the system retrieves the corresponding message generation rule from a pre-built discrepancy-assistance template library. This library is pre-built, with each template corresponding to a specific discrepancy type. Each template defines how to translate that discrepancy type into a combination of natural language description and code modification suggestions. Based on the retrieved message generation rule, and combining the specific content of the expected actions related to the discrepancy in the target intervention path with the specific content of the developer's actual modification actions, the system generates a discrepancy-assistance message. This message includes a code snippet indicating the location of the discrepancy, causal explanation text explaining why the discrepancy occurred, and modification suggestions guiding the developer back to the target intervention path.
[0067] While continuously monitoring the developer's subsequent code modification sequence, the system starts a monitoring session after outputting differentiated assistance messages to the developer. It captures in real time every code modification operation performed by the developer on high-risk code areas and their adjacent code areas in the integrated development environment. The system records the operation type, modification location, and modification content of each modification operation in chronological order. These records constitute the subsequent code modification sequence.
[0068] Whenever a new modification record is added to the subsequent code modification sequence, the system compares this sequence with all the anticipated modification operations that have not yet been completed in the target intervention path, and calculates the deviation of the current sequence relative to the target intervention path. The deviation is calculated as follows: the number of missing anticipated operations, the number of anticipated operations in the wrong order, and the number of inserted unexpected operations are counted, multiplied by their respective preset weight coefficients, and then summed. The weight of missing operations is the highest, indicating that omission has a greater impact than the error in order, followed by inserted operations, and the weight of in the wrong order is the lowest. The weighted sum is the deviation.
[0069] When determining whether a developer's subsequent code modification sequence is stable, the system compares the calculated deviation with the deviation tolerance threshold of the target intervention path. The deviation tolerance threshold is a preset fixed value, which is set by collecting historical data on developers successfully completing complex code modifications in multiple software projects, calculating the deviation between the developer's actual execution path and the theoretically optimal path during each modification, and taking the upper quartile of these deviations as the deviation tolerance threshold for the project, so that the deviation of the vast majority of successful cases falls below this threshold.
[0070] If the current deviation is less than or equal to the deviation tolerance threshold, the subsequent code modification sequence is determined to be in a stable state, and the system stops monitoring. If the deviation is greater than the deviation tolerance threshold, the current state is determined to be unstable, and the system triggers a dynamic recalculation of the perturbation potential energy field. That is, the perturbation potential energy field distribution map is recalculated based on the current code modification state, and the generation of the target intervention path and the output of the differentiated assistance message are re-executed after the recalculation is completed. Then, the system continues to monitor the updated subsequent code modification sequence. This process is repeated until the deviation drops to less than or equal to the deviation tolerance threshold.
[0071] The beneficial effects are as follows: This invention enumerates all possible code rewriting methods within high-risk code regions and calculates the residual cognitive mismatch potential energy of each hypothetical path. It selects the path with the minimum residual potential energy while satisfying engineering feasibility constraints as the target intervention path, thus achieving causal reasoning and proactive guidance for the optimal modification scheme. This invention compares the difference types between expected and actual modifications operation by operation and generates differentiated assistance messages using a template library, ensuring that the assistance content precisely targets the specific reasons why developers deviate from the optimal path. This invention continuously monitors subsequent code modification sequences and calculates the deviation degree. When the deviation tolerance threshold is exceeded, it automatically triggers the recalculation of the perturbation potential energy field and the regeneration of the intervention path, forming a closed-loop convergence control mechanism. This significantly improves the continuous effectiveness of assistance during complex code modification processes and reduces the cognitive repetition and error correction costs for developers.
[0072] like Figure 2 The diagram shown is a functional block diagram of an artificial intelligence-based assisted technology development system provided in an embodiment of the present invention.
[0073] The AI-based collaborative technology development system 100 described in this invention can be installed in an electronic device. Depending on the functions implemented, the AI-based collaborative technology development system 100 may include a vector coupling module 101, a code region recognition module 102, and a code modification monitoring module 103. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and perform a fixed function, and which are stored in the memory of the electronic device.
[0074] In this embodiment, the functions of each module / unit are as follows: The vector coupling module 101 is used to perform vector coupling on the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice, and summarize the coupling results into a perturbation potential energy field distribution map. The code region identification module 102 is used to identify high-risk code regions in the coupling result whose cognitive mismatch potential energy exceeds the first dynamic threshold based on the perturbation potential energy field distribution map. The code modification monitoring module 103 is used to generate differentiated assistance messages based on the difference between the target intervention path of the high-risk code area and the developer's current actual modification operation, and to continuously monitor the developer's subsequent code modification sequence after receiving the differentiated assistance message until the developer's subsequent code modification sequence is stable.
[0075] In the several embodiments provided by this invention, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0076] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0077] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0078] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0079] The embodiments of this application can acquire and process relevant data based on an artificial intelligence technology. Artificial intelligence is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for developing AI-based collaborative technologies, characterized in that, The method includes: L1: Vector coupling is performed on the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice, and the coupling results are summarized into a perturbation potential energy field distribution map; L2: Based on the perturbation potential energy field distribution map, identify the high-risk code region in the coupling result where the cognitive mismatch potential energy exceeds the first dynamic threshold; L3: Based on the difference between the target intervention path of the high-risk code area and the developer's current actual modification operation, generate a differentiated assistance message, and continuously monitor the developer's subsequent code modification sequence after receiving the differentiated assistance message until the developer's subsequent code modification sequence is stable.
2. The artificial intelligence-based collaborative technology development method as described in claim 1, characterized in that, The vector coupling of the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice includes: The system captures developers' modifications to the target code in the integrated development environment in real time, extracts the scope of code modifications corresponding to the modifications, and constructs an initial perturbation slice of the scope of code modifications based on the abstract syntax tree of the target code. Extract the fan-in number, fan-out number, and nesting depth of the code nodes in the abstract syntax tree from the initial perturbation slice, and perform non-linear weighting to obtain the structural perturbation value of the code nodes; Obtain the Levenstein edit distance between the variable name in each code node and the variable names of all other code nodes, divide the distance intervals according to the numerical value, and generate the semantic perturbation value of the code node based on the edit distance frequency in each distance interval; The cognitive mismatch potential energy of the code node is calculated based on the structural perturbation value and the semantic perturbation value. The formula for calculating the cognitive mismatch potential energy is as follows: in, This represents the cognitive mismatch potential energy of the code node. The pre-defined structural weight coefficients for the code file type where the code node is located. The semantic weight coefficients preset for the code file type where the code node is located. This represents the structural disturbance value. This is the semantic perturbation value. As a preset nonlinear factor, The nesting depth of code nodes. It is the natural logarithm function; The cognitive mismatch potential energy is arranged in the original order in the initial perturbation slice, and the perturbation potential energy field distribution map is generated with the cognitive mismatch potential energy of each code node as the potential energy height of the code node in two-dimensional space.
3. The artificial intelligence-based collaborative technology development method as described in claim 2, characterized in that, The coupling results are summarized into a perturbation potential energy field distribution diagram, including: Obtain the cognitive mismatch potential energy of each code node in the initial perturbation slice, and associate each code node with its original coordinate position in the abstract syntax tree; Using the starting and ending line numbers in the original coordinate positions as the horizontal axis interval and the reciprocal of the nesting level in the original coordinate positions as the vertical axis reference, the cognitive mismatch potential energy of each code node is mapped to the potential energy high point on a two-dimensional plane. If two adjacent code nodes in the initial perturbation slice have a direct data dependency or control dependency in the abstract syntax tree, then the potential energy high points of the two code nodes are connected on the two-dimensional plane to obtain a potential energy ridge. All potential energy high points and potential energy ridges are superimposed on the same two-dimensional plane and filled with a grid to form a perturbation potential energy field distribution map.
4. The artificial intelligence-based collaborative technology development method as described in claim 2, characterized in that, The formula for calculating the first dynamic threshold is: in, The first dynamic threshold, This is a preset proportional coefficient. The preset attenuation coefficient, This represents the total number of code nodes in the initial perturbation slice. The preset power index, It is an exponential function. This represents the developer's historical average modification rate. The interquartile range is used to determine the mismatch potential energy. The preset reference interquartile range, This represents the median of the cognitive mismatch potential energy of all code nodes in the initial perturbation slice.
5. The artificial intelligence-based collaborative technology development method as described in claim 4, characterized in that, The step of identifying high-risk code regions in the coupling result where the cognitive mismatch potential energy exceeds a first dynamic threshold based on the perturbation potential energy field distribution map includes: The grids in the perturbation potential energy field distribution map whose cognitive mismatch potential energy is greater than the first dynamic threshold are identified as the initial high-risk grid set. Candidate high-risk nodes are determined based on the original coordinate positions of the code nodes corresponding to the grids in the initial high-risk grid set in the abstract syntax tree; If two candidate high-risk nodes have a direct data dependency edge or control dependency edge in the abstract syntax tree, then these two candidate high-risk nodes are assigned to the same connected component. For the same connected component, if the arithmetic mean of the cognitive mismatch potential energy of candidate high-risk nodes is greater than the preset risk density threshold, then the original coordinate range of all code nodes in the connected component will be marked as a high-risk code region. If the arithmetic mean is less than or equal to the risk density threshold, the connected component is split into individual candidate high-risk nodes, and only the candidate high-risk nodes whose cognitive mismatch potential exceeds the first dynamic threshold and are ranked high are retained as independent high-risk code regions.
6. The artificial intelligence-based collaborative technology development method as described in claim 1, characterized in that, The target intervention path includes: Enumerate all possible code rewriting methods within the high-risk code region, with each rewriting method corresponding to a hypothetical code evolution path; For each hypothetical path, the updated structural perturbation value and semantic perturbation value are calculated node by node, and vector coupling is performed again to obtain the residual cognitive mismatch potential energy. The residual potential energy of all nodes of the hypothetical path is normalized according to the number of rewriting steps to obtain the path residual potential energy. The hypothetical path with the minimum residual potential energy is selected as the initial candidate path. Check whether the initial candidate path meets the preset engineering feasibility constraints. If it does, it is determined as the target intervention path. Otherwise, check the next candidate path in order of path residual potential energy from small to large until a target intervention path that meets the constraints is found.
7. The artificial intelligence-based collaborative technology development method as described in claim 6, characterized in that, The step of generating differentiated assistance messages based on the difference between the target intervention path for the high-risk code region and the developer's current actual modification operation includes: Obtain each expected modification operation defined in the target intervention path, as well as the sequence of actual modification operations that the developer has currently executed in the high-risk code area. Compare the expected modification operations with the sequence of actual modification operations operation by operation to identify the types of differences between them. For each type of difference, the corresponding message generation rule is retrieved from the preset difference-assistance template library; Based on the retrieved message generation rules, combined with the expected operations related to the difference type in the target intervention path and the actual modification operations of the developer, a differentiated assistance message is generated.
8. The artificial intelligence-based collaborative technology development method as described in claim 1, characterized in that, The continuous monitoring of the sequence of subsequent code modifications made by the developer after receiving the differentiated assistance message includes: Real-time capture of every code modification operation performed by the developer on the high-risk code region and adjacent code regions in the integrated development environment, and recording the operation type, modification location and modification content of each modification operation in chronological order as the subsequent code modification sequence; Whenever a new modification record is added to the subsequent code modification sequence, the subsequent code modification sequence is compared with all the expected modification operations that have not yet been completed in the target intervention path to obtain the deviation of the current sequence from the target intervention path.
9. The artificial intelligence-based collaborative technology development method as described in claim 8, characterized in that, The developer's subsequent code modification sequence is stable, including: If the deviation is less than or equal to the deviation tolerance threshold of the target intervention path, it is determined that the current subsequent code modification sequence is in a stable state, and monitoring is stopped. If the deviation is greater than the deviation tolerance threshold, it is determined that the current state is unstable, triggering a dynamic recalculation of the perturbation potential field. After the recalculation is completed, the generation of the target intervention path and the output of the differentiated assistance message are re-executed, and the updated subsequent code modification sequence is monitored until the deviation drops to less than or equal to the deviation tolerance threshold.
10. A collaborative technology development system based on artificial intelligence, characterized in that, The system for implementing the AI-based collaborative technology development method of claim 1 includes: The vector coupling module is used to perform vector coupling on the structural perturbation value and semantic perturbation value of each code node in the initial perturbation slice, and summarize the coupling results into a perturbation potential energy field distribution map; The code region identification module is used to identify high-risk code regions in the coupling result whose cognitive mismatch potential energy exceeds a first dynamic threshold based on the perturbation potential energy field distribution map. The code modification monitoring module is used to generate differentiated assistance messages based on the difference between the target intervention path of the high-risk code area and the developer's current actual modification operation, and to continuously monitor the developer's subsequent code modification sequence after receiving the differentiated assistance message until the developer's subsequent code modification sequence is stable.