A software test case generation method for LoRA fine-tuning large models

By dynamically adjusting the LoRA fine-tuning parameters through global and local feature analysis, the problem of improper rank parameter setting in the LoRA fine-tuning method is solved, and efficient and accurate test case generation of large language models in complex testing scenarios is achieved.

CN123178285APending Publication Date: 2026-11-27FANGYUAN TESTING CERTIFICATION CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611689485.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-29
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing LoRA fine-tuning methods exhibit significant variations in test requirements and test case data distribution characteristics across different periods, leading to improper rank parameter settings. This negatively impacts the learning ability and generation accuracy of large language models, making them ill-suited for complex and ever-changing test scenarios.

Method used

By extracting semantic features and performing cluster analysis, we calculate the global demand diversity and local feature heterogeneity, dynamically adjust the rank parameter of the LoRA fine-tuning architecture, and combine association rule mining to optimize the large model training process.

Benefits of technology

It improves the accuracy and efficiency of test case generation, avoids overfitting or underfitting, optimizes the use of computing resources, and ensures the model's high adaptability in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178285A_ABST
    Figure CN123178285A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of software testing, in particular to a software test case generation method for LoRA fine-tuning of a large model, which comprises the following steps: in a preset fine-tuning period, calling the test requirement information corresponding to each test case generation record and the generated test case information to form a fine-tuning data set; calculating global requirement multivariate degree and local feature heterogeneity; obtaining feature information complexity of the fine-tuning data set, and dynamically adjusting the rank parameter of the LoRA fine-tuning architecture according to the feature information complexity; configuring the rank parameter into the LoRA fine-tuning architecture, using the fine-tuning data set to perform LoRA fine-tuning training on the large model, and using the large model after LoRA fine-tuning to generate software test cases. The application significantly improves the accuracy of automatic generation of software test cases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technology, specifically to a method for generating software test cases using LoRA fine-tuning of large models. Background Technology

[0002] Software testing is a crucial stage in the entire software development lifecycle. Comprehensive and accurate test cases help testers discover potential defects and risks. Traditional methods relying on testers manually writing test cases suffer from high labor costs, low productivity, and difficulties in knowledge transfer, making them ill-suited to the rapid updates required for test assets in agile development and continuous delivery scenarios. In recent years, automatic test case generation methods based on large language models have gained widespread attention due to their strong semantic understanding and text generation capabilities. These methods input textual information such as project descriptions, functional requirements, and technical requirements into a large language model, enabling the model to output structured test case execution steps, significantly improving the efficiency of test case design.

[0003] To enable large language models to continuously learn the latest project business logic and testing specifications, and to avoid generating redundant or incorrect test steps due to knowledge lag, existing technologies typically employ LoRA fine-tuning. However, this LoRA fine-tuning method usually uses a fixed-size rank parameter for model training, ignoring the significant dynamic changes and differences in the distribution characteristics of test requirements and test case data accumulated in different periods during continuous iterations of software testing scenarios. Setting the rank parameter too small limits the large language model's ability to learn complex mapping features, leading to underfitting and decreased test case generation accuracy. Conversely, setting the rank parameter too large easily leads to overfitting, increasing computational overhead and reducing generalization ability, severely restricting the fine-tuning effect of the large language model and affecting the accuracy and reliability of automatically generating software test cases in complex and ever-changing testing scenarios. Summary of the Invention

[0004] To address the aforementioned technical issues, a method for generating software test cases using LoRA fine-tuning of large models is provided.

[0005] The solution to the technical problem in this application is to provide a method for generating software test cases for LoRA fine-tuning of large models, including the following steps: Within the preset fine-tuning period, the test requirement information corresponding to each test case generation record and the generated test case information are retrieved to form a fine-tuning dataset; For the fine-tuning dataset, semantic features are extracted and cluster analysis is performed on the test requirement information. The category differences of requirement semantics are evaluated based on the number distribution of clusters, so as to calculate the global requirement diversity. Association rules are mined for test requirements and test cases within each cluster. The strength of feature mapping is evaluated to quantify the intra-cluster association degree of the cluster. Based on the distribution of the number of mined association rules, the local feature heterogeneity representing the differences in micro-features is calculated. Based on the global demand diversity and local feature heterogeneity, the feature information complexity of the fine-tuning dataset is obtained, and the rank parameter of the LoRA fine-tuning architecture is dynamically adjusted accordingly. The rank parameter is then configured into the LoRA fine-tuning architecture, and the large model is trained using the fine-tuning dataset. Finally, software test cases are generated using the large model fine-tuned by LoRA.

