Multi-adapter fine-tuning automobile question and answer method, computer equipment and storage medium
By fine-tuning the base model and generating different domain adapters, the existing automotive Q&A system is solved by solving the problems of inefficiency and domain deviation when dealing with multiple problems, efficient domain adaptation and new problem handling are achieved, and system maintenance costs are reduced.
Patent Information
- Application Number
- CN202510093220.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2045-01-21
AI Technical Summary
The existing automotive Q&A system is inefficient or insufficient in accuracy when dealing with multiple problems, and cannot handle maintenance failure problems, vehicle usage problems and general field problems at the same time, with domain deviations and high cost of building and maintaining knowledge bases.
The base model is used for pre-training, and by fine-tuning it separately, a repair fault adapter, a vehicle-use problem adapter, a general domain problem adapter and an intention identification adapter are generated to achieve efficient adaptation of problems in different fields.
It improves the accuracy of field adaptation, reduces system maintenance and upgrade costs, realizes efficient identification and handling of new problems, and improves response speed and user experience.
Smart Images

Figure CN119537558A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of automobile information technology, and in particular relates to a multi-adapter fine-tuning automobile question-answering method, a computer device and a storage medium. Background Art
[0002] With the development of large language models, question-answering systems based on large models have performed well in handling complex problems. Large models have powerful natural language processing capabilities and can understand and generate rich language expressions, greatly improving the performance of question-answering systems. However, most current automotive question-answering systems are trained with pre-set rules and a large amount of labeled data, which makes them inefficient or inaccurate when dealing with a variety of problems. Although large models perform well in general fields, they still face challenges in adapting to specific fields. Especially in the automotive field, which involves a lot of professional knowledge and specific field problems, general large models find it difficult to accurately answer these professional questions.
[0003] The existing automotive question-answering system has a single function and cannot handle maintenance fault problems, vehicle usage problems, and general domain problems at the same time. When facing different types of problems, it is often necessary to rely on multiple (more than 1) independent systems or modules, resulting in resource waste and inconvenience. Moreover, the current automotive intelligent question-answering system mainly relies on a pre-built knowledge base for question-answering interaction. This method shows obvious limitations when facing new problems or problems not included in the knowledge base. In addition, the fine-tuning technology of existing systems usually does not distinguish between fields and adopts a single fine-tuning method. This leads to possible domain bias when dealing with problems in different fields, because the scale and characteristics of the data sets in each field are different, and consistent performance cannot be guaranteed. This method ignores the specificity of different fields and makes it difficult to achieve accurate domain adaptation.
[0004] The construction and maintenance of the knowledge base requires a lot of manpower and resources, especially when dealing with frequently updated automotive technology and fault information, the cost is further increased. Among them, data collection, labeling and system updates are time-consuming and labor-intensive processes, increasing the overall operating costs. In addition, the existing full-parameter fine-tuning method is costly, not only requiring a lot of computing resources, but also the fine-tuned model is not pluggable and cannot be updated or replaced at any time, which further increases the maintenance and upgrade costs of the system.
[0005] Traditional rule-based and knowledge-based methods are inefficient when dealing with multi-round question-answering and complex context-related problems. The system needs to frequently update the knowledge base when responding to new questions, which affects the response speed and user experience. At the same time, the existing fine-tuning methods cannot adapt efficiently when facing problems in different fields, resulting in the system's inefficiency in dealing with complex and diverse problems. Summary of the invention
[0006] In view of the above problems, the present invention provides a car question-and-answer method, a computer device and a storage medium fine-tuned by a Muti-Adapter.
[0007] The automobile question-and-answer method for fine-tuning multiple adapters provided by the present invention is characterized in that the automobile question-and-answer method is performed after obtaining and using a maintenance fault adapter, a vehicle problem adapter, a general field problem adapter, and an intention recognition adapter using a large base model, and then performing automobile question-and-answer, including the following steps: S1, establishment and pre-training of the base large model; S2. Fine-tuning the base large model based on the maintenance fault problem data set to obtain the maintenance fault adapter; S3, fine-tuning the base large model based on the car use problem data set to obtain the car use problem adapter; S4, fine-tuning the base large model based on the general domain problem dataset to obtain the general domain problem adapter; S5. Fine-tune the large base model based on the intention recognition task data set to obtain the intention recognition adapter.
[0008] further, The base model is based on AutoMasterGPT v3.5, but its model architecture includes 40 layers of self-attention mechanism and 40 layers of feed-forward neural network; The number of attention heads in the self-attention mechanism layer is 32, and the number of hidden units in the feedforward neural network layer is 8192; The context length of the base large model during the inference phase is 8192 tokens.
[0009] further, The step S2 comprises the following steps: S21. Data preparation: Collect and annotate automobile maintenance failure problem data and organize them into maintenance failure problem data sets; S22, fine-tuning training: using the maintenance fault problem data set to perform fine-tuning training on the base large model to obtain a maintenance fault adapter; S23, evaluation and optimization: evaluating the performance of the repair fault adapter on the repair fault problem and performing corresponding optimization, specifically including the following steps: S231, Evaluation preparation: Select the maintenance fault verification set and test set; S232, determining a repair fault assessment standard and a baseline for measuring whether the performance of the repair fault adapter meets expectations; S233, evaluation index calculation: using accuracy, precision, recall, and F1-score to evaluate the performance of the repair fault adapter; S234, calculating the response time of the large base model to different types of maintenance fault problems; S235, performance analysis: analyzing the performance of the repair fault adapter on different types of repair fault problems according to the calculation results of the evaluation index in step S233; S236, tuning: according to the analysis result of step S235, adjusting the hyper parameters of the maintenance fault adapter; performing data enhancement, including increasing the diversity and quantity of maintenance fault problem data; retraining the base large model, and performing fine tuning; S237, iterative evaluation: repeating the steps S231 to S236 until the performance of the repaired fault adapter reaches the expected standard; S238. Finally, an evaluation is performed on an independent maintenance fault test set to verify the performance of the maintenance fault adapter in a real scenario. The step S3 comprises the following steps: S31. Data preparation: Collect and annotate car-related problem data and organize them into a car-related problem dataset; S32, fine-tuning training: fine-tuning the base large model using the vehicle use problem data set to obtain a vehicle use problem adapter; S33, evaluation and optimization: evaluating the performance of the vehicle use problem adapter on the vehicle use problem and performing corresponding optimization, specifically including the following steps: S331. Evaluation preparation: Select the validation set and test set of the car usage problem; S332, determining a vehicle use problem evaluation standard and a baseline for measuring whether the performance of the vehicle use problem adapter meets expectations; S333, evaluation index calculation: use accuracy, precision, recall, and F1-score to evaluate the performance of the vehicle-related problem adapter; S334, calculating the response time of the vehicle use problem adapter to different types of vehicle use problems; S335, performance analysis: analyzing the performance of the vehicle use problem adapter on different types of vehicle use problems according to the calculation results of the evaluation index of step S333; S336, tuning: according to the analysis result of step S335, adjusting the hyper parameters of the vehicle usage problem adapter; performing data enhancement, including increasing the diversity and quantity of vehicle usage problem data; retraining the base large model, and performing fine tuning; S337, iterative evaluation: repeating the steps S331 to S336 until the performance of the vehicle-related problem adapter reaches the expected standard; S338. Finally, an evaluation is performed on an independent car-use problem test set to verify the performance of the car-use problem adapter in a real scenario. The step S4 comprises the following steps: S41. Data preparation: Collect and annotate common domain problem data and organize them into common domain problem datasets; S42, fine-tuning training: fine-tuning the base large model using the general domain problem dataset to obtain a general domain problem adapter; S43, evaluation and tuning: evaluating the performance of the general domain problem adapter on the general domain problem and performing corresponding optimization, specifically including the following steps: S431. Evaluation preparation: Select the validation set and test set of common domain problems; S432, determining a general domain problem evaluation standard and a baseline for measuring whether the performance of the general domain problem adapter meets the expected goal; S433, evaluation index calculation: use accuracy, precision, recall, and F1-score to evaluate the performance of the general domain problem adapter; S434, calculating the response time of the base large model to different types of general field problems; S435, performance analysis: analyzing the performance of the general domain problem adapter on various general domain problems according to the calculation results of the evaluation index of step S433; S436, tuning: according to the analysis result of step S435, adjusting the hyper parameters of the general domain problem adapter; performing data enhancement, including generating more types of general domain problem data to increase the diversity of training data; retraining the base large model and performing fine tuning; S437, iterative evaluation: repeating the steps S431 to S436 until the performance of the general domain problem adapter reaches the expected standard; S438. Finally, a comprehensive evaluation is performed on an independent general domain problem test set to verify the performance of the general domain problem adapter in real scenarios. The step S5 comprises the following steps: S51, data preparation: collect and annotate intent recognition task data and organize them into intent recognition datasets; S52, fine-tuning training: fine-tuning the base large model using the intent recognition data set to obtain an intent recognition adapter; S53, evaluation and tuning: Evaluate the performance of the intent recognition adapter on the intent recognition task and perform corresponding optimization. The specific steps are as follows: S531, Evaluation preparation: Select the intent recognition verification set and test set, and determine the intent recognition evaluation criteria and baseline; S532, evaluation index calculation: use accuracy, precision, recall, and F1-score to evaluate the performance of the intent recognition adapter, and calculate the response time of the base large model on different types of intent recognition problems; S533, performance analysis: analyzing the performance of the intent recognition adapter according to the calculation result of the evaluation index of step S532; S534, tuning: according to the analysis results of step S533, adjusting the hyperparameters of the intent recognition adapter; performing data enhancement, including increasing the diversity and quantity of intent recognition problem data; retraining the base large model, and performing fine-tuning; S535, iterative evaluation: repeat steps S531 to S534 until the performance of the intent recognition adapter reaches the expected standard, and verify it on an independent intent recognition test set to ensure reliability.
[0010] further, The maintenance fault adapter, vehicle usage problem adapter, general domain problem adapter and intent recognition adapter are based on a common adapter architecture.
[0011] further, The construction of the adapter architecture includes the steps of: LoRA module design: A low-rank adapter module is designed, which adopts the adjusted LoRA model; Adapter integration: Integrate multiple Lora modules into the base model through program reference and calling.
[0012] further, The fine-tuning training in steps S2 to S5 includes the following steps: SS1. Initialization parameters: Initialize parameters from the pre-trained base large model; SS2, low-rank matrix initialization: Initialize two low-rank matrices for the low-rank adapter module A and B ,in, and , r ≪ d ,in, : represents the low-rank matrix A is a d OK r A matrix of columns, : represents the low-rank matrix B is a d OK r A matrix of columns, r ≪ d :express r The value is much smaller than d , r and d is an integer not less than 0, The low-rank matrix is randomly initialized using a Gaussian distribution A and B : , , in, is the standard deviation, which is set to a preset small value according to the working conditions. i 1 and j 1 is an integer, and 1≤ i 1≤ d and 1≤ j 1≤ r , SS3, input data: input the processed data into the base large model, so that the base large model performs feature extraction on the input data; SS4, forward propagation: calculate the output result after LoRA adjustment The various computing layers of the neural network including the self-attention layer and the feedforward neural network layer generate the model output by performing feature extraction on the input data step by step, that is, obtaining the output result At the same time, by adding a low-rank matrix to the weight matrix of each calculation layer A and B The weight matrix is adjusted by multiplying: , In the above formula, is the adjusted weight matrix, W is the initial weight matrix, “·” represents the matrix dot product, B’ yes B The transposed matrix of The output result satisfy: , In the above formula, fis a mapping function, x are input features, f The specific form varies according to the task requirements and is determined by the technicians based on the working conditions; SS5, calculate the cross entropy loss, according to the output results Calculate the cross entropy loss function with the true label : , In the above formula, represents the cross entropy loss function, N is the sample size, C is the category, i.e. the number of types of adapters, It is i The sample j The true label of the class, It is i The sample j The predicted probability of the class, i and j is an integer, log(X) is the logarithm of X with base 10; SS6. Calculate the loss function through the back propagation algorithm With respect to any element of the weight matrix W θ The gradient of and update the low-rank matrix A and B Elements of , In the above formula, is the loss function With respect to any element of the weight matrix W θ The gradient of For the low-rank matrix A Any element of A θ and the low-rank matrix B Any element of B θ , use the optimization algorithm Adam to update, SS7. Iterative training: Repeat steps SS4 to SS6 until the performance of the large base model on the validation set reaches the expected standard.
[0013] further, The optimization algorithm Adam is updated by the following steps: Parameter settings: initial learning rate: 1e-3, batch size: 8; SS61, Calculate Gradient and , that is, the loss function For the low-rank matrix A Any element of A θ and the low-rank matrix B Any element of B θ The partial derivative of : , ; SS62, Update first-order moment estimate, Will A θ and B θ Unified as parameters i ,remember t represents the tth iteration, i.e. the current iteration, where t is an integer greater than 1. The parameter is updated according to the following formula i The corresponding first-order moment estimate of the gradient of the loss function: , in, m t-1 is the first-order moment estimate of the previous iteration, is the loss function Yes i The current gradient of β 1 is the first exponential decay rate hyperparameter; SS63, Updated Second-Order Moment Estimates, Update the parameters as follows i The corresponding second-order moment estimate of the gradient of the loss function: , in, is the second-order moment estimate of the previous iteration, is the loss function Yes i The square of the current gradient of β 2 is the second exponential decay rate hyperparameter, SS64, Computing m t and The deviation correction of because m t and There are deviations in the initial stage, which need to be corrected: , , is the modified first-order moment estimate, is the modified second-order moment estimate, SS65, update the parameters i , use and Update the parameters i : , In the above formula, α represents the learning rate, Yes is a constant.
[0014] The present invention also provides a computer device, which includes a memory, a first processor, and a first computer program stored in the memory and executable on the first processor. When the first computer program is executed by the first processor, the above-mentioned multi-adapter fine-tuning automobile question-and-answer method is implemented.
[0015] The present invention also provides a computer-readable storage medium, which is used to store a second computer program. The second computer program can be executed by at least one second processor to enable the at least one second processor to execute the above-mentioned multi-adapter fine-tuning car question-and-answer method.
[0016] The automobile question-answering method of Muti-Adapter fine-tuning provided by the present invention is proposed for the first time. This method can be fine-tuned according to problems in different fields to ensure the specificity of each field, thereby improving the accuracy of field adaptation and ensuring consistent performance. This is a major improvement over the existing single fine-tuning method and can effectively solve the problem of field deviation. The present invention divides automobile field problems into maintenance failures, car experience, and general problems, and performs Lora fine-tuning on the large base model to generate different Adapter adapters. At the same time, an intent recognition adapter is trained to determine which adapter to use to answer user questions, thereby significantly improving the system's adaptability and accuracy in handling diversified fields and complex problems.
[0017] The present invention achieves efficient identification and processing of new questions through large models and multi-adapter fine-tuning, breaking through the limitations of existing automotive intelligent question-answering systems when facing new questions or questions not included in the knowledge base. This will greatly improve the system's response speed and user experience.
[0018] The fine-tuned model in the present invention is pluggable and can be updated or replaced at any time, which will significantly reduce the maintenance and upgrade costs of the system. This is a major improvement over the existing full-parameter fine-tuning method, which can not only save a lot of computing resources, but also solve the problem that the construction and maintenance of the knowledge base requires a lot of manpower and resources, especially when dealing with frequently updated automotive technology and fault information, which can greatly reduce costs.
[0019] The present invention proposes a method that can efficiently handle new questions without frequently updating the knowledge base, improving response speed and user experience. This is an effective solution to the problem that traditional rule-based and knowledge base-based methods are inefficient in handling multi-round question-answering and complex context-related questions, and can improve the efficiency of handling complex and diverse questions.
[0020] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 A flow chart of a car question-answering method for Muti-Adapter fine-tuning according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" in the specification and claims of the present application and the above-mentioned drawings and any variations thereof are intended to cover non-exclusive inclusions. The terms "first", "second", "third", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order or a primary and secondary relationship. "Multiple" appearing in this application refers to more than two (including two).
[0025] Figure 1 The flowchart of the automobile question-answering method of the Muti-Adapter fine-tuning provided by the present invention. The Muti-Adapter fine-tuning automobile question-answering method uses a large base model to obtain a maintenance fault adapter, a vehicle problem adapter, a general field problem adapter and an intention recognition adapter, and then uses the maintenance fault adapter, the vehicle problem adapter, the general field problem adapter and the intention recognition adapter to answer automobile questions. The Muti-Adapter fine-tuning automobile question-answering method includes the following steps.
[0026] S1. Establishment and pre-training of the base large model.
[0027] The base model (abbreviated as model) can be obtained by taking AutoMasterGPT v3.5 as the basis and optimizing it. AutoMasterGPT v3.5 is a Transformer-based natural language processing model. The architecture of the base model has a higher number of layers and parameters, reaching the order of 14B parameters, to improve the model's expressiveness and generalization ability in processing complex language tasks.
[0028] Specifically, the base model is based on AutoMasterGPT v3.5, but its model architecture includes 40 layers of self-attention mechanism layers (Self-Attention Layer) and 40 layers of feed-forward neural network layers (Feed-ForwardNetwork Layer). The addition of these layers significantly improves the model's representation ability and ability to handle complexity when understanding and generating language. At the same time, the number of model parameters has reached 14B (14 billion), which makes the model have stronger expressiveness and generalization capabilities, especially when dealing with complex natural language tasks.
[0029] In addition, the number of attention heads in the self-attention mechanism layer has been increased from 12 to 32 to better capture long-distance dependencies and detailed information. The number of hidden units in the feedforward neural network layer has been increased from 3072 to 8192, which significantly enhances the model's computing power and generalization ability when processing a large amount of automotive-related knowledge.
[0030] For the pre-training phase, a corpus containing a large amount of automotive knowledge was used for training, including general and professional encyclopedia knowledge, social media content, car repair manuals, etc. Through these improvements, the base large model has a stronger understanding ability and higher answer accuracy when facing professional questions in the automotive field.
[0031] In addition, the context length of the model during the inference phase is expanded from the original 2048 tokens to 8192 tokens.
[0032] These improvements significantly increase the depth and complexity of the model, making it better adapted to automotive expertise and different types of problems. The pre-training is performed using large-scale general text data (including general and automotive encyclopedia knowledge information, social media content, books, blogs, and other corpora), giving the base model a wide range of language understanding and generation capabilities.
[0033] After pre-training the large base model, supervised fine-tuning (SFT) is performed on the large base model using a large amount of general domain data and automotive domain data. This includes: 1. Obtain the pre-trained model parameters through the above pre-training tasks; 2. Use supervised data (10 million+ automotive question-answering data and general conversation data) to fine-tune the pre-trained model.
[0034] 3. During fine-tuning, the model’s parameters are updated based on the supervision data to optimize the model’s performance on the car’s answers.
[0035] 4. The objective function used in the fine-tuning stage is usually the loss function of the supervised learning task, such as the cross entropy loss function.
[0036] S2. Fine-tune the base model based on the maintenance fault problem dataset to obtain a maintenance fault adapter, which specifically includes the following steps: S21. Data preparation: Collect and annotate 100,000 pieces of automobile repair failure problem data and organize them into a repair failure problem dataset.
[0037] S22, fine-tuning training: Use the maintenance fault problem dataset to fine-tune the base large model to obtain a maintenance fault adapter.
[0038] S23, Evaluation and Tuning: Evaluate the adapter performance in the repair fault problem and optimize it accordingly. Specifically, the following steps are included: S231. Evaluation preparation: Select validation and test sets that contain a variety of maintenance failure problems to fully cover different scenarios and ensure the comprehensiveness and representativeness of the evaluation.
[0039] S232. Determine evaluation criteria and baselines to measure whether the performance of the adapter meets expectations.
[0040] S233, Evaluation index calculation: Use accuracy, precision, recall, F1-score and other indicators to evaluate the performance of the adapter.
[0041] S234. Calculate the response time of the model on different types of questions to ensure that the adapter is not only accurate but also responsive.
[0042] S235. Performance Analysis: Based on the calculation results of the evaluation indicators, analyze the performance of the adapter on different types of problems and identify performance bottlenecks. Use visualization tools (such as confusion matrices) to analyze the types of errors that occur when evaluating the adapter and determine which specific types of problems the adapter performs poorly. Evaluate the performance of the adapter under boundary conditions such as unconventional or rare maintenance failure problems to ensure the robustness of the model.
[0043] S236, Tuning: Based on the results of the performance analysis, adjust the adapter's hyperparameters (such as learning rate, batch size, etc.) to optimize the convergence and stability of the model. Perform data augmentation, including increasing the diversity and quantity of data, to improve the adapter's generalization ability in different scenarios. Retrain the model, focusing on the problems of the categories that performed poorly when the adapter was evaluated in step S235, and perform targeted fine-tuning on the model to improve the adapter's performance for specific areas.
[0044] S237, Iterative evaluation: Repeat the evaluation and tuning steps until the performance of the adapter reaches the expected standard. The evaluation results of each iteration are recorded, and the performance improvement between different iterations is compared to ensure that the optimization direction is correct and effective.
[0045] S238. Finally, an evaluation is conducted on an independent test set to verify the performance of the adapter in real scenarios to ensure the reliability and effectiveness of its application.
[0046] S3. Fine-tune the base model based on the car use problem dataset to obtain a car use problem adapter, which specifically includes the following steps: S31. Data preparation: Collect and annotate a large amount of car-related problem data and organize them into a car-related problem dataset.
[0047] S32, fine-tuning training: Use the car use problem dataset to fine-tune the base large model to obtain a car use problem adapter.
[0048] S33, Evaluation and Optimization: Evaluate the performance of the adapter in terms of vehicle usage and optimize it accordingly. This includes the following steps: S331. Evaluation preparation: Select a validation set and a test set that contain diverse car usage problems to ensure that different scenarios are covered and the performance of the adapter is comprehensively evaluated.
[0049] S332. Determine evaluation criteria and baselines to measure whether the performance of the adapter meets expectations.
[0050] S333. Evaluation index calculation: Use indicators such as accuracy, precision, recall, and F1-score to evaluate the performance of the adapter.
[0051] S334. Calculate the adapter's response time for different types of vehicle usage issues to ensure fast response while maintaining accuracy.
[0052] S335. Performance Analysis: Based on the evaluation results, analyze the adapter’s performance on different types of vehicle usage problems and identify areas where performance is insufficient. Use visualization tools (such as confusion matrices) to identify the types of errors the adapter makes when evaluating and determine which types of problems the adapter performs poorly when evaluating. Evaluate the adapter’s performance under boundary conditions, such as when faced with unconventional or rare vehicle usage problems, to ensure the robustness of the model.
[0053] S336, Tuning: According to the performance analysis results, adjust the adapter's hyperparameters (such as learning rate, batch size, etc.) to optimize the convergence and stability of the model. Perform data enhancement to increase the diversity and quantity of data to improve the adapter's generalization ability in different scenarios. Retrain and fine-tune the model for the problems in the categories that performed poorly during the adapter evaluation in step S335 to improve the adapter's performance in specific areas.
[0054] S337, Iterative evaluation: Repeat the evaluation and tuning steps until the performance of the adapter reaches the expected standard. The evaluation results of each iteration are recorded, and the performance improvement is analyzed to ensure that the optimization direction is correct and effective.
[0055] S338. Finally, an evaluation is conducted on an independent test set to verify the performance of the adapter in real scenarios and ensure the reliability and effectiveness of the application.
[0056] S4. Fine-tune the base model based on the general domain problem dataset to obtain a general domain problem adapter, which specifically includes the following steps: S41. Data preparation: Collect and annotate a large amount of common domain problem data and organize them into common domain problem datasets.
[0057] S42, fine-tuning training: Use the general domain problem dataset to fine-tune the base large model to obtain a car-related problem adapter.
[0058] S43, Evaluation and Tuning: Evaluate the adapter performance on common domain issues and optimize accordingly. Specifically, the following steps are included: S431. Evaluation preparation: Select validation and test sets that contain a wide range of general domain problems to ensure that the evaluation coverage is comprehensive enough to cover different types of general problems.
[0059] S432. Determine evaluation criteria and baselines to measure whether the performance of the adapter meets the expected goals.
[0060] S433, Evaluation indicator calculation: Use indicators such as accuracy, precision, recall, and F1-score to evaluate adapter performance.
[0061] S434. Calculate the response time of the model on different types of general domain problems to ensure that the adapter has efficient response capabilities while being accurate.
[0062] S435, Performance Analysis: Analyze the performance of the adapter on various general domain problems based on the evaluation metrics to identify the parts that perform poorly. Use visualization tools (such as confusion matrices and error distribution graphs) to analyze the types of errors that occur when evaluating the adapter, identify the root cause of the problem, and determine which categories of problems the adapter performs poorly when evaluating. Evaluate the adapter's performance when dealing with boundary conditions, such as when evaluating rare or difficult-to-understand general problems, to ensure the adapter's robustness and adaptability.
[0063] S436, Tuning: According to the performance analysis results, adjust the adapter's hyperparameters (such as learning rate, regularization coefficient, batch size, etc.) to optimize the model's convergence speed and stability. Perform data enhancement, including generating more types of general domain questions and increasing the diversity of training data to improve the adapter's generalization ability. Retrain and fine-tune the model for the categories of questions that performed poorly during the adapter evaluation in step S435 to improve the adapter's performance in these areas.
[0064] S437, iterative evaluation: repeat the evaluation and tuning steps until the performance of the adapter reaches the expected standard. The evaluation results of each iteration are recorded, and the performance changes between different iterations are analyzed to ensure the effectiveness of the tuning and the correctness of the optimization direction.
[0065] S438. Finally, a comprehensive evaluation is conducted on an independent test set to verify the performance of the adapter in real scenarios to ensure the stability of the adapter and the reliability of its application.
[0066] S5. Fine-tune the base large model based on the intention recognition task dataset to obtain an intention recognition adapter, which specifically includes the following steps: S51. Data preparation: Collect and annotate a large amount of intent recognition task data and organize it into an intent recognition dataset.
[0067] S52, fine-tuning training: Use the intent recognition dataset to fine-tune the base large model to obtain the intent recognition adapter.
[0068] S53, Evaluation and Tuning: Evaluate the adapter performance on the intent recognition task and optimize it accordingly. The specific steps are as follows: S531. Evaluation preparation: Select validation sets and test sets to ensure coverage of diverse intent recognition task scenarios, and determine evaluation criteria and baselines.
[0069] S532, Evaluation indicator calculation: Use indicators such as accuracy, precision, recall, F1-score, etc. to evaluate the adapter, and calculate the response time of the model for different types of problems.
[0070] S533, Performance Analysis: Analyze the performance of the adapter based on the evaluation results, identify performance bottlenecks, and use visualization tools (such as confusion matrix) to analyze the types or categories of errors that occur during the adapter evaluation to determine the direction of improvement.
[0071] S534, Tuning: Adjust the hyperparameters of the adapter (such as learning rate, batch size, etc.) to optimize the convergence speed and stability of the model. Perform data enhancement to increase the diversity and quantity of data to improve the generalization ability of the adapter in different scenarios. Retrain and fine-tune the model to optimize for the categories of errors that occurred during the adapter evaluation in step S533.
[0072] S535, Iterative Evaluation: Repeat the evaluation and tuning steps until the adapter performance reaches the expected standard and is verified on an independent test set to ensure reliability.
[0073] in, Steps S21, S31, S41, and S51 also include: performing data cleaning on the collected data: removing sensitive information, removing invalid characters, etc., and preprocessing into a fine-tuned data format.
[0074] The annotations in steps S21, S31, and S41 are to mark the answers to the corresponding questions, and the annotation in step S51 is to mark the user intentions for the corresponding intention recognition tasks.
[0075] Each adapter involved in steps S2 to S5 is based on a common adapter architecture, and the construction of the adapter architecture includes the steps of: SA1. Lora module design: A low-rank adapter module is designed, which is an adjusted LoRA (Low-Rank Adaptation) model. The LoRA model is used as a fine-tuning technology. The present invention adjusts the weight of the original LoRA model by adding a low-rank matrix to obtain the adjusted LoRA model, thereby achieving the adaptability of the model while maintaining computational efficiency.
[0076] SA2, Adapter Integration: Integrate multiple Lora modules into the base model through program reference and call. The integration is achieved through the dynamic loading mechanism of the model, so that the adapter module can be quickly called when needed. The number of multiple LoRA modules usually ranges from 3 to 10, and the specific number is adjusted according to the actual needs of the system and the complexity of problems in different fields. This ensures that the adapter can efficiently handle different types of problems and ensure the overall performance of the model.
[0077] The fine-tuning training in steps S2 to S5 includes the following steps: SS1, Initialization parameters: Initialize parameters from the pre-trained base model.
[0078] SS2, low-rank matrix initialization: Initialize two low-rank matrices for each low-rank adapter module generated in steps S2 to S5 A and B ,in, and , r ≪ d , and determined by technical personnel according to working conditions, among which, : represents the matrix A is a d OK r A matrix of columns, : represents the matrix B is a d OK r A matrix of columns, r ≪ d :express r The value is much smaller than d , meaning the matrix is low rank and has smaller dimensions. r and dis an integer not less than 0.
[0079] The present invention uses Gaussian distribution (normal distribution) to randomly initialize the low-rank matrix A and B : , , in, is the standard deviation, which is usually set to a preset small value (such as 0.01 or 0.02) by the technicians according to the working conditions to ensure that the initial weight is small, which is convenient for subsequent model optimization. i 1 and j 1 is an integer, and 1≤ i 1≤ d and 1≤ j 1≤ r . The random initialization injects moderate disturbance into the matrix to avoid the adapter non-contribution problem caused by all elements being zero. The randomness of random initialization provides the model with diverse optimization paths, which helps convergence. Among them, the mean of the initial distribution of random initialization is zero to ensure that the adapter will not offset the basic model in the initial state. Random initialization does not rely on prior knowledge in a specific field and is suitable for various tasks, including the automotive field and intent recognition tasks. At the same time, it also reduces the need for complex preprocessing and improves the adaptability of the adapter.
[0080] SS3. Input data: Input the processed data into the large base model so that the large base model can extract features from the input data.
[0081] SS4, forward propagation: calculate the output result after LoRA adjustment Each computing layer of the neural network, including the self-attention layer and the feedforward neural network layer, generates the model output by extracting features from the input data step by step, that is, obtaining the output prediction, that is, the output result At the same time, by adding low-rank matrices to the weight matrices of these computational layers A and B The weight matrix is adjusted by multiplying the weight matrix to complete adapter fine-tuning and further improve model performance. The adjustment is: , In the above formula, is the adjusted parameter matrix, i.e., the weight matrix, W is the initial parameter matrix (determined by technicians according to the working conditions), A and B is the low-rank matrix in step SS2, “·” represents the matrix dot product, B’ yes BBy introducing the low-rank matrix A and B , lightweight adjustment of the weight matrix can significantly reduce the number of parameters during fine-tuning training while maintaining model performance.
[0082] The output result is the model output satisfy: , In the above formula, f is a mapping function, x are input features. f The specific form of may vary according to the task requirements and may be determined by technical personnel based on the working conditions. For example, it may be a linear transformation or a nonlinear activation function.
[0083] SS5, calculate the cross entropy loss, according to the output results Calculate the cross entropy loss function with the true label : , In the above formula, represents the cross entropy loss function (the cross entropy loss is used to measure the difference between the model's predicted distribution and the true distribution, that is, the error. By minimizing this error, the model's predicted value is as close to the true value as possible). N is the sample size, C is the number of categories (i.e. types of adapters), It is i The sample j The true label of the class, It is i The sample j The predicted probability of the class, i and j is an integer, log(X) is the logarithm of X to the base 10.
[0084] SS6. Calculate the loss function by back propagation calculation method Relative to any element of the weight matrix W θ The gradient of and update the low-rank matrix A and B elements.
[0085] , In the above formula, is the loss function Relative to any element of the weight matrix W θ The gradient of , which indicates the update direction of the weight matrix elements.
[0086] For low rank matrices A Any element of A θ and low-rank matrix B Any element of B θ , using the optimization square algorithm Adam for update. Adam (Adaptive Moment Estimation) is an optimization calculation method that combines momentum and adaptive learning rate, which can accelerate convergence and avoid falling into local optimality. When updating parameters, Adam calculates the first-order moment estimate (i.e. momentum) and the second-order moment estimate (i.e. the exponential moving average of the square of the gradient) of the low-rank matrix parameter gradient to better adjust the learning rate. For low-rank matrices A Any element of A θ and low-rank matrix B Any element of B θ , Adam is updated through the following steps: Parameter settings: Initial learning rate: 1e-3; Batch size: 8 (number of randomly selected samples in each training epoch), SS61, Calculate Gradient and , that is, the loss function For low-rank matrices A Any element of A θ and low-rank matrix B Any element of B θ The partial derivatives of these two gradients represent the low-rank matrix A , B The element update direction: , .
[0087] SS62. Update first-order moment estimate (momentum).
[0088] Will A θ and B θ Unified as parameters i ,remember t Represents the tth iteration, i.e. the current iteration, where t is an integer greater than 1 and is updated according to the following formula i The corresponding first-order moment estimate of the gradient of the loss function (i.e. momentum): , in, m t-1 is the first-order moment estimate of the previous iteration, is the loss function The current gradient of β 1 It is the first exponential decay rate hyperparameter, which is adjusted by technicians according to working conditions.
[0089] SS63, Updated second-order moment estimates.
[0090] Update as follows i The corresponding second-order moment estimate of the gradient of the loss function: , in, is the second-order moment estimate of the previous iteration, is the loss function The square of the current gradient of β 2 It is the second exponential decay rate hyperparameter, which is adjusted by technicians according to working conditions.
[0091] SS64, Computing m t and deviation correction.
[0092] because m t and There are deviations in the initial stage, which need to be corrected: , , is the modified first-order moment estimate, is the modified second-order moment estimate.
[0093] SS65, Update parameters i .
[0094] Use the corrected and Update Parameters i : .
[0095] Specifically for low-rank matrix elements A θ and B θ The update is: , , In the formula,α Represents the learning rate, which is used to control parameters i The update step size is a key hyperparameter that affects the convergence speed and stability. Yes is a small constant (set by technicians according to working conditions) used to prevent the denominator from being zero. A θt+1 and A θt They are A θ The next iteration value and the current iteration value of B θt+1 and B θt They are B θ The next iteration value and the current iteration value of and They are the low-rank matrix elements A θ The first-order moment estimate and second-order moment estimate corresponding to the current iteration calculation, and They are the low-rank matrix elements B θ The first-order moment estimate and second-order moment estimate corresponding to the current iteration calculation. Momentum m t Used to smooth the estimated value of the loss function gradient, reduce oscillation, and accelerate convergence. It is used to adjust the learning rate of each parameter to adapt to the gradient changes of different parameters. Through the above steps, the Adam optimization calculation method can effectively adjust A θ and B θ The value of , makes the loss function Gradually reduce to achieve the optimization goal.
[0096] SS7, iterative training: Repeat steps SS4 to SS6 until the performance of the model on the validation set reaches the expected standard, and finally a fine-tuned model is obtained.
[0097] In the above steps, the accuracy, precision, recall, F1-score and other indicators are used to comprehensively evaluate each adapter. The specific forms of accuracy, precision, recall and F1-score are: Accuracy=(TP+TN) / (TP+TN+FP+FN), Precision = TP / (TP+FP), Recall = TP / (TP+FN), F1-score=(2×Precision×Recall) / (Precision+Recall).
[0098] Among them, TP (True Positive) represents the number of samples that are truly positive (accurate) and correctly predicted as positive, TN (True Negative) represents the number of samples that are truly negative (inaccurate, or wrong) and correctly predicted as negative, FP (False Positive) represents the number of samples that are truly negative but mistakenly predicted as positive, and FN (False Negative) represents the number of samples that are truly positive but mistakenly predicted as negative.
[0099] If the above indicators all reach the expected values, the practical base model required for the Muti-Adapter fine-tuning automobile question-answering method provided by the present invention is obtained. Further, the Muti-Adapter fine-tuning automobile question-answering method is based on an operable system equipped with the practical base model, and when answering automobile questions, the method comprises the following steps: SA, user problem input: users input problems through the operating system interface. The problems can cover various types of problems such as automobile repair failure problems, car usage problems, general field problems, etc.
[0100] SB, the operating system recognizes the intent of the question input by the user through the large model intention recognition adapter of the practical base, and determines whether the question belongs to the field of automobile maintenance failure problem, car use problem, or general field problem. For example, if the user asks a question about automobile failure, the intention recognition adapter will recognize that the question belongs to the maintenance failure type problem.
[0101] The SC and the operating system use the corresponding adapters (maintenance fault adapter, vehicle adapter, and general domain problem adapter) to process the problem based on the result of intent recognition. For example, if the problem is identified as a maintenance fault problem, the maintenance fault problem adapter will be selected for processing.
[0102] The SD and the operating system generate an answer to the question according to the processing result of the corresponding adapter, and then output the answer to the user. For example, if the intention recognition selects the maintenance fault type question adapter, the system will generate the corresponding answer through this adapter and then output the answer to the user.
[0103] The present invention also provides a computer device, which includes a memory, a first processor, and a first computer program stored in the memory and executable on the first processor. When the first computer program is executed by the first processor, the above-mentioned multi-adapter fine-tuning automobile question-and-answer method is implemented.
[0104] The present invention also provides a computer-readable storage medium, which is used to store a second computer program. The second computer program can be executed by at least one second processor to enable the at least one second processor to execute the above-mentioned multi-adapter fine-tuning car question-and-answer method.
[0105] The present invention can: 1. Solve the problem of domain adaptation in different fields: The fine-tuning technology of existing systems usually does not distinguish between fields and adopts a single fine-tuning method, which may lead to domain deviation when dealing with problems in different fields. The present invention introduces a multi-adapter fine-tuning method to perform fine-tuning according to problems in different fields (such as car maintenance, vehicle use, general field problems, etc.), ensure the specificity of each field, thereby improving the accuracy of domain adaptation and ensuring consistent performance.
[0106] 2. Solve the limitations of existing automotive intelligent question-answering systems when facing new questions or questions not included in the knowledge base, and achieve efficient identification and processing of new questions. At the same time, in view of the possible domain deviations of fine-tuning technology between different fields, a fine-tuning method that can accurately adapt to each field is proposed.
[0107] 3. Solve the problem that the construction and maintenance of the knowledge base requires a lot of manpower and resources, especially when dealing with frequently updated automotive technology and fault information, and reduce costs. At the same time, solve the problem of the high cost of the existing full-parameter fine-tuning method, and propose a method that not only requires less computing resources, but also the fine-tuned model can be plugged in and out, updated or replaced at any time, which will reduce the maintenance and upgrade costs of the system.
[0108] 4. Solve the problem that traditional rule-based and knowledge-based methods are inefficient in dealing with multi-round question-answering and complex context-related problems, and propose a method that can efficiently handle new questions, does not require frequent updates of the knowledge base, and improves response speed and user experience. At the same time, propose a method that can efficiently adapt to problems in different fields and improve the efficiency of dealing with complex and diverse problems.
[0109] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0110] Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-adapter fine-tuning automobile question-and-answer method, characterized in that: The base model is used to obtain and apply the maintenance fault adapter, vehicle problem adapter, general domain problem adapter and intention recognition adapter to answer questions about automobile problems, including the following steps: S1, establishment and pre-training of the base large model; S2. Fine-tuning the base large model based on the maintenance fault problem data set to obtain the maintenance fault adapter; S3, fine-tuning the base large model based on the car use problem data set to obtain the car use problem adapter; S4, fine-tuning the base large model based on the general domain problem dataset to obtain the general domain problem adapter; S5. Fine-tune the large base model based on the intention recognition task data set to obtain the intention recognition adapter.
2. The automobile question-and-answer method for multi-adapter fine-tuning according to claim 1, characterized in that: The base model is based on AutoMasterGPT v3.5, but its model architecture includes 40 layers of self-attention mechanism and 40 layers of feed-forward neural network; The number of attention heads in the self-attention mechanism layer is 32, and the number of hidden units in the feedforward neural network layer is 8192; The context length of the base large model during the inference phase is 8192 tokens.
3. The automobile question-and-answer method for multi-adapter fine-tuning according to claim 1 or 2, characterized in that: The step S2 comprises the following steps: S21. Data preparation: Collect and annotate automobile maintenance failure problem data and organize them into maintenance failure problem data sets; S22, fine-tuning training: using the maintenance fault problem data set to perform fine-tuning training on the base large model to obtain a maintenance fault adapter; S23, evaluation and optimization: evaluating the performance of the repair fault adapter on the repair fault problem and performing corresponding optimization, specifically including the following steps: S231, Evaluation preparation: Select the maintenance fault verification set and test set; S232, determining a repair fault assessment standard and a baseline for measuring whether the performance of the repair fault adapter meets expectations; S233, evaluation index calculation: using accuracy, precision, recall, and F1-score to evaluate the performance of the repair fault adapter; S234, calculating the response time of the large base model to different types of maintenance fault problems; S235, performance analysis: analyzing the performance of the repair fault adapter on different types of repair fault problems according to the calculation results of the evaluation index in step S233; S236, tuning: according to the analysis result of step S235, adjusting the hyper parameters of the maintenance fault adapter; performing data enhancement, including increasing the diversity and quantity of maintenance fault problem data; retraining the base large model, and performing fine tuning; S237, iterative evaluation: repeating the steps S231 to S236 until the performance of the repaired fault adapter reaches the expected standard; S238. Finally, an evaluation is performed on an independent maintenance fault test set to verify the performance of the maintenance fault adapter in a real scenario. The step S3 comprises the following steps: S31. Data preparation: Collect and annotate car-related problem data and organize them into a car-related problem dataset; S32, fine-tuning training: fine-tuning the base large model using the vehicle use problem data set to obtain a vehicle use problem adapter; S33, evaluation and optimization: evaluating the performance of the vehicle use problem adapter on the vehicle use problem and performing corresponding optimization, specifically including the following steps: S331. Evaluation preparation: Select the validation set and test set of the car usage problem; S332, determining a vehicle use problem evaluation standard and a baseline for measuring whether the performance of the vehicle use problem adapter meets expectations; S333, evaluation index calculation: use accuracy, precision, recall, and F1-score to evaluate the performance of the vehicle-related problem adapter; S334, calculating the response time of the vehicle use problem adapter to different types of vehicle use problems; S335, performance analysis: analyzing the performance of the vehicle use problem adapter on different types of vehicle use problems according to the calculation results of the evaluation index of step S333; S336, tuning: according to the analysis result of step S335, adjusting the hyper parameters of the vehicle usage problem adapter; performing data enhancement, including increasing the diversity and quantity of vehicle usage problem data; retraining the base large model, and performing fine tuning; S337, iterative evaluation: repeating the steps S331 to S336 until the performance of the vehicle-related problem adapter reaches the expected standard; S338. Finally, an evaluation is performed on an independent car-use problem test set to verify the performance of the car-use problem adapter in a real scenario. The step S4 comprises the following steps: S41. Data preparation: Collect and annotate common domain problem data and organize them into common domain problem datasets; S42, fine-tuning training: fine-tuning the base large model using the general domain problem dataset to obtain a general domain problem adapter; S43, evaluation and tuning: evaluating the performance of the general domain problem adapter on the general domain problem and performing corresponding optimization, specifically including the following steps: S431. Evaluation preparation: Select the validation set and test set of common domain problems; S432, determining a general domain problem evaluation standard and a baseline for measuring whether the performance of the general domain problem adapter meets the expected goal; S433, evaluation index calculation: use accuracy, precision, recall, and F1-score to evaluate the performance of the general domain problem adapter; S434, calculating the response time of the base large model to different types of general field problems; S435, performance analysis: analyzing the performance of the general domain problem adapter on various general domain problems according to the calculation results of the evaluation index of step S433; S436, tuning: according to the analysis result of step S435, adjusting the hyper parameters of the general domain problem adapter; performing data enhancement, including generating more types of general domain problem data to increase the diversity of training data; retraining the base large model and performing fine tuning; S437, iterative evaluation: repeating the steps S431 to S436 until the performance of the general domain problem adapter reaches the expected standard; S438. Finally, a comprehensive evaluation is performed on an independent general domain problem test set to verify the performance of the general domain problem adapter in real scenarios. The step S5 comprises the following steps: S51, data preparation: collect and annotate intent recognition task data and organize them into intent recognition datasets; S52, fine-tuning training: fine-tuning the base large model using the intent recognition data set to obtain an intent recognition adapter; S53, evaluation and tuning: Evaluate the performance of the intent recognition adapter on the intent recognition task and perform corresponding optimization. The specific steps are as follows: S531, Evaluation preparation: Select the intent recognition verification set and test set, and determine the intent recognition evaluation criteria and baseline; S532, evaluation index calculation: use accuracy, precision, recall, and F1-score to evaluate the performance of the intent recognition adapter, and calculate the response time of the base large model on different types of intent recognition problems; S533, performance analysis: analyzing the performance of the intent recognition adapter according to the calculation result of the evaluation index of step S532; S534, tuning: according to the analysis result of step S533, adjusting the hyper parameters of the intent recognition adapter; performing data enhancement, including increasing the diversity and quantity of intent recognition problem data; retraining the base large model, and performing fine tuning; S535, iterative evaluation: repeat steps S531 to S534 until the performance of the intent recognition adapter reaches the expected standard, and verify it on an independent intent recognition test set to ensure reliability.
4. The automobile question-and-answer method for multi-adapter fine-tuning according to claim 3, characterized in that: The maintenance fault adapter, vehicle usage problem adapter, general domain problem adapter and intent recognition adapter are based on a common adapter architecture.
5. The automobile question-and-answer method for multi-adapter fine-tuning according to claim 4, characterized in that: The construction of the adapter architecture includes the steps of: LoRA module design: A low-rank adapter module is designed, which adopts the adjusted LoRA model; Adapter integration: Integrate multiple Lora modules into the base model through program reference and calling.
6. The automobile question-and-answer method for multi-adapter fine-tuning according to claim 5, characterized in that: The fine-tuning training in steps S2 to S5 includes the following steps: SS1. Initialization parameters: Initialize parameters from the pre-trained base large model; SS2, low-rank matrix initialization: Initialize two low-rank matrices for the low-rank adapter module A and B ,in, and , r ≪ d ,in, : represents the low-rank matrix A is a d OK r A matrix of columns, : represents the low-rank matrix B is a d OK r A matrix of columns, r ≪ d :express r The value is much smaller than d , r and d is an integer not less than 0, The low-rank matrix is randomly initialized using a Gaussian distribution A and B : , , in, is the standard deviation, which is set to a preset small value according to the working conditions. i 1 and j 1 is an integer, and 1≤ i 1≤ d and 1≤ j 1≤ r , SS3, input data: input the processed data into the base large model, so that the base large model performs feature extraction on the input data; SS4, forward propagation: calculate the output result after LoRA adjustment The various computing layers of the neural network including the self-attention layer and the feedforward neural network layer generate the model output by performing feature extraction on the input data step by step, that is, obtaining the output result At the same time, by adding a low-rank matrix to the weight matrix of each calculation layer A and B The weight matrix is adjusted by multiplying: , In the above formula, is the adjusted weight matrix, W is the initial weight matrix, "·" represents the matrix dot product, B’ yes B The transposed matrix of The output result satisfy: , In the above formula, f is a mapping function, x are input features, f The specific form varies according to the task requirements and is determined by the technicians based on the working conditions; SS5, calculate the cross entropy loss, according to the output results Calculate the cross entropy loss function with the true label : , In the above formula, represents the cross entropy loss function, N is the sample size, C is the category, i.e. the number of types of adapters, It is i The sample j The true label of the class, It is i The sample j The predicted probability of the class, i and j is an integer, log(X) is the logarithm of X with base 10; SS6. Calculate the loss function through the back propagation algorithm With respect to any element of the weight matrix W θ The gradient of and update the low-rank matrix A and B Elements of , In the above formula, is the loss function With respect to any element of the weight matrix W θ The gradient of For the low-rank matrix A Any element of A θ and the low-rank matrix B Any element of B θ , use the optimization algorithm Adam to update, SS7. Iterative training: Repeat steps SS4 to SS6 until the performance of the large base model on the validation set reaches the expected standard.
7. The automobile question-and-answer method for multi-adapter fine-tuning according to claim 6, characterized in that: The optimization algorithm Adam is updated by the following steps: Parameter settings: initial learning rate: 1e-3, batch size: 8; SS61, Calculate Gradient and , which is the loss function For the low-rank matrix A Any element of A θ and the low-rank matrix B Any element of B θ The partial derivative of : , ; SS62, Update first-order moment estimate, Will A θ and B θ Unified as parameters θ ,remember t represents the tth iteration, i.e. the current iteration, where t is an integer greater than 1. The parameter is updated according to the following formula θ The corresponding first-order moment estimate of the gradient of the loss function: , in, m t-1 is the first-order moment estimate of the previous iteration, is the loss function Yes θ The current gradient of β 1 is the first exponential decay rate hyperparameter; SS63, Updated Second-Order Moment Estimates, Update the parameters as follows θ The corresponding second-order moment estimate of the gradient of the loss function: , in, is the second-order moment estimate of the previous iteration, is the loss function Yes θ The square of the current gradient of β 2 is the second exponential decay rate hyperparameter, SS64, Computing m t and The deviation correction of because m t and There are deviations in the initial stage, which need to be corrected: , , is the modified first-order moment estimate, is the modified second-order moment estimate, SS65, update the parameters θ , use and Update the parameters θ : , In the above formula, α represents the learning rate, Є is a constant.
8. Computer device, characterized in that The invention comprises a memory, a first processor and a first computer program stored in the memory and executable on the first processor, wherein the first computer program, when executed by the first processor, implements the automobile question-and-answer method for multi-adapter fine-tuning according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a second computer program, and the second computer program can be executed by at least one second processor to enable the at least one second processor to execute the multi-adapter fine-tuning automobile question-and-answer method according to any one of claims 1-7.
Citation Information
Patent Citations
Model parameter updating method, classification prediction method and related device
CN117951589A
Large language model fine tuning method based on low-rank matrix decomposition
CN118153715A
Adapter selection method, device and equipment in fine tuning of large language model
CN118296142A
Large model fine tuning method, device, equipment, medium and program product
CN118673999A
Deep learning large model-oriented parameter fine tuning transfer learning method and system
CN118674011A
Cited By
Task processing method and device based on industrial large model, medium and product
CN121599624A