Service execution method and device, storage medium and electronic equipment
By using self-interpreting instructions to generate and adjust the reason information of the deleted text in the large language model, the problem of unstable performance of the large language model in new business scenarios is solved, and the accuracy and stability of the output results are improved.
Patent Information
- Application Number
- CN202411322542.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-27
AI Technical Summary
After learning new business scenarios, large language models are susceptible to the output results of partial prompt examples, resulting in unstable performance and require multiple adjustments and learning to improve model performance.
By obtaining prompt examples and text to be analyzed, determining self-interpretation instructions, and inputting them into the large language model, generating reason information for the initial reply text, adjusting the initial reply text to generate target reply text, and then performing business and improving the output results accuracy.
The reason analysis and adjustment of the initial reply text of the large language model through self-interpretation instructions improves the accuracy of the output results and the stability of the model performance, and reduces the need for multiple adjustments and learning.
Smart Images

Figure CN119202185A_ABST
Abstract
Description
Technical Field
[0001] The present specification relates to the fields of computer technology and artificial intelligence, and in particular to a service execution method, device, storage medium, and electronic device. Background Art
[0002] As an important branch of the field of artificial intelligence technology, the big language model has been applied in many fields. For example, in the field of natural language processing, it can be used to process various text data and complete tasks such as text classification and machine translation. In the financial field, by inputting user-authorized personal information into the big language model, tasks such as risk assessment of users can be performed.
[0003] For many current business scenarios, the large language model is required to use pre-trained prior knowledge to answer questions input by users. When new business scenarios emerge, in order to enable the large language model to be applied in new business scenarios, the context learning ability (In-Context Learning, ICL) of the large language model can be used to learn prompt examples corresponding to the new business scenarios. That is, the prompt examples are used to learn new business scenario examples for the large language model, so that the large language model can execute new business based on the knowledge learned from the prompt examples, instead of training the large language model to enable the large language model to execute new business.
[0004] However, the output results given by the large language model after learning the prompt examples for new business are easily affected by the output results of some prompt examples, resulting in unstable performance of the large language model. Summary of the invention
[0005] The embodiments of this specification provide a service execution method, device, storage medium and electronic device to partially solve the problems existing in the above-mentioned prior art.
[0006] The embodiments of this specification adopt the following technical solutions:
[0007] This specification provides a service execution method, including:
[0008] Obtain at least one prompt example and a text to be analyzed, wherein for each prompt example, the prompt example includes a sample text to be analyzed and a standard reply text corresponding to the sample text to be analyzed;
[0009] Determine the self-explanatory instruction corresponding to the text to be analyzed;
[0010] Inputting the at least one prompt example, the text to be analyzed, and the self-explanatory instruction into a preset large language model, so that the large language model predicts an initial response text corresponding to the text to be analyzed based on the sample text to be analyzed contained in the at least one prompt example and the standard response text corresponding to the sample text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, wherein the reason information is used to indicate the reason on which the large language model obtains the initial response text;
[0011] Execute the service according to the target reply text corresponding to the text to be analyzed.
[0012] Optionally, the method further comprises:
[0013] After determining that the large language model meets the preset conditions, determining the business type corresponding to the text to be analyzed;
[0014] The at least one prompt example, the self-explanatory instruction corresponding to the text to be analyzed, and the business type are correspondingly saved.
[0015] Optionally, the method further comprises:
[0016] Get the question sentence entered by the user;
[0017] Determine the business type corresponding to the question statement as the target type;
[0018] Querying prompt examples and self-explanatory instructions corresponding to the target type;
[0019] The question statement, the prompt example corresponding to the target type and the self-explanatory instruction are input into a preset large language model, so that the large language model outputs the target reply text corresponding to the question statement.
[0020] Optionally, determining the business type corresponding to the question statement as the target type specifically includes:
[0021] Determine a service type option selected by a user in a preset operation interface, wherein the operation interface includes a plurality of service type options;
[0022] According to the business type option selected by the user, the business type corresponding to the question statement is determined as the target type.
[0023] Optionally, the method further comprises:
[0024] Determine a model to be trained, wherein the model scale of the model to be trained is smaller than the large language model;
[0025] Inputting the text to be analyzed and the reason information into the model to be trained, so that the model to be trained outputs a reply text corresponding to the text to be analyzed according to the reason information and the text to be analyzed;
[0026] Determine a loss value according to a deviation between a reply text corresponding to the text to be analyzed output by the model to be trained and a target reply text corresponding to the text to be analyzed generated by the large language model, wherein the deviation is positively correlated with the loss value;
[0027] The model to be trained is trained according to the loss value.
[0028] This specification provides a service execution device, including:
[0029] An acquisition module, used to acquire at least one prompt example and a text to be analyzed, wherein for each prompt example, the prompt example includes a sample text to be analyzed and a standard reply text corresponding to the sample text to be analyzed;
[0030] A determination module, used for determining the self-explanatory instruction corresponding to the text to be analyzed;
[0031] A generating module, configured to input the at least one prompt example, the text to be analyzed, and the self-explanatory instruction into a preset large language model, so that the large language model predicts an initial response text corresponding to the text to be analyzed based on the sample text to be analyzed contained in the at least one prompt example and the standard response text corresponding to the sample text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, wherein the reason information is used to indicate the reason on which the large language model obtains the initial response text;
[0032] The execution module is used to execute the business according to the target reply text corresponding to the text to be analyzed.
[0033] Optionally, the device further comprises:
[0034] The storage module is used to determine the business type corresponding to the text to be analyzed after determining that the large language model meets the preset conditions; and store the at least one prompt example, the self-explanatory instructions corresponding to the text to be analyzed, and the business type accordingly.
[0035] Optionally, the device further comprises:
[0036] A module is used to obtain a question statement input by a user; determine the business type corresponding to the question statement as a target type; query prompt examples and self-explanatory instructions corresponding to the target type; input the question statement, the prompt example corresponding to the target type and the self-explanatory instructions into a preset large language model, so that the large language model outputs a target reply text corresponding to the question statement.
[0037] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned service execution method is implemented.
[0038] An electronic device provided in this specification includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned service execution method when executing the program.
[0039] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:
[0040] In the embodiments of the present specification, first, the server obtains at least one prompt example and a text to be analyzed, and then determines a self-explanatory instruction corresponding to the text to be analyzed, and inputs at least one prompt example, the text to be analyzed, and the self-explanatory instruction into a preset large language model, so that the large language model predicts an initial response text corresponding to the text to be analyzed based on the sample text to be analyzed contained in at least one prompt example and the standard response text corresponding to the sample text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction corresponding to the text to be analyzed, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, and then, according to the target response text corresponding to the text to be analyzed, executes the business, wherein, for each prompt example, the prompt example contains the sample text to be analyzed and the standard response text corresponding to the sample text to be analyzed, and the reason information is used to indicate the reason on which the large language model obtains the initial response text.
[0041] In this method, self-explanatory instructions are used to explain the reason information for the preset large language model to obtain the initial reply text, so that the preset large language model can re-analyze the text to be analyzed according to the reason information, analyze the text to be analyzed more accurately, and generate a more accurate target reply text, thereby improving the accuracy of the output results of the large language model. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:
[0043] Figure 1 A flowchart of a service execution method provided in an embodiment of this specification;
[0044] Figure 2 A data transmission diagram of a service execution method provided in an embodiment of this specification;
[0045] Figure 3A-3B A schematic diagram of an input and output interface of a large language model provided in an embodiment of this specification;
[0046] Figure 4 A schematic diagram of the structure of a service execution detection device provided in an embodiment of this specification;
[0047] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0049] As an important branch of the field of artificial intelligence technology, large language models have been used in a wide range of application fields. For example, in the field of natural language processing, they can be used to process various text data and complete tasks such as text classification and machine translation. For example, in the field of content creation and generation, they can generate various types of text content, such as articles, poems, or copywriting, through keyword information input by users.
[0050] For many current business scenarios, the large language model is required to use pre-trained prior knowledge to answer questions input by users. When new business scenarios emerge, in order to apply the large language model to the new business scenarios, due to the limited number of available training samples, the context learning capability (In-Context Learning, ICL) of the large language model can be used to learn prompt examples corresponding to the new business scenarios. That is, the prompt examples are used to learn new business scenario examples for the large language model, so that the large language model can execute new business based on the knowledge learned from the prompt examples, instead of training the large language model to enable the large language model to execute new business.
[0051] Among them, contextual learning is a method of analogical learning and a powerful emergent capability of large language models. That is, without the need for additional training and parameter adjustment, given a small number of business prompt examples, the large language model can achieve strong few-sample learning capabilities.
[0052] However, the output results given by the large language model for new business after learning the prompt examples are easily affected by the output results of some prompt examples, resulting in unstable performance of the large language model. It is necessary to adjust the prompt examples multiple times and make the large language model learn the prompt examples after multiple adjustments in order to select the learned large language model with relatively high model performance.
[0053] In order to solve the above problem, in an embodiment of the present specification, the server obtains at least one prompt example and a text to be analyzed, and determines a self-explanatory instruction corresponding to the text to be analyzed, and inputs the at least one prompt example, the text to be analyzed and the self-explanatory instruction into a preset large language model, so that the large language model predicts the initial response text corresponding to the text to be analyzed based on the sample text to be analyzed contained in the at least one prompt example and the standard response text corresponding to the sample text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction corresponding to the text to be analyzed, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, and then, according to the target response text corresponding to the text to be analyzed, execute the business, wherein, for each prompt example, the prompt example contains the sample text to be analyzed and the standard response text corresponding to the sample text to be analyzed, and the reason information is used to indicate the reason on which the large language model obtains the initial response text.
[0054] In this method, the reasons for the initial response text obtained by the large language model are explained by using self-explanatory instructions, so that after the large language model performs a preliminary analysis on the text to be analyzed and obtains the output result, the reasons for generating the output result are explained. In this way, the large language model further analyzes the text to be analyzed based on the cause information, and adjusts the initial response text obtained by the preliminary analysis. At the same time, the large language model has as much time as possible to calculate the text to be analyzed, so as to improve the accuracy of the final output result, thereby improving the accuracy of the output result of the large language model.
[0055] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.
[0056] Figure 1 A flowchart of a service execution method provided in an embodiment of this specification includes:
[0057] S100: Obtain at least one prompt example and a text to be analyzed. For each prompt example, the prompt example includes a sample text to be analyzed and a standard reply text corresponding to the sample text to be analyzed.
[0058] For a service execution method provided in this specification, a terminal device such as a desktop computer, a laptop computer, etc. can be used as an execution subject, or a server can be used as an execution subject. For the sake of ease of description, the following only takes the server as the execution subject to describe a service execution method provided in this specification.
[0059] Next, in an embodiment of the present specification, the server first needs to obtain at least one prompt example and a text to be analyzed, wherein the at least one prompt example mentioned here is a prompt example corresponding to the business type to which the text to be analyzed belongs, and for each prompt example, each prompt example contains an example text to be analyzed and a standard reply text corresponding to the example text to be analyzed.
[0060] For example, the business type to which the text to be analyzed mentioned here belongs refers to the sentiment analysis business type, and the prompt example is an example of the sentiment analysis business type, which can be in the form of: "Sample text to be analyzed: a pale imitation, standard response text: negative, sample text to be analyzed: to its superior cast, standard response text: positive".
[0061] S102: Determine the self-explanatory instructions corresponding to the text to be analyzed.
[0062] In the embodiment of the present specification, after the server obtains the text to be analyzed, in order to enable the preset large language model to further analyze the text to be analyzed, it is necessary to determine the self-explanatory instructions corresponding to the text to be analyzed, so that the preset large language model can explain the reason information for the preset large language model generating the reply text corresponding to the text to be analyzed according to the self-explanatory instructions, so as to perform the next step, and further, enable the preset large language model to generate a more accurate target reply text.
[0063] The self-explanatory instructions may be pre-set self-explanatory instructions, that is, the self-explanatory instructions corresponding to all business types are the same. For example, the form of the self-explanatory instructions may be set to "Generate the output and provide a detailed explanation justifying your answer".
[0064] By using self-explanatory instructions, the preset large language model can explain the reason information of the preset large language model generating the reply text according to the self-explanatory instructions, and re-analyze the text to be analyzed based on the reason information, and correct the deficiencies that occurred when the text to be analyzed was first analyzed, so as to obtain a more accurate reply text.
[0065] S104: Input the at least one prompt example, the text to be analyzed, and the self-explanatory instruction into a preset large language model, so that the large language model predicts an initial response text corresponding to the text to be analyzed based on the example text to be analyzed contained in the at least one prompt example and the standard response text corresponding to the example text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, wherein the reason information is used to indicate the reason on which the large language model obtains the initial response text.
[0066] If the preset large language model only predicts the generated initial response text based on the sample text to be analyzed contained in at least one prompt example and the standard response text corresponding to the sample text to be analyzed, the preset large language model may be affected by some prompt examples or learn erroneous content from at least one prompt example, resulting in inaccurate initial response text for the text to be analyzed based on the prompt example.
[0067] Therefore, in this manual, self-explanatory instructions are introduced so that the preset large language model can generate reason information of the initial reply text corresponding to the text to be analyzed through self-explanatory instructions, and then automatically adjust the initial reply text according to the reason information to obtain a more accurate reply text, which serves as the target reply text corresponding to the text to be analyzed.
[0068] That is to say, after the introduction of self-explanatory instructions, the preset large language model can generate the reason information of the initial reply text corresponding to the text to be analyzed through the self-explanatory instructions, and then automatically analyze the initial reply text based on the obtained reason information. That is, if the initial reply text contains erroneous content, the initial reply text will be corrected according to the obtained reason information; if the initial reply text does not contain erroneous content but there is room for further optimization in the content, the initial reply text can be adjusted according to the obtained reason information.
[0069] by Figure 2 Take as an example to explain the data transmission process in the above process.
[0070] Figure 2 A data transmission diagram of a service execution method provided in an embodiment of this specification.
[0071] like Figure 2 As shown, the server inputs the prompt example, the text to be analyzed, and the self-explanatory instructions into the preset large language model. The preset large language model uses context learning capabilities to learn the reasoning relationship between the sample text to be analyzed contained in the prompt example and the standard response text corresponding to the sample text to be analyzed, and combines the language knowledge and context understanding capabilities learned by the preset large language model during pre-training to predict the initial response text corresponding to the text to be analyzed.
[0072] On this basis, in order to enable the preset large language model to adjust the inaccurate content in the initial reply text, it is necessary to use self-explanatory instructions to generate the reason information of the preset large language model predicting the initial reply text based on the text to be analyzed, and then, analyze the initial reply text again according to the reason information, and adjust the initial reply text at the same time, and transmit the adjusted initial reply text to the server as the target reply text, so that the server can execute the business according to the target reply text.
[0073] By adding self-explanatory instructions to the learning prompt example using the context learning ability of the preset large language model, the preset large language model can further analyze the text to be analyzed based on the reason information generated by the self-explanatory instructions based on the initial reply text, so as to identify the inaccurate content contained in the initial reply text or the analysis errors contained in the initial reply text, and more accurately understand the semantics and context of the text to be analyzed, so that the content of the target reply text is more in line with the format of the reply text corresponding to the business type to which the text to be analyzed belongs, thereby improving the accuracy of the target reply text content.
[0074] S106: Execute the service according to the target reply text corresponding to the text to be analyzed.
[0075] After obtaining the target reply text generated by the preset large language model in the above manner, the server will generate a sentence that conforms to the business type of the text to be analyzed based on the target reply text to execute the business, and at the same time present the explanation reason generated by the preset large language model for the text to be analyzed to the user as a business result.
[0076] For example, after the server obtains the target reply text, it checks the target reply text in terms of format and content, and presents the processed target reply text and reason information to the user.
[0077] From the perspective of actual application scenarios, the above process can actually be regarded as the stage in which the preset large language model learns new business scenarios. Generally, it is used to deal with new business scenarios, and the preset large language model is not trained with training samples corresponding to the new business scenarios during the training phase. In order to enable the preset large language model to learn the reasoning characteristics corresponding to the new business scenarios, prompt examples corresponding to the new business scenarios are introduced to allow the preset large language model to learn the reasoning characteristics corresponding to the new business scenarios. Once the learning is completed, the learned large language model can be opened to users.
[0078] However, during the user's use, in order to facilitate user operation, there is no need to re-enter the prompt examples corresponding to the new business scenarios. Therefore, after obtaining the learned large language model, the prompt examples entered during the learning process, the self-explanatory instructions corresponding to the text to be analyzed that is the same business type as the prompt examples, and the business type corresponding to the prompt examples are stored accordingly.
[0079] For example, if the business type corresponding to the text to be analyzed is sentiment analysis business, the prompt example is a prompt example related to the sentiment analysis business, the self-explanatory instruction is a preset self-explanatory instruction, and then, at least one prompt example, self-explanatory instruction and prompt example corresponding to the sentiment analysis business are stored; for another example, or if the business type corresponding to the text to be analyzed is text generation business, the prompt example is a prompt example related to the text generation business, the self-explanatory instruction is a preset self-explanatory instruction, and then, at least one prompt example, self-explanatory instruction and prompt example corresponding to the text generation business are stored.
[0080] Furthermore, in the subsequent user use process, it is only necessary to input the question statement and select the corresponding business type according to the prompt in the preset operation interface to obtain the reply text. That is, the server can query the prompt example and self-explanatory instructions corresponding to the business type according to the acquired business type, and then input the prompt example, question statement and self-explanatory instructions into the learned large language model to obtain the reply text.
[0081] In other words, the user only needs to input a question statement and select a business type in a preset operation interface. The prompt example corresponding to the business type is queried by the server based on the business type, and no user input is required, thereby improving the user experience.
[0082] Among them, the process mentioned here of storing the prompt examples input during the learning process, the self-explanatory instructions corresponding to the text to be analyzed of the same business type as the prompt examples, and the business type corresponding to the prompt examples, can only be stored after determining that the preset large language model meets the preset conditions.
[0083] It should be noted that the preset condition mentioned here can be that the number of prompt examples input into the preset large language model exceeds a preset threshold, or the number of rounds of inputting prompt examples into the preset large language model reaches a preset number of rounds, in which case the preset large language model is considered to have been learned.
[0084] After performing the above operations, the user can input a question statement through the prompt information included in the preset operation interface, and obtain an output result corresponding to the question statement in the preset operation interface.
[0085] by Figure 3A-3B Taking as an example, the process of using the preset large language model is explained from the user's perspective.
[0086] Figure 3A-3B A schematic diagram of an input and output interface of a large language model provided in an embodiment of this specification, Figure 3A is a schematic diagram of an input interface of a large language model provided in an embodiment of this specification, Figure 3BIt is a schematic diagram of an output interface of a large language model provided in an embodiment of this specification.
[0087] In actual application, the preset operation interface can be Figure 3A The input interface displayed, that is, the user enters the question sentence according to the prompt information of the input interface, and Figure 3B The output interface shows the output result generated by the preset large language model for the question sentence.
[0088] Furthermore, after obtaining the question statement input by the user, the server determines the business type corresponding to the question statement as the target type, and queries the prompt example and self-explanatory instruction corresponding to the target type, and then inputs the question statement, the prompt example and self-explanatory instruction corresponding to the target type into the preset large language model, so that the preset large language model outputs the target reply text corresponding to the question statement. Thus, the server adjusts the target reply text according to the target reply text and the question statement input by the user, generates a reply text that conforms to the business type corresponding to the question statement, and presents it to the user, and at the same time presents to the user the reason why the preset large language model generates the target reply text according to the question statement.
[0089] Before the user inputs a question statement in the preset operation interface, the user needs to select the business type corresponding to the question statement in the preset operation interface. Then, the server obtains the business type corresponding to the question statement input by the user according to the business type option selected by the user, and uses it as the target type.
[0090] It should be noted that the preset operation interface includes multiple business type options, such as sentiment analysis, text classification, and text generation. Figure 3A The form in the input interface shown is displayed to the user.
[0091] In addition, with the continuous development of smart devices, users have the need to use the preset large language model functions on smart devices, especially on portable smart devices. Therefore, in this manual, the preset large language model can be used to assist in training a small-scale model to obtain a model with similar functions to the preset large language model, and then the small-scale model can be deployed on the smart device to meet user needs.
[0092] To elaborate, after determining that the model to be trained has a model scale smaller than that of the preset large language model, the preset large language model is used to parse the text to be analyzed belonging to each business type in the above-mentioned manner to obtain the output result and the reason information for generating the output result, and then, the text to be analyzed and the reason information are input into the model to be trained, that is, the small-scale model to be trained, so that the model to be trained outputs a reply text corresponding to the text to be analyzed based on the reason information and the text to be analyzed, thereby, determining the loss value based on the deviation between the reply text corresponding to the text to be analyzed output by the model to be trained and the target reply text corresponding to the text to be analyzed generated by the preset large language model, and training the model to be trained based on the loss value.
[0093] Among them, the deviation is positively correlated with the loss value, that is, the smaller the deviation between the reply text output by the model to be trained and the target reply text generated by the preset large language model, the smaller the loss value, and vice versa.
[0094] By using a preset large language model to assist in the training of a small-scale model, the preset large language model can be compressed and the number of parameters of the small-scale model can be reduced. In this way, in practical applications, the small-scale model can be deployed on mobile smart devices, such as smart phones, to achieve the purpose of implementing functions similar to the preset large language model on mobile smart devices, thereby increasing the user's usage channels and making it more convenient, thereby improving the user experience.
[0095] In summary, in order to overcome the problem that after the large language model uses contextual learning ability to learn prompt examples in new business scenarios, it is affected by the output results of some prompt examples, resulting in unstable performance of the large language model after learning, in the embodiment of this specification, self-explanatory instructions are added to enable the large language model to explain the reasons for generating the output results after performing a preliminary analysis on the text to be analyzed and obtaining the output results. In this way, the large language model can further analyze the text to be analyzed based on the cause information, and adjust the initial reply text obtained by the preliminary analysis. At the same time, the large language model can have as much time as possible to calculate the text to be analyzed, so as to improve the accuracy of the final output result and the stability of the performance of the large language model after learning.
[0096] In addition, if several new business scenarios emerge, the above method can also be used to obtain a large language model after learning prompt examples in several new business scenarios, thereby improving the accuracy of the output results of the large language model in each new business scenario, overcoming the defect of the instability of the large language model caused by the influence of some prompt examples in traditional context learning, and eliminating the need to input different prompt examples multiple times to improve the accuracy of the large language model, further accelerating the learning efficiency.
[0097] In addition, by using a large language model with self-explanatory instructions, users can clearly understand the reasons why the large language model generates output results, thereby enabling users to better understand the entire decision-making process of the large language model and more reasonably formulate solutions or proceed to the next step of question and answer based on the response sentences obtained.
[0098] The above is a service execution method provided in an embodiment of this specification. Based on the same idea, this specification also provides corresponding devices, storage media and electronic devices.
[0099] Figure 4 A schematic diagram of a service execution device provided in an embodiment of this specification, wherein the device includes:
[0100] The acquisition module 401 is used to acquire at least one prompt example and a text to be analyzed. For each prompt example, the prompt example includes a sample text to be analyzed and a standard reply text corresponding to the sample text to be analyzed;
[0101] A determination module 402 is used to determine the self-explanatory instruction corresponding to the text to be analyzed;
[0102] A generating module 403 is used to input the at least one prompt example, the text to be analyzed and the self-explanatory instruction into a preset large language model, so that the large language model predicts the initial response text corresponding to the text to be analyzed according to the sample text to be analyzed contained in the at least one prompt example and the standard response text corresponding to the sample text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, wherein the reason information is used to indicate the reason based on which the large language model obtains the initial response text;
[0103] The execution module 404 is used to execute a service according to the target reply text corresponding to the text to be analyzed.
[0104] Optionally, the device further comprises:
[0105] The storage module 405 is used to determine the business type corresponding to the text to be analyzed after determining that the large language model meets the preset conditions; and store the at least one prompt example, the self-explanatory instructions corresponding to the text to be analyzed, and the business type accordingly.
[0106] Optionally, the device further comprises:
[0107] Module 406 is used to obtain a question statement input by a user; determine the business type corresponding to the question statement as a target type; query the prompt example and self-explanatory instructions corresponding to the target type; input the question statement, the prompt example corresponding to the target type, and the self-explanatory instructions into a preset large language model, so that the large language model outputs the target reply text corresponding to the question statement.
[0108] Optionally, the use module 406 is specifically used to determine the business type option selected by the user in a preset operation interface, where the operation interface includes multiple business type options; and determine the business type corresponding to the question statement as the target type according to the business type option selected by the user.
[0109] Optionally, the device further comprises:
[0110] The training module 407 is used to determine a model to be trained, wherein the model scale of the model to be trained is smaller than that of the large language model; input the text to be analyzed and the reason information into the model to be trained, so that the model to be trained outputs a reply text corresponding to the text to be analyzed according to the reason information and the text to be analyzed; determine a loss value according to a deviation between a reply text corresponding to the text to be analyzed output by the model to be trained and a target reply text corresponding to the text to be analyzed generated by the large language model, wherein the deviation is positively correlated with the loss value; and train the model to be trained according to the loss value.
[0111] This specification also provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, it can be used to perform the above Figure 1 A business execution method is provided.
[0112] based on Figure 1 A service execution method shown in the embodiment of the present specification also provides Figure 5 The structural diagram of the electronic device shown in FIG. Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 A business execution method.
[0113] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0114] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0115] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0116] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0117] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0118] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0119] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0120] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0121] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0122] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0123] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0124] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0125] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0126] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0127] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0128] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0129] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. A business execution method, comprising: Obtain at least one prompt example and a text to be analyzed, wherein for each prompt example, the prompt example includes a sample text to be analyzed and a standard reply text corresponding to the sample text to be analyzed; Determine the self-explanatory instruction corresponding to the text to be analyzed; Inputting the at least one prompt example, the text to be analyzed, and the self-explanatory instruction into a preset large language model, so that the large language model predicts an initial response text corresponding to the text to be analyzed based on the sample text to be analyzed contained in the at least one prompt example and the standard response text corresponding to the sample text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, wherein the reason information is used to indicate the reason on which the large language model obtains the initial response text; Execute the service according to the target reply text corresponding to the text to be analyzed.
2. The method of claim 1, further comprising: After determining that the large language model meets the preset conditions, determining the business type corresponding to the text to be analyzed; The at least one prompt example, the self-explanatory instruction corresponding to the text to be analyzed, and the business type are correspondingly saved.
3. The method of claim 2, further comprising: Get the question sentence entered by the user; Determine the business type corresponding to the question statement as the target type; Querying prompt examples and self-explanatory instructions corresponding to the target type; The question statement, the prompt example corresponding to the target type and the self-explanatory instruction are input into a preset large language model, so that the large language model outputs the target reply text corresponding to the question statement.
4. The method according to claim 3, determining the business type corresponding to the question statement as the target type, specifically comprises: Determine a service type option selected by a user in a preset operation interface, wherein the operation interface includes a plurality of service type options; According to the business type option selected by the user, the business type corresponding to the question statement is determined as the target type.
5. The method of claim 1, further comprising: Determine a model to be trained, wherein the model scale of the model to be trained is smaller than the large language model; Inputting the text to be analyzed and the reason information into the model to be trained, so that the model to be trained outputs a reply text corresponding to the text to be analyzed according to the reason information and the text to be analyzed; Determine a loss value according to a deviation between a reply text corresponding to the text to be analyzed output by the model to be trained and a target reply text corresponding to the text to be analyzed generated by the large language model, wherein the deviation is positively correlated with the loss value; The model to be trained is trained according to the loss value.
6. A service execution device, comprising: An acquisition module, used to acquire at least one prompt example and a text to be analyzed, wherein for each prompt example, the prompt example includes a sample text to be analyzed and a standard reply text corresponding to the sample text to be analyzed; A determination module, used for determining the self-explanatory instruction corresponding to the text to be analyzed; A generating module, configured to input the at least one prompt example, the text to be analyzed, and the self-explanatory instruction into a preset large language model, so that the large language model predicts an initial response text corresponding to the text to be analyzed based on the sample text to be analyzed contained in the at least one prompt example and the standard response text corresponding to the sample text to be analyzed, and generates reason information for obtaining the initial response text through the self-explanatory instruction, so as to adjust the initial response text according to the reason information, and use the adjusted initial response text as the target response text corresponding to the text to be analyzed, wherein the reason information is used to indicate the reason on which the large language model obtains the initial response text; The execution module is used to execute the business according to the target reply text corresponding to the text to be analyzed.
7. The device of claim 5, further comprising: A storage module, configured to determine the business type corresponding to the text to be analyzed after determining that the large language model meets a preset condition; The at least one prompt example, the self-explanatory instruction corresponding to the text to be analyzed, and the business type are correspondingly saved.
8. The device of claim 5, further comprising: Use the module to obtain the question statement input by the user; Determine the business type corresponding to the question statement as the target type; Query the prompt examples and self-explanatory instructions corresponding to the target type; input the question statement, the prompt examples corresponding to the target type and the self-explanatory instructions into a preset large language model, so that the large language model outputs the target reply text corresponding to the question statement.
9. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 5.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 5 when executing the program.