[0006] Preferably, the calculation of global demand diversity includes: For each test case generation record in the fine-tuning dataset, keyword extraction and vectorization of its test requirement information are performed to extract the semantic requirement vector of that test case generation record; Cluster the semantic requirement vectors of all use cases generated in the fine-tuning dataset; count the number of all clusters and positively map them as the global requirement diversity.

[0007] Preferably, the process of obtaining the semantic requirement vector is as follows: extract all keywords from the test requirement information of each test case generation record, and vectorize each keyword to obtain the word vector of each keyword. Then, perform mean pooling on the word vectors of all keywords in the test requirement information to obtain the semantic requirement vector of each test case generation record.

[0008] Preferably, the specific process of association rule mining is as follows: for each test case generation record, all keywords extracted from the test requirement information and all keywords extracted from the test case information constitute the keyword set of that test case generation record; the Apriori algorithm is used to perform association rule mining on the keyword set of all test case generation records in each cluster, and the confidence of all association rules is output.

[0009] Preferably, the intra-cluster correlation is the average confidence level of all association rules corresponding to each cluster.

[0010] Preferably, the calculation process of the local feature heterogeneity is as follows: count the total number of all association rules mined by each cluster, normalize them, and use them as association weights; based on the association weights, perform a weighted summation of the intra-cluster association degrees of all clusters, and perform a negative mapping on the weighted summation result to use it as the local feature heterogeneity.

[0011] Preferably, the complexity of the feature information is positively correlated with both the global demand diversity and the local feature heterogeneity.

[0012] Preferably, the global demand diversity and local feature heterogeneity are weighted and summed based on a preset first weight and a preset second weight, which is used as the feature information complexity. The sum of the preset first weight and the preset second weight is 1.

[0013] Preferably, the dynamic adjustment of the rank parameter of the LoRA fine-tuning architecture includes: dividing a preset distribution range into multiple consecutive sub-intervals; assigning an increasing integer power exponent to each sub-interval in ascending order of sub-interval values; and extracting the integer power exponent corresponding to the sub-interval whose feature information complexity of the fine-tuning dataset belongs, denoted as . Then the rank parameter of the LoRA fine-tuning architecture is .

[0014] Preferably, the LoRA fine-tuning training of the large model includes: freezing the original base weight matrix of the large model so that its parameters do not participate in gradient updates; constructing a dimensionality reduction matrix and an increased dimensionality matrix in the bypass of the base weight matrix based on the rank parameter, wherein the column dimension of the dimensionality reduction matrix and the row dimension of the increased dimensionality matrix are both equal to the rank parameter; using the test requirement information in the fine-tuning dataset as input instructions and the test case information as the expected output labels, during iterative training, backpropagating to update the parameters of the dimensionality reduction matrix and the increased dimensionality matrix according to the loss function between the input instructions and the expected output labels, until training is completed, and obtaining the large model fine-tuned by LoRA.

