Language model adjustment method, device, electronic device and computer readable medium
By obtaining pre-trained language model collection and user-entered prompt text, generating instruction information to be verified and compared for semantic verification, adjusting the model to improve the credibility of the language model, solving the problem of large and long instruction text redundancy in manual verification errors and long instruction texts , realizes efficient language model credibility verification and adjustment.
Patent Information
- Application Number
- CN202410810922.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-06-21
AI Technical Summary
In the prior art, there are differences in individual understanding of the credibility of artificial verification language models, resulting in poor model adjustment effect and large verification errors, and the semantic vectors generated by long instruction text are redundant and have weak representation capabilities, resulting in large verification errors and It takes a long time.
By obtaining the pre-trained set of language models to be adjusted and open source language models, the prompt text input by the user generates the information to be verified and compared, performs semantic verification, and adjusts the model according to the semantic similarity, and controls the number of model adjustments to avoid local maximum Excellent, improve the credibility of the language model.
It reduces the time-consuming verification of the language model's credibility and adjustment effect, and reduces the time-consuming verification error and model adjustment.
Smart Images

Figure CN118747542B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a language model adjustment method, device, electronic device, and computer-readable medium. Background Art
[0002] Large language models usually have powerful feature extraction and learning capabilities, and can handle large-scale text data and text generation tasks. However, for the same model prompt words or model prompt text, the instruction information generated by different large language models is often different, and the credibility of the generated instruction information is difficult to evaluate. Therefore, in order to improve the credibility of large language models, it is usually necessary to verify the credibility of language models during training. At present, when verifying the credibility of language models, the method usually adopted is: manually compare the instruction texts generated by different open source language models horizontally to verify the credibility of the instruction texts generated by the model.
[0003] However, when using the above language model for credibility verification, the following technical problems often occur:
[0004] First, there are large differences in individual understanding when manually verifying the credibility of language models, which results in poor results in subsequent model adjustments and large errors in model credibility verification.
[0005] Second, when the language model outputs a long instruction text, the semantic vector generated by the instruction text often has a lot of redundancy and weak representation ability, which leads to large errors in the model semantic verification and waste of computing power during the verification process.
[0006] Third, adjusting the language model by adjusting the language model parameters or the language model structure often takes a long time and the adjustment effect is unclear.
[0007] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention
[0008] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0009] Some embodiments of the present disclosure propose a language model adjustment method, apparatus, electronic device, and computer-readable medium to solve one or more of the technical problems mentioned in the above background technology section.
[0010] In a first aspect, some embodiments of the present disclosure provide a language model adjustment method, the method comprising: obtaining a pre-trained language model to be adjusted and a pre-trained open source language model set, wherein each open source language model in the above open source language model set has the same task type as the above language model to be adjusted, and each open source language model in the above open source language model set and the above language model to be adjusted are trained using the same data set; receiving a text input by a user as a prompt text; based on the above prompt text, the language model to be adjusted and the above open source language model set, performing the following model adjustment steps: inputting the above prompt text into the language model to be adjusted and each open source language model included in the above open source language model set to generate instruction information to be verified and a comparison instruction information set; performing semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information; in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the above preset semantic verification threshold and the number of executions of the above model adjustment step is less than or equal to the preset number of executions, performing model adjustment on the language model to be adjusted according to the above open source language model set, and taking the adjusted language model to be adjusted as the language model to be adjusted, and performing the above model adjustment step again.
[0011] In a second aspect, some embodiments of the present disclosure provide a language model adjustment device, the device comprising: an acquisition unit, configured to acquire a pre-trained language model to be adjusted and a pre-trained open source language model set, wherein each open source language model in the above open source language model set has the same task type as the above language model to be adjusted, and each open source language model in the above open source language model set is the same as the data set used when training the above language model to be adjusted; a receiving unit, configured to receive a text input by a user as a prompt text; a model adjustment unit, configured to execute the following model adjustment based on the above prompt text, the language model to be adjusted and the above open source language model set. Adjustment step: input the prompt text into the language model to be adjusted and each open source language model included in the open source language model set to generate instruction information to be verified and a comparison instruction information set; perform semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information; in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the preset semantic verification threshold and the number of executions of the model adjustment step is less than or equal to the preset number of executions, perform model adjustment on the language model to be adjusted according to the open source language model set, and use the adjusted language model to be adjusted as the language model to be adjusted, and execute the model adjustment step again.
[0012] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.
[0013] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.
[0014] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the language model adjustment method of some embodiments of the present disclosure, a language model credibility verification method is provided, which can reduce the time consumption of model credibility verification and improve the credibility of the language model. Specifically, the reason for the large error in the semantic verification of the language model and the poor effect of the language model adjustment is that there are large individual understanding differences in the credibility of the manual verification of the language model, resulting in poor subsequent model adjustment effect and large errors in model credibility verification. Based on this, the language model adjustment method of some embodiments of the present disclosure, first, obtains a pre-trained language model to be adjusted and a pre-trained open source language model set. Among them, each open source language model in the above open source language model set has the same task type as the above language model to be adjusted. Each open source language model in the above open source language model set is the same as the data set used when training the above language model to be adjusted. Therefore, a group of open source language models with the same task type and training data set as the above language model to be adjusted can be selected as a group of comparison models for verifying the credibility of the instruction text of the above language model to be adjusted, thereby improving the accuracy of subsequent semantic verification. Afterwards, the text entered by the user is received as the prompt text. Then, based on the above prompt text, the language model to be adjusted and the above open source language model set, the following model adjustment steps are performed: the first step is to input the above prompt text into the language model to be adjusted and each open source language model included in the above open source language model set to generate instruction information to be verified and a set of comparison instruction information. Thus, by inputting a unified prompt text, the instruction information output by each language model is generated under the semantic environment constructed by the same prompt text, thereby reducing the influence of external variables and further reducing the error of semantic verification. The second step is to perform semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information. Thus, by verifying the semantic similarity between the instruction information to be verified and each comparison instruction information in the above comparison instruction information set, the credibility of the language model can be verified. The last step is, in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the above preset semantic verification threshold and the number of executions of the above model adjustment step is less than or equal to the preset number of executions, the language model to be adjusted is model adjusted according to the above open source language model set, and the adjusted language model to be adjusted is used as the language model to be adjusted, and the above model adjustment step is performed again. Therefore, by presetting the threshold of semantic verification and the maximum number of executions of the adjustment step, the number of model adjustments is controlled to avoid the model adjustment of the language model to be adjusted falling into the local optimum.Because the credibility of the model to be adjusted is verified by verifying semantic consistency, when the instruction information to be verified and each comparison instruction information in the comparison instruction information set have high semantic similarity, it can be judged that the language model to be adjusted has high credibility, thereby reducing the time spent on manual verification of the credibility of the language model. When the semantic similarity of the instruction information to be verified and each comparison instruction information in the comparison instruction information set is low, the credibility of the language model can be improved by adjusting the language model to be adjusted. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0016] Figure 1 is a flow chart of some embodiments of the language model adjustment method according to the present disclosure;
[0017] Figure 2 is a schematic diagram of the structure of some embodiments of the language model adjustment device according to the present disclosure;
[0018] Figure 3 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0019] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0020] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0021] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0024] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0025] Figure 1 The process 100 of some embodiments of the language model adjustment method according to the present disclosure is shown. The language model adjustment method comprises the following steps:
[0026] Step 101: Obtain a pre-trained language model to be adjusted and a pre-trained open source language model set.
[0027] In some embodiments, the execution subject (e.g., a computing device) of the language model adjustment method may obtain a pre-trained language model to be adjusted and a pre-trained open source language model set. Among them, the above-mentioned execution subject may be a server. Each open source language model in the above-mentioned open source language model set has the same task type as the above-mentioned language model to be adjusted. The above-mentioned task type may characterize the type of natural language task processed by the corresponding language model. As an example, the above-mentioned natural language task type may be text generation. Each open source language model in the above-mentioned open source language model set is the same as the data set used when training the above-mentioned language model to be adjusted. The above-mentioned language model to be adjusted may be a natural language model that takes prompt text as input, takes instruction text as output, and is used to perform text generation tasks. The open source language model in the above-mentioned open source language model set may be a natural language model that takes prompt text as input, takes instruction text as output, and is used to perform text generation tasks. The above-mentioned language model to be adjusted or the open source language model in the above-mentioned open source language model set can be, but is not limited to: GPT (Generative Pre-trained Transformer) model, CTRL (Conditional Transformer Language Model) model, BART (Bidirectional and Auto-Regressive Transformers) model and T5 (Text-to-Text Transfer Transformer) model
[0028] Step 102: receiving text input by the user as prompt text.
[0029] In some embodiments, the execution entity may receive text information input by a user as prompt text.
[0030] Step 103: Based on the prompt text, the language model to be adjusted, and the open source language model set, perform the following model adjustment steps:
[0031] Step 1031 : input the prompt text into each open source language model included in the language model to be adjusted and the open source language model set to generate instruction information to be verified and a comparison instruction information set.
[0032] In some embodiments, the execution entity may input the prompt text into the language model to be adjusted and each open source language model included in the open source language model set to generate instruction information to be verified and a comparison instruction information set.
[0033] In some optional implementations of some embodiments, the execution subject may input the prompt text into the language model to be adjusted and each open source language model included in the open source language model set through the following steps to generate instruction information to be verified and a comparison instruction information set:
[0034] The first step is, in response to determining that the above prompt text does not meet the preset text standard conditions, performing character elimination processing on the above prompt text to update the above prompt text. The above preset text standard conditions may be that the above prompt text does not contain characters in the preset elimination character set. As an example, each preset elimination character in the above preset elimination character set may include but is not limited to “|”, “@”, “~”, “&”, “^”, “#” and “¥”. In practice, the above execution entity may eliminate at least one text character in the above prompt text that is the same as at least one preset elimination character in the above preset elimination character set to update the above prompt text.
[0035] The second step is to input the prompt text into the language model to be adjusted to obtain instruction information as instruction information to be verified. The instruction information to be verified may be text generated by the language model to be adjusted based on the input prompt text.
[0036] In the third step, for each open source language model in the open source language model set, the prompt text is input into the open source language model to generate instruction information as comparison instruction information. The comparison instruction information may be text generated by the corresponding open source language model based on the input prompt text.
[0037] The fourth step is to determine the generated individual comparison instruction information as a comparison instruction information set.
[0038] Step 1032: perform semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information.
[0039] In some embodiments, the execution subject may perform semantic verification on the instruction information to be verified based on the comparison instruction information set to generate instruction semantic verification information.
[0040] In some optional implementations of some embodiments, the execution subject may perform semantic verification on the instruction information to be verified according to the comparison instruction information set through the following steps to generate instruction semantic verification information:
[0041] The first step is to determine the character length of the instruction information to be verified as the length of the instruction to be verified. In practice, the execution subject may determine the number of characters of the instruction information to be verified as the length of the instruction to be verified.
[0042] The second step is to determine the average character length of each comparison instruction information in the comparison instruction information set as the comparison instruction average length. In practice, first, for each comparison instruction information in the comparison instruction information set, the execution subject may determine the number of characters in the comparison instruction information as the comparison instruction length. Then, the execution subject may determine the average value of the determined comparison instruction lengths as the comparison instruction average length.
[0043] In the third step, the average of the length of the instruction to be verified and the average length of the comparison instruction is determined as the average instruction length.
[0044] In the fourth step, the difference between the length of the instruction to be verified and the average length of the comparison instruction is determined as the instruction length difference.
[0045] In step 5, in response to determining that the average length of the instruction is less than the preset text length threshold or the instruction length difference is less than the preset text length difference threshold, coarse-grained semantic verification is performed on the instruction information to be verified based on the comparison instruction information set to generate instruction semantic verification information. As an example, the preset text length threshold may be 300. The preset text length difference threshold may be 150.
[0046] In the sixth step, in response to determining that the average instruction length is greater than or equal to the above-mentioned preset text length threshold or the instruction length difference is greater than or equal to the above-mentioned preset text length difference threshold, fine-grained semantic verification is performed on the instruction information to be verified based on the comparison instruction information set to generate instruction semantic verification information.
[0047] In some optional implementations of some embodiments, the execution subject may perform coarse-grained semantic verification on the instruction information to be verified according to the comparison instruction information set through the following steps to generate instruction semantic verification information:
[0048] In the first step, for each comparison instruction information in the comparison instruction information set, the following steps are performed:
[0049] The first sub-step is to perform text segmentation processing on the comparison instruction information according to the preset punctuation character set to obtain individual comparison instruction sentences. The preset punctuation characters in the preset punctuation character set may include but are not limited to: ",",",";" and "." In practice, the execution subject may segment the comparison instruction information into individual comparison instruction sentences according to each preset punctuation character in the preset punctuation character set.
[0050] In the second sub-step, for each comparison instruction statement in each comparison instruction statement, the following steps are performed:
[0051] Sub-step 1: perform word segmentation processing on the comparison instruction statement to obtain a word segmentation sequence of the comparison instruction statement. In practice, the execution subject may perform word segmentation processing on the comparison instruction statement through a word segmentation tool to obtain a word segmentation sequence of the comparison instruction statement. As an example, the word segmentation tool may be a Jieba word segmentation tool or a Yaha word segmentation tool.
[0052] Sub-step two, based on the comparison instruction sentence word segmentation sequence, generate a comparison instruction semantic vector corresponding to the above comparison instruction sentence. In practice, the above execution subject can input the comparison instruction sentence word segmentation sequence into a pre-trained semantic embedding model to generate a comparison instruction semantic vector. The above semantic embedding model can be a natural language processing model that takes the word segmentation sequence as input and outputs the corresponding word segmentation vector and semantic vector. As an example, the above semantic embedding model can be but not limited to the Sentence-BERT model.
[0053] The second step is to semantically fuse the generated semantic vectors of the comparison instructions to generate a fused semantic vector of the comparison instructions. In practice, the execution subject may add up the generated semantic vectors of the comparison instructions and take the average to generate a fused semantic vector of the comparison instructions.
[0054] The third step is to generate a semantic vector of the instruction to be verified according to the instruction information to be verified. It should be noted that the implementation steps of "generating a semantic vector of the instruction to be verified according to the instruction information to be verified" and the implementation steps of generating the comparison instruction semantic vector are not repeated here.
[0055] The fourth step is to determine the instruction semantic similarity based on the generated fused comparison instruction semantic vector and the generated instruction semantic vector to be verified. In practice, the execution subject can determine the instruction semantic similarity between the generated fused comparison instruction semantic vector and the generated instruction semantic vector to be verified by a preset similarity algorithm. As an example, the preset similarity algorithm can be a cosine similarity algorithm.
[0056] The fifth step is to determine the instruction semantic similarity as instruction semantic verification information.
[0057] In some optional implementations of some embodiments, the execution subject may perform fine-grained semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information through the following steps, including:
[0058] The first step is to obtain fine-grained weight information. The fine-grained weight information includes word semantic weight and sentence semantic weight. The fine-grained weight information can be weight information for weighting the average semantic similarity of the generated keywords and the semantic similarity of the generated instruction sentences. As an example, the word semantic weight can be 0.6. The sentence semantic weight can be 0.4.
[0059] In the second step, for each comparison instruction information in the above comparison instruction information set, the following steps are performed:
[0060] The first sub-step is to perform text segmentation processing on the comparison instruction information according to the preset punctuation character set to obtain individual comparison instruction sentences. In practice, the execution subject can segment the comparison instruction information into individual comparison instruction sentences according to the preset punctuation characters included in the preset punctuation character set.
[0061] The second sub-step is to perform word segmentation processing on each of the above-mentioned comparison instruction statements to obtain a comparison instruction statement word segmentation sequence. In practice, the above-mentioned execution subject can perform word segmentation processing on the above-mentioned comparison instruction statement through the above-mentioned word segmentation tool to obtain a comparison instruction statement word segmentation sequence.
[0062] The third sub-step is to perform keyword extraction processing on each obtained comparison instruction sentence word segmentation sequence to obtain each comparison instruction keyword. In practice, for each comparison instruction sentence word segmentation sequence in each obtained comparison instruction sentence word segmentation sequence, the execution subject can input the comparison instruction sentence word segmentation sequence into a pre-trained keyword extraction model to obtain each comparison instruction keyword. The keyword extraction model is a natural language processing model that takes the word segmentation sequence as input and each keyword as output. As an example, the keyword extraction model can be but is not limited to a SpaCy model or a BERT model.
[0063] The fourth sub-step is to perform semantic embedding processing on each generated comparison instruction keyword to obtain a semantic vector of each comparison instruction keyword. In practice, the above-mentioned execution subject can perform semantic embedding processing on each of the generated comparison instruction keywords through a bag of words model (BoW model) to obtain a semantic vector of each comparison instruction keyword.
[0064] The fifth sub-step is to generate a comparison instruction semantic vector corresponding to the comparison instruction information according to the obtained word segmentation sequences of each comparison instruction sentence. In practice, first, the execution subject can generate each comparison instruction sentence semantic vector by inputting the obtained word segmentation sequences of each comparison instruction sentence into the semantic embedding model. Then, the execution subject can add and average the generated semantic vectors of each comparison instruction sentence to generate a comparison instruction semantic vector corresponding to the comparison instruction information.
[0065] The third step is to perform keyword extraction processing on the instruction information to be verified to generate keywords for each instruction to be verified. It should be noted that the implementation steps of the above-mentioned "perform keyword extraction processing on the instruction information to be verified to generate keywords for each instruction to be verified" can refer to the implementation steps of the above-mentioned "generate keywords for each comparison instruction", which will not be repeated here.
[0066] The fourth step is to perform semantic embedding processing on each of the generated keywords of the instruction to be verified to obtain the semantic vector of each keyword of the instruction to be verified. In practice, the above-mentioned execution subject can perform semantic embedding processing on each of the generated keywords of the instruction to be verified through a bag of words model (BoW model) to obtain the semantic vector of each keyword of the instruction to be verified.
[0067] The fifth step is to generate a semantic vector of the instruction to be verified according to the information of the instruction to be verified. It should be noted that the implementation steps of generating the above-mentioned "semantic vector of the instruction to be verified" can refer to the implementation steps of generating the "comparison instruction semantic vector", which will not be repeated here.
[0068] The sixth step is to determine the semantic similarity of the instruction statement based on the generated semantic vector of the instruction to be verified and the generated semantic vector of the comparison instruction. In practice, the execution subject can determine the similarity between the generated semantic vector of the instruction to be verified and the generated semantic vector of the comparison instruction as the semantic similarity of the instruction statement through the preset similarity algorithm.
[0069] The seventh step is to cluster the semantic vectors of the keywords of the instructions to be verified generated as the cluster centers and the number of the semantic vectors of the keywords of the instructions to be verified generated as the number of clusters, and to obtain a set of comparison instruction keyword semantic vector groups. In practice, the above-mentioned execution subject can use a preset clustering algorithm to cluster the semantic vectors of the keywords of the instructions to be verified generated as the cluster centers and the number of the semantic vectors of the keywords of the instructions to be verified generated as the number of clusters, and to obtain a set of comparison instruction keyword semantic vector groups. As an example, the above-mentioned preset clustering algorithm can be but is not limited to the K-means algorithm.
[0070] In step 8, for each comparison instruction keyword semantic vector group in the comparison instruction keyword semantic vector group set, perform the following steps:
[0071] The first sub-step is to determine the average semantic vector of the comparison instruction keyword of each comparison instruction keyword semantic vector in the comparison instruction keyword semantic vector group. In practice, the execution subject may add up the semantic vectors of each comparison instruction keyword in the comparison instruction keyword semantic vector group and take the average to determine the average semantic vector of the comparison instruction keyword.
[0072] The second sub-step is to determine the keyword semantic similarity based on the to-be-verified instruction keyword semantic vector corresponding to the above-mentioned comparison instruction keyword semantic vector group and the above-mentioned comparison instruction keyword average semantic vector. In practice, the above-mentioned execution subject can determine the similarity between the to-be-verified instruction keyword semantic vector corresponding to the above-mentioned comparison instruction keyword semantic vector group and the above-mentioned comparison instruction keyword average semantic vector as the keyword semantic similarity through the above-mentioned preset similarity algorithm.
[0073] In the ninth step, the average value of the determined semantic similarities of the keywords is determined as the average semantic similarity of the keywords.
[0074] Step 10: Determine instruction semantic verification information based on the above-mentioned fine-grained weight information, the average semantic similarity of keywords, and the semantic similarity of instruction sentences. In practice, the above-mentioned execution subject can multiply the word semantic weight included in the above-mentioned fine-grained weight information with the above-mentioned average semantic similarity of keywords, multiply the sentence semantic weight included in the above-mentioned fine-grained weight information with the above-mentioned average semantic similarity, and add the two multiplied results to determine the instruction semantic verification information.
[0075] The first to tenth steps mentioned above are an inventive point of an embodiment of the present disclosure, which can solve the second technical problem mentioned in the background technology: "When the language model outputs a long instruction, the semantic vector generated by the instruction text often has more redundancy and weak representation ability, which leads to a large error in model semantic verification and a waste of computing power during the verification process." The factors that lead to waste of computing power and large errors in semantic verification are often as follows: When the language model outputs a long instruction, the semantic vector generated by the instruction text often has more redundancy and weak representation ability, which leads to a large error in model semantic verification and a waste of computing power during the verification process. If the above factors are solved, the effect of reducing the waste of computing power resources and reducing the error of semantic verification can be achieved. In order to achieve this effect, the present disclosure improves the accuracy of instruction semantic verification by weighting the semantics of instruction keywords and instruction statements, and at the same time adopts a method of representing the semantics of the entire instruction information with the semantics of each instruction keyword and instruction statement, so that there is no need to perform overall semantic extraction on the entire instruction information, thereby reducing the waste of computing power resources. In practice, for short texts, a single keyword has a greater impact on the semantics of the entire instruction text. However, for long texts, a single keyword has little influence on the semantics of the entire instruction text, but the semantics of a single keyword can often reflect the topic semantics of the corresponding sentence. Therefore, by weighting the semantic similarity of the determined long text by determining the semantic similarity of each keyword, the accuracy of semantic verification can be improved, thereby improving the verification accuracy of the model credibility.
[0076] Step 1033, in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the preset semantic verification threshold and the number of executions of the model adjustment step is less than or equal to the preset number of executions, according to the open source language model set, model adjustment is performed on the language model to be adjusted, and the adjusted language model to be adjusted is used as the language model to be adjusted, and the model adjustment step is executed again.
[0077] In some embodiments, the execution subject may, in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the preset semantic verification threshold and the number of executions of the model adjustment step is less than or equal to the preset number of executions, perform model adjustment on the language model to be adjusted according to the open source language model set, and use the adjusted language model to be adjusted as the language model to be adjusted, and perform the model adjustment step again. The preset semantic verification threshold may be an instruction semantic similarity threshold. As an example, the preset semantic verification threshold may be 0.85.
[0078] In some optional implementations of some embodiments, the execution subject may adjust the language model to be adjusted according to the open source language model set through the following steps:
[0079] The first step is to preprocess the instruction information to be verified to obtain the word segmentation sequence of each instruction to be verified. It should be noted that "preprocess the instruction information to be verified to obtain the word segmentation sequence of each instruction to be verified." can refer to the implementation steps of generating "comparison instruction statement word segmentation sequence", which will not be repeated here.
[0080] The second step is to perform relation extraction processing on each instruction word segmentation sequence to be verified to obtain the relation information of each instruction to be verified. Among them, the above-mentioned instruction relationship information to be verified can be a triple containing a head entity, a relationship and a tail entity. In practice, for each instruction word segmentation sequence to be verified in each instruction word segmentation sequence to be verified, the above-mentioned execution subject can perform entity recognition and relationship extraction on the instruction word segmentation sequence to be verified through the relevant knowledge graph library function (such as the Stanford CoreNLP library function in Python) to obtain the instruction relationship information to be verified corresponding to the above-mentioned instruction word segmentation sequence to be verified.
[0081] The third step is to splice each instruction relationship information to be verified with the above-mentioned prompt text to obtain the spliced prompt text. In practice, first, for each instruction relationship information to be verified in each instruction relationship information to be verified, the above-mentioned execution subject can splice the head entity, relationship and tail entity included in the instruction relationship information to be verified to obtain the spliced instruction text. Then, the above-mentioned execution subject can splice the obtained spliced instruction texts according to the order of the instruction sentences to be verified corresponding to the corresponding instruction segmentation sequences to be verified in the above-mentioned instruction information to be verified, and use the spliced text as the background text of the instruction to be verified. Finally. The above-mentioned execution subject can splice the background text of the instruction to be verified with the above-mentioned prompt text to obtain the spliced prompt text.
[0082] The fourth step is to input the concatenated prompt text into each open source language model included in the above open source language model set to generate each sample instruction information.
[0083] Step 5: For each sample instruction information in each sample instruction information, perform the following steps:
[0084] The first sub-step is to segment the sample instruction information into sample instruction sentences according to the preset punctuation character set. In practice, the execution subject may segment the sample instruction information into sample instruction sentences according to the preset punctuation characters included in the preset punctuation character set.
[0085] The second sub-step is to perform word segmentation processing on each of the sample instruction statements to obtain a word segmentation sequence of the sample instruction statements. In practice, the execution subject may perform word segmentation processing on the sample instruction statements through the word segmentation tool to obtain a word segmentation sequence of the sample instruction statements.
[0086] The third sub-step is to perform relation extraction on each sample instruction sentence segmentation sequence in the obtained sample instruction sentence segmentation sequences to obtain sample instruction relation information. The sample instruction relation information may be a triple containing entities (head entities, tail entities) and relations in the corresponding sample instruction sentence segmentation sequences. It should be noted that the implementation steps of "performing relation extraction on the sample instruction sentence segmentation sequences" can refer to the implementation steps of "performing relation extraction on the above-mentioned each instruction segmentation sequence to be verified to obtain each instruction relation information to be verified", which will not be repeated here.
[0087] The fourth sub-step is to generate a training instruction text according to the generated sample instruction relationship information and the above-mentioned instruction text. In practice, first, for the sample instruction relationship information in the generated sample instruction relationship information, the above-mentioned execution subject can splice the head entity, relationship and tail entity included in the sample instruction relationship information to obtain the spliced sample instruction relationship text. Then, the above-mentioned execution subject can sequentially splice the word segmentation sequences of each sample instruction sentence corresponding to each spliced sample instruction relationship text in the order in the corresponding sample instruction information to obtain the sample instruction background text. Finally, the above-mentioned execution subject can splice the above-mentioned sample instruction background text with the above-mentioned instruction text to generate the training instruction text.
[0088] The sixth step is to determine the generated training instruction texts as a training instruction text set.
[0089] Step 7: retrain the language model to be adjusted based on the training instruction text set to adjust the language model to be adjusted. In practice, the execution subject may use the training instruction text set as a data set to train the language model to be adjusted to adjust the model to be adjusted.
[0090] The first to seventh steps mentioned above are an inventive point of an embodiment of the present disclosure, which can solve the technical problem three mentioned in the background technology, "adjusting the language model by adjusting the model parameters or the model structure often takes a long time and the adjustment effect is unclear". The factors that lead to the long model adjustment time and the unclear model adjustment effect are often as follows: adjusting the language model by adjusting the model parameters or the model structure often takes a long time and the adjustment effect is unclear. If the above factors are solved, the effect of reducing the model adjustment time and improving the performance of the adjusted model can be achieved. In order to achieve this effect, in practice, different open source language models use different encoders or decoders (that is, different encoding logics), so the generated instructions are different. However, each generated instruction contains the encoding logic of the corresponding open source language model, and the entities and relationships are inferred based on the corresponding encoding logic. Therefore, when the instruction information generated by the model to be adjusted has a large semantic difference from the instruction information generated by each open source language model, the training prompt text is obtained by extracting the entity relationship of each comparison instruction information in the comparison instruction information set, and splicing the extracted entity relationship triples as the text knowledge background with the prompt text. By using the training entity text to train the above-mentioned language model to be adjusted, the semantic deficiencies of the language model to be adjusted can be supplemented, the text generation capability of the above-mentioned language model to be adjusted can be enhanced, and the performance of the adjusted language model can be improved.
[0091] Optionally, the above model adjustment step may further include the following steps:
[0092] In the first step, in response to determining that the instruction semantic verification information is greater than or equal to a preset semantic verification threshold, the following model optimization steps are performed:
[0093] The first sub-step is to obtain preset model optimization weight information. The preset model optimization weight information includes: model semantic weight and model compression rate weight. The model semantic weight and model compression rate weight can respectively represent the model semantic priority and the model compression rate priority in the above model optimization step. For example, when the model semantic weight is 1 and the model compression rate weight is 2, it can be represented that when optimizing the language model to be adjusted, the model compression rate has a higher priority.
[0094] The second sub-step is to perform a first optimization process on the language model to be adjusted to obtain a first optimized language model. In practice, the execution subject may perform a first optimization process on the language model to be adjusted by presetting a first optimization algorithm to obtain a first optimized language model. As an example, the first optimization algorithm may be an asymmetric quantization algorithm.
[0095] The third sub-step is to input the prompt text into the first optimized language model to generate the first instruction information.
[0096] The fourth sub-step is to generate the first instruction semantic verification information based on the comparison instruction information set and the first instruction information. In practice, the implementation steps of "generating the first instruction semantic verification information" can refer to the implementation steps of "performing semantic verification on the instruction information to be verified based on the comparison instruction information set to generate instruction semantic verification information", which will not be repeated here.
[0097] The fifth sub-step is to perform a second optimization process on the language model to be adjusted to obtain a second optimized language model. In practice, the execution subject may perform a second optimization process on the language model to be adjusted by presetting a second optimization algorithm to obtain a second optimized language model. As an example, the second optimization algorithm may be a symmetric quantization algorithm.
[0098] The sixth sub-step is to input the prompt text into the second optimized language model to generate second instruction information.
[0099] The seventh sub-step is to generate the second instruction semantic verification information based on the comparison instruction information set and the second instruction information. In practice, the implementation steps of "generating the second instruction semantic verification information" can refer to the implementation steps of "performing semantic verification on the instruction information to be verified based on the comparison instruction information set to generate instruction semantic verification information", which will not be repeated here.
[0100] In an eighth sub-step, in response to determining that the first semantic verification information is greater than or equal to the preset semantic verification threshold and the second semantic verification information is greater than or equal to the preset semantic verification threshold, executing the following steps:
[0101] Sub-step one, according to the language model to be adjusted, determine the model compression rate of the above-mentioned first optimized language model as the first model compression rate. In practice, first, the above-mentioned execution subject can determine the number of parameters in the above-mentioned language model to be adjusted as the initial model parameter number through the relevant library function (for example, model.parameters() in Python). Then, the above-mentioned execution subject can determine the number of model parameters of the first optimized language model as the first optimized model parameter number through the above-mentioned relevant library function. Finally, the above-mentioned execution subject can determine the ratio of the number of parameters of the above-mentioned first optimized model to the number of parameters of the initial model as the first model compression rate.
[0102] Sub-step 2: According to the language model to be adjusted, determine the model compression rate of the second optimized language model as the second model compression rate. In practice, first, the execution subject can determine the number of model parameters of the second optimized language model as the number of second optimized model parameters through the relevant library function. Finally, the execution subject can determine the ratio of the number of second optimized model parameters to the number of initial model parameters as the first model compression rate.
[0103] Sub-step three, selecting an optimized language model that satisfies the model optimization condition corresponding to the preset model optimization weight information from the above-mentioned first optimized language model and the above-mentioned second optimized language model as the target language model. Wherein, when the model semantic weight included in the above-mentioned preset model optimization weight information is greater than the model compression rate weight, the above-mentioned model optimization condition may be that the semantic verification information of the optimized language model determined as the target language model is greater than the semantic verification information of the other optimized language model in the above-mentioned first optimized language model and the above-mentioned second optimized language model. When the model semantic weight included in the above-mentioned preset model optimization weight information is less than the model compression rate weight, the above-mentioned model optimization condition may be that the model compression rate of the optimized language model determined as the target language model is greater than the model compression rate of the other optimized language model in the above-mentioned first optimized language model and the above-mentioned second optimized language model.
[0104] A ninth sub-step, in response to determining that the first semantic verification information is greater than or equal to the preset semantic verification threshold, determines the first optimized language model as the target language model.
[0105] A tenth sub-step, in response to determining that the second semantic verification information is greater than or equal to the semantic verification threshold, determining the second optimized language model as the target language model.
[0106] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the language model adjustment method of some embodiments of the present disclosure, a language model credibility verification method is provided, which can reduce the time consumption of model credibility verification and improve the credibility of the language model. Specifically, the reason for the large error in the semantic verification of the language model and the poor effect of the language model adjustment is that there are large individual understanding differences in the credibility of the manual verification of the language model, resulting in poor subsequent model adjustment effect and large errors in model credibility verification. Based on this, the language model adjustment method of some embodiments of the present disclosure, first, obtains a pre-trained language model to be adjusted and a pre-trained open source language model set. Among them, each open source language model in the above open source language model set has the same task type as the above language model to be adjusted. Each open source language model in the above open source language model set is the same as the data set used when training the above language model to be adjusted. Therefore, a group of open source language models with the same task type and training data set as the above language model to be adjusted can be selected as a group of comparison models for verifying the credibility of the instruction text of the above language model to be adjusted, thereby improving the accuracy of subsequent semantic verification. Afterwards, the text entered by the user is received as the prompt text. Then, based on the above prompt text, the language model to be adjusted and the above open source language model set, the following model adjustment steps are performed: the first step is to input the above prompt text into the language model to be adjusted and each open source language model included in the above open source language model set to generate instruction information to be verified and a set of comparison instruction information. Thus, by inputting a unified prompt text, the instruction information output by each language model is generated under the semantic environment constructed by the same prompt text, thereby reducing the influence of external variables and further reducing the error of semantic verification. The second step is to perform semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information. Thus, by verifying the semantic similarity between the instruction information to be verified and each comparison instruction information in the above comparison instruction information set, the credibility of the language model can be verified. The last step is, in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the above preset semantic verification threshold and the number of executions of the above model adjustment step is less than or equal to the preset number of executions, the language model to be adjusted is model adjusted according to the above open source language model set, and the adjusted language model to be adjusted is used as the language model to be adjusted, and the above model adjustment step is performed again. Therefore, by presetting the threshold of semantic verification and the maximum number of executions of the adjustment step, the number of model adjustments is controlled to avoid the model adjustment of the language model to be adjusted falling into the local optimum.Because the credibility of the model to be adjusted is verified by verifying semantic consistency, when the instruction information to be verified and each comparison instruction information in the comparison instruction information set have high semantic similarity, it can be judged that the language model to be adjusted has high credibility, thereby reducing the time spent on manual verification of the credibility of the language model. When the semantic similarity of the instruction information to be verified and each comparison instruction information in the comparison instruction information set is low, the credibility of the language model can be improved by adjusting the language model to be adjusted.
[0107] Further references Figure 2 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a language model adjustment device. These device embodiments are similar to Figure 1 Corresponding to the method embodiments shown, the language model adjustment device can be specifically applied to various electronic devices.
[0108] like Figure 2 As shown, the language model adjustment device 200 of some embodiments includes: an acquisition unit 201, a receiving unit 202 and a model adjustment unit 203. The acquisition unit 201 is configured to acquire a pre-trained language model to be adjusted and a pre-trained open source language model set, wherein each open source language model in the open source language model set has the same task type as the language model to be adjusted, and each open source language model in the open source language model set has the same data set used when training the language model to be adjusted; the receiving unit 202 is configured to receive a text input by a user as a prompt text; the model adjustment unit 203 is configured to perform the following model adjustment steps based on the prompt text, the language model to be adjusted and the open source language model set: input the prompt text into the language model to be adjusted and each open source language model included in the open source language model set to generate instruction information to be verified and a comparison instruction information set; perform semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information; in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the preset semantic verification threshold and the number of executions of the model adjustment step is less than or equal to the preset number of executions, perform model adjustment on the language model to be adjusted according to the open source language model set, and use the adjusted language model to be adjusted as the language model to be adjusted, and perform the model adjustment step again. .
[0109] It can be understood that the units described in the language model adjustment device 200 are similar to those described in the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the language model adjustment device 200 and the units included therein, and will not be described in detail here.
[0110] Reference below Figure 3 , which shows a structural schematic diagram of an electronic device 300 suitable for implementing some embodiments of the present disclosure. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0111] like Figure 3 As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory 302 or a program loaded from a storage device 308 into a random access memory 303. Various programs and data required for the operation of the electronic device 300 are also stored in the random access memory 303. The processing device 301, the read-only memory 302, and the random access memory 303 are connected to each other via a bus 304. An input / output interface 305 is also connected to the bus 304.
[0112] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0113] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the read-only memory 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0114] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0115] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0116] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a pre-trained language model to be adjusted and a pre-trained open source language model set, wherein each open source language model in the open source language model set has the same task type as the language model to be adjusted, and each open source language model in the open source language model set is trained with the same data set as the language model to be adjusted; receives text input by a user as a prompt text; and based on the prompt text, the language model to be adjusted and the open source language model set, performs the following model adjustment steps: inputs the prompt text into the language model to be adjusted and each open source language model included in the open source language model set to generate instruction information to be verified and a comparison instruction information set; performs semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information; in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the preset semantic verification threshold and the number of executions of the model adjustment step is less than or equal to the preset number of executions, performs model adjustment on the language model to be adjusted according to the open source language model set, and uses the adjusted language model to be adjusted as the language model to be adjusted, and performs the model adjustment step again.
[0117] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0118] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0119] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor comprising an acquisition unit, a receiving unit, and a model adjustment unit. The names of these units do not, in some cases, constitute limitations on the units themselves, for example, the acquisition unit may also be described as "a unit for acquiring a pre-trained language model to be adjusted and a set of pre-trained open source language models".
[0120] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0121] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A language model adjustment method, comprising: Obtain a pre-trained language model to be adjusted and a pre-trained open source language model set, wherein each open source language model in the open source language model set has the same task type as the language model to be adjusted, and each open source language model in the open source language model set and the language model to be adjusted are trained using the same data set; Receive the text entered by the user as prompt text; Based on the prompt text, the language model to be adjusted and the open source language model set, the following model adjustment steps are performed: Inputting the prompt text into the language model to be adjusted and each open source language model included in the open source language model set to generate instruction information to be verified and a comparison instruction information set; According to the comparison instruction information set, semantic verification is performed on the instruction information to be verified to generate instruction semantic verification information; In response to determining that the instruction semantic verification information is less than a threshold verification condition corresponding to a preset semantic verification threshold and the number of executions of the model adjustment step is less than or equal to a preset number of executions, performing model adjustment on the language model to be adjusted according to the open source language model set, and using the adjusted language model to be adjusted as the language model to be adjusted, and executing the model adjustment step again; In response to determining that the instruction semantic verification information is greater than or equal to a preset semantic verification threshold, the following model optimization steps are performed: Obtaining preset model optimization weight information, wherein the preset model optimization weight information includes: model semantic weight and model compression rate weight; Performing a first optimization process on the language model to be adjusted to obtain a first optimized language model; Inputting the prompt text into the first optimized language model to generate first instruction information; Generate first instruction semantic verification information according to the comparison instruction information set and the first instruction information; Performing a second optimization process on the language model to be adjusted to obtain a second optimized language model; Inputting the prompt text into the second optimized language model to generate second instruction information; Generate second instruction semantic verification information according to the comparison instruction information set and the second instruction information; In response to determining that the first instruction semantic verification information is greater than or equal to the preset semantic verification threshold and the second instruction semantic verification information is greater than or equal to the preset semantic verification threshold, performing the following steps: According to the language model to be adjusted, determining a model compression rate of the first optimized language model as a first model compression rate; Determining, according to the language model to be adjusted, a model compression rate of the second optimized language model as a second model compression rate; Selecting an optimized language model that satisfies the model optimization condition corresponding to the preset model optimization weight information from the first optimized language model and the second optimized language model as a target language model; In response to determining that the first instruction semantic verification information is greater than or equal to the preset semantic verification threshold, determining the first optimized language model as a target language model; In response to determining that the second instruction semantic verification information is greater than or equal to the semantic verification threshold, the second optimized language model is determined as a target language model.
2. The method according to claim 1, wherein: The step of inputting the prompt text into the language model to be adjusted and each open source language model included in the open source language model set to generate instruction information to be verified and a set of comparison instruction information includes: In response to determining that the prompt text does not meet a preset text standard condition, performing character removal processing on the prompt text to update the prompt text; Inputting the prompt text into the language model to be adjusted to obtain instruction information as instruction information to be verified; For each open source language model in the open source language model set, inputting the prompt text into the open source language model to generate instruction information as comparison instruction information; The generated individual comparison instruction information are determined as a comparison instruction information set.
3. The method according to claim 2, wherein: The step of performing semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information includes: Determine the character length of the instruction information to be verified as the length of the instruction to be verified; Determine the average character length of each comparison instruction information in the comparison instruction information set as the comparison instruction average length; The average of the length of the instruction to be verified and the average length of the compared instructions is determined as the average length of the instruction; The difference between the length of the instruction to be verified and the average length of the comparison instruction is determined as the instruction length difference; In response to determining that the average length of the instruction is less than a preset text length threshold or the instruction length difference is less than the preset text length difference threshold, performing coarse-grained semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information; In response to determining that the average instruction length is greater than or equal to the preset text length threshold or the instruction length difference is greater than or equal to the preset text length difference threshold, fine-grained semantic verification is performed on the instruction information to be verified based on the comparison instruction information set to generate instruction semantic verification information.
4. The method according to claim 3, wherein: The step of performing coarse-grained semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information includes: For each comparison instruction information in the comparison instruction information set, perform the following steps: According to a preset punctuation character set, the comparison instruction information is subjected to text segmentation processing to obtain individual comparison instruction sentences; For each comparison instruction statement in each comparison instruction statement, perform the following steps: Perform word segmentation processing on the contrast instruction sentence to obtain a word segmentation sequence of the contrast instruction sentence; Generate a contrast instruction semantic vector corresponding to the contrast instruction sentence according to the contrast instruction sentence segmentation sequence; Performing semantic fusion on each generated comparison instruction semantic vector to generate a fused comparison instruction semantic vector; Generate a semantic vector of the instruction to be verified according to the instruction information to be verified; Determining the instruction semantic similarity according to the generated fused comparison instruction semantic vector and the generated instruction semantic vector to be verified; The determined instruction semantic similarity is determined as instruction semantic verification information.
5. A language model adjustment device, comprising: an acquisition unit configured to acquire a pre-trained language model to be adjusted and a pre-trained open source language model set, wherein each open source language model in the open source language model set has the same task type as the language model to be adjusted, and each open source language model in the open source language model set and the language model to be adjusted are trained using the same data set; A receiving unit, configured to receive text input by a user as a prompt text; The model adjustment unit is configured to perform the following model adjustment steps based on the prompt text, the language model to be adjusted and the open source language model set: input the prompt text into the language model to be adjusted and each open source language model included in the language model to be adjusted to generate instruction information to be verified and a comparison instruction information set; perform semantic verification on the instruction information to be verified according to the comparison instruction information set to generate instruction semantic verification information; in response to determining that the instruction semantic verification information is less than the threshold verification condition corresponding to the preset semantic verification threshold and the number of executions of the model adjustment step is less than or equal to the preset execution number, perform model adjustment on the language model to be adjusted according to the open source language model set, and use the adjusted language model to be adjusted as the language model to be adjusted, and perform the model adjustment step again; in response to determining that the instruction semantic verification information is greater than or equal to the preset semantic verification threshold, perform the following model optimization steps: obtain preset model optimization weight information, wherein the preset model optimization weight information includes: model semantic weight and model compression rate weight; perform first optimization processing on the language model to be adjusted to obtain a first optimized language model; input the prompt text into the first optimized language model to generate first instruction information; instruction information, generating first instruction semantic verification information; performing a second optimization process on the language model to be adjusted to obtain a second optimized language model; inputting the prompt text into the second optimized language model to generate second instruction information; generating second instruction semantic verification information according to the comparison instruction information set and the second instruction information; in response to determining that the first instruction semantic verification information is greater than or equal to the preset semantic verification threshold and the second instruction semantic verification information is greater than or equal to the preset semantic verification threshold, performing the following steps: determining the model compression rate of the first optimized language model as the first model compression rate according to the language model to be adjusted; determining the model compression rate of the second optimized language model as the second model compression rate according to the language model to be adjusted; selecting an optimized language model that meets the model optimization condition corresponding to the preset model optimization weight information from the first optimized language model and the second optimized language model as the target language model; in response to determining that the first instruction semantic verification information is greater than or equal to the preset semantic verification threshold, determining the first optimized language model as the target language model; in response to determining that the second instruction semantic verification information is greater than or equal to the semantic verification threshold, determining the second optimized language model as the target language model.
6. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
