Large model fine tuning method and device, electronic equipment, storage medium and system
By automatically detecting the corpus change indicators of the industry knowledge base and fine-tuning of the big model, the problem of untimely update of the industry's big model and difficult to evaluate the difference in corpus is solved, the efficiency and accuracy of the fine-tuning of the big model is improved, and the data accuracy and usage effect of downstream applications are ensured.
Patent Information
- Application Number
- CN202411521006.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-03-11
AI Technical Summary
The fine-tuning of big model fine-tuning has the problem of untimely update of industry big model and difficult to evaluate the differences in the latest industry knowledge corpus, resulting in low accuracy of fine-tuning results, which in turn affects the data accuracy and usage effect of downstream applications.
By detecting the corpus change indicators of the target industry knowledge base in multiple industry knowledge bases within the target time to the current time, fine-tuning parameters are generated, including the identification of the target industry knowledge base and the model parameters of the basic model, reading the current corpus data set from the target industry knowledge base for format conversion, obtaining the target fine-tuning corpus data set in the target format, and fine-tuning the model parameters of the basic model based on the data set, obtaining the target industry big model file, and updating the first industry big model to the second industry big model generated based on the file.
The automation of the fine-tuning process of large-scale models has been realized, manpower and material resources have been liberated, the efficiency and accuracy of fine-tuning of large-scale models has been improved, and the data accuracy and usage effect of downstream applications have been ensured.
Smart Images