[0015] This application has at least the following beneficial effects: This application extracts semantic features and performs cluster analysis on test requirement information to calculate global requirement diversity. By using text clustering, unstructured input requirements are transformed into macroscopic scenario categories, reflecting the richness of semantic types of test requirement information within the current fine-tuning cycle. A larger number of clusters indicates more test requirement types and a more dispersed semantic distribution, meaning the fine-tuning dataset contains more diverse test scenarios and the model needs to learn more complex feature patterns. This global quantitative indicator provides a macroscopic basis for the adaptive adjustment of the LoRA rank parameter. By deeply exploring the causal relationship between test requirement information and test case information through association rules and calculating local feature heterogeneity, this application can accurately reveal whether specific actions diverge and mutate even within the same test scenario. It reveals the degree of difference between test case generation records within each cluster at the microscopic level. This local indicator compensates for the shortcomings of global requirement diversity, which only focuses on inter-cluster differences and ignores intra-cluster differences, achieving a comprehensive quantitative evaluation of the complexity of the fine-tuning dataset from macro to micro. Furthermore, it combines global requirement diversity, which represents the differences in semantic categories of requirements, with the degree of divergence representing microscopic mapping features. The heterogeneity of local features is fused to calculate the complexity of feature information, comprehensively characterizing the multi-level complexity of the fine-tuning dataset and reflecting the feature learning difficulty faced by the large model. The rank parameter of the LoRA fine-tuning architecture is adjusted according to the complexity of the feature information, dynamically adapting the rank parameter to the actual complexity of the fine-tuning dataset corresponding to different fine-tuning cycles. When the feature information complexity is low, a smaller rank parameter is used to avoid overfitting and reduce computational overhead, improving training efficiency. When the feature information complexity is high, a larger rank parameter is used to ensure that the large language model has sufficient learning capacity to fit complex and diverse feature patterns, improving the accuracy of test case generation. This achieves adaptive adjustment, with a large parameter space for complex data to prevent underfitting and a small parameter space for simple data to prevent overfitting, maximizing computational cost savings while ensuring fine-tuning accuracy. Furthermore, by configuring the final determined rank parameter into the LoRA architecture for fine-tuning training, the final large language model can accurately generate software test cases corresponding to the input new test requirements, achieving synergistic optimization of test case generation accuracy and model training efficiency, significantly improving the accuracy of automatic software test case generation. Attached Figure Description

[0016] The following section provides a more detailed description of a method for generating software test cases for a LoRA fine-tuning large model, in conjunction with the accompanying drawings.

[0017] Figure 1 A flowchart illustrating the steps of a method for generating software test cases for LoRA fine-tuning of a large model, as provided in this application embodiment; Figure 2A flowchart illustrating the steps of a method for obtaining local feature heterogeneity provided in an embodiment of this application. Detailed Implementation

[0018] The following, in conjunction with the accompanying drawings and embodiments, provides a more detailed description of the software test case generation method for LoRA fine-tuning large models proposed in this application.

[0019] Please see Figure 1 The diagram illustrates a flowchart of a method for generating software test cases for fine-tuning a large LoRA model according to an embodiment of this application. The method includes the following steps: Step 1: Within the preset fine-tuning period, retrieve the test requirement information and the generated test case information corresponding to each test case generation record to form a fine-tuning dataset; Step 2: For the fine-tuned dataset, perform semantic feature extraction and cluster analysis on the test requirement information, evaluate the category differences of requirement semantics based on the number distribution of clusters, and calculate the global requirement diversity; mine association rules for the test requirement information and test case information within each cluster, evaluate the feature mapping strength to quantify the intra-cluster association degree of the cluster, and calculate the local feature heterogeneity that represents the differences in micro features by combining the number distribution of the mined association rules. Step 3: Based on the global demand diversity and local feature heterogeneity, obtain the feature information complexity of the fine-tuning dataset, and dynamically adjust the rank parameter of the LoRA fine-tuning architecture accordingly; configure the rank parameter into the LoRA fine-tuning architecture, use the fine-tuning dataset to train the large model using LoRA fine-tuning, and use the large model fine-tuned by LoRA to generate software test cases.

[0020] Test case generation is a core component of software testing, and its quality directly determines the efficiency of software defect detection and test coverage. A standardized set of software test cases typically includes elements such as test inputs, execution steps, expected results, and preconditions, serving as a crucial link between test requirements and test execution. With the accelerated functional iteration of the software system under test and the increasing diversification of test requirements, automatic test case generation technology based on large language models has emerged. This technology inputs test requirement information such as project descriptions, technical requirements, and business functions into a large model, enabling the model to output structured test case steps, thereby assisting testers in efficiently completing test case design.

[0021] In step 1, the specific process is as follows: Within a preset fine-tuning cycle, retrieve the test requirement information corresponding to each test case generation record and the generated test case information to form a fine-tuning dataset; Among them, test requirement information refers to the input instruction data that triggers the generation of the large model, including test number, project description, test business function, technical requirements, test case type, expected results, and evaluation criteria; test case information refers to the specific test execution steps output by the large language model; It should be noted that the large model refers to the large language model. In this embodiment, the Qwen-7B open-source language model is selected as the large language model for performing the software test case generation task. Secondly, the preset fine-tuning period is set to one month. As for other implementation methods, implementers can set it according to the actual situation.

