Text processing method, computing device, electronic device and storage medium
By adjusting and screening prompt templates, the response accuracy and task processing ability of the text processing model have been improved, and the problem of poor response effects during specific task processing of the existing technical Chinese text processing model is solved.
Patent Information
- Application Number
- CN202411950239.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-01-28
- 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 text and its response results that matches the initial prompt template, adjust the initial prompt template to generate multiple candidate prompt templates, and obtain the target prompt template by screening. Higher than the initial response result.
The response accuracy of the text processing model to the target reminder is significantly improved, and the emergence of the wrong case is reduced, so that the text processing model can better understand and respond to the user's needs, thereby improving the processing capabilities of the text processing model under specific tasks.
Smart Images

Figure CN119378523A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of large model technology and text processing, and more specifically, 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 to improving the performance of large language models (LLMs) on specific tasks. However, manually debugging prompt words not only requires rich experience, but is also often accompanied by the complexity of repeated trials, resulting in the fact that large language models may still have poor processing capabilities on specific tasks based on manually debugged prompt words.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide a text processing method, a computing device, an electronic device, and a storage medium to at least solve the technical problem in the related art that the response effect is poor when using a text processing model to process a specific task.
[0005] According to one aspect of an embodiment of the present application, a text processing method is provided, including: obtaining an initial prompt word text matching 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; based on the initial response result and the initial prompt word text, adjusting the initial prompt word template to obtain a plurality of candidate prompt word templates; based on the initial prompt word text, screening the plurality of candidate prompt word templates 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.
[0006] According to one aspect of an embodiment of the present application, a text processing method is also provided, including: in response to an input instruction acting on an operation interface, displaying an initial prompt word text matching an initial prompt word template and an initial response result corresponding to the initial prompt word text 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 a processing instruction acting on the operation interface, displaying a target prompt word template 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 multiple candidate prompt word templates are used to represent a template 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 the 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 an embodiment of the present application, a text processing method is also provided, including: obtaining 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; 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, 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; outputting the target prompt word template by calling a second interface, wherein the second interface includes a second parameter, and the parameter value of the second parameter includes the target prompt word template.
[0008] According to another aspect of an embodiment of the present application, a text processing device is further provided, comprising: a parameter acquisition module, used to acquire an initial prompt word text matching 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; a first adjustment module, 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; a first screening module, used 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, used to screen the plurality of candidate prompt word templates based on the plurality of evaluation scores, to obtain a target prompt word template, wherein the evaluation score of the target response result corresponding to the target prompt word text matching 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 an embodiment of the present application, a text processing device is also provided, including: a first display module, used to respond to an input instruction acting on an operation interface, and display an initial prompt word text matching an initial prompt word template and an initial response result corresponding to the initial prompt word text 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; a second display module, used to respond to a processing instruction acting on the operation interface, and display a target prompt word template on the operation interface, wherein the target prompt word template is used to represent a result obtained by screening multiple candidate prompt word templates based on multiple evaluation scores corresponding to multiple candidate prompt word templates, the multiple evaluation scores are used to represent a result obtained by evaluating multiple candidate prompt word templates based on the initial prompt word text, and the multiple candidate prompt word templates are used to represent an adjustment of the initial prompt word template based on the initial response result and the initial prompt word text.
[0010] According to one aspect of an embodiment of the present application, a text processing device is further provided, comprising: a first calling module, configured to obtain 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; a second adjusting 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 evaluating 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, wherein the evaluation score of the target response result corresponding to the target prompt word text matching 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, wherein the second interface includes a second parameter, and the parameter value of the second parameter includes the target prompt word template.
[0011] According to another aspect of the embodiments of the present application, a computing device is further provided, including: a memory storing an executable program; and a processor for running the program, wherein the method in each embodiment of the present application is executed when the program is running.
[0012] According to another aspect of the embodiments of the present application, an electronic device is also provided, including: a memory storing an executable program; a processor connected to the memory via a bus and used to run the program, wherein the method of each embodiment of the present application is executed when the program is running.
[0013] According to another aspect of an embodiment of the present application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in each embodiment of the present application.
[0014] According to another aspect of the embodiments of the present application, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present application is implemented.
[0015] According to another aspect of an embodiment of the present application, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present application is implemented.
[0016] According to another aspect of the embodiments of the present application, a computer program is also provided, and when the computer program is executed by a processor, the methods in the various embodiments of the present application are implemented.
[0017] In an embodiment of the present application, an initial prompt word text matching an initial prompt word template and an initial response result corresponding to the initial prompt word text are obtained; 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, a 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 can be reduced, and the text processing model can better understand and respond to user needs, thereby improving the processing capability of the text processing model under specific tasks, thereby 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 notice that the above general description and the following detailed description are only for the purpose of exemplifying and explaining the present application, and do not constitute a limitation of 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 on 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 3dis a schematic diagram of the fourth part of a text processing process according to an embodiment of the present application;
[0026] Figure 4 is a flowchart of another text processing method according to an embodiment of the present application;
[0027] Figure 5 is a flowchart of another text processing method according to an embodiment of the present application;
[0028] Figure 6 is a structural block diagram of a text processing device according to an embodiment of the present application;
[0029] Figure 7 is a structural block diagram of another text processing device according to an embodiment of the present application;
[0030] Figure 8 is a structural block diagram of another text processing device according to an embodiment of the present application;
[0031] Fig. 9 is a structural block diagram of a computing device according to an embodiment of the present application;
[0032] Fig.10 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection 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 are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] The technical solution provided in this application is mainly implemented using large-scale model technology. The large model here refers to a deep learning model with large-scale model parameters, which can usually contain hundreds of millions, tens of billions, hundreds of billions, trillions or even more than 10 trillion model parameters. The large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as large-scale language model (LLM), multi-modal pre-training model, etc.
[0036] It should be noted that when the large model is actually applied, the pre-trained model can be fine-tuned through a small number of samples, so that the large model can be applied to different tasks. For example, the large model can be widely used in natural language processing (NLP), computer vision, speech processing and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, etc. It can also be widely used in natural language processing tasks such as text-based sentiment classification, text summary generation, machine translation, etc. Therefore, the main application scenarios of the large model include but are not limited to digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc. In the embodiment of the present application, the data processing of the prompt word template in the model training scenario is taken as an example for explanation,
[0037] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:
[0038] Beam Search: A greedy search algorithm that retains a list of candidates ("beam") with better processing power, such as accuracy greater than a preset threshold, at each selection step, balancing the requirements of search accuracy and computing resources.
[0039] Monte Carlo Tree Search: MCTS is a decision-making algorithm that estimates the potential benefits of each action by simulating a random game starting from the current state. The algorithm mainly consists of four steps: selection, expansion, simulation, and backpropagation. Each step gradually optimizes the decision tree through statistical simulation results to select the action with the highest expected benefit.
[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 a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0041] Considering the huge amount of model parameters of the large model and the limited computing resources of the mobile terminal, the above method provided in the embodiment of the present application can be applied to Figure 1 The application scenarios shown are not limited to these. 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. Figure 1 In the application scenario shown, the large model is deployed in the server 10, and 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. The client device 20 here may include but is not limited to: a smart phone, a tablet computer, a laptop computer, a PDA, a personal computer, a smart home device, a vehicle-mounted device, etc. The client device 20 can interact with the user through a graphical user interface to implement the call of the large model, thereby implementing the method provided in 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 perform 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; 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 screens 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 in the embodiment of the present application can also be applied to the model all-in-one machine. In an optional embodiment, a plurality of models are built into the model all-in-one machine, and the user can choose to adjust a model as needed to obtain the user's own model, so that the high-performance computing unit built into the model all-in-one machine can directly call the adjusted model to execute the above method provided in the embodiment of the present application. In another optional embodiment, a trained model is built into the large model all-in-one machine, so that the high-performance computing unit built into the model all-in-one machine can directly call the model to execute the above method provided in the embodiment of the present application.
[0044] Furthermore, when users need to train their own models, they can also upload their own data sets through the client, which are sent by the client to the server, so that the server can adjust the pre-trained model with the data set to obtain the user's own model and then deploy it to the production environment. In order to facilitate users' needs for model adjustment, the server can provide complete adjustment tools, development frameworks and processes, and can support multiple adjustment strategies, so that the adjusted model can better adapt to applications in different fields and achieve a high degree of customization.
[0045] Under the above operating environment, this application provides Figure 2 The text processing method shown. Figure 2 1 is a flowchart of a text processing method according to an embodiment of the present application. Figure 2 As shown, the method may include the following steps:
[0046] Step S202, obtaining an initial prompt word text that matches the initial prompt word template, and an initial response result corresponding to the initial prompt word text.
[0047] 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.
[0048] The above-mentioned initial prompt word text may refer to text used to train the processing ability of the text processing model on a specific task, and may be used to guide the text processing model to generate output of a specific type or specific content, which may include but is not limited to: description text of the scene corresponding to the specific task, text processing instructions constructed for the specific task, etc. It may be a simple sentence or a complex text paragraph. 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-mentioned initial response result may refer to the processing of the initial prompt word text by the text processing model 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 optional scheme of the present embodiment, considering that before using the text processing model to process a specific type of task, it is usually necessary to first use a large number of prompt word 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, and the process of constructing the prompt word text for the specific task may consume a large amount of time resources. Therefore, in order to improve the efficiency of generating the prompt word text, the text processing system can usually construct a corresponding prompt word template for the specific task, and use the prompt word module to quickly generate the prompt word text related to the specific task by means of vocabulary filling, thereby improving the efficiency of using the prompt word text to train the text processing model. However, considering that in the actual process of generating the prompt word text, the text processing system may generate prompt words with low relevance to the specific task through the prompt word template, resulting in the generated prompt word text may be a text that the text processing system cannot understand, and then the text processing model has poor processing ability for the generated prompt word text, such as low processing accuracy or low processing efficiency, which means that the template used to generate the prompt word text may have problems of logical confusion and poor adaptability. Based on this, in order to improve the processing ability of the text processing model for a specific task, the text processing system can adjust the prompt word template used in real time during the process of training the text processing model using the prompt word text, so as to ensure the matching degree between the prompt word text generated by the prompt word template and the specific task, and at the same time ensure the logic and accuracy of the generated prompt word text. Correspondingly, when optimizing the prompt word template, the text processing system can first obtain the prompt word template currently used in the process of training the text processing model, that is, the initial prompt word template mentioned above, and the initial prompt word generated by the initial prompt word template, and in order to be able to show the processing of different initial prompt words by the text processing model, so as to adaptively adjust the currently used initial prompt word template according to the processing of the initial prompt word, the text processing system can also obtain the initial response result corresponding to the initial prompt word text obtained after the initial prompt word text is processed by the text processing model.
[0050] Step S204: 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.
[0051] In an optional solution of this embodiment, considering the initial response result matching the initial prompt word text, it can reflect the processing of the initial prompt word text by the text processing model, and according to the processing of different initial prompt word texts, it can reflect the prompt word generation ability of the initial prompt word template used to generate the initial prompt word text, for example, reflecting the sentence logic ability of the initial prompt word template and the adaptability to different words in different scenarios. Therefore, in order to reasonably optimize the currently used initial prompt word template, after obtaining the corresponding initial prompt word text and the initial response result, the text processing system can use the initial response result and the initial prompt word text to analyze the problem of insufficient vocabulary generation ability that may exist in the initial prompt word template, and then adjust the initial prompt word template according to the analyzed problem, so as to obtain multiple candidate prompt word templates with strong prompt word generation ability, and the text processing system can select the template with higher prompt word generation ability from the constructed multiple candidate prompt word templates as the template for generating prompt words, so as to ensure that the text processing model can stably and accurately respond to the generated prompt word text, thereby improving the text processing ability of the text processing model.
[0052] In order to ensure the robustness of the generated multiple candidate prompt word templates, a preset large language model (LLM) may be used to process the above initial response results and the initial prompt word text to generate corresponding multiple candidate prompt word templates.
[0053] Step S206: Screen multiple candidate prompt word templates based on the initial prompt word text to obtain a target prompt word template.
[0054] 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 the text processing model, and the target prompt word text matches the target response result.
[0055] In an optional scheme of the present embodiment, as shown above, taking into account the problems of logical confusion and poor adaptability that may exist in the initial prompt word template, resulting in poor prompt word generation capability of the initial prompt word template, and further resulting in poor processing capability of the text processing model trained on the basis of the initial prompt word template for specific tasks. Therefore, in order to improve the processing capability of the text processing model for specific tasks, the text processing system needs to select target prompt word templates with higher prompt word generation capabilities as much as possible to avoid the existence of text problems in the target prompt word template that appear in the initial prompt word template. Considering that the initial prompt word text generated by using the initial prompt word template can just reflect the problems in the initial prompt word template, in order to accurately screen out a suitable target prompt word template from multiple candidate prompt word templates, the text processing system can introduce the above-mentioned initial prompt word text when selecting the target prompt word template from multiple candidate prompt word templates, so as to summarize the reasons for the above-mentioned problems in the initial prompt word template according to the initial prompt word text, and then use the summarized reasons to screen the above-mentioned multiple candidate prompt word templates, so as to ensure that the screened target prompt word template will not have the problems existing in the initial prompt word template, thereby ensuring the prompt word generation ability of the screened target prompt word template.
[0056] In an optional scheme of the present embodiment, the prompt word generation capabilities of different prompt word templates can also be reflected from the response results of the text processing model to the prompt word texts corresponding to different prompt word templates. For example, if the text processing model responds to prompt word text A with higher accuracy and higher efficiency, it can be considered that the effect of training the text processing model using prompt word text A is better, and correspondingly, it can be considered that the text processing model has better processing capabilities for the specific tasks corresponding to prompt word text A, and the prompt word template A used to generate prompt word text A has higher prompt word generation capabilities. Therefore, in order to screen out a suitable target prompt word template, the text processing system can evaluate the response results corresponding to different candidate prompt word templates based on the response results output by the text processing model, for example, evaluate the accuracy and response efficiency of different response results to obtain evaluation scores of different response results, and at the same time evaluate the initial response result obtained above to obtain the evaluation score of the initial response result, and then preliminarily screen out the first template whose corresponding response result evaluation score is greater than the evaluation score of the initial response result from multiple candidate prompt word templates, and finally determine the above-mentioned target prompt word template from the preliminarily screened first template, so as to ensure that the evaluation score of the template response result corresponding to the screened target prompt word template can be greater than the evaluation score of the initial response result, that is, to ensure that the prompt word generation ability of the screened target prompt word template can be higher than the prompt word generation ability of the initial prompt word template.
[0057] In an embodiment of the present application, an initial prompt word text matching an initial prompt word template and an initial response result corresponding to the initial prompt word text are obtained; 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, a 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 can be reduced, and the text processing model can better understand and respond to user needs, thereby improving the processing capability of the text processing model under specific tasks, thereby solving the technical problem of poor response effect when using the text processing model to process specific tasks in the related art.
[0058] In an embodiment of the present application, the initial prompt word template is adjusted based on the initial response result and the initial prompt word text 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; adjusting the initial prompt word template based on the initial prompt word text and the error case to obtain multiple candidate prompt word templates.
[0059] The above-mentioned error case may refer to the prompt word text that the text processing model cannot understand or cannot accurately respond to in the initial prompt word text generated by the initial prompt word template. The above-mentioned preset threshold may refer to the threshold used to determine 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 accuracy, the above-mentioned preset threshold can also be parameters such as efficiency and recall rate of the initial response result output by the text processing model. The specific parameters such as the type and size of the preset threshold can be set by the user according to actual conditions and are not limited here.
[0060] In an optional scheme of the present embodiment, considering that the initial prompt word text generated by the initial prompt word template is usually a prompt word text that matches a specific task, when the text processing model cannot understand the prompt word text, it means that there may be certain text problems in the prompt word text, such as the aforementioned logical confusion and poor adaptability problems. By analyzing the prompt word text, the problems existing in the initial prompt word template can usually be determined, so that the text processing system can better adjust the initial prompt word template. Based on this, when adjusting the initial prompt word template, the text processing system can first determine the above-mentioned error cases from the initial prompt word text according to the initial response results corresponding to different prompt word texts. For example, the prompt word text whose accuracy of the initial response result is less than a preset threshold can be determined as an error case that can reflect the problems existing in the initial prompt word template. After determining the error cases, the text processing system can analyze the error cases and use the error cases to adjust the initial prompt word template. Considering that the initial prompt word text not only contains error cases but also contains more correct cases that the text processing model can accurately respond to, these correct cases can reflect the accurate logical relationship contained in the initial prompt word template. Therefore, when adjusting the initial prompt word template using the error cases, the corresponding initial prompt word text can also be introduced to simultaneously use the initial prompt word text and the error cases contained in the initial prompt word text to adjust the initial prompt word template to obtain multiple candidate prompt word templates. For example, the text processing system can first determine multiple correct cases from the initial prompt word text according to the accuracy rates corresponding to different initial prompt word texts, and then perform feature extraction on the multiple correct cases to obtain case features of different correct cases in multiple dimensions such as structure and semantics, and summarize the case features of different correct cases. The text processing system can preliminarily determine from the initial prompt word template the correct part that can correctly generate the prompt word text related to the specific task, and the first error part that cannot correctly generate the prompt word text related to the specific task. The corresponding correct part can be regarded as the part that can be retained in the initial prompt word template. Similarly, the text processing system can perform feature extraction on 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 word template. Finally, the first error part and the second error part are merged to determine the target error part that actually needs to be modified from the initial prompt word template. The corresponding text processing system can modify the target error part to obtain the above-mentioned multiple candidate prompt word templates.
[0061] In an embodiment of the present application, an initial prompt word template is adjusted based on an initial prompt word text and an error case to obtain a plurality of candidate prompt word templates, including: analyzing 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 to-be-modified segment from a plurality of template segments included in the initial prompt word template; modifying the to-be-modified segment based on the error cause to obtain a plurality of target segments; and adjusting the initial prompt word template based on the plurality of target segments to obtain a plurality of candidate prompt word templates.
[0062] In an optional scheme of the present embodiment, when the initial prompt word template is adjusted using the initial prompt word text and the error case, given that the initial prompt word text may include the error case and the correct case, and the error case and the correct case may reflect the erroneous logical relationship and the normal logical relationship included in the initial prompt word template, based on this, in order to ensure the accuracy of the adjustment of the initial prompt word template and avoid the situation where the adjustment direction is wrong, the text processing system may first analyze the acquired initial prompt word template to determine the reason for the corresponding error case in the initial prompt word template, that is, analyze the above-mentioned error cause, and then determine the segment that needs to be modified from the multiple template segments included in the initial prompt word template according to the error cause, that is, the above-mentioned segment to be modified, wherein, in order to ensure the accuracy of the determined error cause, the text processing system may 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, and then analyze the above-mentioned error cause according to the description content corresponding to this part in the initial prompt word template. For example, assuming that the error case is "outputting a search result corresponding to "XX" information", and the initial response result is "outputting multiple search results corresponding to "XX" information at one time", then by comparing the error case with the initial response result, the text processing system can determine that the text processing model cannot understand the "text output part" in the initial prompt word template. Based on this, the error causes that can be determined may include but are not limited to: "text output part" is in an easy-to-forget area, and the text processing model does not consider the output quantity when outputting the result; "text output part" has missing and incomplete information, 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" and 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 current segment that needs to be modified, the text processing system can modify the segment to be modified in a targeted manner in combination with the error cause currently analyzed, so as to obtain multiple segments that can preliminarily solve the error cause, that is, the above-mentioned multiple target segments, and 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, in order to ensure the logic of the determined fragment to be modified, the text processing system can divide the initial prompt word template according to the logical relationship corresponding to different positions in the initial prompt word template to obtain multiple template fragments. In order to improve efficiency, considering that the logical relationship of a single paragraph or sentence is usually complete, the text processing system can directly divide the multiple sentences or paragraphs contained in the initial prompt word template into different template fragments.
[0064] In an embodiment of the present application, the segment to be modified is modified based on the cause of the error to obtain multiple target segments, including: obtaining the model indicator corresponding to the initial prompt word template, and the segment position of the segment to be modified in the initial prompt word template, wherein the model indicator is used to reflect the performance of the text processing model in performing tasks based on the initial prompt word template; the segment to be modified is adjusted based on the segment position, the cause of the error and the model indicator to obtain multiple target segments.
[0065] In an optional solution of this embodiment, considering that whether it is the model training stage or the model deployment stage, fully understanding the performance of the model in different scenarios is crucial to ensure that the model can accurately and efficiently complete the expected task, therefore, when modifying the to-be-modified segment using the error reason, 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 word template, such as the performance of the text processing model in performing a specific task under the initial prompt word template, that is, obtaining the model indicators corresponding to the initial prompt word template, such as accuracy, processing efficiency and other indicators. At the same time, considering that the text processed by the text processing model is usually a long sequence text, when performing text processing, the model may find it difficult to maintain long-term memory of all information in the entire input text, thereby causing information forgetting, which affects the processing ability of the model. Whether the information will be forgotten is usually related to the position of the information in the input text. Therefore, the text processing system can also obtain the segment position of the currently determined segment to be modified in the initial prompt word template, so as to determine whether it is necessary to allocate additional attention weight to the segment modification process according to the segment position, so as to avoid the modification direction error, resulting in the original problems still existing in the modified multiple target segments, or the emergence of new problems that affect the prompt word generation process. After determining the above-mentioned model indicators and segment positions, the text processing system can further adjust the segment to be modified based on the analyzed error causes and the corresponding model indicators and segment positions, thereby obtaining multiple target segments that can more stably generate prompt word texts.
[0066] In an embodiment of the present application, the segment to be modified is adjusted based on the segment position, the error cause and the model indicator to obtain multiple target segments, including: modifying the segment to be modified based on the error cause and the model indicator to obtain multiple first segments; identifying the segment position to determine the segment type of the segment to be modified; in response to the segment type being a first preset type, determining multiple first segments as multiple 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, generating second segments corresponding to different first segments, and based on the multiple first segments and the segment to be modified, constructing multiple target segments, 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 different first segments and the segment to be modified.
[0067] In an optional scheme of the present embodiment, when adjusting the segment to be modified according to the determined segment position, error cause and model index, the text processing system can first modify the segment to be modified using the determined error cause and model index to obtain multiple first segments that can preliminarily solve the corresponding error cause and improve the model index at the same time. Considering that if the segment to be modified is in an easily forgotten area, such as the middle area of the template, it means that more attention weight needs to be allocated to the segment to be modified to ensure that the modified segment can be better applied to the process of prompt word generation to ensure the accuracy of the generated prompt word 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 an easily forgotten 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 easy-to-forget area, the text processing system can directly determine the generated multiple first segments as multiple target segments without additionally allocating 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 easy-to-forget area, the text processing system can consider allocating more attention weights to the generated multiple first segments, and considering that the 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, in order to reduce the cost of training the text processing model using the prompt word 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 word text corresponding to the modified prompt word template, it can understand the result of adjusting the segment to be modified through the additionally set 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 based on the difference between the segment to be modified and the first segment, and then construct corresponding multiple target segments based on the generated multiple first segments and the corresponding second segments.
[0068] In an embodiment of the present application, an initial prompt word template is adjusted based on multiple target segments to obtain multiple candidate prompt word templates, including: using multiple target segments to update the initial prompt word template to obtain multiple first prompt word templates; verifying the multiple first prompt word templates to obtain verification results corresponding to different first prompt word templates, wherein the verification results are used to characterize whether different first prompt word templates conform to preset language logic rules; in response to the verification result that the multiple first prompt word templates conform to the language logic rules, determining the multiple first prompt word templates as multiple candidate prompt word templates; in response to the verification result 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 are that the new multiple first prompt word templates conform to the language logic rules, or the number of times the new segments to be modified are re-determined reaches a preset value, determining the new multiple first prompt word templates as multiple candidate prompt word templates.
[0069] In an optional solution of this embodiment, when adjusting the initial prompt word template using the constructed multiple target segments, the text processing system may first update the initial prompt word template using the multiple target segments to obtain the above-mentioned multiple first prompt word templates. For example, if the multiple target segments only include multiple first segments, it means that the corresponding segment to be modified is not in the easy-to-forget area. The corresponding text processing system may directly use the multiple first segments to replace the segment to be modified without worrying that the text processing model will not notice the modification result. If the multiple target segments simultaneously include multiple first segments and second segments corresponding to different first segments, it means that the corresponding segment to be modified is in the easy-to-forget area. At this time, the text processing system may first use the multiple first segments to replace the segment to be modified to generate multiple new prompt word templates, and then add the second segment corresponding to the first segment to the non-easy-to-forget area included in the new prompt word template, for example, to the beginning or end of the new prompt word template to obtain multiple first prompt word templates, so that the text processing model can notice the first segment in the easy-to-forget area by noticing the second segment in the non-easy-to-forget area, thereby focusing on understanding the difference between the first segment 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 preset language logic rules, thereby obtaining verification results corresponding to different prompt word templates. When verifying, the generated new template can contain all variable placeholders to avoid the appearance of words that cannot be configured in the template or logical confusion.
[0070] Correspondingly, if the verification result is that multiple first prompt word templates all meet the preset language logic rules, the text processing system can directly determine multiple candidate prompt word templates from the multiple first prompt word templates; if the verification result is that there are templates that do not meet the preset language logic rules among the multiple first prompt word templates, the text processing system can re-determine a new segment to be modified from the initial prompt word template according to the aforementioned process, and construct multiple new first prompt word templates based on the new segment to be modified, until the constructed new prompt word template can meet the preset language logic rules, or when the number of times the segment to be modified is re-determined reaches a preset value, the new multiple first prompt word templates corresponding to the re-determined segment to be modified are determined as multiple candidate prompt word templates. It should be noted that the new segment to be modified determined each time can be the same, but the new first prompt word template re-determined based on the new segment to be modified needs to be different from the first prompt word template constructed previously, so as to avoid repeatedly constructing the same prompt word template, which affects the efficiency of constructing the candidate prompt word template.
[0071] In an embodiment of the present application, multiple candidate prompt word templates are screened based on an initial prompt word text to obtain a target prompt word template, including: adjusting the initial prompt word text based on multiple candidate prompt word models to obtain multiple candidate prompt word texts; evaluating text response results corresponding to multiple candidate prompt word texts based on multiple evaluation dimensions to obtain multiple dimensional evaluation results corresponding to different text response results, wherein different text response results are used to characterize results obtained by processing different candidate prompt word texts using a text processing model; summarizing multiple dimensional evaluation results to obtain evaluation scores corresponding to different text response results; and screening multiple candidate prompt word templates based on the evaluation scores corresponding to different text response results to obtain a target prompt word template.
[0072] The above-mentioned multiple evaluation dimensions may refer to parameters that can reflect the prompt word generation capabilities of different candidate prompt word templates, for example, may include but are not limited to: accuracy, recall rate, response efficiency and other parameters of text response results corresponding to different candidate prompt word templates.
[0073] In an optional 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 format, etc., according to the constructed multiple candidate prompt word templates, so as to generate candidate prompt word texts corresponding to different candidate prompt word templates, and then input the generated candidate prompt word texts into the text processing model, so as to use the text processing model to process different candidate prompt word texts, so as to obtain text response results corresponding to different candidate prompt word texts, and then in the above multiple evaluation Dimensions, different text response results are evaluated to obtain dimensional evaluation results of different text response results in different evaluation dimensions, such as the above-mentioned accuracy, recall rate, response efficiency and other dimensions. Finally, the dimensional 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 express the dimensional evaluation results of text response results in different evaluation dimensions in the form of percentages, and then perform weighted summation of the percentages corresponding to different evaluation dimensions to obtain a time-sharing that can reflect the prompt word generation capabilities of different candidate prompt word templates, that is, the above-mentioned evaluation scores. After generating the evaluation scores corresponding to different candidate prompt word templates, the text processing system can filter out the above-mentioned target prompt word template from multiple candidate prompt word templates according to the evaluation scores.
[0074] In an embodiment of the present application, an initial prompt word text is adjusted based on multiple candidate prompt word models to obtain multiple candidate prompt word texts, including: extracting features of error cases contained in the initial prompt word text to obtain case features of the error cases; and filling multiple candidate prompt word templates based on the case features to obtain multiple candidate prompt word texts.
[0075] In an optional solution of the present embodiment, considering that the purpose of constructing a candidate prompt word template is to solve the problems existing in the initial prompt word template, the text processing system may first perform feature extraction on the error cases contained in the initial prompt word text to obtain the case features of the error cases, and then use the extracted case features to fill in multiple candidate prompt word templates respectively to obtain candidate prompt word texts corresponding to different candidate prompt word templates. In order to clearly reflect whether the constructed candidate prompt word template still has the problems existing in the initial prompt word template, when extracting features from the error cases, the text processing system may extract the content that can be modified contained in the error case, such as the text that can be actively input by the user, and then fill in the extracted content according to the template format given by the candidate prompt word template, thereby generating the above-mentioned candidate prompt word template without changing the original meaning of the error case and without introducing problems that may occur in the initial prompt word template.
[0076] In an embodiment of the present application, a plurality of candidate prompt word templates are screened based on evaluation scores corresponding to different text response results to obtain a target prompt word template, including: sorting a plurality of candidate prompt word templates based on evaluation scores corresponding to different text response results to obtain a prompt word template sequence; selecting a plurality of second prompt word templates from the prompt word template sequence in a preset manner, wherein an evaluation score of any one of the second prompt word templates is greater than an evaluation score of other prompt word templates in the prompt word template sequence except for the plurality of second prompt word templates; obtaining historical evaluation data corresponding to the plurality of second prompt word templates; and selecting a target prompt word template from the plurality of second prompt word templates based on the historical evaluation data.
[0077] In an optional solution of this embodiment, when screening multiple candidate prompt word templates, in order to ensure the accuracy of the screened target prompt word template, the text processing system may first sort the multiple candidate prompt word templates according to the multiple evaluation scores corresponding to different candidate prompt word templates, so as to obtain the above prompt word template sequence in descending order, and then select multiple second prompt word templates from the prompt word template sequence in a preset manner, such as selecting the first n or first n% templates in the sequence. In order to ensure the accuracy of the determined target prompt word template, the text processing system may also obtain historical evaluation data corresponding to the selected multiple second prompt word templates, such as the evaluation data corresponding to different second prompt word templates in the process of determining the first prompt word template in each iteration, and finally select the above target prompt word template from the multiple second prompt word templates according to the obtained historical evaluation data.
[0078] In an embodiment of the present application, after a plurality of candidate prompt word templates are screened based on an initial prompt word text to obtain a target prompt word template, the method further includes: in response to an evaluation score of a target response result satisfying a preset evaluation condition, outputting the target prompt word template; in response to an evaluation score of a target response result not satisfying a preset evaluation condition, regenerating a plurality of new candidate prompt word templates based on the initial response result, the initial prompt word text and the initial prompt word template according to a preset iterative algorithm, and screening the plurality of new prompt word templates based on the initial prompt word text until the evaluation score corresponding to the screened-out new target prompt word template satisfies the preset evaluation condition, and outputting a new target prompt word template.
[0079] The above-mentioned preset evaluation conditions may refer to conditions that can reflect the user's needs for the target prompt word template. For example, it may be the target prompt word text generated by the target prompt word template, whether the text processing model has high processing capabilities under specific tasks, whether there will be no errors, whether the processing efficiency is fast, etc. These requirements can be reflected through the evaluation scores corresponding to the target prompt word template.
[0080] In an optional solution of the present embodiment, considering that the target prompt word template selected through the aforementioned process can preliminarily solve the potential problems in the initial prompt word template, the evaluation score can also reflect that the prompt word generation capability 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 user's input demand content related to the target prompt word template, and generate the above-mentioned preset evaluation conditions according to the received demand 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 condition. If the target response result meets the preset evaluation condition, the text processing system can determine that the current target prompt word template can meet the user's needs, and the target prompt word template can be displayed in the operation interface accordingly; if the template response result does not meet the preset evaluation condition, the text processing system can perform a preset iterative algorithm, such as Beam Search or Monte Carlo Tr10. Search algorithm is used to construct multiple new candidate prompt word templates based on the above initial response results, initial prompt word texts and initial prompt word templates, and reuse the initial prompt word texts to screen these multiple new candidate prompt word templates according to the above process, until the evaluation score corresponding to the newly screened new target prompt word template can meet the above preset evaluation conditions, then the text processing system can output the new target prompt word template. If the target prompt word template that can meet the above preset evaluation conditions cannot be obtained in multiple iterative cycles, then the text processing system can determine the target prompt word template with the largest corresponding evaluation score among the target prompt word templates determined multiple times 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 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 multiple second prompt word templates. The fourth part is the iterative screening part, which can be used to repeatedly execute the entire process of determining the target prompt word template, thereby ensuring the accuracy of the target prompt word template finally determined.
[0082] Figure 3a is a schematic diagram of the first part of a text processing process according to an embodiment of the present application, such 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, obtain the scene description text, error case and other texts generated under the initial prompt word template, and then analyze the initial prompt word text to determine the error cause of the error case in the initial prompt word text, and the to-be-modified segment that needs to be modified, and at the same time determine the segment position of the to-be-modified segment, and then perform preliminary modification on the to-be-modified segment according to the data such as the error cause and the model performance to obtain multiple first segments, and determine whether the segment type of the to-be-modified segment is the second preset type through the segment position of the to-be-modified segment, that is, determine whether the to-be-modified segment is in the easy-to-forget area, if not, the text processing system can directly use the multiple first segments to adjust the initial prompt word template to obtain multiple first prompt word templates; if it is, the text processing system can generate a second segment for describing the modified content according to the difference between the first segment and the to-be-modified segment, and then use the first segment and the corresponding second segment 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 if the number of iterations does not reach the maximum number, continue to build new first prompt word templates; if the verification fails, the above process can be used to re-determine the segment to be modified, re-build the first segment, and re-build the first prompt word template to ensure the accuracy of the determined candidate prompt word template. After determining multiple candidate prompt word templates, the second part can be started to preliminarily screen multiple candidate prompt words.
[0083] Figure 3b is a schematic diagram of the second part of a text processing process according to an embodiment of the present application, such as Figure 3b As shown, in the second part, the text processing system can first perform a preliminary screening of multiple candidate prompt word templates, for example, first evaluate different candidate prompt word templates according to the prompt word text to obtain multiple corresponding evaluation scores, and then sort the 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 according to a preset method.
[0084] Figure 3c is a schematic diagram of the third part of a text processing process according to an embodiment of the present application, such 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 can obtain historical evaluation data corresponding to different second prompt word templates, and select a template with better prompt word generation ability from multiple second prompt word templates based on the historical evaluation data as the above-mentioned target prompt word template.
[0085] Figure 3d is a schematic diagram of the fourth part of a text processing process according to an embodiment of the present application, such as Figure 3d As shown in the fourth part, if there is a concern that the prompt word generation ability of the selected target prompt word template is still unstable, the text processing system can also perform a new round of target prompt word template selection process according to a preset iterative algorithm, such as 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 number of algorithm iterations, and then the final 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 used for analysis, stored data, displayed data, etc.) involved in this 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 must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0087] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0088] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment 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 this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0089] According to an embodiment of the present application, another text processing method is also provided. Figure 4 is a flowchart of another text processing method according to an embodiment of the present application, such as Figure 4 As shown, the method may include the following steps:
[0090] Step S402, in response to an input instruction acting on the operation interface, an initial prompt word text matching the initial prompt word template and an initial response result corresponding to the initial prompt word text are displayed on the operation interface.
[0091] 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 the processing instruction acting on the operation interface, the target prompt word template is displayed on the operation interface.
[0093] Among them, the target prompt word template is used to represent the 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 the template 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 a text processing model, and the target prompt word text matches the target response result.
[0094] In an optional 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 word template used to generate the prompt word text 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. Based on this, before training the text processing model, when receiving the above-mentioned input instruction, the text processing system can first obtain the initial prompt word text matching the initial prompt word template currently used, and the initial response result corresponding to the initial prompt word text, and display the initial prompt word text and the corresponding initial response result in the operation interface for user viewing. When receiving the above processing instruction, the text processing system can 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, and then use the initial prompt word text to screen the multiple candidate prompt word templates to obtain the above target prompt word template. For example, the text processing system can first use the initial prompt word text to evaluate different candidate prompt word templates to obtain the evaluation scores corresponding to different candidate prompt word templates, and then determine the above target prompt word template from multiple candidate prompt word templates according to the determined evaluation scores, and display the determined target prompt word template in the operation interface for user viewing. The specific process of determining the prompt word 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 is a flowchart of another text processing method according to an embodiment of the present application, such as Figure 5 As shown, the method may include the following steps:
[0096] Step S502: acquiring 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.
[0097] 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.
[0098] Step S504: 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.
[0099] Step S506: Screen multiple candidate prompt word templates based on the initial prompt word text to obtain a target prompt word 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 the 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] The second interface includes a second parameter, and a parameter value of the second parameter includes a target prompt word template.
[0103] In an optional solution of this embodiment, similarly, in order to obtain a target prompt word template with higher accuracy and train the text processing model using the target prompt word text generated by the target prompt word template, the text processing can first obtain the corresponding first parameter by calling the above-mentioned first interface, that is, obtaining 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, and 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, so as to facilitate user viewing. The specific process of determining the prompt word template can be as shown above, and is not limited here.
[0104] According to an embodiment of the present application, a text processing device for implementing the above text processing method is also provided. Figure 6 is a structural block diagram of a text processing device according to an embodiment of the present application. Figure 6 As 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 obtain the initial prompt word text matching the initial prompt word template, and the initial response result corresponding to the initial prompt word text, wherein 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 multiple candidate prompt word templates based on the initial prompt word text to obtain a target prompt word template, wherein 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 an embodiment of the present application, the first adjustment module 604 includes: a case determination unit, which is used to determine 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; and a template adjustment unit, which is used 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 an embodiment of the present application, the template adjustment unit is also used to: 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, determine the segment to be modified from the multiple template segments included in the initial prompt word template; modify the segment to be modified based on the error cause to obtain multiple target segments; adjust the initial prompt word template based on the multiple target segments to obtain multiple candidate prompt word templates.
[0108] In an embodiment of the present application, the template adjustment unit is also used to: obtain the model indicator corresponding to the initial prompt word template, and the fragment position of the fragment to be modified in the initial prompt word template, wherein the model indicator 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, error cause and model indicator to obtain multiple target fragments.
[0109] In an embodiment of the present application, the template adjustment unit is also used to: modify the to-be-modified fragment based on the error cause and the model indicator to obtain multiple first fragments; identify the fragment position to determine the fragment type of the to-be-modified fragment; in response to the fragment type being a first preset type, determine the multiple first fragments as multiple target fragments; in response to the fragment type being a second preset type, based on the multiple first fragments and the to-be-modified fragment, generate second fragments corresponding to different first fragments, and based on the multiple first fragments and the to-be-modified fragment, construct multiple target fragments, wherein the attention weight of the to-be-modified fragment corresponding to the first preset type is greater than the attention weight of the to-be-modified fragment corresponding to the second preset type, and the second fragment is used to characterize the difference between different first fragments and the to-be-modified fragment.
[0110] In an embodiment of the present application, the template adjustment unit is further used to: update the initial prompt word template using multiple target segments to obtain multiple first prompt word templates; verify the multiple first prompt word templates to obtain verification results corresponding to different first prompt word templates, wherein the verification results are used to characterize whether the different first prompt word templates comply with preset language logic rules; in response to the verification result that the multiple first prompt word templates comply with the language logic rules, determine that the multiple first prompt word templates are multiple candidate prompt word templates; in response to the verification result that any one of the first prompt word templates does not comply with the language logic rules, re-determine new segments to be modified, and construct 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 are that the new multiple first prompt word templates comply with the language logic rules, or the number of times the new segments to be modified are re-determined reaches a preset value, and determine that the new multiple first prompt word templates are multiple candidate prompt word templates.
[0111] In the embodiment of the present application, the first screening module 606 includes: a text feature unit, which is used to adjust the initial prompt word text based on multiple candidate prompt word models to obtain multiple candidate prompt word texts; a result evaluation unit, which is used to 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 characterize the results obtained by processing different candidate prompt word texts using the text processing model; a result summary unit, which is used to summarize the multiple dimensional evaluation results to obtain evaluation scores corresponding to different text response results; a template screening unit, which is used to screen multiple 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 also used to: extract features of error cases contained in the initial prompt word text to obtain case features of the error cases; fill in multiple candidate prompt word templates based on the case features to obtain multiple candidate prompt word texts.
[0113] In an embodiment of the present application, the template screening unit is further used to: sort multiple candidate prompt word templates based on evaluation scores corresponding to different text response results to obtain a prompt word template sequence; select multiple second prompt word templates from the prompt word template sequence in a preset manner, 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; obtain historical evaluation data corresponding to the multiple second prompt word templates; and select a target prompt word template from the multiple second prompt word templates based on the historical evaluation data.
[0114] In an embodiment of the present application, the above-mentioned device also includes: a first output module, which is used to output a target prompt word template in response to the evaluation score of the target response result satisfying a preset evaluation condition; a second output module, which is used to regenerate multiple new candidate prompt word templates based on the initial response result, the initial prompt word text and the initial prompt word template in response to the evaluation score of the target response result not satisfying the preset evaluation condition according to a preset iterative algorithm, and screen the multiple new prompt word templates based on the initial prompt word text until the evaluation score corresponding to the screened new target prompt word template meets the preset evaluation condition, and outputs a new target prompt word template.
[0115] It should be noted that the 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, and the three modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents 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 (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above modules may also be part of a device and may be run in the electronic device 10 provided in the above embodiment.
[0116] According to an embodiment of the present application, another text processing device for implementing the above text processing method is also provided. Figure 7 is a structural block diagram of another text processing device according to an embodiment of the present application, such as Figure 7 As shown, the device includes: a first display module 702 and a second display module 704 .
[0117] Among them, the first display module 702 is used to respond to the input instruction acting on the operation interface, and display the initial prompt word text matching the initial prompt word template and the initial response result corresponding to the initial prompt word text on the operation interface, wherein 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 second display module 704 is used to respond to the processing instruction acting on the operation interface, and display the target prompt word template on the operation interface, wherein the target prompt word template is used to represent the 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 the template 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.
[0118] It should be noted that the first display module 702 and the second display module 704 correspond to steps S402 to S404 in the above embodiment, and the two modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents 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 (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above modules may also be part of a device and may be run in the electronic device 10 provided in the above embodiment.
[0119] According to an embodiment of the present application, another text processing device for implementing the above text processing method is also provided. Figure 8 is a structural block diagram of another text processing device according to an embodiment of the present application, such as Figure 8 As shown, the device includes: a first calling module 802 , a second adjusting module 804 , a second screening module 806 , and a second calling module 808 .
[0120] The first calling module 802 is used 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 by calling the first interface, wherein 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 second adjusting 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 multiple candidate prompt word templates; the second screening module 806 is used to screen the multiple candidate prompt word templates based on the initial prompt word text to obtain the target prompt word template, wherein 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; the second calling module 808 is used to output the target prompt word template by calling the second interface, wherein 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 that the first calling module 802, the second adjusting module 804, the second screening module 806 and the second calling module 808 correspond to steps S502 to S508 in the above embodiment, and the four modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents 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 (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above modules can also be part of the device and can be run in the electronic device 10 provided in the above embodiment.
[0122] It should be noted that the preferred implementation scheme involved in the above embodiments of the present application is the same as the scheme provided in the above embodiments, as well as the application scenario and implementation process, but is not limited to the scheme provided in the above embodiments.
[0123] An embodiment of the present application may provide a computing device. Fig. 9 is a structural block diagram of a computing device according to an embodiment of the present application. Fig. 9 As 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-mentioned 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 computing device can be pre-installed with the model in the above-mentioned embodiment of the present application.
[0125] Specifically, the computing device can pre-set multiple types of models, including but not limited to models in the fields of natural language processing, visual processing, speech processing, code processing, multimodal task processing, etc., so as to provide a variety of model choices. In different product forms, the computing device can support one or more model usage methods, including but not limited to model training, model calling, model fine-tuning, model deployment, model reasoning 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 multiple types of models such as discriminant and generative models), model version control (supporting the control of different model versions), model evaluation (based on model evaluation tools, evaluating the performance and effect of the model), etc. In other product forms, the computing device can also create applications based on models, provide API calling capabilities, and can call models to the created applications through API interfaces, while providing application management tools to achieve management and monitoring of applications.
[0126] Furthermore, the computing device can also include data management (supporting the creation and management of model tuning data sets), training center (providing rich training resources to help users learn and master AI technology), and basic management and control capabilities (providing enterprise-level basic management and control capabilities to ensure the security and efficient operation of the system). Through the above functions, a comprehensive, 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 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, implementing 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 memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0128] The processor may call the executable program stored in the memory through the transmission device to execute any method in the above embodiments.
[0129] An embodiment of the present application may provide an electronic device. Fig.10 1 is a structural block diagram of an electronic device according to an embodiment of the present application. Fig.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 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, implementing 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 memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0131] The processor may call the executable program stored in the memory through the transmission device to execute any method in the above embodiments.
[0132] It will be understood by those skilled in the art that the structure shown in the figure is for illustration only, and the computing device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. The figure does not limit the structure of the above computing device. For example, the computing device 100 may also include more or fewer components (such as a network interface, a display device, etc.) than those shown in the figure, or have a configuration different from that shown in the figure.
[0133] A person 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 hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0134] The embodiment of the present application further provides a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium can be used to store 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 a computing device.
[0136] Optionally, in this embodiment, the computer-readable storage medium is configured to store an executable program, and when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods in the above embodiments.
[0137] The embodiment of the present application further provides a computer program product. Optionally, in this embodiment, the computer program product may include a computer program, and the computer program implements the method provided in the embodiment when executed by a processor.
[0138] The embodiments of the present application also provide a computer program product. Optionally, the computer program product may include a non-volatile computer-readable storage medium, which may be used to store a computer program, and when the computer program is executed by a processor, the method provided in the embodiments is implemented.
[0139] The embodiment of the present application further provides a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, the method provided in the above embodiment is implemented.
[0140] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0141] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0142] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0143] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0144] If 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 this understanding, the technical solution of the present application, 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, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0145] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection 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 initial prompt word template to obtain multiple candidate prompt word templates; 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 indicator 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 indicator 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 models 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 the different text response results, wherein the different text response results are used to represent the results obtained by processing the 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 a 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 the 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 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 the target prompt word text using the text processing model, and the target prompt word text matches the target response result.
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 initial prompt word template to obtain multiple candidate prompt word templates; 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
Text processing method and device, equipment and storage medium
CN117829113A
Log analysis method and device based on prompt optimization, equipment and storage medium
CN118427294A
Multi-stage collaborative term definition standardization method based on large model
CN118446208A
Prompt generation method and text processing method
CN118655989A
Method and device for optimizing cue word, equipment and medium
CN118733758A
Cited By
Problem prompt word generation method and system and electronic equipment
CN119782768A
Question Prompt Generation Method, System and Electronic Device
CN119782768B
Large model cue word automatic optimization method based on distributed intelligent agent
CN120277204A
Automatic optimization method of large model prompt words based on distributed intelligent agent
CN120277204B
Method for detecting log abnormity of power dispatching automation system
CN120723588A