Model tuning method, device, equipment and storage medium
By setting preset model tuning conditions on the training and push-in machine, automatically obtaining Q&A data and determining the tuning algorithm, the problem of poor model tuning effect on the training and push-in machine is solved, and efficient automatic tuning is achieved.
Patent Information
- Application Number
- CN202510705454.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2045-05-29
AI Technical Summary
In the prior art, model tuning on the training and push-in machine requires manual collection of sample data and creation of training tasks, resulting in poor tuning effects and low efficiency.
By presetting model tuning conditions, the server device automatically adjusts the node to the training state, obtains question-and-answer data and determines the target tuning algorithm to realize automated model tuning.
It improves the effect and efficiency of model tuning, reduces human errors, and improves overall resource utilization and user experience.
Smart Images

Figure CN120235244B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a model tuning method, apparatus, device, and storage medium. Background Art
[0002] In today's era of rapid technological advancement, large models, with their powerful language understanding, data analysis, and generation capabilities, have been widely applied in many fields. Consequently, the demand for training large models and using them for inference has exploded. Therefore, the all-in-one training and inference machine has emerged, innovatively integrating training and inference functions on the same hardware platform.
[0003] Currently, to tune a model deployed on a training and push machine, users are required to manually collect sample data and create training tasks, resulting in poor model training and tuning results, and in turn, low model tuning efficiency. Summary of the Invention
[0004] The present application provides a model tuning method, apparatus, device and storage medium to at least solve the problem in related technologies of poor model training and tuning effects, which in turn leads to low model tuning efficiency.
[0005] In a first aspect, the present application provides a model tuning method, the method comprising:
[0006] In response to meeting a preset model tuning condition, adjusting the current node to a training state;
[0007] Obtain target data; the target data includes multiple sample data; the target data is used for model training and tuning; the sample data is question-answering data, and the question-answering data is at least one of question-answering text data, question-answering image data, or question-answering video data;
[0008] Determine the target tuning algorithm based on the target data;
[0009] The target model is tuned based on the target data and using the target tuning algorithm; the target model is the question-answering model to be tuned.
[0010] In a second aspect, the present application also provides a model tuning device, comprising:
[0011] An adjustment module, configured to adjust a current node to a training state in response to satisfying a preset model tuning condition;
[0012] An acquisition module is used to acquire target data; the target data includes multiple sample data; the target data is used for model training and tuning; the sample data is question-answer data, and the question-answer data is at least one of question-answer text data, question-answer image data, or question-answer video data;
[0013] A determination module, used to determine a target tuning algorithm based on target data;
[0014] The tuning module is used to tune the target model based on the target data and using the target tuning algorithm; the target model is the question-answering model to be tuned.
[0015] In a third aspect, the present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of the model tuning method provided in the first aspect above when executing the computer program.
[0016] In a fourth aspect, the present application also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the model tuning method provided in the first aspect are implemented.
[0017] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the model tuning method provided in the first aspect above.
[0018] Through the model tuning method, device, equipment and storage medium provided by this application, since the low-configuration training and pushing all-in-one machine cannot meet the reasoning function and training function at the same time, when it is identified that the preset model tuning conditions are met, the current node is adjusted to the training state and the target data is obtained. Among them, the target data includes multiple sample data, and the sample data is question and answer data. In order to ensure that the tuning algorithm can be better applied to the target model deployed on the training and pushing all-in-one machine, the target tuning algorithm is determined according to the obtained target data, and then the determined target tuning algorithm is adopted and the target model is tuned according to the target data. Compared with manually collecting sample data and creating training tasks, by setting preset model tuning conditions, when the preset model tuning conditions are met, model tuning is automatically performed, and the target tuning algorithm is determined according to the obtained target data, thereby enhancing the effect of model training and tuning, and thus improving the efficiency of model tuning. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0020] Figure 1 This is a diagram of an application scenario of the model tuning method provided in an embodiment of the present application;
[0021] Figure 2 A flowchart of a model tuning method provided in one embodiment of the present application;
[0022] Figure 3 A schematic diagram of a flow chart of a model tuning method provided in another embodiment of the present application;
[0023] Figure 4 A schematic diagram of the structure of a model tuning device provided in one embodiment of the present application;
[0024] Figure 5 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0026] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0027] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0028] In addition, this application involves conducting big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and using artificial intelligence technology to make automated decisions, and making technical solutions that have a significant impact on personal rights and interests based on the results of automated decisions. The application provides users with corresponding operation entrances for them to choose to agree or reject the results of automated decisions; if the user chooses to reject, the expert decision-making process will be entered.
[0029] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0030] In today's era of rapid technological advancement, large models, with their powerful language understanding, data analysis, and generation capabilities, have been widely used in many fields. Consequently, the demand for training large models and using them for inference has exploded. Therefore, the all-in-one training and inference machine has emerged. This machine integrates these two key functions, training and inference, on a single hardware platform. Users can deploy large models on the machine for use. Currently, tuning models deployed on the machine requires users to manually collect sample data and create training tasks. Manual operations can lead to configuration errors, resulting in poor training results, poor model training and tuning, and ultimately low model tuning efficiency.
[0031] Therefore, when facing the above technical problems, by presetting the model tuning conditions, the server-side device adjusts the current node to the training state and obtains the target data when it recognizes that the preset model conditions are met. Among them, the target data includes multiple sample data, the sample data is question and answer data, and the question and answer data is the question and answer data when the user uses the large model deployed on the training and push all-in-one machine for inference. The question and answer data is data collected with the user's permission. Furthermore, in order to improve the tuning effect of the model, the target tuning algorithm is determined by the target data, and the target model is tuned according to the target data using the determined target tuning algorithm, thereby realizing automated model tuning, enhancing the effect of model training and tuning, and thus improving the efficiency of model tuning.
[0032] Figure 1 This is an application scenario diagram of the model tuning method provided in the embodiment of this application. Figure 1 As shown, the application scenario provided by this embodiment includes: a server device 10 and a client 20. The model tuning method is applied to the server device 10. The server device 10 responds when it recognizes that the preset model tuning conditions are met, adjusts the current node to a training state, and obtains target data. The target data is data used for model training and tuning, including a plurality of question and answer data, and the question and answer data is at least one of question and answer text data, question and answer image data, or question and answer video data. Furthermore, the server device 10 determines a target tuning algorithm based on the target data, and thereby tunes the target model based on the target data and adopts the target tuning algorithm. The target model is the question and answer model to be tuned. After the target model tuning is completed, the tuning result is sent to the client 20, and the client 20 displays the tuning result.
[0033] Figure 2A flow chart of a model tuning method provided in an embodiment of the present application is shown as follows: Figure 2 The model tuning method provided in this embodiment is applied to a server device. The model tuning method provided in this embodiment specifically includes the following steps:
[0034] S201: In response to meeting a preset model tuning condition, adjusting the current node to a training state.
[0035] The preset model tuning conditions are pre-set conditions that can trigger model tuning.
[0036] The training state refers to using the system resources of the training and pushing machine to tune the target model. When the current node is in the training state, the training and pushing machine cannot perform inference.
[0037] The current node also includes the inference state. While in use, the current node remains in the inference state. This state refers to the system resources of the training and push machine being used to infer the target model, interact with the user, and answer questions. While the current node is in the inference state, the training and push machine cannot perform training.
[0038] Among them, the target model is the question-answering model to be tuned. It is a large model deployed on the search and push all-in-one machine. It is used to perform reasoning functions on the training and push all-in-one machine and interact with users to conduct questions and answers.
[0039] It is understandable that the system resources of the training and pushing integrated machine include but are not limited to computing resources, memory resources, storage space, network bandwidth and video memory, etc., which are not limited in this embodiment.
[0040] Optionally, the preset model tuning conditions can be preset according to needs and are not limited in this embodiment.
[0041] Specifically, in this embodiment, when the server device receives a message that a preset model tuning condition is met, the current node is adjusted to a training state.
[0042] Optionally, in this embodiment, the user can set an idle time period when using the training and pushing machine, that is, a time period that can be used for model tuning. The server sets a timer to read the current time regularly and compares the current time with the idle time period. When it is recognized that the current time is included in the idle time period, the server device determines that the preset model tuning conditions are currently met, and adjusts the current node to the training state.
[0043] S202: Acquire target data.
[0044] The target data includes multiple sample data, which are used for model training and tuning. The sample data is question-and-answer data. The question-and-answer data is at least one of question-and-answer text data, question-and-answer image data, or question-and-answer video data.
[0045] Specifically, in this embodiment, the server device obtains target data from a preset database.
[0046] It is understandable that when users use the training and promotion machine, they can make their own choices and choose whether to allow the data corresponding to daily questions and answers and the user's satisfaction with the answers to be used for model training. After the user allows, the data generated by the user when using the reasoning function of the training and promotion machine will be collected and used for target model training.
[0047] The target data includes questions raised by users, answers given by the target model through inference, and user feedback on the answers (likes or dislikes).
[0048] S203: Determine a target tuning algorithm based on the target data.
[0049] The target tuning algorithm is an algorithm used to tune the target model.
[0050] Specifically, in this embodiment, the server-side device preprocesses the target data, extracts features from the preprocessed data, and compares the features extracted from the target data with preset features, thereby determining a target tuning algorithm.
[0051] Optionally, the preset data may be feature data corresponding to each initial tuning algorithm, etc., which is not limited in this embodiment.
[0052] S204: Optimize the target model based on the target data and using a target optimization algorithm.
[0053] Among them, the target model is the question-answering model to be tuned.
[0054] Specifically, in this embodiment, the server device preprocesses the target data, inputs the preprocessed target data into the target model, and optimizes the target model using the determined target optimization algorithm.
[0055] Optionally, preprocessing may include data cleaning, removal of invalid data, etc., which is not limited in this embodiment.
[0056] Specifically, since the low-configuration training and pushing all-in-one machine cannot meet the reasoning function and training function at the same time, when it is identified that the preset model tuning conditions are met, the current node is adjusted to the training state and the target data is obtained. Among them, the target data includes multiple sample data, and the sample data is question and answer data. In order to ensure that the tuning algorithm can be better applied to the target model deployed on the training and pushing all-in-one machine, the target tuning algorithm is determined according to the acquired target data, and then the determined target tuning algorithm is adopted and the target model is tuned according to the target data. Compared with manually collecting sample data and creating training tasks, by setting preset model tuning conditions, when the preset model tuning conditions are met, model tuning is automatically performed, and the target tuning algorithm is determined according to the acquired target data, thereby enhancing the effect of model training and tuning, and thus improving the efficiency of model tuning.
[0057] As an optional implementation, based on any of the above embodiments, in response to meeting a preset model tuning condition, adjusting the current node to a training state includes:
[0058] Using a preset prediction model to determine the target training time period for the target model;
[0059] Receive sample data sent by the client;
[0060] Storing the sample data and calculating the sample size of the stored sample data;
[0061] Compare the sample size to a preset sample size threshold;
[0062] If the sample size is less than the preset sample size threshold, continue to receive sample data sent by the client until the sample size is greater than or equal to the preset sample size threshold;
[0063] If the sample size is greater than or equal to the preset sample size threshold, the current time is obtained;
[0064] Compare the current time with the target training time period;
[0065] If the target training time period includes the current time, it is determined that the preset model tuning conditions are met and the current node is adjusted to the training state;
[0066] If the target training time period does not include the current time, the current state is maintained in the inference state until the current time is included in the target training time period, then it is determined that the preset model tuning conditions are met and the current node is adjusted to the training state.
[0067] Among them, the preset prediction model is a pre-trained model.
[0068] Optionally, the preset prediction model may be a seasonal decomposition model or other models, which is not limited in this embodiment.
[0069] Exemplarily, the preset forecasting model is a seasonal decomposition model. By feeding historical usage data into the seasonal decomposition model, the moving average method is used to eliminate short-term fluctuations, decomposing the raw data into three components: long-term trend, seasonal fluctuation, and random residual. The seasonal factor is then standardized to ensure balanced fluctuations across cycles and verify whether the residual conforms to a random distribution. Exemplarily, for daily off-peak forecasts, the model calculates a 24-hour moving average to extract the trend. By comparing the difference between the actual value and the trend value, the seasonal factor is statistically analyzed hourly (e.g., low load is common between 1:00 AM and 5:00 AM). This low-load period can then be determined as the target training period for the target model.
[0070] The preset historical usage data includes the video memory occupancy rate, the number of inference task queries per second, the task queue waiting time, etc. within the preset historical time period.
[0071] Optionally, the preset historical time period may be 3 months, etc., which is not limited in this embodiment.
[0072] The sample data is the question and answer data between the user and the target model through the client's operation interface.
[0073] It can be understood that each sample data corresponds to a question and answer data.
[0074] For example, a user asks a question and the target model answers the question. The question and the target model's answer serve as a sample data.
[0075] Here, client refers to the client device.
[0076] The preset sample size threshold is the pre-set minimum number of samples used for model training and tuning.
[0077] Optionally, the preset sample size threshold can be set independently according to needs and is not limited in this embodiment.
[0078] The target training time period is the time period that can be used for model training and tuning.
[0079] It is understandable that the target training time period may be a time period predicted by a preset prediction model in which the user uses the reasoning function less or does not use the reasoning function.
[0080] Specifically, in this embodiment, the server device sends a prediction request to a preset prediction model, and the preset prediction model predicts the time period in which model training and optimization can be performed every day within a preset time period in the future, and outputs the predicted time period as the target training time period. In addition, the server device receives and stores the sample data sent by the client, and sets a timer. Every preset time period, the sample size of the stored sample data is calculated, and the sample size of the stored sample data is compared with the preset sample size threshold. If the stored sample size is less than the preset sample size threshold, the sample data continues to be received and stored until the sample size of the stored sample data is greater than or equal to the preset sample size threshold. When the stored sample size is greater than or equal to the preset sample size threshold, the server device obtains the current time and determines whether the current time is included in the target training time period. If the current time is within the target training time period, it is determined that the preset model tuning conditions are met, and a response is made to adjust the current node to the training state. If the current time is not within the target training time period, the server device continues to keep the current node in the inference state to allow the user to use it normally, and queries the current time every preset time period to determine whether the current time is within the target training time period. Until the current time is included in the target training time period, it is determined that the preset model tuning conditions are met, and the current node is adjusted to the training state.
[0081] Among them, the preset time period can be 1 week, etc., and can be independently limited according to actual needs. There is no limitation in this embodiment.
[0082] The preset time period is the preset viewing frequency.
[0083] Optionally, the preset time period can be set independently according to needs and is not limited in this embodiment.
[0084] Specifically, by adopting a preset prediction model to determine the target training time period, it is possible to avoid training the target model during the peak period when users use the inference function, thereby avoiding resource competition and improving overall resource utilization. By setting a preset sample size threshold and comparing it with the currently stored sample size, it is ensured that the stored sample size is greater than or equal to the preset sample size threshold, thereby ensuring that there is a sufficient sample size when performing model training and tuning, avoiding underfitting of the target model due to insufficient data, thereby improving the accuracy and generalization ability of the target model. By combining the sample size and the target training time period, the target model training is triggered when the sample size is met and within the target training time period, thereby maximizing the target model performance, and automatically adjusting the current node status according to the satisfaction of the preset model tuning conditions, and automatically triggering the target model training without manual settings, thereby reducing operation and maintenance costs and improving user experience.
[0085] As an optional implementation manner, based on any of the above embodiments, in response to meeting a preset model tuning condition, after adjusting the current node to a training state, the method further includes:
[0086] Start a preset container and execute steps for obtaining target data in the preset container.
[0087] Among them, the container is an executable unit of software. It uses a form of operating system virtualization to provide a complete operating environment for applications and can run on the desktop, cloud, etc.
[0088] Specifically, in this embodiment, after recognizing that the current node is adjusted to the training state, the server device starts a preset container and executes the steps of obtaining target data and subsequent steps in the preset container.
[0089] It is understandable that the server device runs the preset container and performs training and tuning of the target model within the container.
[0090] Specifically, by running a preset container when the current node is in the training state and performing target model training and tuning within the preset container, the training and production environments can be isolated. System resources can be dynamically allocated based on training needs, ensuring efficient operation during the target model training process and avoiding resource waste. Furthermore, target data can be securely processed within the preset container, avoiding the risk of target data leakage and ensuring the security of the target data.
[0091] As an optional implementation, based on any of the above embodiments, determining a target tuning algorithm based on target data includes:
[0092] Perform feature extraction on target data to obtain target features;
[0093] Determine the target tuning algorithm based on the target characteristics.
[0094] Among them, the target feature is the feature extracted from the target data.
[0095] Specifically, in this embodiment, the server device obtains target data. If the target data includes at least two of question-and-answer text data, question-and-answer image data, or question-and-answer video data, the target data is classified into text data, image data, or video data. Feature extraction is performed on the classified data using different preset feature extraction algorithms, and feature alignment is performed after extraction to obtain target features. The target feature data is compared with the preset data to determine the target tuning algorithm.
[0096] Optionally, the preset data may be feature data corresponding to each initial tuning algorithm, etc., which is not limited in this embodiment.
[0097] Optionally, question and answer text data may be feature extracted using techniques such as a bag-of-words model, word frequency-inverse document frequency, etc., which are not limited in this embodiment.
[0098] Optionally, the question-and-answer image data may be subjected to feature extraction using technologies such as convolutional neural networks, which is not limited in this embodiment.
[0099] Optionally, question-and-answer video data can be feature extracted using convolutional neural networks combined with long short-term memory networks and other technologies, which is not limited in this embodiment.
[0100] Among them, convolutional neural networks are a type of neural network specifically designed to process grid-structured data. Long short-term memory networks are a modified form of recurrent neural networks. The bag-of-words model treats text as an unordered collection of words, ignoring word order and grammatical structure. The term frequency-inverse document frequency (TF-IDF) technique measures word importance by multiplying term frequency and inverse document frequency.
[0101] Specifically, by extracting features from the target data, key information in the target data can be obtained, which in turn helps determine the target tuning algorithm.
[0102] As an optional implementation, based on any of the above embodiments, determining a target tuning algorithm based on target features includes:
[0103] Obtain feature data corresponding to multiple initial tuning algorithms;
[0104] Calculate the variance of the feature data in each initial tuning algorithm with the target feature to obtain the feature variance corresponding to each initial tuning algorithm;
[0105] Sort the feature variances corresponding to the initial tuning algorithms from small to large, and determine the smallest feature variance among the feature variances;
[0106] Obtain the historical execution success rate of the initial tuning algorithm corresponding to the minimum feature variance;
[0107] Determine the target tuning algorithm based on historical execution success rates.
[0108] Among them, the feature database stores multiple question-answering models, and each question-answering model corresponds to an initial tuning algorithm.
[0109] The historical execution success rate refers to the proportion of initial tuning algorithms that were successfully deployed and verified in historical tuning.
[0110] The feature data in each initial tuning algorithm is pre-stored feature data.
[0111] Optionally, the multiple initial tuning algorithms may include a basic fine-tuning algorithm, a layered learning rate algorithm, an adversarial fine-tuning algorithm, a regularization fine-tuning algorithm, a multi-task fine-tuning algorithm, a progressive fine-tuning algorithm, a contrastive learning fine-tuning algorithm, and a low-rank adaptive fine-tuning algorithm, etc., and may also include other tuning algorithms, which are not limited in this embodiment.
[0112] The basic fine-tuning algorithm uses a new task dataset to update and optimize all model parameters based on a pre-trained model. The layered learning rate algorithm is a fine-tuning strategy that sets different learning rates for different layers of the model. The adversarial fine-tuning algorithm introduces adversarial examples during the fine-tuning process to enhance the model's robustness against perturbations. The regularized fine-tuning algorithm adds a regularization term to the fine-tuning process to prevent overfitting and improve generalization. The multi-task fine-tuning algorithm simultaneously optimizes multiple related tasks, enabling the model to learn shared feature representations across tasks. The progressive fine-tuning algorithm divides the fine-tuning process into multiple stages, gradually adjusting hyperparameters such as the learning rate and batch size to gradually optimize the model. The contrastive learning fine-tuning algorithm enhances the model's feature extraction capabilities by bringing similar samples closer together and dissimilar samples further apart. The low-rank adaptation fine-tuning algorithm (LoRA) is a parameter-efficient fine-tuning algorithm that optimizes specific tasks by inserting a low-rank adapter module into the pre-trained model.
[0113] Specifically, in this embodiment, the server-side device obtains a model evaluation library, which includes a variety of question-answering models, and each question-answering model corresponds to an initial fine-tuning algorithm and corresponding feature data. The server-side device extracts a preset number of feature points from the feature data and target features in each initial tuning algorithm, and performs sample variance calculation on the feature points extracted from the feature data in each initial tuning algorithm and the feature points extracted from the target features, thereby obtaining the feature variance corresponding to each initial tuning algorithm. Further, the calculated feature variances corresponding to each initial tuning algorithm are sorted from small to large, and the smallest feature variance among each feature variance is determined, thereby determining the initial tuning algorithm corresponding to the smallest feature variance. After determining the initial tuning algorithm corresponding to the smallest feature variance, the historical execution success rate of the initial tuning algorithm corresponding to the smallest feature variance is obtained from the preset database, and the target tuning algorithm is determined using a preset strategy based on the historical execution success rate of the initial tuning algorithm corresponding to the smallest feature variance.
[0114] Optionally, the preset strategy may be threshold comparison, etc., which is not limited in this embodiment.
[0115] It is understandable that when the training and push-integrated machine is used, users can independently deploy large models. For the maintenance personnel of the training and push-integrated machine, it is impossible to know what large model the user has deployed. To achieve automatic tuning of the user model, the maintenance personnel of the training and push-integrated machine pre-train multiple models, each with a suitable tuning algorithm and corresponding feature data. Therefore, each model is associated with a tuning algorithm and feature data. Therefore, by obtaining the target data, extracting the target features from the target data, and calculating the variance between the target features and the feature data corresponding to the model, the most matching feature data is determined. Therefore, it can be considered that the target model and the current model are more similar, and the tuning algorithm corresponding to the model is selected for tuning.
[0116] Specifically, by calculating the variance of the feature data and target data corresponding to multiple initial tuning algorithms respectively, the similarity between the feature data corresponding to each initial tuning algorithm and the target feature can be quantitatively evaluated, and the feature variances corresponding to each initial tuning algorithm calculated are sorted from small to large, and the initial tuning algorithm corresponding to the smallest feature variance is determined, thereby determining the initial tuning algorithm that best matches the target feature. Furthermore, when determining the initial tuning algorithm corresponding to the smallest feature variance, the historical execution success rate of the initial tuning algorithm is combined, which helps to determine the appropriate tuning algorithm, and the system can more effectively optimize the target model parameters and improve the accuracy and generalization ability of the target model.
[0117] As an optional implementation, based on any of the above embodiments, determining a target tuning algorithm based on a historical execution success rate includes:
[0118] Compare the historical execution success rate with the preset success rate threshold;
[0119] If the historical execution success rate is greater than or equal to the preset success rate threshold, the initial tuning algorithm corresponding to the historical execution success rate is determined as the target tuning algorithm.
[0120] Optionally, the preset success rate threshold may be 98%, or may be independently set according to needs, which is not limited in this embodiment.
[0121] If this is the first time to tune, the historical execution success rate is greater than the preset success rate threshold by default.
[0122] Specifically, in this embodiment, the server device compares the historical execution success rate of the initial tuning algorithm corresponding to the minimum feature variance with the preset success rate threshold. If the historical execution success rate is greater than or equal to the preset success rate threshold, the initial tuning algorithm corresponding to the historical execution success rate is determined as the target tuning algorithm.
[0123] Among them, if the historical execution success rate is less than or equal to the preset success rate threshold, then the initial tuning algorithm corresponding to the second-ranked feature variance among the feature variances sorted from small to large is obtained, and the historical execution success rate of the initial tuning algorithm corresponding to the second-ranked feature variance is compared with the preset success rate threshold. If the historical execution success rate is greater than or equal to the preset success rate threshold, the initial tuning algorithm corresponding to the historical execution success rate is determined as the target tuning algorithm. If it is still less than or equal to the historical execution success rate, then the historical execution success rate of the initial tuning algorithm corresponding to the third-ranked feature variance is obtained, and compared with the preset success rate threshold again. If the historical execution success rate is greater than or equal to the preset success rate threshold, then the initial tuning algorithm corresponding to the historical execution success rate is determined as the target tuning algorithm. If the historical execution success rate is less than or equal to the preset success rate threshold, the step of extracting features from the target data is re-executed to obtain the target features.
[0124] Specifically, by comparing the historical execution success rate of the corresponding initial tuning algorithm with a preset success rate threshold, the system can quickly determine the effectiveness of the corresponding initial tuning algorithm in historical practice.
[0125] As an optional implementation manner, based on any of the above embodiments, the method further includes:
[0126] When the current node is in the training state, it receives the inference request sent by the client;
[0127] Record the number of inference requests received;
[0128] Compare the number of inference requests with a preset request number threshold;
[0129] If the number of inference requests is less than the preset request threshold, the current node is kept in training state;
[0130] If the number of inference requests is greater than or equal to the preset request number threshold, the training state of the current node is adjusted to the inference state.
[0131] The inference request is a request sent by the user through the client's operation interface.
[0132] Optionally, the preset request quantity threshold can be independently set according to actual needs and is not limited in this embodiment.
[0133] It is understandable that users can still send inference requests in the corresponding operation interface of the client.
[0134] Specifically, in this embodiment, when the current node is in the training state, the server device still receives inference requests sent by the client, and records the cumulative number of inference requests received in this training state, and compares the cumulative number of inference requests received with the preset request number threshold. If the number of inference requests is less than the preset request number threshold, the current node continues to be kept in the training state, and the target model is trained and tuned. If the number of inference requests is greater than or equal to the preset request number threshold, the corresponding process of the currently running model tuning is paused, the training state of the current node is adjusted to the inference state, and the system resources are used for the inference function of the training and inference all-in-one machine.
[0135] Specifically, by receiving the inference requests sent by the client when the current node is in the training state, calculating the number of inference requests accumulated during this period, and comparing it with the preset request number threshold, when the number of inference requests is greater than or equal to the preset request number threshold, the current node is switched to the inference state, so as to respond to the client's needs in a timely manner, reduce user waiting time, ensure the continuity and real-time performance of the service, and thus improve user experience.
[0136] Figure 3 A flow chart of a model tuning method provided in another embodiment of the present application is shown in FIG. Figure 3 The model tuning method provided in this embodiment is applied to a server device. The model tuning method provided in this embodiment specifically includes the following steps:
[0137] S301: Determine a target training time period for a target model using a preset prediction model.
[0138] S302: Determine whether the sample size of the sample data is greater than or equal to a preset sample size threshold.
[0139] S303: If the sample size is less than the preset sample size threshold, continue to receive sample data sent by the client until the sample size is greater than or equal to the preset sample size threshold.
[0140] S304: If the sample size is greater than or equal to the preset threshold, determine whether the current time is included in the target training time period.
[0141] S305: If the current time is not included in the target training time period, keep the current node of the target model in the inference state, and set a timer to determine whether the current time is included in the target training time period at intervals of a preset time period until the current time is included in the target training time period.
[0142] S306: If the current time is included in the target training time period, the current node is adjusted to a training state and a preset container is run.
[0143] S307: Acquire target data and target model data.
[0144] The target model data is the data for realizing the target model.
[0145] S308: Extract features from the target data to obtain target features.
[0146] S309: Acquire feature data corresponding to multiple initial tuning algorithms, and perform variance calculation on the feature data in each initial tuning algorithm and the target feature, thereby obtaining the feature variance corresponding to each initial tuning algorithm.
[0147] 310 , sorting the feature variances corresponding to the initial tuning algorithms from small to large, determining the smallest feature variance among the feature variances, and obtaining the historical execution success rate of the initial tuning algorithm corresponding to the smallest feature variance.
[0148] 311 , comparing the historical execution success rate with a preset success rate threshold. If the historical execution success rate is greater than or equal to the preset success rate threshold, determining the initial tuning algorithm corresponding to the historical execution success rate as the target tuning algorithm.
[0149] 312 , tuning the target model based on the target data and the target model data and using a target tuning algorithm.
[0150] 313. After the target data is tuned, the target model data is updated and the target model is deployed.
[0151] After the deployment is completed, the target model is verified to verify whether it can run normally and respond to problems. If it can run normally and respond to problems, it means that the deployment is successful. If it cannot run normally and respond to problems, it means that the deployment has failed. The current node is adjusted to the training state, re-tuned and verified again. When the number of target model deployment failures reaches the threshold, it is determined that the automatic tuning has failed, the preset container is deleted, and an early warning message is sent to the user.
[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0153] Figure 4 This is a schematic diagram of the structure of the model tuning device provided in one embodiment of the present application. Figure 5As shown, the model tuning method described above is implemented as a model tuning device. This device can be implemented as a computer program; it can also be implemented as a medium storing the relevant computer program, such as a USB flash drive and / or optical disk, or it can also be implemented as a physical device, such as an electronic device, that integrates or installs the relevant computer program. The electronic device can be a computer or a server. The model tuning device provided in this embodiment is located in the electronic device. The model tuning device 50 provided in this embodiment includes: an adjustment module 41, an acquisition module 42, a determination module 43, and a tuning module 44.
[0154] Specifically, the adjustment module 41 is used to adjust the current node to the training state in response to meeting the preset model tuning conditions; the acquisition module 42 is used to obtain target data; the target data includes multiple sample data; the target data is used for model training and tuning; the sample data is question and answer data, and the question and answer data is at least one of question and answer text data, question and answer image data or question and answer video data; the determination module 43 is used to determine the target tuning algorithm based on the target data; the tuning module 44 is used to tune the target model based on the target data and using the target tuning algorithm; the target model is the question and answer model to be tuned.
[0155] Optionally, the adjustment module 41, in response to satisfying the preset model tuning conditions and adjusting the current node to the training state, is specifically used to: use a preset prediction model to determine the target training time period of the target model; receive sample data sent by the client; store the sample data and calculate the sample size of the stored sample data; compare the sample size with the preset sample size threshold; if the sample size is less than the preset sample size threshold, continue to receive sample data sent by the client until the sample size is greater than or equal to the preset sample size threshold; if the sample size is greater than or equal to the preset sample size threshold, obtain the current time; compare the current time with the target training time period; if the target training time period includes the current time, determine that the preset model tuning conditions are satisfied, and adjust the current node to the training state; if the target training time period does not include the current time, keep the current node in the inference state until the current time is included in the target training time period, then determine that the preset model tuning conditions are satisfied, and adjust the current node to the training state.
[0156] Optionally, the multi-model tuning device further includes a startup module.
[0157] Accordingly, the startup module, in response to meeting the preset model tuning conditions and adjusting the current node to the training state, is used to: start the preset container and execute the step of obtaining target data in the preset container.
[0158] Optionally, when determining the target tuning algorithm based on the target data, the determination module 43 is configured to extract features from the target data to obtain target features; and determine the target tuning algorithm based on the target features.
[0159] Optionally, the determination module 43 is used to obtain feature data corresponding to multiple initial tuning algorithms when determining the target tuning algorithm based on the target feature; perform variance calculation on the feature data in each initial tuning algorithm and the target feature respectively to obtain the feature variance corresponding to each initial tuning algorithm; sort the feature variances corresponding to each initial tuning algorithm from small to large to determine the smallest feature variance among the feature variances; obtain the historical execution success rate of the initial tuning algorithm corresponding to the smallest feature variance; and determine the target tuning algorithm based on the historical execution success rate.
[0160] Optionally, the determination module 43 is used to compare the historical execution success rate with a preset success rate threshold when determining the target tuning algorithm based on the historical execution success rate; if the historical execution success rate is greater than or equal to the preset success rate threshold, the initial tuning algorithm corresponding to the historical execution success rate is determined as the target tuning algorithm.
[0161] Optionally, the multi-model tuning device further includes a receiving module, a recording model and a comparison module.
[0162] Accordingly, the receiving module is used to receive the inference request sent by the client when the current node is in the training state; the recording module is used to record the number of inference requests received; the comparison module is used to compare the number of inference requests with the preset request number threshold; if the number of inference requests is less than the preset request number threshold, the current node is kept in the training state; if the number of inference requests is greater than or equal to the preset request number threshold, the training state of the current node is adjusted to the inference state.
[0163] For the description of the features in the embodiment corresponding to the model tuning device, please refer to the relevant description of the embodiment corresponding to the model tuning method, and no further details will be given here.
[0164] Figure 5 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. Figure 5 As shown, the electronic device 50 provided in an embodiment of the present application includes: a memory 52 and a processor 51.
[0165] The memory 52 stores a computer program, and the processor 51 is configured to run the computer program to execute the steps in any of the above-mentioned model tuning method embodiments.
[0166] The specific implementation process of the processor 51 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0167] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the application may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0168] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0169] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0170] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned model tuning method embodiments when running.
[0171] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0172] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned model tuning method embodiments are implemented.
[0173] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-mentioned model tuning method embodiments are implemented.
[0174] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0175] The above is a detailed introduction to a device information display method provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A model tuning method, applied to a target model deployed on a training and pushing machine, characterized in that: The method comprises: In response to meeting a preset model tuning condition, adjusting the current node to a training state, wherein the tuning condition is: the sample size of the sample data is greater than or equal to a preset sample size threshold, and the current time is included in a target training time period; Obtain target data; the target data includes multiple sample data; the target data is used for model training and tuning; the sample data is question-answering data, and the question-answering data is at least one of question-answering text data, question-answering image data, or question-answering video data; determining a target tuning algorithm based on the target data; Tuning a target model based on the target data and using the target tuning algorithm; the target model is a question-answering model to be tuned; Determining a target tuning algorithm based on the target data includes: Acquiring the target data and classifying the target data; The classified data are respectively subjected to feature extraction using different preset feature extraction algorithms, and feature alignment is performed after extraction to obtain target features; Determining the target tuning algorithm based on the target characteristics; Also includes: When the current node is in a training state, receiving an inference request sent by a client; Recording the number of received inference requests; Comparing the number of inference requests with a preset request number threshold; If the number of the inference requests is less than the preset request number threshold, keeping the current node in the training state; If the number of the inference requests is greater than or equal to the preset request number threshold, the training state of the current node is adjusted to the inference state.
2. The model tuning method according to claim 1, characterized in that: In response to satisfying a preset model tuning condition, adjusting the current node to a training state includes: Determining a target training time period for the target model using a preset prediction model; Receiving the sample data sent by the client; Storing the sample data and calculating the sample size of the stored sample data; comparing the sample size with a preset sample size threshold; If the sample size is less than the preset sample size threshold, continue to receive the sample data sent by the client until the sample size is greater than or equal to the preset sample size threshold; If the sample size is greater than or equal to the preset sample size threshold, obtaining the current time; Comparing the current time with the target training time period; If the target training time period includes the current time, determining that the preset model tuning condition is met, and adjusting the current node to the training state; If the target training time period does not include the current time, the current node is maintained in the inference state until the current time is included in the target training time period, then it is determined that the preset model tuning conditions are met, and the current node is adjusted to the training state.
3. The model tuning method according to claim 1, characterized in that: After adjusting the current node to the training state in response to meeting the preset model tuning condition, the method further includes: A preset container is started, and the step of obtaining target data is performed in the preset container.
4. The model tuning method according to claim 1, characterized in that: The determining the target tuning algorithm based on the target feature includes: Obtain feature data corresponding to multiple initial tuning algorithms; Performing variance calculations on the feature data in each of the initial tuning algorithms and the target feature to obtain feature variances corresponding to each of the initial tuning algorithms; Sort the feature variances corresponding to the initial tuning algorithms from small to large, and determine the smallest feature variance among the feature variances; Obtaining a historical execution success rate of the initial tuning algorithm corresponding to the minimum feature variance; The target tuning algorithm is determined based on the historical execution success rate.
5. The model tuning method according to claim 4, characterized in that: The determining the target tuning algorithm based on the historical execution success rate includes: Comparing the historical execution success rate with a preset success rate threshold; If the historical execution success rate is greater than or equal to the preset success rate threshold, the initial tuning algorithm corresponding to the historical execution success rate is determined as the target tuning algorithm.
6. A model tuning device, applied to a target model deployed on a training and pushing machine, characterized in that: include: an adjustment module, configured to adjust the current node to a training state in response to satisfying a preset model tuning condition, wherein the tuning condition is that the sample size of the sample data is greater than or equal to a preset sample size threshold, and the current time is included in a target training time period; An acquisition module is configured to acquire target data, wherein the target data includes a plurality of sample data, and the target data is used for model training and tuning; the sample data is question-answer data, and the question-answer data is at least one of question-answer text data, question-answer image data, or question-answer video data; A determination module, configured to determine a target tuning algorithm based on the target data; A tuning module, configured to tune a target model based on the target data and using the target tuning algorithm; the target model is a question-answering model to be tuned; The determining module is specifically configured to: Acquiring the target data and classifying the target data; The classified data are respectively subjected to feature extraction using different preset feature extraction algorithms, and feature alignment is performed after extraction to obtain target features; Determining the target tuning algorithm based on the target characteristics; It also includes a receiving module, a recording module and a comparing module; The receiving module is configured to receive an inference request sent by a client when the current node is in a training state; The recording module is configured to record the number of received inference requests; The comparison module is configured to compare the number of inference requests with a preset request number threshold; If the number of the inference requests is less than the preset request number threshold, keeping the current node in the training state; If the number of the inference requests is greater than or equal to the preset request number threshold, the training state of the current node is adjusted to the inference state.
7. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the model tuning method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the model tuning method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Large language model fine tuning method and device, equipment and storage medium
CN117592535A
Enterprise management large model fine tuning method, device and equipment and storage medium
CN118428490A
Multi-objective optimization dam crack detection enhancement method and system based on expert system
CN119090875A