[0022] In software test case generation scenarios, the newly added test objects and test requirements often exhibit significant dynamic differences across different fine-tuning cycles. This causes the corresponding test cases to continuously change in terms of business causal logic and operational boundaries. To enable the large language model to continuously learn the latest project's business logic and testing specifications, and to avoid generating redundant or erroneous test steps due to knowledge lag, it is necessary to fine-tune the large language model using accumulated test case data. LoRA (Low-Rank Adaptation) is an efficient parameter fine-tuning technique for large language models. Its core principle is to freeze the original basic weights of the pre-trained large language model and inject trainable low-rank matrices only as bypasses in specific network layers of the model. By updating the parameters only on the low-rank matrix, the model can be adapted to specific downstream tasks with a minimal number of trainable parameters.

[0023] In the LoRA fine-tuning architecture, the rank parameter is a core hyperparameter that determines the size of the low-rank matrix dimension. Its value directly controls the scale of trainable parameters and the model's fitting ability. Existing LoRA fine-tuning methods typically use a fixed-size rank parameter. However, in practical applications, the new test items and test requirements vary significantly across different fine-tuning cycles. If the test requirements are of a single type and the business scenario is relatively regular during the fine-tuning cycle, using an excessively large rank parameter can easily lead to model overfitting. Conversely, if the test requirements are diverse and the business logic is complex and varied during the fine-tuning cycle, using a small rank parameter will limit the model's ability to learn complex mapping features. Therefore, to achieve the best balance between fine-tuning accuracy and preventing overfitting, the LoRA rank parameter needs to be adaptively and dynamically adjusted according to the feature complexity of the fine-tuning dataset.

[0024] The complexity of features that the large model needs to learn in the entire fine-tuning dataset essentially stems from the differences in test requirement information that triggers test case generation. The diversity of business function descriptions and technical requirements of different test projects directly determines the discrete distribution of features in the fine-tuning dataset. Therefore, in order to quantitatively evaluate the complexity of the fine-tuning dataset from a global macro perspective and thus provide reliable data support for setting reasonable rank parameters, the specific process in step 2 is as follows: Step 201: Extract all keywords from the test requirement information of each test case generation record, and vectorize each keyword to obtain the word vector of each keyword. Perform mean pooling on the word vectors of all keywords in the test requirement information to serve as the semantic requirement vector of each test case generation record. Specifically, for the test requirement information of each test case generation record, the jieba word segmentation tool is used to segment the information and filter out stop words to obtain all keywords contained in the test requirement information. Then, the Word2Vec model is used to obtain the word vectors corresponding to each keyword, where the word vector dimension is set to 128, the window size is set to 3, and the minimum word frequency is set to 1. Finally, for the test requirement information of each test case generation record, the word vectors of all its keywords are averaged, that is, the arithmetic mean of each word vector is taken on the same dimension, which is used as the semantic requirement vector of the test requirement information. The jieba word segmentation tool, the Word2Vec model, and the average pooling operation are all well-known technologies and will not be described in detail here.

[0025] Step 202: Cluster the semantic requirement vectors of all use case generation records in the fine-tuning dataset to obtain multiple clusters; count the number of all clusters and perform a positive mapping on them as the global requirement diversity. Specifically, the K-means clustering algorithm is used for clustering, and the number of clusters is determined by the elbow rule. Both the K-means clustering algorithm and the elbow rule are well-known techniques and will not be elaborated here. Secondly, the positive mapping process is as follows: the ratio of the number of all clusters to the preset number of reference clusters is used as the result of the positive mapping. The process of obtaining the preset benchmark reference cluster number is as follows: collect all test requirement information accumulated in the historical life cycle before the current fine-tuning cycle, obtain the semantic requirement vector using the above method, use all semantic requirement vectors in the historical life cycle as input to the K-means clustering algorithm, use the elbow rule to determine the optimal cluster number, and use it as the benchmark reference cluster number.