Figure CN119599110A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a large model fine-tuning method, device, electronic equipment, storage medium and system. Background Art
[0002] Fine tuning of a large model refers to the process and related work of obtaining an industry large model that can solve problems in a specific field based on the basic model (or also called the basic large model) and the corpus of industry knowledge. Figure 1 As shown in the figure, based on the basic big model and industry knowledge (corpus), the industry big model can be obtained. In the field of artificial intelligence generative content (AIGC), fine-tuning of the big model can better serve vertical fields and provide more professional services for specific industries.
[0003] In actual situations, there are problems in large model fine-tuning, such as untimely updates of industry large models and difficulty in assessing the differences between industry large models and the latest industry knowledge corpus. This leads to low accuracy of large model fine-tuning results, which in turn leads to low data accuracy in downstream applications and poor performance in a large number of downstream applications. The low accuracy of fine-tuning results will also lead to repeated fine-tuning and low fine-tuning efficiency. Summary of the invention
[0004] The present invention provides a large model fine-tuning method, device, electronic device, storage medium and system, which are used to solve the defects of low efficiency and accuracy of large model fine-tuning in the prior art, and achieve the purpose of effectively improving the efficiency and accuracy of large model fine-tuning.
[0005] The present invention provides a large model fine-tuning method, comprising the following steps.
[0006] Detect the corpus change index of the target industry knowledge base in multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set is read from the target industry knowledge base last time, and the target industry knowledge base is any one of the multiple industry knowledge bases; when the corpus change index meets the fine-tuning start condition, generate fine-tuning parameters; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; read the current corpus data set from the target industry knowledge base corresponding to the above identifier, perform format conversion on the current corpus data set, and obtain the target fine-tuning corpus data set in the target format; fine-tune the model parameters of the basic model according to the target fine-tuning corpus data set to obtain the target industry large model file; update the current first industry large model to the second industry large model generated based on the target industry large model file.
[0007] According to a large model fine-tuning method provided by the present invention, the corpus change index of the target industry knowledge base from the target time to the current time is detected, including: comparing the current corpus data set in the target industry knowledge base with the used fine-tuning corpus data set, and determining the corpus change index according to the comparison result; wherein the used fine-tuning corpus data set is the fine-tuning corpus data set obtained by the last format conversion.
[0008] According to a large model fine-tuning method provided by the present invention, the corpus data set of each industry knowledge base includes multiple corpus data, each of the multiple corpus data corresponds to a corpus data identifier, and the current corpus data set in the target industry knowledge base is compared with the used fine-tuning corpus data set, including: comparing the corpus data identifiers of the multiple corpus data in the current corpus data set with the corpus data identifiers of the multiple corpus data in the used fine-tuning corpus data set one by one; determining the corpus change index according to the comparison result, including: determining the first corpus data identifier that exists in both the current corpus data set and the used fine-tuning corpus data set, and the second corpus data identifier that only exists in the used fine-tuning corpus data set according to the comparison result; determining the corpus change index according to the first number of the first corpus data identifiers, the second number of the second corpus data identifiers, and the total number of corpus data in the current corpus data set.
[0009] According to a large model fine-tuning method provided by the present invention, the corpus change index includes a first change index and a second change index. The corpus change index is determined according to a first quantity identified by the first corpus data, a second quantity identified by the second corpus data, and the total number of corpus data in the current corpus data set, including: obtaining a first ratio of the first quantity to the total number of corpus data in the current corpus data set, determining the first ratio as the first change index; and determining the second quantity as the second change index.
[0010] According to a large model fine-tuning method provided by the present invention, after determining the corpus change index based on the first number of first corpus data identifiers, the second number of second corpus data expressions, and the total number of corpus data in the current corpus data set, the method also includes: real-time display of the corpus change index.
[0011] According to a big model fine-tuning method provided by the present invention, the current first industry big model is updated to a second industry big model generated based on a target industry big model file, including: generating a second industry big model based on the target industry big model file; allocating user traffic based on user traffic strategy, and updating the first industry big model of the target user to the second industry big model according to the allocation result.
[0012] The present invention also provides a large model fine-tuning device, comprising the following modules: a detection module, a generation module, a corpus reading module, a corpus conversion module, a fine-tuning module and an updating module.
[0013] The detection module is used to detect the corpus change index of the target industry knowledge base among multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases.
[0014] The generation module is used to generate fine-tuning parameters when the corpus change indicators meet the fine-tuning start conditions; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model.
[0015] The corpus reading module is used to read the current corpus data set from the target industry knowledge base corresponding to the identifier.
[0016] The corpus conversion module is used to convert the format of the current corpus dataset to obtain a target fine-tuning corpus dataset in a target format.
[0017] The fine-tuning module is used to fine-tune the model parameters of the basic model according to the target fine-tuning corpus dataset to obtain the target industry large model file.
[0018] The update module is used to update the current first industry large model to a second industry large model generated based on the target industry large model file.
[0019] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the large model fine-tuning methods described above is implemented.
[0020] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the computer program implements any of the large model fine-tuning methods described above.
[0021] The present invention also provides a computer program product, including a computer program, which implements any of the large model fine-tuning methods described above when executed by a processor.
[0022] The large model fine-tuning method, device, electronic device, storage medium and system provided by the present invention detect the corpus change index of the target industry knowledge base in multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; when the corpus change index meets the fine-tuning start condition, the fine-tuning parameters are generated; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; the current corpus data set is read from the target industry knowledge base corresponding to the identifier of the target industry knowledge base, and the current corpus data set is formatted to obtain a target fine-tuning corpus data set in the target format; the model parameters of the basic model are fine-tuned according to the target fine-tuning corpus data set to obtain a target industry large model file; based on the second industry large model generated by the target industry large model file, the first industry large model is updated to the second industry large model. The present invention makes the large model fine-tuning process no longer rely on manual labor, but automatically detects corpus change indicators, and promptly starts the large model fine-tuning process according to the corpus change indicators, freeing up manpower and material resources, and effectively solving the defects of low efficiency and accuracy of large model fine-tuning in the prior art, thereby achieving the purpose of effectively improving the efficiency and accuracy of large model fine-tuning. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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.
[0024] Figure 1 It is a schematic diagram of fine-tuning a large model in the related art.
[0025] Figure 2 This is one of the flow charts of the large model fine-tuning method provided by the present invention.
[0026] Figure 3 It is a schematic diagram of a specific process in the large model fine-tuning method provided by the present invention.
[0027] Figure 4 It is a schematic diagram of a part of a specific process in the large model fine-tuning method provided by the present invention.
[0028] Figure 5 It is a schematic diagram of the comparison of corpus data sets in the large model fine-tuning method provided by the present invention.
[0029] Figure 6 This is the second flow chart of the large model fine-tuning method provided by the present invention.
[0030] Figure 7 It is a schematic diagram of the working process of the large model service publishing and access gateway component in the large model fine-tuning method provided by the present invention.
[0031] Figure 8 It is a structural schematic diagram of the large model fine-tuning device provided by the present invention.
[0032] Fig. 9 It is a structural schematic diagram of the large model fine-tuning system provided by the present invention.
[0033] Fig.10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings 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.
[0035] In related technologies, the training and use process of large model fine-tuning is relatively cumbersome, as follows: Step 1: Prepare corpus (such as multi-round conversations, work order data, etc.).
[0036] In actual situations, most corpora are saved and edited in Excel format, which is inefficient and inconvenient to retrieve. Especially when the corpus is large and the files are large, the editor efficiency is very low.
[0037] Step 2: Convert the corpus into a fine-tuning format (such as JSON format) that can be accepted by the basic model.
[0038] In this process, first, different base models may accept slightly different formats, so adaptation is required; second, conversion to a fine-tuned format requires separate development of scripts or programs, which are scattered and difficult to manage; third, after the conversion, the fine-tuned file is disconnected from the original corpus file, resulting in the inability to understand knowledge coverage later.
[0039] Step 3: Configure fine-tuning parameters and start the fine-tuning execution (run) script.
[0040] This process may last for tens of minutes or hours, depending on the amount of corpus and the configuration of the server hardware (such as the Graphic Processing Unit (GPU)) involved in fine-tuning. However, in reality, since the fine-tuning execution parameter archiving is done manually, the time for configuring fine-tuning parameters is not regular, making it difficult to manage fine-tuning execution parameters and not conducive to experience accumulation.
[0041] Step 4: After fine-tuning, the output industry model file replaces the model file loaded in the existing industry large model service to achieve model update and capability upgrade.
[0042] Replacing the model file in the service requires stopping the service, resulting in intermittent service unavailability. If you want to serve multiple versions at the same time, multiple deployments are required, which is difficult to manage. After the model is launched, if the knowledge base is repeatedly updated, it is difficult to evaluate the difference in capabilities between the latest knowledge and the online model, and whether it is necessary to re-execute fine-tuning engineering to refresh the knowledge.
[0043] The above are the actual problems and difficulties encountered in the training and use process of large model fine-tuning. Each step in the above process must rely on manual processing. However, due to the complexity of the data and the uncertain update timing, it is difficult to accurately and efficiently obtain an industry large model that matches the latest industry knowledge corpus by relying entirely or partially on manual labor. As a result, the efficiency and accuracy of large model fine-tuning are both low.
[0044] Based on the above problems, this application provides a large model fine-tuning method. Figure 2-Figure 7 The large model fine-tuning method of the present invention is described.
[0045] Figure 2 This is one of the flow charts of the large model fine-tuning method provided by the present invention. Figure 2 As shown, the large model fine-tuning method provided by the embodiment of the present invention includes the following S210~S250.
[0046] S210: Detect corpus change indicators of a target industry knowledge base among multiple industry knowledge bases from a target time to a current time; wherein the target time is the time when a corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases.
[0047] See also Figure 3 , multiple industry knowledge bases are pre-set in Figure 3 In the Corpus Manager shown.
[0048] In some embodiments, Figure 3 In the corpus manager shown, the settings of multiple industry knowledge bases are as follows: Figure 4As shown, each industry knowledge base corresponds to an industry category. Industry categories include finance, insurance, tourism, catering, real estate, etc., and multiple industry knowledge bases may include, for example, a financial knowledge base, an insurance knowledge base, a tourism knowledge base, a catering knowledge base, a real estate knowledge base, etc.
[0049] Each industry knowledge base stores a corpus dataset of the industry category corresponding to the industry knowledge base. The corpus dataset specifically contains the corpus of professional knowledge of the industry type. These corpora may include, for example: work order data corresponding to the industry type extracted from the work order library, and conversation data corresponding to the industry type extracted from the conversation library that stores the conversation dataset.
[0050] For example, see Figure 4 The corpus data in the corpus dataset can be in various formats, such as PDF format, word format, and Excel format, etc.
[0051] When detecting the corpus change index, the current corpus data set in the target industry knowledge base and the used fine-tuned corpus data set may be compared, and the corpus change index may be determined based on the comparison result.
[0052] The used fine-tuning corpus dataset is specifically the fine-tuning corpus dataset obtained by the last format conversion.
[0053] In an embodiment of the present invention, during each fine-tuning process, a corpus dataset is first read from a target industry knowledge base, the corpus dataset is converted into a target fine-tuning corpus dataset in a target format, and then the data in the corresponding data repository is updated to the target fine-tuning corpus dataset.
[0054] The data repository can be a third-party storage service (e.g. Figure 3 The Object Storage Service (OSS) in the , or it can be a pre-set local data repository.
[0055] When fine-tuning the large model next time, the target fine-tuning corpus dataset stored in the data repository last time is used as the fine-tuning corpus dataset.
[0056] For the detection of the corpus change index this time, when the last used fine-tuned corpus dataset is obtained, the current corpus dataset in the target industry knowledge base and the used fine-tuned corpus dataset can be compared to obtain the specific change information of the corpus data in the target industry knowledge base.
[0057] In some embodiments, the corpus data set of the industry knowledge base in the embodiment of the present invention may include multiple corpus data, each of the multiple corpus data corresponds to a corpus data identifier (for example Figure 5ID=1, ID=2 and ID=3).
[0058] Comparing the current corpus data set and the used fine-tuned corpus data set in the target industry knowledge base can be: comparing the corpus data identifiers of the multiple corpus data in the current corpus data set with the corpus data identifiers of the multiple corpus data in the used fine-tuned corpus data set one by one. For example, each of the multiple corpus data in the current corpus data set can be used as the comparison corpus data in turn, and the corpus data identifier of the comparison corpus data can be compared with the corpus data identifiers of the multiple corpus data in the used fine-tuned corpus data set one by one to determine whether the two corpus data identifiers to be compared are the same; or, each of the multiple corpus data in the used fine-tuned corpus data set can be used as the comparison corpus data in turn, and the corpus data identifier of the comparison corpus data can be compared with the corpus data identifiers of the multiple corpus data in the current fine-tuned corpus data set one by one to determine whether the two corpus data identifiers to be compared are the same.
[0059] According to the comparison results, the corpus change indicators are determined, such as Figure 6 As shown, this can be achieved by executing S610~S620.
[0060] S610: Determine, according to the comparison result, first corpus data identifiers that exist in both the current corpus dataset and the used fine-tuned corpus dataset, and second corpus data identifiers that exist only in the used fine-tuned corpus dataset.
[0061] If the comparison results of the two corpus data identifiers to be compared are the same, the two corpus data identifiers are determined to be the first corpus data identifier.
[0062] For example, Figure 5 As shown, the corpus data identifier ID=1 in the target industry knowledge base is compared with the corpus data identifiers of multiple corpus data in the used fine-tuned corpus data set one by one. Among the corpus data identifiers of the multiple corpus data in the used fine-tuned corpus data set, there is also a corpus data identifier that is the same as ID=1. In this case, the corpus data identifier ID=1 is determined as the first corpus data identifier.
[0063] If the corpus data identifiers of all the corpus data in the current corpus data set are different from the comparison corpus data identifier in the used fine-tuning corpus data set, the comparison corpus data identifier is determined to be the second corpus data identifier.
[0064] For example, Figure 5As shown, all corpus identifiers in the current corpus dataset include: corpus data identifier ID=1 and corpus data identifier ID=3, and all corpus identifiers in the used fine-tuned corpus dataset include: corpus data identifier ID=1 and corpus data identifier ID=2. Corpus data identifier ID=2 in the used fine-tuned corpus dataset is different from the corpus data identifiers of all corpus data in the current corpus dataset, and corpus data identifier ID=2 is determined as the second corpus identifier. The second corpus identifier is actually a deleted corpus identifier, corresponding to a deleted corpus data.
[0065] If the corpus data identifiers of all the corpus data in the fine-tuned corpus data set are different from the comparison corpus data identifier in the current corpus data set, the comparison corpus data identifier is determined to be the third corpus data identifier.
[0066] For example, Figure 5 As shown, all corpus identifiers in the current corpus dataset include: corpus data identifier ID=1 and corpus data identifier ID=3, and all corpus identifiers in the used fine-tuned corpus dataset include: corpus data identifier ID=1 and corpus data identifier ID=2. Corpus data identifier ID=3 in the current corpus dataset is different from the corpus data identifiers of all corpus data in the used fine-tuned corpus dataset, and corpus data identifier ID=3 is determined as the third corpus identifier. The third corpus identifier is actually a newly added corpus identifier, corresponding to a newly added corpus data.
[0067] S620: Determine a corpus change indicator according to a first number of first corpus data identifiers, a second number of second corpus data identifiers, and a total number of corpus data in a current corpus data set.
[0068] A first ratio of the first quantity to the total number of corpus data in the current corpus data set may be obtained, and the first ratio may be determined as the first change indicator; and / or the second quantity may be determined as the second change indicator.
[0069] In a specific implementation, the first change index can reflect the coverage of the corpus data in the current corpus data set to the corpus data in the used fine-tuning corpus data set, which can be regarded as the knowledge coverage of the current corpus data set. Figure 5 In the data set, the number of first corpus data with ID=1 is 1, the total number of corpus data in the current corpus data set is 2, and the knowledge coverage = 1 / 2 = 50%.
[0070] The second number of the second corpus data identifier can reflect the situation of expired corpus data in the used fine-tuning corpus data set, and the second change indicator can be regarded as the number of expired corpus data in the current corpus data set compared with the corpus data set at the last fine-tuning startup. Figure 5In the example, the number of second corpus data identifier ID=2 is 1, and the number of expired corpus data items is 1.
[0071] The corpus change indicator may include only the first change indicator, or only the second change indicator, or both the first change indicator and the second change indicator.
[0072] S220: When the corpus change index meets the fine-tuning start condition, generate fine-tuning parameters; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model.
[0073] In the case where the corpus change indicators only include the first change indicator, the fine-tuning start condition may specifically be: the first change indicator is less than a first preset threshold.
[0074] Specifically, when the first change index is less than the first preset threshold, it indicates that the knowledge coverage is too small. In this case, fine-tuning can be initiated to generate fine-tuning parameters.
[0075] For example, the first preset threshold is 80%. When the first change index is less than 80%, it means that the knowledge coverage is less than 80%. At this time, fine-tuning can be started to generate fine-tuning parameters.
[0076] The first preset threshold may be set by those skilled in the art according to actual conditions, and the embodiment of the present invention does not limit this.
[0077] When the corpus change indicator includes only the second change indicator and the second change indicator is greater than the second preset threshold, it indicates that the amount of expired corpus data is large. In this case, fine-tuning can be started to generate fine-tuning parameters.
[0078] For example, the second preset threshold is 1000. When the second change index is greater than 1000, it indicates that the amount of expired corpus data is large. In this case, fine-tuning can be started to generate fine-tuning parameters.
[0079] The second preset threshold may be set by those skilled in the art according to actual conditions, and the embodiment of the present invention does not limit this.
[0080] When the corpus change indicator includes the first change indicator and the second change indicator, fine-tuning can be initiated to generate fine-tuning parameters when either the knowledge coverage is too small or the amount of expired corpus data is large.
[0081] The model parameters of the basic model may include, for example: model type, model parameter quantity, hardware configuration parameters, accuracy requirement parameters, user preference parameters, and model preference parameters.
[0082] Model preference parameters may include, for example: 1. The number of servers allowed for large-model fine-tuning of industry-large models; 2. The number of GPUs on each server allowed for large-model fine-tuning of industry-large models; 3. The method used for large-model fine-tuning of industry-large models, such as Deepspeed or Lora; 4. Some memory and bandwidth strategy parameters to be used for the method used for large-model fine-tuning, such as ZeRO optimization level; 5. Other parameters related to running fine-tuning optimization strategies, such as per_device_train_batch_size (single-device training size), per_device_eval_batch_size (single-device evaluation batch size), max_steps (maximum number of steps), eval_steps (number of evaluation steps), save_steps (number of save point steps), etc.
[0083] S230: Read the current corpus dataset from the target industry knowledge base corresponding to the above identifier, and perform format conversion on the current corpus dataset to obtain a target fine-tuning corpus dataset in a target format.
[0084] Specifically, the current corpus data set is read from the target industry knowledge base corresponding to the identifier of the target industry knowledge base, and the current corpus data set is stored in a preset data repository (eg Figure 3 The object storage service in the repository is called the next time the corpus change indicator is detected.
[0085] When the format of the current corpus dataset is converted, the current corpus dataset may be first read from a preset data repository, and then the format of the current corpus dataset is converted to obtain a target fine-tuning corpus dataset in a target format.
[0086] S240: Fine-tune the model parameters of the basic model according to the target fine-tuning corpus data set to obtain a large model file for the target industry.
[0087] For example, see Figure 3 As shown in the figure, the target fine-tuning corpus dataset can be loaded through the fine-tuning executor (the fine-tuning executor can be obtained based on the computer programming language Python), the model parameters of the basic model are fine-tuned according to the target fine-tuning corpus dataset, the target industry large model file is generated, and the target industry large model file is stored in OSS ( Figure 3 The corresponding object storage system) is stored in the database so that it can be called later when generating a large model.
[0088] S250: Update the current first industry large model to a second industry large model generated based on the target industry large model file.
[0089] See also Figure 3, the target industry big model file can be called from OSS, and the second industry big model generated based on the target industry big model file can be executed through the big model service publishing and access gateway component.
[0090] In some embodiments, the first industry big model can be directly updated to the second industry big model based on the second industry big model generated by the target industry big model file.
[0091] In some embodiments, in order to facilitate the evaluation of the first industry big model and the second industry big model, the user traffic can be allocated based on the user traffic strategy, and the first line big model of the target user is updated to the second industry big model according to the allocation result. For non-target users, the first line big model of the non-target user is not updated. In this case, the performance and actual efficacy of the second industry big model can be evaluated based on the usage of the first industry big model by non-target users and the usage of the second industry big model by target users in the same period.
[0092] For example, the user traffic is allocated based on the user traffic strategy, and the process of updating the first row large model of the target user to the second industry large model according to the allocation result can be as follows.
[0093] On the first day, 70% of users were assigned the first industry large model, and 30% of users were assigned the second industry large model.
[0094] On the second day, 50% of the users are assigned the first industry large model, and 50% of the users are assigned the second industry large model.
[0095] On the third day, 30% of users were assigned the first industry large model, and 70% of users were assigned the second industry large model.
[0096] On the fourth day, the second industry large model is assigned to 100% of the users (i.e. all users).
[0097] The purpose of allocating user traffic based on the user traffic strategy is that, compared with directly replacing the currently used first industry model with the second industry model, the above user traffic strategy can transfer the user traffic of the first industry model to the second industry model in a smoother and progressive manner. In this process, the user's feedback on the use effect of the second industry model can be observed from the initial smaller user traffic, and whether it is necessary to continue to replace the industry model (that is, replace the first industry model with the second industry model) can be determined based on the user's feedback results. If the evaluation effect of the second industry model in the user feedback results is not good, the replacement of the industry model can be stopped in time, and the user traffic allocated to the second industry model can be allocated to the first industry model again; on the contrary, if the evaluation effect of the second industry model in the user feedback results is good, the replacement of the industry model can be continued, and the user traffic of the first industry model can continue to be transferred to the second industry model. This can avoid the problem of a large number of users complaining about poor use results in a short period of time or a large number of users losing.
[0098] For example, taking the above example of allocating user traffic based on user traffic strategy as an example, if 30% of users are allocated the second industry large model on the first day, and the user feedback obtained from 30% of users is that users have a good evaluation effect on the second industry large model, then the user traffic of the second industry large model will continue to increase on the second day (while the user traffic of the first industry large model will be reduced accordingly), and 50% of users will be allocated the first industry large model, and 50% of users will be allocated the second industry large model, and so on, until the fourth day, 100% of users (i.e. all users) will be allocated the second industry large model. If the user feedback obtained from 30% of users is that users have a poor evaluation effect on the second industry large model, the model replacement can be terminated, for example, 100% of users (i.e. all users) will be allocated the first industry large model on the second day, and no users will be allocated to the second industry large model.
[0099] See also Figure 7 ,The large model service publishing and access gateway component consists of the ,following parts.
[0100] The service registration and access controller is used to receive the registration request from the industry large model service container and register the industry large model service container.
[0101] The service agent is used to start the industry large model service container, receive the registration of the industry large model service container, and route the user traffic strategy to the specified version of the industry large model service container.
[0102] The service agent is a host process started on each GPU server. It accepts service registration and access controller requests, completes large model service container image downloads, industry large model file downloads, local Docker startup, and management (stop, delete) actions.
[0103] Industry big model service container: a big model service basic image container used to load the specified industry big model file to run. It can carry the container image of the corresponding type of industry big model, but does not contain the industry big model file.
[0104] In some embodiments, in order to facilitate users to timely learn about changes in corpus data in a corpus database, after determining the corpus change indicator based on the first number of first corpus data identifiers, the second number of second corpus data representations, and the total number of corpus data in the current corpus data set, the corpus change indicator can also be displayed in real time. The specific display method can be charts and / or text, etc., which is not limited in the embodiments of the present invention.
[0105] The large model fine-tuning method provided by the present invention detects the corpus change index of the target industry knowledge base in multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; when the corpus change index meets the fine-tuning start condition, the fine-tuning parameters are generated; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; the current corpus data set is read from the target industry knowledge base corresponding to the identifier of the target industry knowledge base, and the current corpus data set is formatted to obtain a target fine-tuning corpus data set in the target format; the model parameters of the basic model are fine-tuned according to the target fine-tuning corpus data set to obtain a target industry large model file; based on the second industry large model generated by the target industry large model file, the first industry large model is updated to the second industry large model. The present invention makes the large model fine-tuning process no longer rely on manual labor, but automatically detects corpus change indicators, and promptly starts the large model fine-tuning process according to the corpus change indicators, freeing up manpower and material resources, and effectively solving the defects of low efficiency and accuracy of large model fine-tuning in the prior art, thereby achieving the purpose of effectively improving the efficiency and accuracy of large model fine-tuning.
[0106] The large model fine-tuning device provided by the present invention is described below. The large model fine-tuning device described below and the large model fine-tuning method described above can be referenced to each other.
[0107] Figure 8 Schematic diagram of the structure of the large model fine-tuning device provided by the present invention. Figure 8As shown, the large model fine-tuning device 800 includes: a detection module 801, a generation module 802, a corpus reading module 803, a corpus conversion module 804, a fine-tuning module 805 and an updating module 806.
[0108] The detection module 801 is used to detect the corpus change index of the target industry knowledge base among multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases.
[0109] The generation module 802 is used to generate fine-tuning parameters when the corpus change index meets the fine-tuning start condition; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model.
[0110] The corpus reading module 803 is used to read the current corpus data set from the target industry knowledge base corresponding to the identifier.
[0111] The corpus conversion module 804 is used to convert the format of the current corpus dataset to obtain a target fine-tuning corpus dataset in a target format.
[0112] The fine-tuning module 805 is used to fine-tune the model parameters of the basic model according to the target fine-tuning corpus data set to obtain a large model file for the target industry.
[0113] The updating module 806 is used to update the current first industry big model to a second industry big model generated based on the target industry big model file.
[0114] In some embodiments, the detection module 801 includes a comparison submodule ( Figure 8 ) and determine the submodule ( Figure 8 not shown).
[0115] The comparison submodule is used to compare the current corpus dataset in the target industry knowledge base with the used fine-tuned corpus dataset; wherein the used fine-tuned corpus dataset is the fine-tuned corpus dataset obtained by the last format conversion.
[0116] A submodule is determined, which is used to determine the corpus change index according to the comparison result.
[0117] In some embodiments, the corpus data set of each industry knowledge base includes multiple corpus data, each of the multiple corpus data corresponds to a corpus data identifier.
[0118] The comparison submodule is specifically used to compare the corpus data identifiers of multiple pieces of corpus data in the current corpus data set with the corpus data identifiers of multiple pieces of corpus data in the used fine-tuning corpus data set one by one.
[0119] The determination submodule includes: a first determination unit and a second determination unit.
[0120] The first determining unit is used to determine, according to the comparison result, a first corpus data identifier that exists in both the current corpus data set and the used fine-tuned corpus data set, and a second corpus data identifier that exists only in the used fine-tuned corpus data set.
[0121] The second determining unit is used to determine the corpus change index according to the first number of the first corpus data identifier, the second number of the second corpus data identifier, and the total number of corpus data in the current corpus data set.
[0122] In some embodiments, the corpus change indicator includes a first change indicator and a second change indicator, and the second determination unit is specifically used to: obtain a first ratio of the first quantity to the total number of corpus data in the current corpus data set, and determine the first ratio as the first change indicator; determine the second quantity as the second change indicator.
[0123] In some embodiments, the large model fine-tuning device further includes: a display module ( Figure 7 ), which is used to display the corpus change indicator in real time after the second determination unit determines the corpus change indicator according to the first number of the first corpus data identifier, the second number of the second corpus data identifier, and the total number of corpus data in the current corpus data set.
[0124] In some embodiments, the update module is specifically used to: generate a second industry big model based on the target industry big model file; allocate user traffic based on user traffic strategy, and update the first industry big model of the target user to the second industry big model according to the allocation result.
[0125] The large model fine-tuning device provided by the present invention detects the corpus change index of the target industry knowledge base in multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; when the corpus change index meets the fine-tuning start condition, the fine-tuning parameters are generated; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; the current corpus data set is read from the target industry knowledge base corresponding to the identifier of the target industry knowledge base, and the format of the current corpus data set is converted to obtain the target fine-tuning corpus data set in the target format; the model parameters of the basic model are fine-tuned according to the target fine-tuning corpus data set to obtain the target industry large model file; based on the second industry large model generated by the target industry large model file, the first industry large model is updated to the second industry large model. The present invention makes the large model fine-tuning process no longer rely on manual labor, but automatically detects corpus change indicators, and promptly starts the large model fine-tuning process according to the corpus change indicators, freeing up manpower and material resources, and effectively solving the defects of low efficiency and accuracy of large model fine-tuning in the prior art, thereby achieving the purpose of effectively improving the efficiency and accuracy of large model fine-tuning.
[0126] Fig. 9 Schematic diagram of the structure of the large model fine-tuning system provided by the present invention. Fig. 9 As shown, the large model fine-tuning system 900 includes: a large model fine-tuning device 800 and multiple industry knowledge bases 901, each of the multiple industry knowledge bases 901 stores a corresponding corpus data set.
[0127] Fig.10 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.10As shown, the electronic device may include: a processor (processor) 1010 , a communication interface (Communications Interface) 1020 , a memory (memory) 1030 and a communication bus 1040 , wherein the processor 1010 , the communication interface 1020 , and the memory 1030 communicate with each other via the communication bus 1040 . The processor 1010 can call the logic instructions in the memory 1030 to execute the large model fine-tuning method, which includes: detecting the corpus change index of the target industry knowledge base among multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set was last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; when the corpus change index meets the fine-tuning start condition, generating fine-tuning parameters; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; reading the current corpus data set from the target industry knowledge base corresponding to the identifier of the target industry knowledge base, converting the format of the current corpus data set to obtain the target fine-tuning corpus data set in the target format; fine-tuning the model parameters of the basic model according to the target fine-tuning corpus data set to obtain the target industry large model file; based on the second industry large model generated by the target industry large model file, updating the first industry large model to the second industry large model.
[0128] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0129] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the large model fine-tuning method provided by the above methods, which method includes: detecting the corpus change index of a target industry knowledge base in multiple industry knowledge bases from the target time to the current time; wherein the target time is the time when the corpus data set was last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; when the corpus change index meets the fine-tuning start condition, generating fine-tuning parameters; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; reading the current corpus data set from the target industry knowledge base corresponding to the identifier of the target industry knowledge base, converting the format of the current corpus data set, and obtaining the target fine-tuning corpus data set in the target format; fine-tuning the model parameters of the basic model according to the target fine-tuning corpus data set to obtain the target industry large model file; based on the second industry large model generated by the target industry large model file, updating the first industry large model to the second industry large model.
[0130] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the large model fine-tuning method provided by the above-mentioned methods, the method comprising: detecting a corpus change index of a target industry knowledge base among multiple industry knowledge bases from a target time to a current time; wherein the target time is the time when a corpus data set was last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; generating fine-tuning parameters when the corpus change index meets the fine-tuning start condition; the fine-tuning parameters include an identifier of the target industry knowledge base and model parameters of a basic model; reading a current corpus data set from a target industry knowledge base corresponding to the identifier of the target industry knowledge base, performing format conversion on the current corpus data set, and obtaining a target fine-tuning corpus data set in a target format; fine-tuning the model parameters of the basic model according to the target fine-tuning corpus data set, and obtaining a target industry large model file; and updating the first industry large model to a second industry large model based on a second industry large model generated based on the target industry large model file.
[0131] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0132] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. 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 replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A large model fine-tuning method, characterized in that: include: Detecting a corpus change index of a target industry knowledge base among multiple industry knowledge bases from a target time to a current time; wherein the target time is the time when a corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; When the corpus change index satisfies the fine-tuning start condition, generating fine-tuning parameters; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; Reading a current corpus data set from the target industry knowledge base corresponding to the identifier, and performing format conversion on the current corpus data set to obtain a target fine-tuning corpus data set in a target format; Fine-tune the model parameters of the basic model according to the target fine-tuning corpus dataset to obtain a target industry large model file; The current first industry big model is updated to a second industry big model generated based on the target industry big model file.
2. The large model fine-tuning method according to claim 1, characterized in that: The corpus change indicators of the target industry knowledge base from the detection target time to the current time include: Comparing the current corpus dataset in the target industry knowledge base with the used fine-tuned corpus dataset, and determining the corpus change index according to the comparison result; The used fine-tuning corpus dataset is the fine-tuning corpus dataset obtained by performing the format conversion last time.
3. The large model fine-tuning method according to claim 2, characterized in that: The corpus data set of each of the industry knowledge bases includes a plurality of corpus data, each of the plurality of corpus data corresponds to a corpus data identifier, and the current corpus data set in the target industry knowledge base is compared with the used fine-tuned corpus data set, including: Comparing the corpus data identifiers of the multiple pieces of corpus data in the current corpus data set with the corpus data identifiers of the multiple pieces of corpus data in the used fine-tuning corpus data set one by one; Determining the corpus change indicator according to the comparison result includes: Determine, according to the comparison result, a first corpus data identifier that exists in both the current corpus data set and the used fine-tuned corpus data set, and a second corpus data identifier that exists only in the used fine-tuned corpus data set; The corpus change indicator is determined according to a first number of the first corpus data identifiers, a second number of the second corpus data identifiers, and a total number of corpus data in the current corpus data set.
4. The large model fine-tuning method according to claim 3, characterized in that: The corpus change index includes a first change index and a second change index, and determining the corpus change index according to a first number of the first corpus data identifier, a second number of the second corpus data identifier, and a total number of corpus data in the current corpus data set includes: Obtaining a first ratio of the first number to the total number of corpus data in the current corpus data set, and determining the first ratio as the first change indicator; The second number is determined as the second change indicator.
5. The large model fine-tuning method according to claim 3, characterized in that: After determining the corpus change indicator according to the first number of the first corpus data identifiers, the second number of the second corpus data identifiers, and the total number of corpus data in the current corpus data set, the method further includes: The corpus change indicator is displayed in real time.
6. The large model fine-tuning method according to claim 1, characterized in that: The updating of the current first industry big model to a second industry big model generated based on the target industry big model file includes: Generate a second industry big model based on the target industry big model file; The user traffic is allocated based on the user traffic strategy, and the first industry model of the target user is updated to the second industry model according to the allocation result.
7. A large model fine-tuning device, characterized in that: include: A detection module, used to detect a corpus change index of a target industry knowledge base among multiple industry knowledge bases from a target time to a current time; wherein the target time is the time when a corpus data set is last read from the target industry knowledge base, and the target industry knowledge base is any one of the multiple industry knowledge bases; A generation module, used for generating fine-tuning parameters when the corpus change index meets the fine-tuning start condition; the fine-tuning parameters include the identifier of the target industry knowledge base and the model parameters of the basic model; A corpus reading module, used for reading a current corpus data set from the target industry knowledge base corresponding to the identifier; A corpus conversion module, used to convert the format of the current corpus dataset to obtain a target fine-tuning corpus dataset in a target format; A fine-tuning module, used to fine-tune the model parameters of the basic model according to the target fine-tuning corpus dataset to obtain a target industry large model file; The updating module is used to update the current first industry big model to the second industry big model generated based on the target industry big model file.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the large model fine-tuning method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the large model fine-tuning method according to any one of claims 1 to 6 is implemented.
10. A large model fine-tuning system, characterized in that: include: According to the large model fine-tuning device and multiple industry knowledge bases as described in claim 7, each of the multiple industry knowledge bases stores a corresponding corpus data set.