Hyper-parameter value determination method and device based on large model algorithm, and electronic equipment
By adaptively adjusting hyperparameter values through the large model algorithm, the problem of difficulty in balancing creativity and accuracy in complex tasks with smaller LLMs is solved, and efficient inference results are achieved under resource constraints.
Patent Information
- Application Number
- CN202410822978.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-18
AI Technical Summary
It is difficult for smaller language models (LLM) to simultaneously demonstrate high creativity and high accuracy in complex task scenarios. Existing technology requires frequent adjustments of hyperparameters to adapt to different task requirements, and the reasoning effect is poor when resources are tight.
Through the hyperparameter value determination method based on the large model algorithm, the decision model and the annotation score relationship curve are used to adaptively adjust the hyperparameter value to balance creativity and accuracy. It is suitable for real-time reasoning of smaller LLMs, achieves style switching, and improves performance. Effect.
Improve the inference accuracy of smaller LLMs in scenarios where computing resources are tight. You can switch between creation and accuracy to improve model performance without fine-tuning large models.
Smart Images

Figure CN118798327A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of large model technology, and in particular to a method, device and electronic device for determining a hyperparameter value based on a large model algorithm. Background Art
[0002] In the process of outputting content using a large language model (LLM), the hyperparameters used during decoding (such as Temperature, Top_p, etc.) are of key significance, and the values of these hyperparameters play a decisive role in the style of the output content.
[0003] In addition, due to the limitation of the model's own parameters (or weights), when using smaller LLMs, such as Qwen-1.8B, Minicm-2B and their quantized versions for inference, the impact of hyperparameter values on the output will be further amplified. Especially when facing complex task scenarios, the output of smaller LLMs either maintains high creativity or high accuracy, and cannot show ideal results. Summary of the invention
[0004] The present disclosure provides a method, device and electronic device for determining a hyperparameter value based on a large model algorithm to at least solve the above technical problems existing in the prior art.
[0005] According to a first aspect of the present disclosure, a method for determining a hyperparameter value based on a large model algorithm is provided, the method comprising:
[0006] Get the first input of the large model and the first mark of the output at time T-1;
[0007] Inputting the first input and the first label into a decision model to determine the hyperparameter value of the large model at time T-1;
[0008] Determine the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value;
[0009] Among them, the hyperparameter value represents the accuracy and creativity of the output of the large model; the higher the hyperparameter value, the higher the creativity of the output of the large model; the lower the hyperparameter value, the higher the accuracy of the output of the large model.
[0010] In the above scheme, the method further comprises:
[0011] Obtain a second input and at least one tag corresponding to the second input;
[0012] Determining, based on the large model, a labeling score of at least one tag corresponding to the second input;
[0013] Inputting the second input and at least one tag corresponding to the second input into a decision model, and obtaining a prediction score of the decision model for the at least one tag corresponding to the second input;
[0014] Adjusting parameters of the decision model based on the annotation score and the prediction score;
[0015] The labeling score represents the score of the large model for the accuracy of at least one label. The higher the accuracy, the higher the corresponding labeling score; the lower the accuracy, the lower the corresponding labeling score.
[0016] In the above scheme, the method further includes:
[0017] Determine the hyperparameter value corresponding to each label of the second input output by the large model;
[0018] Determine a relationship curve between the hyperparameter value and the annotation score based on the labeled hyperparameter value corresponding to each second input and the annotation score corresponding to each second input;
[0019] Among them, in the relationship curve between the hyperparameter value and the score, the higher the hyperparameter value, the lower the annotation score; the lower the hyperparameter value, the higher the annotation score.
[0020] In the above solution, the step of inputting the first input and the first label into the decision model to determine the hyperparameter value of the large model at time T-1 includes:
[0021] Inputting the first input and the first label into a decision model to determine a score corresponding to the first label;
[0022] Based on the score and the relationship curve between the hyperparameter value and the marked score, the hyperparameter value corresponding to the first mark is determined as the hyperparameter value of the large model at time T-1.
[0023] In the above solution, determining the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value includes:
[0024] determining semantics of the first mark;
[0025] Based on the semantics of the first tag and the hyperparameter value of the large model at time T-1, the hyperparameter value of the large model at time T is determined.
[0026] In the above solution, determining the hyperparameter value of the large model at time T based on the semantics of the first mark and the hyperparameter value of the large model at time T-1 includes one of the following:
[0027] In response to the accuracy of the output of the large model at time T represented by the semantic representation of the first mark being greater than the accuracy of the output of the large model at time T-1, determining that the hyperparameter value of the large model at time T is less than the hyperparameter value of the large model at time T-1;
[0028] In response to the semantic representation of the first mark indicating that the creativity of the output of the large model at time T is greater than the creativity of the output of the large model at time T-1, it is determined that the hyperparameter value of the large model at time T is greater than or equal to the hyperparameter value of the large model at time T-1.
[0029] In the above solution, after determining the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value, the method further includes:
[0030] Adjust the hyperparameter values of the large model so that the large model outputs the label corresponding to the first input based on the adjusted hyperparameter values at time T.
[0031] According to a second aspect of the present disclosure, a hyperparameter value determination device based on a large model algorithm is provided, the device comprising:
[0032] An acquisition unit, used for acquiring a first input of the large model and a first mark output at time T-1;
[0033] A first determining unit, configured to input the first input and the first label into a decision model to determine a hyperparameter value of the large model at time T-1;
[0034] A second determining unit, configured to determine a hyperparameter value of the large model at time T based on the first mark and the hyperparameter value;
[0035] Among them, the hyperparameter value represents the accuracy and creativity of the output of the large model; the higher the hyperparameter value, the higher the creativity of the output of the large model; the lower the hyperparameter value, the higher the accuracy of the output of the large model.
[0036] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0037] at least one processor; and
[0038] a memory communicatively connected to the at least one processor; wherein,
[0039] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0040] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0041] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0043] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0044] Figure 1 A first optional flow chart of a method for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown;
[0045] Figure 2 A second optional flow chart of the method for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown;
[0046] Figure 3 A third optional flow chart of the method for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown;
[0047] Figure 4 A schematic diagram of a process for determining a training data set annotation score provided in an embodiment of the present disclosure is shown;
[0048] Figure 5 A schematic diagram of the process of training a decision model provided by an embodiment of the present disclosure is shown;
[0049] Figure 6 A schematic diagram of a curve showing the relationship between the hyperparameter value and the annotation score provided in an embodiment of the present disclosure is shown;
[0050] Figure 7 A schematic diagram of adjusting the hyperparameter value of a large model based on a decision model provided by an embodiment of the present disclosure is shown;
[0051] Figure 8 An optional structural schematic diagram of a device for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown;
[0052] Fig. 9 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0053] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0054] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0055] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein.
[0056] Unless otherwise defined, all technical and scientific terms used in this disclosure have the same meaning as those commonly understood by those skilled in the art to which this disclosure belongs. The terms used in this disclosure are only for the purpose of describing the embodiments of this disclosure and are not intended to limit this disclosure.
[0057] It should be understood that in the various embodiments of the present disclosure, the size of the serial number of each implementation process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0058] In related technologies, LLM's hyperparameters are set based on past experience and task expectations to perform LLM reasoning; however, clear task requirements are required, and LLM's hyperparameters need to be adjusted frequently based on the task; in addition, in order to ensure the versatility of LLM and user experience, LLM's output is usually set to be more creative; accordingly, there are output errors for common sense and reasoning problems.
[0059] In view of the defects existing in the related art, the embodiments of the present disclosure provide a method for determining a hyperparameter value based on a large model algorithm to at least solve some or all of the above-mentioned technical problems.
[0060] Figure 1 A first optional flow chart of a method for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown and will be described according to each step.
[0061] Step S101, obtaining the first input of the large model and the first mark output at time T-1.
[0062] In some embodiments, the first input of the large model can be a question, and the output of the large model, that is, the answer to the first input, is a piece of text; when the large model outputs, a number of words are output at each moment, which are set as tokens, that is, the output of the large model consists of multiple tokens, and each moment has a corresponding token.
[0063] In some embodiments, the T-1 moment is the moment before the T moment, for example, the T moment is the next moment, and the corresponding T-1 moment is the current moment; or the T moment is the current moment, and the corresponding T-1 moment is the previous moment. Implement a carrier (hereinafter referred to as a carrier) for determining a hyperparameter value based on a large model algorithm, obtain a first input of the large model, and a first mark output at the T-1 moment. The carrier can be a computer program, an electronic circuit, a database, a mobile application, an electronic device, a cloud computing platform, a distributed system, an artificial intelligence framework, a mathematical model, an automation tool, and a microcontroller, etc., which can implement software or hardware of an algorithm or method flow.
[0064] Step S102: input the first input and the first label into a decision model to determine the hyperparameter value of the large model at time T-1.
[0065] In some embodiments, the decision model may determine the degree of creativity or accuracy of the first mark based on the first input and the first mark at time T-1, and assign a corresponding score (i.e., score the degree of creativity or accuracy). Optionally, the higher the degree of creativity of the first mark, the lower the score; the higher the degree of accuracy of the first mark, the higher the score.
[0066] In some embodiments, the hyperparameter value represents the accuracy and creativity of the output of the large model; the higher the hyperparameter value, the higher the creativity of the output of the large model; the lower the hyperparameter value, the higher the accuracy of the output of the large model.
[0067] Step S103: Determine the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value.
[0068] In some embodiments, the carrier determines the degree of creativity or accuracy of the mark output at time T based on the semantics corresponding to the first mark; or, based on the semantics corresponding to the first mark, determines the degree of creativity or accuracy of the mark output at time T relative to the first mark.
[0069] In some embodiments, the hyperparameter value determines the style (creativity or accuracy) of the large model output. Therefore, after determining the style of the markup output at time T, the hyperparameter value of the large model at time T can be determined in combination with the hyperparameter value at time T-1.
[0070] For example, according to the semantics corresponding to the first tag, if the creativity of the tag output at time T is high, then it is determined that the hyperparameter value of the large model at time T is greater than the hyperparameter value of the large model at time T-1, or is the same as the hyperparameter value of the large model at time T-1; or, according to the semantics corresponding to the first tag, if the accuracy of the tag output at time T is high, then it is determined that the hyperparameter value of the large model at time T is less than the hyperparameter value of the large model at time T-1.
[0071] For another example, according to the semantics corresponding to the first tag, the creativity of the tag output at time T is higher than that of the first tag, then it is determined that the hyperparameter value of the large model at time T is greater than the hyperparameter value of the large model at time T-1; or, according to the semantics corresponding to the first tag, the accuracy of the tag output at time T is higher than that of the first tag, then it is determined that the hyperparameter value of the large model at time T is less than the hyperparameter value of the large model at time T-1.
[0072] In this way, through the method for determining hyperparameter values based on the large model algorithm provided by the embodiment of the present disclosure, the style of the mark to be output at the current moment can be determined in combination with the first mark output at the previous moment, and the hyperparameter value when the large model outputs the mark to be output can be determined according to the style of the mark to be output, the style of the first mark, and the hyperparameter value when the large model outputs the first mark; the hyperparameter of the large model is adjusted according to the hyperparameter value, so that the large model outputs a mark that conforms to the style at time T. In other words, the method for determining hyperparameter values based on the large model algorithm provided by the embodiment of the present disclosure can adaptively adjust the hyperparameter value of the large model, so that the large model can output a creative answer when it needs to output a creative style answer in response to an input, and can output an accurate answer when it needs to output an accurate style answer, so that the large model takes both creativity and accuracy into account at the same time, and improves the performance of the large model.
[0073] Figure 2 A second optional flow chart of the method for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown and will be explained according to each step.
[0074] Step S201, training a decision model.
[0075] In some embodiments, the vector determines a data set for training a decision model.
[0076] In some embodiments, the carrier determines a plurality of question-answer pairs (or dialogue data), including a second input and a second answer corresponding to the second input; decomposes the second answer into at least one tag, and scores at least one tag in the second answer based on contextual learning or contextual learning (ICL) and a large model, and the score is a labeling score. The labeling score represents the score of the large model for the accuracy of at least one tag, and the higher the accuracy, the higher the corresponding labeling score; the lower the accuracy, the lower the corresponding labeling score.
[0077] Among them, the large model involved in step S201 and the large model involved in steps S101 to S103 can be the same large model or different large models. When the two large models are different, the large model involved in step S201 is the first large model. Specifically, when scoring for marking, a large model with stronger capabilities is required to complete, such as GPT4; however, the method for determining the hyperparameter value based on the large model algorithm involved in the embodiment of the present disclosure can be applied to large models with stronger capabilities, and can also be applied to large models with weaker capabilities (or smaller LLMs, such as Qwen-1.8B, Minicm-2B, etc.).
[0078] In some embodiments, the carrier inputs the second question and at least one tag corresponding to the second answer into the decision model, and enables the decision model to output a prediction score for each tag.
[0079] The loss function of the decision model is calculated based on the annotation score and the prediction score of each mark, and the weight of the decision model is adjusted based on the loss function. The loss function can be determined by sampling cross entropy.
[0080] Step S202, determining a relationship curve between the hyperparameter value and the annotation score.
[0081] In some embodiments, the carrier determines the corresponding hyperparameter value when determining the mark corresponding to each second input based on step S201; determines the relationship curve between the hyperparameter value and the annotation score based on the hyperparameter value of the mark corresponding to each second input and the annotation score corresponding to each second input; wherein, in the relationship curve between the hyperparameter value and the annotation score, the horizontal axis is the annotation score and the vertical axis is the hyperparameter value. The higher the hyperparameter value, the lower the annotation score; the lower the hyperparameter value, the higher the annotation score.
[0082] Step S203, obtaining the first input of the large model and the first label output at time T-1.
[0083] The specific step flow of step S203 is the same as that of step S101 and will not be repeated here.
[0084] Step S204: input the first input and the first label into a decision model to determine the hyperparameter value of the large model at time T-1.
[0085] In some embodiments, the carrier inputs the first input and the first mark into the decision model to determine the score corresponding to the first mark; using the score corresponding to the first mark as the horizontal coordinate, the corresponding vertical coordinate is found in the relationship curve between the hyperparameter value and the labeled score, and it is confirmed that the score corresponding to the vertical coordinate is the hyperparameter value corresponding to the first mark, that is, the hyperparameter value of the large model at time T-1.
[0086] Step S205: Determine the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value.
[0087] In some embodiments, the carrier determines the semantics of the first tag, and based on the semantics of the first tag, determines the style of the tag output at time T, or the style of the tag output at time T relative to the first tag; based on the style of the tag output at time T and the hyperparameter value of the large model at time T-1; or, based on the style of the tag output at time T relative to the first tag and the hyperparameter value of the large model at time T, determines the hyperparameter value of the large model at time T.
[0088] In some optional embodiments, in response to the accuracy of the output of the large model at time T represented by the semantic representation of the first label being greater than the accuracy of the output of the large model at time T-1, it is determined that the hyperparameter value of the large model at time T is less than the hyperparameter value of the large model at time T-1; for example, if the first label is "Mountain A relative to Mountain B", then the label output at time T is more creative, for example, the label output at time T may be "slightly lower", "farther" or "closer", etc.
[0089] In response to the fact that the semantic representation of the first label indicates that the creativity of the output of the large model at time T is greater than the creativity of the output of the large model at time T-1, it is determined that the hyperparameter value of the large model at time T is greater than or equal to the hyperparameter value of the large model at time T-1; for example, if the first label is "the difference between the two", then the label output at time T is more accurate, such as the label output at time T may be "319 meters".
[0090] Step S206, adjust the hyperparameter value of the large model so that the large model outputs a label corresponding to the first input based on the adjusted hyperparameter value at time T.
[0091] In some embodiments, the carrier adjusts the hyperparameter value of the large model based on the hyperparameter value of the large model at time T determined in step S205, so that the large model outputs a label corresponding to the first input based on the adjusted hyperparameter value at time T.
[0092] In some optional embodiments, the hyperparameter value can be used to influence the value of the sampling strategy parameter; during the output process of the current large model, for the output at the next moment, the large model will provide multiple alternative outputs, and the target output among the multiple alternative outputs is determined by the sampling strategy parameter. The sampling strategy parameter includes the sampling probability of each alternative output. If the hyperparameter value is low, the sampling probability of the alternative output with higher accuracy is higher; if the hyperparameter value is high, the sampling probability of the alternative output with higher creativity is higher.
[0093] In some optional embodiments, steps S203 to S206 may be executed once at each moment in the process of the large model outputting an answer to the first input, that is, the carrier may also obtain the first input of the large model and a third mark of the output at moment T; based on the third mark and the hyperparameter value of the large model at moment T determined in step S205, determine the hyperparameter value of the large model at moment T+1.
[0094] In some other optional embodiments, steps S203 to S206 may be selectively executed, such as once at intervals of the first period, or executed based on the semantics of the tags output by the large model, such as executing when keywords are involved in the tags.
[0095] In this way, through the method for determining the hyperparameter value based on the large model algorithm provided by the embodiment of the present disclosure, in the scenario where computing resources are relatively tight, fewer resources can be used to improve the accuracy of the result reasoning of the large language model (or smaller LLM) with relatively low parameter quantity. When LLM performs real-time reasoning, it can adaptively switch styles so that the large model switches styles according to the current output content during the reasoning process, showing high accuracy in scenarios such as code writing and mathematical reasoning, and showing diversity in scenarios such as creation; at the same time, the carrier for implementing the method for determining the hyperparameter value based on the large model algorithm can be used as a plug-in without fine-tuning the large model, which is plug-and-play.
[0096] Figure 3 A third optional flow chart of the method for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown and will be explained according to each step.
[0097] Step S301, determining the annotation score of the training data set.
[0098] Figure 4 A schematic diagram of a process for determining a training data set annotation score provided by an embodiment of the present disclosure is shown.
[0099] In some embodiments, the carrier obtains question-answer pairs as a training data set, and based on a powerful LLM (such as GPT4) combined with an ICL algorithm and a question (query) in the question-answer pair, annotates at least one tag corresponding to the answer in the question-answer pair to obtain a labeling score corresponding to each tag.
[0100] like Figure 4 As shown in the figure, the input is a question-answer pair, the question is Query, and the token corresponding to the answer is [Token_1, Token_2, ..., Token_k], where k is an integer greater than 1; the tokens corresponding to the question and answer are input into GPT4, and each token is scored in combination with ICL to obtain [Score_1, Score_2, ..., Scroe_k], where the tokens and the annotation scores correspond one to one, that is, Token_a corresponds to Score_a, 1≤a≤k.
[0101] Step S302: training the decision model based on the training data set.
[0102] Figure 5 A flow chart of a training decision model provided in an embodiment of the present disclosure is shown.
[0103] In some embodiments, the carrier inputs a question-answer pair into a decision model, wherein the question-answer pair includes at least one tag corresponding to the question and the answer, namely, Query and [Token_1, Token_2, ..., Token_k]; the decision model outputs a prediction score for each tag, namely, Predict. A loss function is determined based on the annotation score and the prediction score, and the parameters of the decision model are adjusted based on the loss function. Wherein, Predict is [Predict_1, Predict_2, ..., Predict_k].
[0104] Figure 6 A schematic diagram of a curve showing the relationship between the hyperparameter value and the annotation score provided in an embodiment of the present disclosure is shown.
[0105] In some embodiments, the carrier determines the corresponding hyperparameter value when the large model outputs the label corresponding to each second input; based on the hyperparameter value of the label corresponding to each second input and the label score corresponding to each second input, a relationship curve between the hyperparameter value and the label score is determined. Figure 6 As shown in the relationship curve between the hyperparameter value and the annotation score, the horizontal axis is the annotation score and the vertical axis is the hyperparameter value; the higher the hyperparameter value, the lower the annotation score; the lower the hyperparameter value, the higher the annotation score.
[0106] Step S303, adjusting the hyperparameter values of the large model based on the decision model.
[0107] In some embodiments, the carrier obtains a first input of a large model and a first label output at time T-1; inputs the first input and the first label into a decision model to determine a hyperparameter value of the large model at time T-1; and determines a hyperparameter value of the large model at time T based on the first label and the hyperparameter value.
[0108] Figure 7 A schematic diagram of adjusting the hyperparameter values of a large model based on a decision model provided by an embodiment of the present disclosure is shown, and will be explained according to each step.
[0109] Take the first input as "Which mountain is the highest in XX? What are its characteristics? Which one is higher than Mountain A? How much higher?". The first input is input into the big model. The output of the big model at time T-1 is marked as "The highest mountain in XX is Mountain B, Mountain B..., with an altitude of 1545 meters, and the altitude of Mountain A is 1864 meters, so Mountain A is higher than Mountain B". Figure 7 [?] is the content that needs to be output at time T. The carrier inputs the first input and the mark of the output at time T-1 into the decision model, obtains the hyperparameter value at time T, and adjusts the sampling probability of each candidate output of the large model based on the hyperparameter value at time T. Figure 7 In the figure, the alternative outputs of the large model at time T include "high", "low", "more" and "drift", and the indicator bar behind it is the sampling probability. The longer the indicator bar, the higher the sampling probability. The sampling probability of the alternative output "high" is higher, so the output of the large model at time T is "high".
[0110] Furthermore, taking the large model MiniCPM-2B-int4 as an example, if the output of the large model is "The highest mountain in Shandong Province is Mount Tai, located in the central and southwestern regions of Shandong. It is the first of the Five Sacred Mountains in China and has an altitude of 1,545 meters. Mount Huangshan is one of the most beautiful peaks in China, with an altitude of 1,864 meters. It is a famous mountain in East China. Compared with Mount Huangshan, the altitude of Mount Tai is slightly [?]", when the hyperparameter value of the large model is set to 0.1, the accuracy is 100%. When the hyperparameter value of the large model is set to 0.7, the accuracy is 83%. According to the semantics at time T-1, the output style at time T is more creative, so the hyperparameter value of the large model can be increased and the output is "low". If the output of the large model is "The highest mountain in Shandong Province is Mount Tai, located in the central and southwestern regions of Shandong. It is the first of the Five Sacred Mountains in China and has an altitude of 1,545 meters. Mount Huangshan is one of the most beautiful peaks in China, with an altitude of 1,864 meters. It is a famous mountain in East China. Compared with Mount Huangshan, Mount Tai has a slightly lower altitude, and the difference between the two is [?]", when the hyperparameter value of the large model is set to 0.1, the accuracy is 100%. When the hyperparameter value of the large model is set to 0.7, the accuracy is 68%. According to the semantics at time T-1, the output style at time T is high accuracy. The hyperparameter value of the large model is lowered, and the output at time T is "319 meters".
[0111] In this way, through the method for determining the hyperparameter value based on the large model algorithm provided by the embodiment of the present disclosure, in the scenario where computing resources are relatively tight, fewer resources can be used to improve the accuracy of the result reasoning of the large language model (or smaller LLM) with relatively low parameter quantity. When LLM performs real-time reasoning, it can adaptively switch styles so that the large model switches styles according to the current output content during the reasoning process, showing high accuracy in scenarios such as code writing and mathematical reasoning, and showing diversity in scenarios such as creation; at the same time, the carrier for implementing the method for determining the hyperparameter value based on the large model algorithm can be used as a plug-in without fine-tuning the large model, which is plug-and-play.
[0112] Figure 8 An optional structural schematic diagram of a device for determining a hyperparameter value based on a large model algorithm provided in an embodiment of the present disclosure is shown and will be described according to each part.
[0113] In some embodiments, the hyperparameter value determination device 700 based on the large model algorithm includes an acquisition unit 701, a first determination unit 702 and a second determination unit 703.
[0114] The acquisition unit 701 is used to acquire the first input of the large model and the first mark output at time T-1;
[0115] The first determining unit 702 is used to input the first input and the first label into the decision model to determine the hyperparameter value of the large model at time T-1;
[0116] The second determining unit 703 is used to determine the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value;
[0117] Among them, the hyperparameter value represents the accuracy and creativity of the output of the large model; the higher the hyperparameter value, the higher the creativity of the output of the large model; the lower the hyperparameter value, the higher the accuracy of the output of the large model.
[0118] The acquisition unit 701 is further configured to acquire the second input and at least one tag corresponding to the second input;
[0119] Determining, based on the large model, a labeling score of at least one tag corresponding to the second input;
[0120] Inputting the second input and at least one tag corresponding to the second input into a decision model, and obtaining a prediction score of the decision model for the at least one tag corresponding to the second input;
[0121] Adjusting parameters of the decision model based on the annotation score and the prediction score;
[0122] The labeling score represents the score of the large model for the accuracy of at least one label. The higher the accuracy, the higher the corresponding labeling score; the lower the accuracy, the lower the corresponding labeling score.
[0123] The acquisition unit 701 is further used to determine the corresponding hyperparameter value when the large model outputs a label corresponding to each second input;
[0124] Determine a relationship curve between the hyperparameter value and the annotation score based on the labeled hyperparameter value corresponding to each second input and the annotation score corresponding to each second input;
[0125] Among them, in the relationship curve between the hyperparameter value and the score, the higher the hyperparameter value, the lower the annotation score; the lower the hyperparameter value, the higher the annotation score.
[0126] The first determining unit 702 is specifically configured to input the first input and the first mark into a decision model to determine a score corresponding to the first mark;
[0127] Based on the score and the relationship curve between the hyperparameter value and the marked score, the hyperparameter value corresponding to the first mark is determined as the hyperparameter value of the large model at time T-1.
[0128] The second determining unit 703 is specifically configured to determine the semantics of the first mark;
[0129] Based on the semantics of the first tag and the hyperparameter value of the large model at time T-1, the hyperparameter value of the large model at time T is determined.
[0130] The second determining unit 703 is specifically configured to do one of the following:
[0131] In response to the accuracy of the output of the large model at time T represented by the semantic representation of the first mark being greater than the accuracy of the output of the large model at time T-1, determining that the hyperparameter value of the large model at time T is less than the hyperparameter value of the large model at time T-1;
[0132] In response to the semantic representation of the first mark indicating that the creativity of the output of the large model at time T is greater than the creativity of the output of the large model at time T-1, it is determined that the hyperparameter value of the large model at time T is greater than or equal to the hyperparameter value of the large model at time T-1.
[0133] The second determination unit 703, after determining the hyperparameter value of the large model at time T based on the first label and the hyperparameter value, is further used to adjust the hyperparameter value of the large model so that the large model outputs the label corresponding to the first input based on the adjusted hyperparameter value at time T.
[0134] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0135] Fig. 9 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0136] like Fig. 9 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0137] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0138] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a method for determining a hyperparameter value based on a large model algorithm. For example, in some embodiments, a method for determining a hyperparameter value based on a large model algorithm may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the method for determining a hyperparameter value based on the large model algorithm described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured in any other appropriate manner (eg, by means of firmware) to execute a hyperparameter value determination method based on a large model algorithm.
[0139] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0140] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0141] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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 foregoing.
[0142] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0143] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by 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), and the Internet.
[0144] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0145] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0146] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0147] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for determining a hyperparameter value based on a large model algorithm, the method comprising: Get the first input of the large model and the first mark of the output at time T-1; Inputting the first input and the first label into a decision model to determine the hyperparameter value of the large model at time T-1; Determine the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value; Among them, the hyperparameter value represents the accuracy and creativity of the output of the large model; the higher the hyperparameter value, the higher the creativity of the output of the large model; the lower the hyperparameter value, the higher the accuracy of the output of the large model.
2. The method according to claim 1, further comprising: Obtain a second input and at least one tag corresponding to the second input; Determining, based on the large model, a labeling score of at least one tag corresponding to the second input; Inputting the second input and at least one tag corresponding to the second input into a decision model, and obtaining a prediction score of the decision model for the at least one tag corresponding to the second input; Adjusting parameters of the decision model based on the annotation score and the prediction score; The labeling score represents the score of the large model for the accuracy of at least one label. The higher the accuracy, the higher the corresponding labeling score; the lower the accuracy, the lower the corresponding labeling score.
3. The method according to claim 2, further comprising: Determine the hyperparameter value corresponding to each label of the second input output by the large model; Determine a relationship curve between the hyperparameter value and the annotation score based on the labeled hyperparameter value corresponding to each second input and the annotation score corresponding to each second input; Among them, in the relationship curve between the hyperparameter value and the score, the higher the hyperparameter value, the lower the annotation score; the lower the hyperparameter value, the higher the annotation score.
4. The method according to claim 3, wherein the step of inputting the first input and the first label into a decision model to determine a hyperparameter value of the large model at time T-1 comprises: Inputting the first input and the first label into a decision model to determine a score corresponding to the first label; Based on the score and the relationship curve between the hyperparameter value and the marked score, the hyperparameter value corresponding to the first mark is determined as the hyperparameter value of the large model at time T-1.
5. The method according to claim 1, wherein determining the hyperparameter value of the large model at time T based on the first tag and the hyperparameter value comprises: determining semantics of the first mark; Based on the semantics of the first tag and the hyperparameter value of the large model at time T-1, the hyperparameter value of the large model at time T is determined.
6. The method according to claim 5, wherein determining the hyperparameter value of the large model at time T based on the semantics of the first mark and the hyperparameter value of the large model at time T-1 comprises one of the following: In response to the accuracy of the output of the large model at time T represented by the semantic representation of the first mark being greater than the accuracy of the output of the large model at time T-1, determining that the hyperparameter value of the large model at time T is less than the hyperparameter value of the large model at time T-1; In response to the semantic representation of the first mark indicating that the creativity of the output of the large model at time T is greater than the creativity of the output of the large model at time T-1, it is determined that the hyperparameter value of the large model at time T is greater than or equal to the hyperparameter value of the large model at time T-1.
7. The method according to claim 1, after determining the hyperparameter value of the large model at time T based on the first mark and the hyperparameter value, the method further comprises: Adjust the hyperparameter values of the large model so that the large model outputs the label corresponding to the first input based on the adjusted hyperparameter values at time T.
8. A device for determining a hyperparameter value based on a large model algorithm, the device comprising: An acquisition unit, used for acquiring a first input of the large model and a first mark output at time T-1; A first determining unit, configured to input the first input and the first label into a decision model to determine a hyperparameter value of the large model at time T-1; A second determining unit, configured to determine a hyperparameter value of the large model at time T based on the first mark and the hyperparameter value; Among them, the hyperparameter value represents the accuracy and creativity of the output of the large model; the higher the hyperparameter value, the higher the creativity of the output of the large model; the lower the hyperparameter value, the higher the accuracy of the output of the large model.
9. An electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method according to any one of claims 1 to 7.