[0026] Specifically, if a new test requirement type that has never appeared in the past exists within the fine-tuning period, causing the ratio to be greater than 1, then the global requirement diversity will be directly truncated to 1.

[0027] It should be noted that the greater the global requirement diversity, the more test case generation records are divided into clusters within the fine-tuning cycle. This reflects that the fine-tuning dataset covers a wider range of test business functions and technical requirements, indicating that the training features, which serve as fine-tuning instructions for the large model, are extremely complex and dispersed, requiring the model to have more powerful parallel mapping and learning capabilities. Conversely, the smaller the global requirement diversity, the fewer the clusters within the fine-tuning cycle. This reflects that the test cases are mostly concentrated in a single or a few similar business scenarios, indicating that the training features contained in the fine-tuning dataset have high homogeneity and feature extraction is relatively easy.

[0028] Furthermore, global requirement diversity characterizes the richness of test requirement types in the fine-tuning training dataset from the perspective of global semantic distribution. However, while this metric can measure the breadth of test scenarios covered by the fine-tuning dataset from a macro perspective, it is still insufficient to accurately assess the learning difficulty of large models in specific generation tasks. In actual testing scenarios, although test requirement information within the same cluster has high semantic similarity at the macro level such as project description and business functions, there may still be significant differences in fine-grained function execution and operational boundaries. For example, among multiple test requirements belonging to the "attack tracing" function test, some test cases only need to verify the traceability of the attack path, while others additionally include verification of automatic attack protection functions. The difference in technical requirements between the two leads to substantial differences in the corresponding test steps. As another example, the test business functions are basically the same, but the differences in the technical environment of different customers (such as different versions of supported communication protocols) lead to differentiation in the operational boundaries and verification conditions of test cases.

[0029] While the aforementioned differences are insufficient to classify test requirement information into different clusters, they have a significant impact on the feature extraction complexity during large-scale model training. Relying solely on global requirement diversity for evaluation would mask the differentiation of generated actions under similar requirements within a cluster. If the differences between use cases within a cluster are large, the model needs to learn more diverse mapping relationships within the same cluster, increasing training difficulty. Conversely, if the use cases within a cluster are highly correlated and have strong inferability, the training features are more regular, and the model's learning difficulty is lower. To ensure that the LoRA large-scale model can accurately capture subtle differences and output targeted test steps when encountering similar but not identical input instructions, it is necessary to further delve into the internal microstructure of the clusters. Therefore, the flowchart of the method for obtaining local feature heterogeneity provided in this application is as follows: Figure 2 As shown, the specific process is as follows: Step 203: For each test case generation record, all keywords extracted from the test requirement information and all keywords extracted from the test case information constitute the keyword set of the test case generation record; use the Apriori algorithm to mine association rules for the keyword sets of all test case generation records in each cluster, and output the confidence of all association rules; calculate the average confidence of all association rules corresponding to each cluster as the intra-cluster association degree. The Apriori algorithm is a well-known technique. In the Apriori algorithm framework, the set of keywords for each use case generation record in a cluster is defined as a transaction, and each keyword is defined as an item. All keywords within the same transaction constitute the itemset of that item. The Apriori algorithm scans all transactions within a cluster to discover frequent itemsets that meet a preset minimum support threshold, and then generates all association rules that meet a preset minimum confidence threshold and their corresponding confidence levels. However, if the minimum support threshold is too low, a large number of randomly co-occurring low-frequency keyword combinations will be included in frequent itemsets, introducing noisy associations and interfering with the accuracy of subsequent use case association evaluations. Conversely, if the minimum support threshold is too high... A high minimum support threshold can easily overlook effective rules that have actual semantic relevance but appear infrequently due to the limited number of transactions within a cluster, reducing the coverage of the association analysis. In the context of text data scale in software test case generation scenarios, this embodiment sets a preset minimum support threshold of 0.2. Secondly, confidence reflects the inferability of association rules. If the minimum confidence threshold is too low, a large number of weak association rules will be included in the statistics, diluting the ability to represent the true degree of association between keywords within a cluster. If the minimum confidence threshold is too high, rules with some reference value will be eliminated, making the association analysis results too conservative. This embodiment sets a preset minimum confidence threshold of 0.6. As other implementation methods, implementers can set it according to their actual situation.

