Text processing method, computing device, electronic device, and storage medium
By adjusting the initial prompt word template to generate a more suitable candidate prompt word template and selecting a target prompt word template with high response evaluation scores, the problem of poor response effect of the text processing model on specific tasks is solved, significantly improving the response accuracy and processing ability.
Patent Information
- Application Number
- CN202411950239.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In the prior art, the response effect of using text processing models to process specific tasks is poor and there is a lack of effective solutions.
By obtaining the initial prompt word text and its response results that match the initial prompt word template, adjusting the initial prompt word template based on these results, multiple candidate prompt word templates are generated, and the target prompt word template is selected by filtering until the response evaluation score of the target prompt word template is higher than the initial response result.
It significantly improves the accuracy of the text processing model's response to target prompt words, reduces the occurrence of error cases, and enables the text processing model to better understand and respond to user needs, thereby improving the processing capability of the text processing model under specific tasks.
Smart Images

Figure CN119378523B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of large model technology and text processing. Specifically, it relates to a text processing method, a computing device, an electronic device, and a storage medium. Background Art
[0002] Currently, high-quality prompt words are crucial for improving the performance of large language models (LLMs) in specific tasks. However, manually debugging prompt words not only requires rich experience but also often involves the complexity of repeated trials, resulting in the poor processing ability of large language models in specific tasks based on the manually debugged prompt words.
[0003] In response to the above problems, no effective solution has been proposed yet. Summary of the Invention
[0004] Embodiments of this application provide a text processing method, a computing device, an electronic device, and a storage medium to at least solve the technical problem of poor response effect when using a text processing model to process specific tasks in related technologies.
[0005] According to one aspect of the embodiments of this application, a text processing method is provided, including: obtaining an initial prompt word text that matches an initial prompt word template, and an initial response result corresponding to the initial prompt word text, where the initial prompt word text is used to train a text processing model, and the initial response result is the result obtained by using the text processing model to process the initial prompt word text; adjusting the initial prompt word template based on the initial response result and the initial prompt word text to obtain a plurality of candidate prompt word templates; screening the plurality of candidate prompt word templates based on the initial prompt word text to obtain a target prompt word template, where the evaluation score of the target response result corresponding to the target prompt word template is greater than the evaluation score of the initial response result, the target response result is the result obtained by using the text processing model to process the target prompt word text, and the target prompt word text matches the target response result.
[0006] According to one aspect of the embodiments of the present application, there is also provided a text processing method, including: responding to an input instruction acting on an operation interface, and displaying on the operation interface an initial prompt word text that matches an initial prompt word template, and an initial response result corresponding to the initial prompt word text, wherein the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; responding to a processing instruction acting on the operation interface, and displaying on the operation interface a target prompt word template, wherein the target prompt word template is used to represent a template obtained by screening multiple candidate prompt word templates based on the initial prompt word text, the multiple candidate prompt word templates are used to represent templates obtained by adjusting the initial prompt word template based on the initial response result and the initial prompt word text, an evaluation score of a target response result corresponding to the target prompt word template is greater than an evaluation score of the initial response result, the target response result is a result obtained by processing a target prompt word text using the text processing model, and the target prompt word text matches the target response result.
[0007] According to one aspect of the embodiments of the present application, there is also provided a text processing method, including: obtaining, by calling a first interface, an initial prompt word text that matches an initial prompt word template, and an initial response result corresponding to the initial prompt word text, wherein the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; adjusting the initial prompt word template based on the initial response result and the initial prompt word text to obtain multiple candidate prompt word templates; screening the multiple candidate prompt word templates based on the initial prompt word text to obtain a target prompt word template, wherein an evaluation score of a target response result corresponding to the target prompt word template is greater than an evaluation score of the initial response result, the target response result is a result obtained by processing a target prompt word text using the text processing model, and the target prompt word text matches the target response result; outputting the target prompt word template by calling a second interface, wherein the second interface includes a second parameter, and a parameter value of the second parameter includes the target prompt word template.
[0008] According to another aspect of the embodiments of the present application, there is also provided a text processing device, including: a parameter acquisition module, configured to acquire an initial prompt word text that matches an initial prompt word template, and an initial response result corresponding to the initial prompt word text, where the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; a first adjustment module, configured to adjust the initial prompt word template based on the initial response result and the initial prompt word text to obtain a plurality of candidate prompt word templates; a first screening module, configured to evaluate the plurality of candidate prompt word templates based on the initial prompt word text to obtain a plurality of evaluation scores corresponding to the plurality of candidate prompt word templates; a first screening module, configured to screen the plurality of candidate prompt word templates based on the plurality of evaluation scores to obtain a target prompt word template, where the evaluation score of the target response result corresponding to the target prompt word text that matches the target prompt word template is greater than the evaluation score of the initial response result, and the target response result is a result obtained by processing the target prompt word text using the text processing model.
[0009] According to one aspect of the embodiments of the present application, there is also provided a text processing device, including: a first display module, configured to respond to an input instruction acting on an operation interface and display, on the operation interface, an initial prompt word text that matches an initial prompt word template, and an initial response result corresponding to the initial prompt word text, where the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; a second display module, configured to respond to a processing instruction acting on the operation interface and display, on the operation interface, a target prompt word template, where the target prompt word template is used to represent being obtained by screening the plurality of candidate prompt word templates based on the plurality of evaluation scores corresponding to the plurality of candidate prompt word templates, the plurality of evaluation scores are used to represent being obtained by evaluating the plurality of candidate prompt word templates based on the initial prompt word text, and the plurality of candidate prompt word templates are used to represent being adjusted to the initial prompt word template based on the initial response result and the initial prompt word text.
[0010] According to one aspect of the embodiments of the present application, there is also provided a text processing device, including: a first calling module, configured to obtain an initial prompt word text that matches an initial prompt word template and an initial response result corresponding to the initial prompt word text by calling a first interface, where the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; a second adjustment module, configured to adjust the initial prompt word template based on the initial response result and the initial prompt word text to obtain a plurality of candidate prompt word templates; a second evaluation module, configured to evaluate the plurality of candidate prompt word templates based on the initial prompt word text to obtain a plurality of evaluation scores corresponding to the plurality of candidate prompt word templates; a second screening module, configured to screen the plurality of candidate prompt word templates based on the plurality of evaluation scores to obtain a target prompt word template, where an evaluation score of a target response result corresponding to a target prompt word text that matches the target prompt word template is greater than the evaluation score of the initial response result, and the target response result is a result obtained by processing the target prompt word text using the text processing model; a second calling module, configured to output the target prompt word template by calling a second interface, where the second interface includes a second parameter, and a parameter value of the second parameter includes the target prompt word template.
[0011] According to another aspect of the embodiments of the present application, there is also provided a computing device, including: a memory storing an executable program; a processor configured to run the program, where when the program runs, it executes the methods in the various embodiments of the present application.
[0012] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including: a memory storing an executable program; a processor connected to the memory through a bus and configured to run the program, where when the program runs, it executes the methods in the various embodiments of the present application.
[0013] According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, where the computer-readable storage medium includes a stored executable program, and when the executable program runs, it controls the device where the computer-readable storage medium is located to execute the methods in the various embodiments of the present application.
[0014] According to another aspect of the embodiments of the present application, there is also provided a computer program product, including a computer program, where the computer program implements the methods in the various embodiments of the present application when executed by a processor.
[0015] According to another aspect of the embodiments of the present application, there is also provided a computer program product, including a non-volatile computer-readable storage medium storing a computer program, where the computer program implements the methods in the various embodiments of the present application when executed by a processor.
[0016] According to another aspect of the embodiments of the present application, there is also provided a computer program which, when executed by a processor, implements the methods in the various embodiments of the present application.
[0017] In the embodiments of the present application, the method includes obtaining an initial prompt word text that matches an initial prompt word template and an initial response result corresponding to the initial prompt word text; adjusting the initial prompt word template based on the initial response result and the initial prompt word text to obtain a plurality of candidate prompt word templates; and screening the plurality of candidate prompt word templates based on the initial prompt word text to obtain a target prompt word template. By dynamically adjusting the initial prompt word template according to the initial response result and the initial prompt word text to obtain a plurality of candidate prompt word templates, and selecting the target prompt word template from the plurality of candidate prompt word templates according to the initial prompt word text, the response accuracy of the text processing model to the target prompt word can be significantly improved, the occurrence of error cases can be reduced, the text processing model can better understand and respond to the user's needs, thereby improving the processing ability of the text processing model in specific tasks, and further solving the technical problem of poor response effect when using the text processing model to process specific tasks in the related art.
[0018] It is easy to note that the above general description and the following detailed description are only for exemplifying and explaining the present application, and do not constitute a limitation to the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation to the present application. In the drawings:
[0020] Figure 1 is a hardware structure block diagram of an electronic device (or mobile device) for implementing a text processing method according to an embodiment of the present application;
[0021] Figure 2 is a flowchart of a text processing method according to an embodiment of the present application;
[0022] Figure 3a is a schematic diagram of the first part of a text processing process according to an embodiment of the present application;
[0023] Figure 3b is a schematic diagram of the second part of a text processing process according to an embodiment of the present application;
[0024] Figure 3c is a schematic diagram of the third part of a text processing process according to an embodiment of the present application;
[0025] Figure 3dIt is a schematic diagram of the fourth part of a text processing process shown according to an embodiment of the present application;
[0026] Figure 4 It is a flowchart of another text processing method shown according to an embodiment of the present application;
[0027] Figure 5 It is a flowchart of another text processing method shown according to an embodiment of the present application;
[0028] Figure 6 It is a structural block diagram of a text processing device shown according to an embodiment of the present application;
[0029] Figure 7 It is a structural block diagram of another text processing device shown according to an embodiment of the present application;
[0030] Figure 8 It is a structural block diagram of another text processing device shown according to an embodiment of the present application;
[0031] Figure 9 It is a structural block diagram of a computing device shown according to an embodiment of the present application;
[0032] Figure 10 It is a structural block diagram of an electronic device shown according to an embodiment of the present application. Detailed implementation manners
[0033] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0035] The technical solution provided by this application is mainly implemented using large model technology. Here, a large model refers to a deep learning model with a large number of model parameters, usually including hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than one quadrillion model parameters. A large model can also be referred to as a Foundation Model. Through pre-training of the large model with a large amount of unlabeled corpus, a pre-trained model with more than one billion parameters is produced. This model can adapt to a wide range of downstream tasks and has good generalization ability. For example, large language models (LLMs), multi-modal pre-training models, etc.
[0036] It should be noted that in actual applications, the pre-trained model can be fine-tuned with a small number of samples so that the large model can be applied to different tasks. For example, large models can be widely applied in the fields of natural language processing (NLP), computer vision, speech processing, etc. Specifically, they can be applied to tasks in the field of computer vision such as visual question answering (VQA), image captioning (IC), image generation, etc., and can also be widely applied to tasks in the field of natural language processing such as text-based sentiment classification, text summary generation, machine translation, etc. Therefore, the main application scenarios of large models include but are not limited to digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc. In the embodiments of this application, an example of data processing on a prompt template in a model training scenario is used for explanation.
[0037] First, some nouns or terms that appear in the process of describing the embodiments of this application are applicable to the following explanations:
[0038] Beam Search: A greedy search algorithm that retains a candidate list ("beam") with better processing capabilities, such as accuracy greater than a preset threshold, at each step of the selection, balancing the requirements of search accuracy and computing resources.
[0039] Monte Carlo Tree Search: MCTS, a decision-making process algorithm that estimates the potential rewards of each action by simulating random games starting from the current state. This algorithm mainly consists of four steps: Selection, Expansion, Simulation, and Backpropagation. In each step, the decision tree is gradually optimized by statistical simulation results to select the action with the highest expected reward.
[0040] According to an embodiment of the present application, a text processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0041] Considering that the number of model parameters of the large model is huge and the computing resources of the mobile terminal are limited, the above method provided by the embodiment of the present application can be applied to Figure 1 the application scenarios shown, but not limited thereto. Figure 1 is a hardware structure block diagram of an electronic device (or mobile device) for implementing the text processing method shown according to an embodiment of the present application. In Figure 1 the application scenarios shown, the large model is deployed in the server 10. The server 10 can be connected to one or more client devices 20 through a local area network connection, a wide area network connection, an Internet connection, or other types of data networks. Here, the client devices 20 can include but are not limited to: smart phones, tablets, laptop computers, palmtop computers, personal computers, smart home devices, in-vehicle devices, etc. The client device 20 can interact with the user through a graphical user interface to realize the invocation of the large model, and further realize the method provided by the embodiment of the present application.
[0042] In the embodiment of the present application, the system composed of the client device and the server can execute the following steps: The client device executes to obtain the initial prompt word text matching the initial prompt word template and the initial response result corresponding to the initial prompt word text, and outputs the target prompt word template. The server executes to adjust the initial prompt word template based on the initial response result and the initial prompt word text to obtain multiple candidate prompt word templates, and filters the multiple candidate prompt word templates based on the initial prompt word text to obtain the target prompt word template.
[0043] It should be noted that with the rapid development of high-performance computing units, in other application scenarios, the above method provided by the embodiments of the present application can also be applied to model all-in-ones. In an alternative embodiment, multiple models are built into the model all-in-one, and users can select a model for adjustment as needed to obtain their own model. Thus, the high-performance computing unit built into the model all-in-one can directly call the adjusted model to execute the above method provided by the embodiments of the present application. In another alternative embodiment, a trained model is built into the large model all-in-one. Thus, the high-performance computing unit built into the model all-in-one can directly call this model to execute the above method provided by the embodiments of the present application.
[0044] Furthermore, when a user needs to train their own model, they can also upload their own dataset through the client. This dataset is sent from the client to the server, enabling the server to adjust the pre-trained model with this dataset to obtain the user's own model, which is then deployed to the production environment. To facilitate the user's model adjustment requirements, the server can provide complete adjustment tools, development frameworks, and processes, and support multiple adjustment strategies, enabling the adjusted model to better adapt to different field applications and achieve high customization.
[0045] In the above operating environment, the present application provides a Figure 2 text processing method as shown. Figure 2 is a flowchart of a text processing method shown according to an embodiment of the present application. As Figure 2 shown, the method may include the following steps:
[0046] Step S202, obtain an initial prompt word text that matches an initial prompt word template, and an initial response result corresponding to the initial prompt word text.
[0047] Among them, the initial prompt word text is used to train a text processing model, and the initial response result is the result obtained by processing the initial prompt word text using the text processing model.
[0048] The above initial prompt word text may refer to the text used to train the processing ability of the text processing model for a specific task, which can be used to guide the text processing model to generate outputs of a specific type or specific content, and may include, but is not limited to: description texts of scenarios corresponding to specific tasks, text processing instructions constructed for specific tasks, etc. The content can be simple statements or complex text paragraphs. The specific setting of the initial prompt word text can be determined by the user according to the actual situation and is not limited here. The above initial response result may refer to the processing situation of the text processing model on the initial prompt word text after the initial prompt word text is input into the text processing model, which can be used to judge the processing ability of the text processing model for a specific task.
[0049] In an alternative solution of this embodiment, considering that before using a text processing model to process a specific type of task, it is usually necessary to first use a large number of prompt texts related to the specific task to guide the processing direction of the text processing model, thereby improving the processing ability of the text processing model for the specific task. However, the process of constructing prompt texts for a specific task may consume a large amount of time resources. Therefore, in order to improve the efficiency of generating prompt texts, the text processing system can usually construct corresponding prompt templates for specific tasks and use the prompt module to quickly generate prompt texts related to the specific task by means of vocabulary filling, thereby improving the efficiency of training the text processing model using the prompt texts. However, considering that in the actual process of generating prompt texts, the text processing system may generate prompt texts with a relatively low relevance to the specific task through the prompt template, resulting in the generated prompt texts being texts that the text processing system cannot understand. As a result, the processing ability of the text processing model for the generated prompt texts is poor, such as low processing accuracy or low processing efficiency. This means that the template used to generate prompt texts may have problems such as logical confusion and poor adaptability. Based on this, in order to improve the processing ability of the text processing model for specific tasks, the text processing system can adjust the used prompt template in real time during the process of training the text processing model using the prompt texts to ensure the matching degree of the prompt texts generated through the prompt template with the specific task, and at the same time ensure the logic and accuracy of the generated prompt texts. Correspondingly, when optimizing the prompt template, the text processing system can first obtain the prompt template currently used in the process of training the text processing model, that is, the above-mentioned initial prompt template, and the initial prompt generated through this initial prompt template. In order to be able to show the processing situation of the text processing model for different initial prompts and adaptively adjust the currently used initial prompt template according to the processing situation of the initial prompts, the text processing system can also obtain the initial response result corresponding to the initial prompt text after the initial prompt text is processed by the text processing model.
[0050] Step S204: Based on the initial response result and the initial prompt text, adjust the initial prompt template to obtain multiple candidate prompt templates.
[0051] In an alternative solution of this embodiment, considering that the initial response result matching the initial prompt text can reflect the processing situation of the text processing model for the initial prompt text, and according to the processing situations of different initial prompt texts, the prompt generation ability of the initial prompt template used to generate the initial prompt text can be reflected. For example, it can reflect the statement logic ability of the initial prompt template and the adaptability to different words in different scenarios. Therefore, in order to reasonably optimize the currently used initial prompt template, after obtaining the corresponding initial prompt text and initial response result, the text processing system can use the initial response result and the initial prompt text to analyze possible problems of insufficient vocabulary generation ability in the initial prompt template, and then adjust the initial prompt template according to the analyzed problems, so as to obtain multiple candidate prompt templates with stronger prompt generation ability. The text processing system can select a template with a higher prompt generation understanding ability from the constructed multiple candidate prompt templates as the final template for generating prompts, so as to ensure that the text processing model can stably and accurately respond to the generated prompt text, and further improve the text processing ability of the text processing model.
[0052] Among them, in order to ensure the robustness of the generated multiple candidate prompt templates, a preset large language model (LLM) can be used to process the above initial response result and initial prompt text to generate corresponding multiple candidate prompt templates.
[0053] Step S206: Screen the multiple candidate prompt templates based on the initial prompt text to obtain a target prompt template.
[0054] Among them, the evaluation score of the target response result corresponding to the target prompt template is greater than the evaluation score of the initial response result. The target response result is the result obtained by processing the target prompt text using the text processing model, and the target prompt text matches the target response result.
[0055] In an alternative solution of this embodiment, as shown above, considering that there may be problems such as logical confusion and poor adaptability in the initial prompt template, resulting in poor prompt generation ability of the initial prompt template, and further resulting in poor processing ability of the text processing model trained based on the initial prompt template in specific tasks. Therefore, in order to improve the processing ability of the text processing model in specific tasks, the text processing system needs to select a target prompt template with relatively high prompt generation ability as much as possible, and avoid the text problems that appear in the initial prompt template in the target prompt template. Considering that the initial prompt text generated using the initial prompt template can exactly reflect the problems that appear in the initial prompt template, therefore, in order to accurately screen out a suitable target prompt template from multiple candidate prompt templates, when the text processing system selects a target prompt template from multiple candidate prompt templates, it can introduce the above-mentioned initial prompt text to summarize the reasons for the above problems in the initial prompt template based on the initial prompt text, and then use the summarized reasons to screen the above-mentioned multiple candidate prompt templates, so as to ensure that the selected target prompt template will not have the problems existing in the initial prompt template, and further ensure the prompt generation ability of the selected target prompt template.
[0056] In an alternative solution of this embodiment, considering the prompt generation ability of different prompt templates, it can also be reflected from the response results of the text processing model to the prompt texts corresponding to different prompt templates. For example, if the text processing model has a high response accuracy and fast response efficiency to prompt text A, it can be considered that the training effect of using prompt text A on the text processing model is good. Correspondingly, it can also be considered that the text processing model has good processing ability for the specific task corresponding to prompt text A, and the prompt generation ability of the prompt template A used to generate prompt text A is relatively high. Therefore, in order to screen out a suitable target prompt template, the text processing system can start from the response results output by the text processing model and evaluate the response results corresponding to different candidate prompt templates, such as evaluating the accuracy and response efficiency of different response results, to obtain the evaluation scores of different response results, and at the same time evaluate the previously obtained initial response results to obtain the evaluation score of the initial response results. Then, from multiple candidate prompt templates, initially screen out the first template whose corresponding response result evaluation score is greater than the evaluation score of the initial response result. Finally, determine the above-mentioned target prompt template from the initially screened first templates, so as to ensure that the evaluation score of the template response result corresponding to the selected target prompt template can be greater than the evaluation score of the initial response result, that is, to ensure that the prompt generation ability of the selected target prompt template can be higher than the prompt generation ability of the initial prompt template.
[0057] In the embodiments of the present application, an initial prompt word text that matches an initial prompt word template is obtained, as well as an initial response result corresponding to the initial prompt word text; based on the initial response result and the initial prompt word text, the initial prompt word template is adjusted to obtain a plurality of candidate prompt word templates; based on the initial prompt word text, the plurality of candidate prompt word templates are screened to obtain a target prompt word template. By dynamically adjusting the initial prompt word template according to the initial response result and the initial prompt word text to obtain a plurality of candidate prompt word templates, and selecting a target prompt word template from the plurality of candidate prompt word templates according to the initial prompt word text, the response accuracy of the text processing model to the target prompt word can be significantly improved, the occurrence of error cases is reduced, so that the text processing model can better understand and respond to the needs of users, thereby improving the processing ability of the text processing model in specific tasks, and further solving the technical problem of poor response effect when using the text processing model to process specific tasks in the related art.
[0058] In the embodiments of the present application, based on the initial response result and the initial prompt word text, the initial prompt word template is adjusted to obtain a plurality of candidate prompt word templates, including: determining error cases from the initial prompt word text, where the accuracy of the initial response result corresponding to the error case is less than a preset threshold; based on the initial prompt word text and the error cases, the initial prompt word template is adjusted to obtain a plurality of candidate prompt word templates.
[0059] The above-mentioned error cases may refer to prompt word texts in the initial prompt word text generated by the initial prompt word template that the text processing model cannot understand or cannot accurately respond to. The above-mentioned preset threshold may refer to a threshold for determining whether different initial prompt word texts are error cases. In order to improve the universality of determining error cases, the above-mentioned preset threshold may be a preset accuracy threshold. Correspondingly, the accuracy of the initial response result corresponding to the error case is usually less than the preset threshold. It should be noted that, in addition to the accuracy, the above-mentioned preset threshold may also be parameters such as the efficiency and recall rate of the text processing model outputting the initial response result. The specific type, size and other parameters of the preset threshold can be set by the user according to the actual situation and are not limited herein.
[0060] In an alternative solution of this embodiment, considering that the initial prompt text generated by the initial prompt template is usually a prompt text that matches a specific task, and when the text processing model fails to understand the prompt text, it means that there may be certain text problems in the prompt text, such as the aforementioned problems of logical confusion and poor adaptability. By analyzing the prompt text, the problems existing in the initial prompt template can usually be determined, so that the text processing system can better adjust the initial prompt template. Based on this, when adjusting the initial prompt template, the text processing system can first determine the above-mentioned error cases from the initial prompt text according to the initial response results corresponding to different prompt texts. For example, the prompt text with an accuracy of the initial response result less than the preset threshold can be determined as an error case that can reflect the problems existing in the initial prompt template. After determining the error cases, the text processing system can analyze the error cases to adjust the initial prompt template using the error cases. Considering that the initial prompt text not only contains error cases but also may contain many correct cases that the text processing model can accurately respond to, and these correct cases can reflect the accurate logical relationships included in the initial prompt template. Therefore, when adjusting the initial prompt template using the error cases, the corresponding initial prompt text can also be introduced to adjust the initial prompt template to obtain multiple candidate prompt templates by using both the initial prompt text and the error cases included in the initial prompt text. For example, the text processing system can first determine multiple correct cases from the initial prompt text according to the accuracy rates corresponding to different initial prompt texts, and then extract the features of the determined multiple correct cases to obtain the case features of different correct cases in multiple dimensions such as structure and semantics. By summarizing the case features of different correct cases, the text processing system can preliminarily determine the correct part of the initial prompt template that can correctly generate the prompt text related to a specific task and the first error part that cannot correctly generate the prompt text related to a specific task. The determined correct part can be regarded as the part that can be retained in the initial prompt template. Similarly, the text processing system can extract the features of multiple error cases from multiple dimensions and summarize the extracted features. According to the features of the summarized error cases, the text processing system can determine the corresponding second error part from the initial prompt template. Finally, by combining the first error part and the second error part, the target error part that actually needs to be modified can be determined from the initial prompt template. Correspondingly, the text processing system can modify the target error part to obtain the above-mentioned multiple candidate prompt templates.
[0061] In the embodiments of the present application, the initial prompt word template is adjusted based on the initial prompt word text and error cases to obtain multiple candidate prompt word templates, including: analyzing the initial prompt word text to determine the error reason for the error case in the initial prompt word template; determining the fragment to be modified from multiple template fragments included in the initial prompt word template based on the error reason; modifying the fragment to be modified based on the error reason to obtain multiple target fragments; and adjusting the initial prompt word template based on the multiple target fragments to obtain multiple candidate prompt word templates.
[0062] In an alternative solution of this embodiment, when adjusting the initial prompt word template using the initial prompt word text and error cases, since the initial prompt word text can include error cases and correct cases, and the error cases and correct cases can reflect the incorrect and normal logical relationships included in the initial prompt word template. Based on this, to ensure the accuracy when adjusting the initial prompt word template and avoid incorrect adjustment directions, the text processing system can first analyze the obtained initial prompt word template to determine the reason for the corresponding error cases in the initial prompt word template, that is, analyze the above-mentioned error reasons. Then, according to the error reasons, determine the segments that need to be modified from the multiple template segments included in the initial prompt word template, that is, the above-mentioned segments to be modified. Among them, to ensure the accuracy of the determined error reasons, the text processing system can first obtain the initial response result corresponding to the error case, and compare the initial response result with the error case to determine the part that the text processing model cannot accurately understand from the error case. Then, according to the corresponding description content in this part of the initial prompt word template, analyze the above-mentioned error reasons. For example, assume that the error case is "output the search results corresponding to an 'XX' information", and the initial response result is "output multiple search results corresponding to an 'XX' information at once". By comparing the error case and the initial response result, the text processing system can determine that what the text processing model cannot understand is the "text output part" in the initial prompt word template. Based on this, the determined error reasons can include, but are not limited to: the "text output part" is in an area prone to being forgotten, and the text processing model does not consider the output quantity when outputting the result; there is missing or incomplete information in the "text output part", resulting in the text processing model being unable to accurately understand the specific content of the "output part" in the error case; the field involved in the "text output part" is different from the application field of the text processing model, resulting in the text processing model ignoring the specific content of the "output part". After determining the segment that needs to be modified currently, the text processing system can then modify the segment to be modified in a targeted manner in combination with the currently analyzed error reasons to obtain multiple segments that can initially solve the error reason, that is, the above-mentioned multiple target segments. Finally, adjust the above-mentioned initial prompt word template according to the multiple target segments, and use the modified target segments to replace the original segments to be modified, so as to obtain multiple candidate prompt word templates with higher accuracy.
[0063] Among them, to ensure the logic of the determined segments to be modified, the text processing system can divide the initial prompt word template according to the logical relationships corresponding to different positions in the initial prompt word template to obtain multiple template segments. To improve efficiency, considering that the logical relationship of a single paragraph or sentence is usually complete, therefore, the text processing system can directly divide the multiple sentences or paragraphs included in the initial prompt word template into different template segments.
[0064] In the embodiment of the present application, the fragment to be modified is modified based on the error reason to obtain multiple target fragments, including: obtaining the model metrics corresponding to the initial prompt template and the fragment position of the fragment to be modified in the initial prompt template, where the model metrics are used to reflect the performance of the text processing model in executing tasks based on the initial prompt template; adjusting the fragment to be modified based on the fragment position, the error reason, and the model metrics to obtain multiple target fragments.
[0065] In an alternative solution of this embodiment, considering that whether in the model training stage or the model deployment stage, fully understanding the performance of the model in different scenarios is crucial for ensuring that the model can accurately and efficiently complete the expected tasks. Therefore, when using the error reason to modify the fragment to be modified, in order to ensure the accuracy of the modification direction, the text processing system can first determine the model performance of the text processing model under the initial prompt template, such as the performance of the text processing model in executing a specific task under the initial prompt template, that is, obtaining the model metrics corresponding to the initial prompt template, such as metrics like accuracy and processing efficiency. At the same time, considering that the text processed by the text processing model is usually long-sequence text, during text processing, the model may have difficulty maintaining long-term memory of all information in the entire input text, resulting in the phenomenon of information forgetting, which affects the processing ability of the model. And whether information will be forgotten usually depends on the position of the information in the input text. Therefore, the text processing system can also obtain the fragment position of the currently determined fragment to be modified in the initial prompt template to determine whether additional attention weights need to be assigned during the fragment modification process, so as to avoid incorrect modification directions, resulting in the existence of the original problems in the multiple target fragments obtained by the modification, or the emergence of new problems that will affect the prompt word generation process. After determining the above model metrics and fragment positions, the text processing system can further adjust the fragment to be modified based on the analyzed error reason, combined with the corresponding model metrics and fragment positions, so as to obtain multiple target fragments that can generate prompt word text more stably.
[0066] In the embodiments of the present application, the fragment to be modified is adjusted based on the fragment position, error reason, and model metrics to obtain multiple target fragments, including: modifying the fragment to be modified based on the error reason and model metrics to obtain multiple first fragments; identifying the fragment position to determine the fragment type of the fragment to be modified; in response to the fragment type being the first preset type, determining the multiple first fragments as the multiple target fragments; in response to the fragment type being the second preset type, generating second fragments corresponding to different first fragments based on the multiple first fragments and the fragment to be modified, and constructing multiple target fragments based on the multiple first fragments and the second fragments, where the attention weight of the fragment to be modified corresponding to the first preset type is greater than the attention weight of the fragment to be modified corresponding to the second preset type, and the second fragments are used to represent the differences between different first fragments and the fragment to be modified.
[0067] In an alternative solution of this embodiment, when adjusting the segment to be modified according to the determined segment position, error reason, and model metric, the text processing system can first modify the segment to be modified by using the determined error reason and model metric to obtain multiple first segments that can initially solve the corresponding error reason and improve the model metric. Considering that if the segment to be modified is in the forgettable area, such as the middle area of the template, it means that more attention weights need to be assigned to the segment to be modified to ensure that the modified segment can be better applied in the process of prompt generation to ensure the accuracy of the generated prompt text. Therefore, while constructing multiple first segments, the text processing system can also identify the segment type of the segment to be modified according to the determined segment position to determine whether the segment to be modified is a segment in the forgettable area. Correspondingly, if the segment type of the segment to be modified is the first preset type, that is, the segment to be modified is not in the forgettable area, the text processing system can directly determine the generated multiple first segments as multiple target segments without the need to assign more attention weights to the multiple first segments; if the segment type of the segment to be modified is the second preset type, that is, the segment to be modified is in the forgettable area, the text processing system can consider assigning more attention weights to the generated multiple first segments. Considering that attention weights are usually set in the text processing model, if the parameters of the text processing model are adjusted, it may take a lot of time to adjust the overall model training process and model parameters, resulting in a large time cost. Therefore, to reduce the cost of training the text processing model using the prompt template, the text processing system can set additional text descriptions for the generated multiple first segments in a way that the text processing model can understand, so that when the text processing model is trained using the prompt text corresponding to the modified prompt template, it can understand the result of adjusting the segment to be modified through the additional text description, thereby better responding to the modified first segment. Based on this, if the type of the segment to be modified is the second preset type, the text processing system can construct a second segment corresponding to the first segment that can reflect the modification result according to the difference between the segment to be modified and the first segment, and then construct corresponding multiple target segments according to the generated multiple first segments and the corresponding second segments.
[0068] In the embodiments of the present application, the initial prompt word template is adjusted based on multiple target segments to obtain multiple candidate prompt word templates, including: updating the initial prompt word template with multiple target segments to obtain multiple first prompt word templates; verifying multiple first prompt word templates to obtain verification results corresponding to different first prompt word templates, where the verification results are used to characterize whether different first prompt word templates conform to the preset language logic rules; in response to the verification results indicating that multiple first prompt word templates conform to the language logic rules, determining multiple first prompt word templates as multiple candidate prompt word templates; in response to the verification results indicating that any one of the first prompt word templates does not conform to the language logic rules, re-determining new segments to be modified, and constructing new multiple first prompt word templates based on the new segments to be modified until the verification results of the new multiple first prompt word templates indicate that the new multiple first prompt word templates conform to the language logic rules, or the number of times of re-determining new segments to be modified reaches a preset value, determining the new multiple first prompt word templates as multiple candidate prompt word templates.
[0069] In an alternative solution of this embodiment, when using the constructed multiple target segments to adjust the initial prompt word template, the text processing system may first update the initial prompt word template with multiple target segments to obtain the above-mentioned multiple first prompt word templates. For example, if the multiple target segments only contain multiple first segments, it means that the corresponding segment to be modified is not in the forgettable area. The corresponding text processing system can directly use these multiple first segments to replace the segment to be modified without worrying about the situation that the text processing model will not notice the modification result. If the multiple target segments contain both multiple first segments and second segments corresponding to different first segments, it means that the corresponding segment to be modified is in the forgettable area. At this time, the text processing system can first use these multiple first segments to replace the segment to be modified to generate multiple new prompt word templates, and then add the second segments corresponding to the first segments to the non-forgettable area included in the new prompt word templates, such as adding them to the beginning or end of the new prompt word templates, to obtain multiple first prompt word templates, so that the text processing model can notice the first segments in the forgettable area by noticing the second segments in the non-forgettable area, and thus focus on understanding the difference between the first segments and the segment to be modified. After obtaining multiple first prompt word templates, in order to improve the rationality of the generated prompt word templates, the text processing system can also verify different first prompt word templates to determine whether different first prompt word templates conform to the preset language logic rules, so as to obtain verification results corresponding to different prompt word templates. Among them, when performing verification, it is possible to detect all variable placeholders included in the generated new templates to avoid the occurrence of words that cannot be configured in the templates or the occurrence of logical confusion.
[0070] Correspondingly, if the verification result shows that multiple first prompt word templates all conform to the preset language logic rules, the text processing system can directly determine multiple candidate prompt word templates from these multiple first prompt word templates; if the verification result shows that there are templates among the multiple first prompt word templates that do not conform to the preset language logic rules, the text processing system can, according to the foregoing process, re-determine a new fragment to be modified from the initial prompt word templates, and construct a new set of multiple first prompt word templates based on the new fragment to be modified, until the newly constructed prompt word templates can meet the preset language logic rules, or when the number of times of re-determining the fragment to be modified reaches a preset value, the new set of multiple first prompt word templates corresponding to the re-determined fragment to be modified is determined as multiple candidate prompt word templates. It should be noted that the newly determined fragment to be modified each time can be the same, but the newly determined first prompt word templates based on the new fragment to be modified need to be different from the previously constructed first prompt word templates, so as to avoid repeatedly constructing the same prompt word templates, which may affect the efficiency of constructing candidate prompt word templates.
[0071] In the embodiment of the present application, screening multiple candidate prompt word templates based on the initial prompt word text to obtain target prompt word templates includes: adjusting the initial prompt word text based on multiple candidate prompt word models to obtain multiple candidate prompt word texts; evaluating the text response results corresponding to the multiple candidate prompt word texts based on multiple evaluation dimensions to obtain multiple dimension evaluation results corresponding to different text response results, where different text response results are used to represent the results obtained by processing different candidate prompt word texts using a text processing model; summarizing the multiple dimension evaluation results to obtain evaluation scores corresponding to different text response results; and screening the multiple candidate prompt word templates based on the evaluation scores corresponding to different text response results to obtain target prompt word templates.
[0072] The above-mentioned multiple evaluation dimensions can refer to parameters that can reflect the prompt word generation capabilities of different candidate prompt word templates. For example, they can include but are not limited to: parameters such as the accuracy, recall rate, and response efficiency of the text response results corresponding to different candidate prompt word templates.
[0073] In an alternative solution of this embodiment, in order to be able to screen out a suitable target prompt word template from multiple candidate prompt word templates, the text processing system can first adjust the content related to the prompt word template in the initial prompt word text, such as fixed prompt words, template formats, etc., according to the constructed multiple candidate prompt word templates, to generate candidate prompt word texts corresponding to different candidate prompt word templates. Then, the generated candidate prompt word texts are input into the text processing model to use the text processing model to process different candidate prompt word texts to obtain text response results corresponding to different candidate prompt word texts. Then, under the above multiple evaluation dimensions, different text response results are evaluated to obtain dimension evaluation results of different text response results in different evaluation dimensions, such as the above accuracy, recall rate, response efficiency, etc. Finally, the dimension evaluation results corresponding to different text response results are summarized to obtain evaluation scores corresponding to different text response results. For example, the text processing system can represent the dimension evaluation results of the text response results under different evaluation dimensions in the form of percentages, and then perform weighted summation on the percentages corresponding to different evaluation dimensions to obtain a score that can reflect the prompt word generation ability of different candidate prompt word templates, that is, the above evaluation score. After generating the evaluation scores corresponding to different candidate prompt word templates, the text processing system can screen out the above target prompt word template from multiple candidate prompt word templates according to the evaluation scores.
[0074] In the embodiment of the present application, based on multiple candidate prompt word models, the initial prompt word text is adjusted to obtain multiple candidate prompt word texts, including: extracting features of error cases included in the initial prompt word text to obtain case features of the error cases; filling multiple candidate prompt word templates based on the case features to obtain multiple candidate prompt word texts.
[0075] In an alternative solution of this embodiment, considering that the purpose of constructing the candidate prompt word template is to solve the problems existing in the initial prompt word template, therefore, the text processing system can first extract features of the error cases included in the initial prompt word text to obtain case features of the error cases, and then use the extracted case features to fill multiple candidate prompt word templates respectively to obtain candidate prompt word texts corresponding to different candidate prompt word templates. Among them, in order to be able to clearly reflect whether there are still problems existing in the initial prompt word template in the constructed candidate prompt word template, when extracting features of the error cases, the text processing system can extract the content that can be modified included in the error cases, such as the text actively input by the user, and then fill the extracted content according to the template format given by the candidate prompt word template, so as to generate the above candidate prompt word template without changing the original meaning of the error case and without introducing possible problems in the initial prompt word template.
[0076] In an embodiment of the present application, multiple candidate prompt templates are screened based on the evaluation scores corresponding to different text response results to obtain a target prompt template, including: sorting multiple candidate prompt templates based on the evaluation scores corresponding to different text response results to obtain a sequence of prompt templates; selecting multiple second prompt templates from the sequence of prompt templates according to a preset method, where the evaluation score of any one of the second prompt templates is greater than the evaluation scores of other prompt templates in the sequence of prompt templates except for the multiple second prompt templates; obtaining historical evaluation data corresponding to the multiple second prompt templates; and selecting a target prompt template from the multiple second prompt templates based on the historical evaluation data.
[0077] In an alternative solution of this embodiment, when screening multiple candidate prompt templates, to ensure the accuracy of the selected target prompt template, the text processing system may first sort the multiple candidate prompt templates according to the multiple evaluation scores corresponding to different candidate prompt templates to obtain the above-mentioned sequence of prompt templates in descending order, and then select multiple second prompt templates from the sequence of prompt templates according to a preset method, such as selecting the first n or the first n% of the templates in the sequence. To ensure the precision of the determined target prompt template, the text processing system may also obtain the historical evaluation data corresponding to the selected multiple second prompt templates, such as the evaluation data corresponding to different second prompt templates in the process of determining the first prompt template in each iteration, and finally select the above-mentioned target prompt template from the multiple second prompt templates based on the obtained historical evaluation data.
[0078] In an embodiment of the present application, after screening multiple candidate prompt templates based on the initial prompt text to obtain a target prompt template, the method further includes: outputting the target prompt template in response to the evaluation score of the target response result meeting a preset evaluation condition; and in response to the evaluation score of the target response result not meeting the preset evaluation condition, regenerating multiple new candidate prompt templates based on the initial response result, the initial prompt text, and the initial prompt template according to a preset iterative algorithm, and screening the multiple new prompt templates based on the initial prompt text until the evaluation score of the newly selected target prompt template meets the preset evaluation condition, and outputting the new target prompt template.
[0079] The above-mentioned preset evaluation condition may refer to a condition that can reflect the user's requirements for the target prompt template. For example, it may be whether the processing ability of the text processing model for the target prompt text generated by the target prompt template is high, whether errors will occur, and whether the processing efficiency is fast, etc. These requirements can be reflected by the evaluation score corresponding to the target prompt template.
[0080] In an alternative solution of this embodiment, considering that the selected target prompt word template through the foregoing process can initially solve the potential problems in the initial prompt word template, and the evaluation score can also reflect that the prompt word generation ability of the target prompt word template is relatively high, but it may not meet the actual needs of the user. Therefore, when determining the target prompt word template, the text processing system can also receive the requirement content related to the target prompt word template input by the user, and generate the above-mentioned preset evaluation conditions according to the received requirement content. After determining the target prompt word template, the text processing system can further match the evaluation score of the above-mentioned target response result with the preset evaluation conditions. If the target response result meets the preset evaluation conditions, the text processing system can determine that the current target prompt word template can meet the user's needs, and correspondingly display the target prompt word template in the operation interface; if the template response result does not meet the preset evaluation conditions, the text processing system can follow the preset iterative algorithm, such as the Beam Search or Monte Carlo Tr10 Search algorithm, to construct multiple new candidate prompt word templates based on the above-mentioned initial response result, initial prompt word text, and initial prompt word template, and re-screen these multiple new candidate prompt word templates using the initial prompt word text according to the foregoing process until the evaluation score corresponding to the newly selected target prompt word template can meet the above-mentioned preset evaluation conditions, then the text processing system can output the new target prompt word template. If a target prompt word template that can meet the above-mentioned preset evaluation conditions cannot be obtained after multiple iterative loops, the text processing system can determine the target prompt word template with the largest corresponding evaluation score among the multiple determined target prompt word templates as the final template and output it.
[0081] For ease of understanding, the entire text processing process can be roughly divided into four parts. The first part is the template generation part, which can be used to generate multiple candidate prompt word templates. The second part is the preliminary screening part, which can be used to screen out multiple second prompt word templates from the multiple candidate prompt word templates. The third part is the secondary screening part, which can be used to screen out the target prompt word template from the multiple second prompt word templates. The fourth part is the iterative screening part, which can be used to repeat the entire process of determining the target prompt word template to ensure the accuracy of the finally determined target prompt word template.
[0082] Figure 3a is a schematic diagram of the first part of a text processing process shown according to an embodiment of the present application, as Figure 3aAs shown, in the first part, the text processing system can first obtain the initial prompt word template and the corresponding initial prompt word text. For example, it can obtain text such as the scene description text and error cases generated under the initial prompt word template, and then analyze the initial prompt word text to determine the error reasons for the error cases in the initial prompt word text, the fragments to be modified that need to be modified, and at the same time determine the fragment positions of the fragments to be modified. Then, according to data such as the error reasons and model performance, the fragments to be modified are initially modified to obtain multiple first fragments, and through the fragment positions of the fragments to be modified, it is judged whether the fragment type of the fragment to be modified is the second preset type, that is, it is judged whether the fragment to be modified is in the easy-to-forget area. If not, the text processing system can directly use the multiple first fragments to adjust the initial prompt word template to obtain multiple first prompt word templates; if so, the text processing system can generate a second fragment for describing the modified content according to the difference between the first fragment and the fragment to be modified, and then use the first fragment and the corresponding second fragment to adjust the initial prompt word template to obtain multiple first prompt word templates. After generating multiple first prompt word templates, the text processing system can also verify these multiple first prompt word templates to determine whether the first prompt word templates conform to the preset language logic rules. If the verification passes, these multiple first prompt word templates can be determined as multiple candidate prompt word templates, and when the number of iterations has not reached the maximum number, continue to construct new first prompt word templates; if the verification fails, the fragments to be modified can be re-determined through the above process, the first fragments can be re-constructed, and the first prompt word templates can be re-constructed to ensure the accuracy of the determined candidate prompt word templates. After determining multiple candidate prompt word templates, the second part can be started to preliminarily screen the multiple candidate prompt words.
[0083] Figure 3b is a schematic diagram of the second part of a text processing process shown according to an embodiment of the present application, as Figure 3b shown, in the second part, the text processing system can first preliminarily screen multiple candidate prompt word templates. For example, it can first evaluate different candidate prompt word templates according to the prompt word text to obtain corresponding multiple evaluation scores, and then sort these multiple prompt word templates according to the multiple evaluation scores corresponding to different candidate prompt word templates to obtain a corresponding prompt word template sequence, and then select multiple second prompt word templates from the prompt word template sequence in a preset manner.
[0084] Figure 3c is a schematic diagram of the third part of a text processing process shown according to an embodiment of the present application, as Figure 3cAs shown, in the third part, in order to ensure the accuracy of the target prompt word template determined from multiple second prompt word templates, the text processing system may obtain the historical evaluation data corresponding to different second prompt word templates, and select the template with better prompt word generation ability from the multiple second prompt word templates according to the historical evaluation data to be used as the above-mentioned target prompt word template.
[0085] Figure 3d FIG. is a schematic diagram of the fourth part of a text processing process according to an embodiment of the present application. As Figure 3d shown, in the fourth part, if it is worried that the prompt word generation ability of the selected target prompt word template is still unstable, the text processing system may also perform a new round of selection process of the target prompt word template according to a preset iterative algorithm, such as the Beam Search or Monte Carlo Tr10 Search algorithm, until the selection process meets the preset requirements, such as selecting a suitable target prompt word template or reaching the preset algorithm iteration times, and then the finally determined target prompt word template can be output.
[0086] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject.
[0087] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps may be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0088] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), and includes several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of the various embodiments of the present application.
[0089] According to an embodiment of the present application, another text processing method is also provided. Figure 4 It is a flowchart of another text processing method shown according to an embodiment of the present application. As Figure 4 shown, the method may include the following steps:
[0090] Step S402, in response to an input instruction acting on the operation interface, display on the operation interface an initial prompt word text that matches the initial prompt word template, and an initial response result corresponding to the initial prompt word text.
[0091] Among them, the initial prompt word text is used to train the text processing model, and the initial response result is the result obtained by processing the initial prompt word text using the text processing model.
[0092] Step S404, in response to a processing instruction acting on the operation interface, display a target prompt word template on the operation interface.
[0093] Among them, the target prompt word template is used to represent a template obtained by screening multiple candidate prompt word templates based on the initial prompt word text. The multiple candidate prompt word templates are used to represent templates obtained by adjusting the initial prompt word template based on the initial response result and the initial prompt word text. The evaluation score of the target response result corresponding to the target prompt word template is greater than the evaluation score of the initial response result. The target response result is the result obtained by processing the target prompt word text using the text processing model, and the target prompt word text matches the target response result.
[0094] In an alternative solution of this embodiment, in order to stably train the processing ability of the text processing model under a specific task, the text processing system can optimize the prompt template for generating the prompt text to obtain a target prompt template with higher accuracy, and use the target prompt text generated by the target prompt template to train the text processing model. Based on this, before training the text processing model, when receiving the above input instruction, the text processing system can first obtain the initial prompt text that matches the currently used initial prompt template, and the initial response result corresponding to the initial prompt text, and display the initial prompt text and the corresponding initial response result on the operation interface for the user to view. When receiving the above processing instruction, the text processing system can adjust the initial prompt template according to the initial prompt text and the corresponding initial response result to obtain multiple candidate prompt templates, and then use the initial prompt text to screen the multiple candidate prompt templates to obtain the above target prompt template. For example, the text processing system can first use the initial prompt text to evaluate different candidate prompt templates to obtain the evaluation scores corresponding to different candidate prompt templates, and then determine the above target prompt template from the multiple candidate prompt templates according to the determined evaluation scores, and display the determined target prompt template on the operation interface for the user to view. The specific process of determining the prompt template can be as shown above, and is not limited here.
[0095] According to an embodiment of the present application, another text processing method is also provided. Figure 5 It is a flowchart of another text processing method shown according to an embodiment of the present application. As Figure 5 shown, the method may include the following steps:
[0096] Step S502, obtain the initial prompt text that matches the initial prompt template and the initial response result corresponding to the initial prompt text by calling the first interface.
[0097] Among them, the initial prompt text is used to train the text processing model, and the initial response result is the result obtained by using the text processing model to process the initial prompt text.
[0098] Step S504, adjust the initial prompt template based on the initial response result and the initial prompt text to obtain multiple candidate prompt templates.
[0099] Step S506, screen the multiple candidate prompt templates based on the initial prompt text to obtain the target prompt template.
[0100] Among them, the evaluation score of the target response result corresponding to the target prompt word template is greater than the evaluation score of the initial response result. The target response result is the result obtained by processing the target prompt word text using a text processing model, and the target prompt word text matches the target response result.
[0101] Step S508, output the target prompt word template by calling the second interface.
[0102] Among them, the second interface includes a second parameter, and the parameter value of the second parameter includes the target prompt word template.
[0103] In an alternative solution of this embodiment, similarly, in order to obtain a target prompt word template with higher accuracy and use the target prompt word text generated by the target prompt word template to train the text processing model, the text processing can first obtain the corresponding first parameter by calling the above-mentioned first interface, that is, obtain the initial prompt word text matching the currently used initial prompt word template and the initial response result corresponding to the initial prompt word text, and then adjust the initial prompt word template according to the initial prompt word text and the corresponding initial response result to obtain multiple candidate prompt word templates. Finally, use the initial prompt word text to screen the multiple candidate prompt word templates to determine the above-mentioned target prompt word template from the multiple candidate prompt word templates, and output the second parameter by calling the second interface, that is, output the determined target prompt word template for the user to view. The specific process of determining the prompt word template can be as shown above and is not limited here.
[0104] According to the embodiments of the present application, there is also provided a text processing device for implementing the above text processing method. Figure 6 It is a structural block diagram of a text processing device shown according to the embodiments of the present application, as Figure 6 shown. The device includes: a parameter acquisition module 602, a first adjustment module 604, and a first screening module 606.
[0105] Among them, the parameter acquisition module 602 is used to acquire an initial prompt word text that matches the initial prompt word template, and an initial response result corresponding to the initial prompt word text. The initial prompt word text is used to train the text processing model, and the initial response result is the result obtained by processing the initial prompt word text using the text processing model. The first adjustment module 604 is used to adjust the initial prompt word template based on the initial response result and the initial prompt word text to obtain multiple candidate prompt word templates. The first screening module 606 is used to screen the multiple candidate prompt word templates based on the initial prompt word text to obtain a target prompt word template. The evaluation score of the target response result corresponding to the target prompt word template is greater than the evaluation score of the initial response result. The target response result is the result obtained by processing the target prompt word text using the text processing model, and the target prompt word text matches the target response result.
[0106] In the embodiment of the present application, the first adjustment module 604 includes: a case determination unit, configured to determine an error case from the initial prompt word text, where the accuracy of the initial response result corresponding to the error case is less than a preset threshold; a template adjustment unit, configured to adjust the initial prompt word template based on the initial prompt word text and the error case to obtain multiple candidate prompt word templates.
[0107] In the embodiment of the present application, the template adjustment unit is further configured to: analyze the initial prompt word text to determine the error reason for the error case in the initial prompt word template; based on the error reason, determine the fragment to be modified from the multiple template fragments included in the initial prompt word template; modify the fragment to be modified based on the error reason to obtain multiple target fragments; adjust the initial prompt word template based on the multiple target fragments to obtain multiple candidate prompt word templates.
[0108] In the embodiment of the present application, the template adjustment unit is further configured to: obtain the model metric corresponding to the initial prompt word template and the fragment position of the fragment to be modified in the initial prompt word template, where the model metric is used to reflect the performance of the text processing model in performing tasks based on the initial prompt word template; adjust the fragment to be modified based on the fragment position, the error reason, and the model metric to obtain multiple target fragments.
[0109] In the embodiment of the present application, the template adjustment unit is further configured to: modify the fragment to be modified based on the error reason and the model metric to obtain a plurality of first fragments; identify the fragment position to determine the fragment type of the fragment to be modified; in response to the fragment type being the first preset type, determine the plurality of first fragments as a plurality of target fragments; in response to the fragment type being the second preset type, generate second fragments corresponding to different first fragments based on the plurality of first fragments and the fragment to be modified, and construct a plurality of target fragments based on the plurality of first fragments and the second fragments, wherein the attention weight of the fragment to be modified corresponding to the first preset type is greater than the attention weight of the fragment to be modified corresponding to the second preset type, and the second fragment is used to represent the difference between different first fragments and the fragment to be modified.
[0110] In the embodiment of the present application, the template adjustment unit is further configured to: update the initial prompt word template with the plurality of target fragments to obtain a plurality of first prompt word templates; verify the plurality of first prompt word templates to obtain verification results corresponding to different first prompt word templates, wherein the verification results are used to represent whether different first prompt word templates conform to the preset language logic rules; in response to the verification results indicating that the plurality of first prompt word templates conform to the language logic rules, determine the plurality of first prompt word templates as a plurality of candidate prompt word templates; in response to the verification results indicating that any one of the first prompt word templates does not conform to the language logic rules, re-determine a new fragment to be modified, and construct a new plurality of first prompt word templates based on the new fragment to be modified until the verification results of the new plurality of first prompt word templates indicate that the new plurality of first prompt word templates conform to the language logic rules, or the number of times of re-determining the new fragment to be modified reaches a preset value, and determine the new plurality of first prompt word templates as a plurality of candidate prompt word templates.
[0111] In the embodiment of the present application, the first screening module 606 includes: a text feature unit, configured to adjust the initial prompt word text based on a plurality of candidate prompt word models to obtain a plurality of candidate prompt word texts; a result evaluation unit, configured to evaluate the text response results corresponding to the plurality of candidate prompt word texts based on a plurality of evaluation dimensions to obtain a plurality of dimension evaluation results corresponding to different text response results, wherein different text response results are used to represent the results obtained by processing different candidate prompt word texts using a text processing model; a result summarization unit, configured to summarize the plurality of dimension evaluation results to obtain evaluation scores corresponding to different text response results; and a template screening unit, configured to screen the plurality of candidate prompt word templates based on the evaluation scores corresponding to different text response results to obtain a target prompt word template.
[0112] In the embodiment of the present application, the text feature unit is further configured to: extract features of the error cases included in the initial prompt word text to obtain case features of the error cases; and fill the plurality of candidate prompt word templates based on the case features to obtain a plurality of candidate prompt word texts.
[0113] In an embodiment of the present application, the template screening unit is further configured to: sort a plurality of candidate prompt templates based on the evaluation scores corresponding to different text response results to obtain a prompt template sequence; select a plurality of second prompt templates from the prompt template sequence in a preset manner, where the evaluation score of any one of the second prompt templates is greater than the evaluation scores of other prompt templates in the prompt template sequence except for the plurality of second prompt templates; obtain historical evaluation data corresponding to the plurality of second prompt templates; and select a target prompt template from the plurality of second prompt templates based on the historical evaluation data.
[0114] In an embodiment of the present application, the above device further includes: a first output module, configured to output a target prompt template in response to the evaluation score of the target response result satisfying a preset evaluation condition; and a second output module, configured to, in response to the evaluation score of the target response result not satisfying the preset evaluation condition, regenerate a plurality of new candidate prompt templates based on an initial response result, an initial prompt text, and an initial prompt template according to a preset iterative algorithm, and screen the plurality of new prompt templates based on the initial prompt text until the evaluation score corresponding to the screened new target prompt template satisfies the preset evaluation condition, and output the new target prompt template.
[0115] It should be noted here that the above parameter acquisition module 602, the first adjustment module 604, and the first screening module 606 correspond to steps S202 to S206 in the above embodiment. The instances and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiment. It should be noted that the above modules or units may be hardware components or software components stored in a memory (for example, memory 104) and processed by one or more processors (for example, processors 102a, 102b,..., 102n). The above modules may also be part of a device and may run in the electronic device 10 provided in the above embodiment.
[0116] According to an embodiment of the present application, there is also provided another text processing device for implementing the above text processing method. Figure 7 It is a structural block diagram of another text processing device shown according to an embodiment of the present application, as Figure 7 shown, the device includes: a first display module 702 and a second display module 704.
[0117] Among them, the first display module 702 is configured to respond to an input instruction acting on the operation interface, and display an initial prompt word text matching the initial prompt word template and an initial response result corresponding to the initial prompt word text on the operation interface, where the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; the second display module 704 is configured to respond to a processing instruction acting on the operation interface, and display a target prompt word template on the operation interface, where the target prompt word template is used to represent a template obtained by screening multiple candidate prompt word templates based on the initial prompt word text, the multiple candidate prompt word templates are used to represent templates obtained by adjusting the initial prompt word template based on the initial response result and the initial prompt word text, an evaluation score of a target response result corresponding to the target prompt word template is greater than an evaluation score of the initial response result, the target response result is a result obtained by processing a target prompt word text using the text processing model, and the target prompt word text matches the target response result.
[0118] It should be noted here that the above first display module 702 and second display module 704 correspond to steps S402 to S404 in the above embodiment. The instances and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiment. It should be noted that the above module or unit may be a hardware component or a software component stored in a memory (for example, memory 104) and processed by one or more processors (for example, processors 102a, 102b,..., 102n), and the above module may also be part of a device and can run in the electronic device 10 provided in the above embodiment.
[0119] According to an embodiment of the present application, there is also provided another text processing device for implementing the above text processing method. Figure 8 is a structural block diagram of another text processing device shown according to an embodiment of the present application, as Figure 8 shown, the device includes: a first calling module 802, a second adjustment module 804, a second screening module 806, and a second calling module 808.
[0120] Among them, the first calling module 802 is used to obtain an initial prompt word text matching the initial prompt word template and an initial response result corresponding to the initial prompt word text by calling a first interface. The initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model. The second adjustment module 804 is used to adjust the initial prompt word template based on the initial response result and the initial prompt word text to obtain a plurality of candidate prompt word templates. The second screening module 806 is used to screen the plurality of candidate prompt word templates based on the initial prompt word text to obtain a target prompt word template. The evaluation score of the target response result corresponding to the target prompt word template is greater than the evaluation score of the initial response result. The target response result is a result obtained by processing the target prompt word text using the text processing model, and the target prompt word text matches the target response result. The second calling module 808 is used to output the target prompt word template by calling a second interface. The second interface includes a second parameter, and the parameter value of the second parameter includes the target prompt word template.
[0121] It should be noted here that the above first calling module 802, second adjustment module 804, second screening module 806, and second calling module 808 correspond to steps S502 to S508 in the above embodiment. The examples and application scenarios implemented by the four modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiment. It should be noted that the above modules or units can be hardware components or software components stored in a memory (for example, memory 104) and processed by one or more processors (for example, processors 102a, 102b,..., 102n). The above modules can also be part of a device and can run in the electronic device 10 provided in the above embodiment.
[0122] It should be noted that the preferred implementation schemes involved in the above embodiments of the present application are the same as the schemes, application scenarios, and implementation processes provided in the above embodiments, but are not limited to the schemes provided in the above embodiments.
[0123] An embodiment of the present application can provide a computing device. Figure 9 It is a structural block diagram of a computing device shown according to an embodiment of the present application. As Figure 9 shown, the computing device 900 may include: one or more (only one is shown in the figure) processors 902, a memory 904, a storage controller, and a peripheral interface.
[0124] The above computing device can be understood as an integrated intelligent terminal, including but not limited to a server, a desktop computer, a PC (Personal Computer), a model all-in-one machine, etc. And, the above model in the above embodiments of the present application can be pre-set in the computing device.
[0125] Specifically, the computing device can be pre - installed with various types of models, including but not limited to models in the fields of natural language processing, visual processing, speech processing, code processing, multi - modal task processing, etc., so as to provide diverse model selections. In different product forms, the computing device can support one or more model usage methods, including but not limited to model training, model invocation, model fine - tuning, model deployment, model inference and application, etc. In some product forms, the computing device also supports model management, including but not limited to multi - type model management (supporting the management of various types of models such as discriminative and generative models), model version control (supporting the control of different model versions), model evaluation (evaluating the performance and effectiveness of the model based on model evaluation tools), etc. In other product forms, the computing device can also create applications based on the model, provide API invocation capabilities, and can call the model into the created application through the API interface. At the same time, an application management tool is provided to realize the management and monitoring of the application.
[0126] Furthermore, the computing device can also include data management (supporting the creation and management of model tuning data sets), a training center (providing rich training resources to help users learn and master AI technologies), and basic control capabilities (providing enterprise - level basic control capabilities to ensure the security and efficient operation of the system). Through the above functions, a comprehensive and integrated AI development, training, deployment, and application device is provided.
[0127] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and devices in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implements the methods in the above - mentioned embodiments. The memory can include high - speed random access memory, and can also include non - volatile memory, such as one or more magnetic storage devices, flash memory, or other non - volatile solid - state memories. In some instances, the memory can further include memories remotely set relative to the processor, and these remote memories can be connected to terminal A through a network. Examples of the above - mentioned network include but are not limited to the Internet, enterprise intranets, local area networks, mobile communication networks, and their combinations.
[0128] The processor can call the executable program stored in the memory through the transmission device to execute the method of any one of the above - mentioned embodiments.
[0129] Embodiments of the present application can provide an electronic device. Figure 10 It is a structural block diagram of an electronic device shown according to an embodiment of the present application. As Figure 10As shown, the electronic device may include: an input / output device 1002; a memory 1004 and a processor 1006, wherein the processor 1006 is connected to the input / output device 1002 and the memory 1004 via a bus 1008.
[0130] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and devices in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implements the methods in the above embodiments. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory may further include a memory remotely disposed relative to the processor, and these remote memories can be connected to the terminal A through a network. Examples of the above network include but are not limited to the Internet, enterprise intranets, local area networks, mobile communication networks, and combinations thereof.
[0131] The processor can call the executable program stored in the memory through a transmission device to execute the method of any one of the above embodiments.
[0132] Those of ordinary skill in the art can understand that the structure shown in the figure is only schematic, and the computing device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a mobile Internet device (Mobile Internet Devices, MID), a PAD and other terminal devices. This figure does not limit the structure of the above computing device. For example, the computing device 100 may further include more or fewer components (such as a network interface, a display device, etc.) than those shown in the figure, or have a different configuration from that shown in the figure.
[0133] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware of the terminal device through a program, and the program can be stored in a computer-readable storage medium. The storage medium may include: a flash drive, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disc, etc.
[0134] The embodiments of the present application also provide a computer-readable storage medium. Optionally, in this embodiment, the above computer-readable storage medium can be used to save the program code executed by the method provided in the above embodiment.
[0135] Optionally, in this embodiment, the above storage medium may be located in the computing device.
[0136] Optionally, in this embodiment, the computer-readable storage medium is configured to store an executable program, and when the executable program runs, it controls the device where the computer-readable storage medium is located to execute the method according to any one of the above embodiments.
[0137] The embodiments of the present application also provide a computer program product. Optionally, in this embodiment, the above computer program product may include a computer program, and when the above computer program is executed by a processor, it implements the method provided by the above embodiments.
[0138] The embodiments of the present application also provide a computer program product. Optionally, the above computer program product may include a non-volatile computer-readable storage medium, and the above non-volatile computer-readable storage medium may be used to store a computer program, and when the computer program is executed by a processor, it implements the method provided by the above embodiments.
[0139] The embodiments of the present application also provide a computer program. Optionally, in this embodiment, when the above computer program is executed by a processor, it implements the method provided by the above embodiments.
[0140] In the above embodiments of the present application, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0141] In the several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of units or modules can be in electrical or other forms.
[0142] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0143] In addition, the functional units in the respective embodiments of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0144] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media that can store program codes, such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), mobile hard disks, magnetic disks, or optical discs.
[0145] The foregoing are only the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.
Claims
1. A text processing method, characterized in that: include: Acquire an initial prompt word text that matches the initial prompt word template, and an initial response result corresponding to the initial prompt word text, wherein the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; Based on the initial response result and the initial prompt word text, adjusting the to-be-modified segment contained in the initial prompt word template to obtain a plurality of candidate prompt word templates, wherein the to-be-modified segment is determined by the error cause of the error in the initial prompt word text; The multiple candidate prompt word templates are screened based on the initial prompt word text to obtain a target prompt word template, wherein an evaluation score of a target response result corresponding to the target prompt word template is greater than an evaluation score of the initial response result, the target response result is a result obtained by processing the target prompt word text using the text processing model, and the target prompt word text matches the target response result.
2. The method according to claim 1, characterized in that Based on the initial response result and the initial prompt word text, the initial prompt word template is adjusted to obtain multiple candidate prompt word templates, including: Determining an error case from the initial prompt word text, wherein the accuracy of the initial response result corresponding to the error case is less than a preset threshold; The initial prompt word template is adjusted based on the initial prompt word text and the error case to obtain the multiple candidate prompt word templates.
3. The method according to claim 2, characterized in that The initial prompt word template is adjusted based on the initial prompt word text and the error case to obtain the multiple candidate prompt word templates, including: Analyze the initial prompt word text to determine the error cause of the error case in the initial prompt word template; Based on the error cause, determining a segment to be modified from a plurality of template segments included in the initial prompt word template; Modify the to-be-modified segment based on the error cause to obtain multiple target segments; The initial prompt word template is adjusted based on the multiple target segments to obtain the multiple candidate prompt word templates.
4. The method according to claim 3, characterized in that The to-be-modified segment is modified based on the error cause to obtain multiple target segments, including: Obtaining a model index corresponding to the initial prompt word template and a segment position of the segment to be modified in the initial prompt word template, wherein the model index is used to reflect the performance of the text processing model in performing a task based on the initial prompt word template; The to-be-modified segment is adjusted based on the segment position, the error cause and the model index to obtain the multiple target segments.
5. The method according to claim 4, characterized in that The to-be-modified segment is adjusted based on the segment position, the error cause and the model index to obtain the multiple target segments, including: Modify the to-be-modified segment based on the error cause and the model indicator to obtain a plurality of first segments; Identifying the segment position and determining the segment type of the segment to be modified; In response to the segment type being a first preset type, determining the plurality of first segments as the plurality of target segments; In response to the segment type being a second preset type, based on the multiple first segments and the segment to be modified, second segments corresponding to different first segments are generated, and based on the multiple first segments and the second segments, the multiple target segments are constructed, wherein the attention weight of the segment to be modified corresponding to the first preset type is greater than the attention weight of the segment to be modified corresponding to the second preset type, and the second segment is used to characterize the difference between the different first segments and the segment to be modified.
6. The method according to claim 3, characterized in that: The initial prompt word template is adjusted based on the multiple target segments to obtain the multiple candidate prompt word templates, including: Using the multiple target segments to update the initial prompt word template to obtain multiple first prompt word templates; Verifying the plurality of first prompt word templates to obtain verification results corresponding to different first prompt word templates, wherein the verification results are used to indicate whether the different first prompt word templates conform to preset language logic rules; In response to the verification result that the plurality of first prompt word templates conform to the language logic rule, determining the plurality of first prompt word templates as the plurality of candidate prompt word templates; In response to the verification result being that any one of the first prompt word templates does not conform to the language logic rule, a new segment to be modified is re-determined, and new multiple first prompt word templates are constructed based on the new segment to be modified, until the verification result of the new multiple first prompt word templates is that the new multiple first prompt word templates conform to the language logic rule, or the number of times the new segment to be modified is re-determined reaches a preset value, and the new multiple first prompt word templates are determined to be the multiple candidate prompt word templates.
7. The method according to claim 1, characterized in that The plurality of candidate prompt word templates are screened based on the initial prompt word text to obtain a target prompt word template, including: Adjusting the initial prompt word text based on the multiple candidate prompt word templates to obtain multiple candidate prompt word texts; Evaluate the text response results corresponding to the multiple candidate prompt word texts based on multiple evaluation dimensions to obtain multiple dimensional evaluation results corresponding to different text response results, wherein the different text response results are used to represent the results obtained by processing different candidate prompt word texts using the text processing model; Summarizing the evaluation results of the multiple dimensions to obtain evaluation scores corresponding to different text response results; The plurality of candidate prompt word templates are screened based on evaluation scores corresponding to different text response results to obtain the target prompt word template.
8. The method according to claim 7, characterized in that The initial prompt word text is adjusted based on the multiple candidate prompt word models to obtain multiple candidate prompt word texts, including: Extracting features of the error cases contained in the initial prompt word text to obtain case features of the error cases; The plurality of candidate prompt word templates are filled based on the case features to obtain the plurality of candidate prompt word texts.
9. The method according to claim 7, characterized in that: The plurality of candidate prompt word templates are screened based on the evaluation scores corresponding to different text response results to obtain the target prompt word template, including: sorting the plurality of candidate prompt word templates based on evaluation scores corresponding to different text response results to obtain a prompt word template sequence; According to a preset manner, multiple second prompt word templates are selected from the prompt word template sequence, wherein the evaluation score of any second prompt word template is greater than the evaluation scores of other prompt word templates in the prompt word template sequence except the multiple second prompt word templates; Acquire historical evaluation data corresponding to the plurality of second prompt word templates; The target prompt word template is selected from the plurality of second prompt word templates based on the historical evaluation data.
10. The method according to claim 1, characterized in that After the plurality of candidate prompt word templates are screened based on the initial prompt word text to obtain a target prompt word template, the method further includes: In response to the evaluation score of the target response result satisfying a preset evaluation condition, outputting the target prompt word template; In response to the evaluation score of the target response result not satisfying the preset evaluation condition, a plurality of new candidate prompt word templates are regenerated based on the initial response result, the initial prompt word text and the initial prompt word template according to a preset iterative algorithm, and the plurality of new prompt word templates are screened based on the initial prompt word text until the evaluation score corresponding to the screened new target prompt word template satisfies the preset evaluation condition, and the new target prompt word template is output.
11. A text processing method, characterized in that: include: In response to an input instruction on an operation interface, an initial prompt word text matching an initial prompt word template and an initial response result corresponding to the initial prompt word text are displayed on the operation interface, wherein the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; In response to the processing instruction acting on the operation interface, a target prompt word template is displayed on the operation interface, wherein the target prompt word template is used to represent a template obtained by screening multiple candidate prompt word templates based on the initial prompt word text, and the multiple candidate prompt word templates are used to represent a template obtained by adjusting the to-be-modified segment contained in the initial prompt word template based on the initial response result and the initial prompt word text, the evaluation score of the target response result corresponding to the target prompt word template is greater than the evaluation score of the initial response result, the target response result is the result obtained by processing the target prompt word text using the text processing model, the target prompt word text matches the target response result, and the to-be-modified segment is determined by the error cause of the error in the initial prompt word text.
12. A text processing method, characterized in that: include: Acquire an initial prompt word text matching an initial prompt word template and an initial response result corresponding to the initial prompt word text by calling a first interface, wherein the initial prompt word text is used to train a text processing model, and the initial response result is a result obtained by processing the initial prompt word text using the text processing model; Based on the initial response result and the initial prompt word text, adjusting the to-be-modified segment contained in the initial prompt word template to obtain a plurality of candidate prompt word templates, wherein the to-be-modified segment is determined by the error cause of the error in the initial prompt word text; The plurality of candidate prompt word templates are screened based on the initial prompt word text to obtain a target prompt word template, wherein an evaluation score of a target response result corresponding to the target prompt word template is greater than an evaluation score of the initial response result, the target response result is a result obtained by processing the target prompt word text using the text processing model, and the target prompt word text matches the target response result; The target prompt word template is output by calling a second interface, wherein the second interface includes a second parameter, and a parameter value of the second parameter includes the target prompt word template.
13. A computing device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 12 when running.
14. An electronic device, characterized in that: include: A memory storing an executable program; A processor, connected to the memory via a bus, and configured to run the program, wherein the program executes the method described in any one of claims 1 to 12 when running.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is executed, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 12.
16. A computer program product, characterized in that It comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Prompt generation method and text processing method
CN118655989A