[0030] Specifically, if the number of records generated by a use case in a cluster is 1, it indicates that the use case is specific and there are no other use cases in the cluster that can be associated. In this case, the Apriori algorithm is skipped and the intra-cluster association degree is directly set to 0. Secondly, if the total number of association rules mined by the cluster is 0, the intra-cluster association degree is directly set to 0.

[0031] It should be noted that a higher intra-cluster correlation indicates a very high confidence level in the association rules mined within that cluster. This reflects a tighter co-occurrence relationship between keywords within the cluster and a stronger derivability of the association rules. In other words, the mapping pattern between test requirement information and test case information within the cluster is highly consistent and regular, indicating a high degree of convergence in the micro-features within the cluster. When facing such requirements, large models only need to extract a few core features to accurately deduce the association rules, making the learning difficulty relatively low. Conversely, a lower intra-cluster correlation indicates a generally lower confidence level in the association rules within the cluster. This reflects a sparser co-occurrence relationship between keywords and a weaker derivability of the association rules. In other words, the consistency between test requirement information and test case information within the cluster is weak, with more semantic diversity or subtle differences. This indicates a large amount of irregular differentiation in the intra-cluster features and a complex business mapping relationship. Large models must have stronger fine-grained feature extraction capabilities to cope with this, making the learning difficulty extremely high.

[0032] Furthermore, after mining the association patterns within clusters using the Apriori algorithm, although the intra-cluster association degree can be used to measure the convergence strength of intra-cluster logic, this indicator has certain limitations. Specifically, when only a very small number of association rules are generated within a cluster, and these rules happen to have extremely high confidence, directly using the mean confidence level will lead to an artificially high intra-cluster association degree, thus incorrectly judging that the cluster's features are simple and easy to learn. However, a sparse number of association rules often means that most of the data within the cluster lacks common features and exhibits a highly discrete state. To correct this evaluation bias caused by the sparsity of local rules, the number of association rules must be introduced as an auxiliary metric. Specifically: Step 204: Count the total number of all association rules mined for each cluster, normalize them, and use them as association weights; based on the association weights, perform a weighted summation of the intra-cluster association degrees of all clusters, and perform a negative mapping on the weighted summation result as the local feature heterogeneity. The normalization process employs maximum value normalization, which involves selecting the maximum total number of association rules across all clusters. If this maximum value is 0, the association weights of all clusters are directly set to 0. If the maximum value is greater than 0, the ratio of the total number of association rules in each cluster to this maximum value is used as the normalization result, i.e., the association weight. The negative mapping process is as follows: Calculate the ratio between the weighted summation result and the number of all clusters, and take the difference between the value 1 and this ratio as the result of the negative mapping; In this embodiment, the local feature heterogeneity The calculation formula is: in, For the first The association weights of each cluster. For the first Intra-cluster association of a cluster, The number of all clusters; It should be noted that the greater the heterogeneity of local features, the fewer the number of high-confidence association rules mined within the cluster, or the lower the confidence level. This indicates that even for the same type of test requirements in the fine-tuning dataset, the final generated test steps are extremely divergent and lack stable causal reasoning patterns. In this case, it is difficult for large models to summarize common execution actions from such homogeneous data, making micro-level learning extremely difficult. Conversely, the smaller the heterogeneity of local features, the more numerous and high-confidence association rules exist within the cluster. The mapping relationship between test requirement instructions and test execution actions is highly rigid and consistent, indicating that the fine-tuning dataset is highly convergent at the micro level and does not have ambiguous divergent features. Large models can easily extract and solidify the generation paradigm of test cases from it, making micro-level learning extremely easy.

[0033] Furthermore, in step 3, the complexity of feature information is determined based on the global demand diversity and local feature heterogeneity, specifically as follows: Step 301: The feature information complexity of the fine-tuning dataset is positively correlated with both the global requirement diversity and the local feature heterogeneity. It should be noted that a positive correlation means that the dependent variable increases as the independent variable increases and decreases as the independent variable decreases.

[0034] Specifically, based on a preset first weight and a preset second weight, the global demand diversity and local feature heterogeneity are weighted and summed to represent the feature information complexity. The sum of the preset first weight and the preset second weight is 1. In this embodiment, the preset first weight is set to be equal to the preset second weight, both of which are 0.5. In other implementation methods, the implementer can set the weight according to the actual situation.

[0035] It should be noted that the greater the complexity of the feature information, the more extensive and dispersed the test requirements scenarios covered in the current fine-tuning cycle are, and the more divergent and elusive the specific execution actions under similar requirements are. This reflects that the business mapping features contained in the fine-tuning dataset are extremely redundant and difficult to extract, and the training feature information faced by the large model is relatively complex. It is necessary to appropriately increase the rank parameter of the LoRA fine-tuning architecture to improve the training feature extraction and learning ability, so as to prevent underfitting. Conversely, it indicates that the test requirements scenarios covered in the fine-tuning cycle are singular, and the mapping rules from requirements to actions in these scenarios are highly consistent. This reflects that the features of the fine-tuning dataset are extremely simple and convergent. In this case, the LoRA fine-tuning architecture needs to use a smaller rank parameter to avoid overfitting and improve the efficiency of fine-tuning training.

[0036] Furthermore, based on the binary principle of computers, the rank parameter of the LoRA fine-tuning architecture is typically taken as a power of 2. In software test case generation scenarios, the power exponent is usually an integer between 1 and 8. Therefore, based on the complexity of feature information, the power exponent is determined to dynamically adjust the rank parameter of the LoRA fine-tuning architecture, specifically as follows: Step 302, set the preset distribution range The dataset is divided into multiple consecutive sub-intervals. Following the ascending order of values ​​within each sub-interval, an increasing integer exponent is assigned to each sub-interval. The feature complexity of the fine-tuned dataset is extracted, and the integer exponent corresponding to the sub-interval to which it belongs is denoted as... Then the rank parameter of the LoRA fine-tuning architecture is ; Specifically, it is to The distribution range is divided into 8 consecutive sub-intervals at equal intervals, namely: , , , , , , , Therefore, subinterval The corresponding integer exponent is set to 1, and the sub-interval is... The corresponding integer exponent is set to 2, and the sub-interval is... The corresponding integer exponent is set to 3, and the sub-interval is... The corresponding integer exponent is set to 4, and the sub-interval is... The corresponding integer exponent is set to 5, and the sub-interval is... The corresponding integer exponent is set to 6, and the sub-interval is... The corresponding integer exponent is set to 7, and the sub-interval is... The corresponding integer exponent is set to 8.

[0037] Therefore, the rank parameter calculated above is configured into the LoRA fine-tuning architecture, and the pre-trained large language model is fine-tuned using the fine-tuning dataset to obtain the large language model after LoRA fine-tuning. In this embodiment, the test requirement information in the fine-tuning dataset is used as the input instruction, and the test case information is used as the expected output label. During the training process, the scaling factor is set to a preset multiple of the rank parameter. In this embodiment, the preset multiple is set to 1, the random inactivation rate is set to 0.05, the learning rate is 1e-4, and the number of training rounds is set to 20. As for other implementation methods, the implementer can set them according to the actual situation. The specific fine-tuning process is as follows: During training, the original basic weight matrix of the pre-trained large language model is frozen, and its parameters are kept from participating in gradient updates; based on the configured rank parameter, a side-channel injected dimensionality reduction matrix A and an increased dimensionality matrix B are constructed, where the column dimension of the dimensionality reduction matrix A and the row dimension of the increased dimensionality matrix B are both equal to the rank parameter; during iterative training, the parameters of the dimensionality reduction matrix A and the increased dimensionality matrix B are updated only based on the loss function between the input instruction and the expected output label, thereby achieving efficient fitting of the model to the test case generation rules. It should be noted that the LoRA fine-tuning process for large models is a well-known technique and will not be elaborated here.

[0038] In the actual reasoning application stage, when a new test task is received, the test requirement information of the test task is obtained and input into the large language model after LoRA fine-tuning. Based on the mapping rules learned by the fine-tuning, the model automatically generates and outputs the corresponding software test cases.

[0039] The generated software test cases assist testers or automated testing frameworks in performing functional tests on the software system under test.

Claims

1. A method for generating software test cases for LoRA fine-tuning large models, characterized in that, The method includes the following steps: Within the preset fine-tuning period, the test requirement information corresponding to each test case generation record and the generated test case information are retrieved to form a fine-tuning dataset; For the fine-tuning dataset, semantic features are extracted and cluster analysis is performed on the test requirement information. The category differences of requirement semantics are evaluated based on the number distribution of clusters, so as to calculate the global requirement diversity. Association rules are mined for test requirements and test cases within each cluster. The strength of feature mapping is evaluated to quantify the intra-cluster association degree of the cluster. Based on the distribution of the number of mined association rules, the local feature heterogeneity representing the differences in micro-features is calculated. Based on the global demand diversity and local feature heterogeneity, the feature information complexity of the fine-tuning dataset is obtained, and the rank parameter of the LoRA fine-tuning architecture is dynamically adjusted accordingly. The rank parameter is then configured into the LoRA fine-tuning architecture, and the large model is trained using the fine-tuning dataset. Finally, software test cases are generated using the large model fine-tuned by LoRA.

2. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 1, characterized in that, The calculation of global demand diversity includes: For each test case generation record in the fine-tuning dataset, keyword extraction and vectorization of its test requirement information are performed to extract the semantic requirement vector of that test case generation record; Cluster the semantic requirement vectors of all use cases generated in the fine-tuning dataset; count the number of all clusters and positively map them as the global requirement diversity.

3. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 2, characterized in that, The process of obtaining the semantic requirement vector is as follows: extract all keywords from the test requirement information of each test case generation record, vectorize each keyword, obtain the word vector of each keyword, and perform mean pooling operation on the word vectors of all keywords in the test requirement information to serve as the semantic requirement vector of each test case generation record.

4. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 1, characterized in that, The specific process of association rule mining is as follows: for each test case generation record, all keywords extracted from the test requirement information and all keywords extracted from the test case information constitute the keyword set of that test case generation record; The Apriori algorithm is used to mine association rules for the keyword set of all use case records generated within each cluster, and the confidence of all association rules is output.

5. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 4, characterized in that, The intra-cluster association degree is the average confidence level of all association rules corresponding to each cluster.

6. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 5, characterized in that, The calculation process for the local feature heterogeneity is as follows: count the total number of all association rules mined from each cluster, normalize them, and use them as association weights; Based on the association weights, the intra-cluster association degrees of all clusters are weighted and summed, and the weighted sum is negatively mapped as the local feature heterogeneity.

7. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 1, characterized in that, The complexity of the feature information is positively correlated with both the global requirement diversity and the local feature heterogeneity.

8. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 7, characterized in that, Based on the preset first weight and the preset second weight, the global demand diversity and the local feature heterogeneity are weighted and summed to represent the feature information complexity. The sum of the preset first weight and the preset second weight is 1.

9. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 1, characterized in that, The dynamic adjustment of the rank parameter of the LoRA fine-tuning architecture includes: dividing a preset distribution range into multiple consecutive sub-intervals; assigning an increasing integer power exponent to each sub-interval in ascending order of sub-interval values; extracting the integer power exponent corresponding to the sub-interval containing the feature information complexity of the fine-tuning dataset, denoted as . Then the rank parameter of the LoRA fine-tuning architecture is .

10. The method for generating software test cases for a LoRA fine-tuning large model as described in claim 1, characterized in that, The LoRA fine-tuning training of the large model includes: freezing the original base weight matrix of the large model so that its parameters do not participate in gradient updates; constructing a dimensionality reduction matrix and an increased dimensionality matrix in the bypass of the base weight matrix based on the rank parameter, wherein the column dimension of the dimensionality reduction matrix and the row dimension of the increased dimensionality matrix are both equal to the rank parameter; using the test requirement information in the fine-tuning dataset as input instructions and the test case information as the expected output labels, during iterative training, backpropagating to update the parameters of the dimensionality reduction matrix and the increased dimensionality matrix according to the loss function between the input instructions and the expected output labels, until training is completed, and obtaining the large model fine-tuned by LoRA.