Prompt text determination method, data processing method, computing device, and storage medium
By optimizing and evaluating the initial prompt text of the large language model multiple times, the problems of excessive computing resources and insufficient adaptation were solved, and better data processing results were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ALIBABA CLOUD COMPUTING CO LTD
- Filing Date
- 2024-12-10
- Publication Date
- 2026-06-12
AI Technical Summary
Large language models require excessive computational resources during optimization and lack effective adaptation to specific domain data processing tasks, resulting in poor optimization performance.
By identifying multiple initial prompt texts, selecting a suitable algorithm to optimize and evaluate them, and iteratively optimizing them to obtain the target prompt text, the algorithm is adapted to specific target data processing tasks.
The optimization of target prompt text has been improved, making it better suited to specific data processing tasks and improving processing efficiency.
Smart Images

Figure CN122196171A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of data processing technology, and in particular to a method for determining prompt text, a data processing method, a computing device, and a storage medium. Background Technology
[0002] In practical applications, large language models are gradually replacing natural language processing models for language processing tasks. Due to their complexity and massive scale, using large language models requires higher technical capabilities and computational resources. Optimization of a large set of language models typically utilizes fine-tuning or cue word engineering. However, as the size of large language models increases, the computational resources required for fine-tuning become excessively large. Furthermore, cue word engineering optimization lacks effective adaptation to specific domain-specific data processing tasks, resulting in poor optimization performance. Therefore, an effective technical solution is urgently needed to address these issues. Summary of the Invention
[0003] In view of this, embodiments of this specification provide a method for determining prompt text. One or more embodiments of this specification also relate to a prompt text determining device, a data processing method, a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.
[0004] According to a first aspect of the embodiments of this specification, a method for determining prompt text is provided, including: Based on the training data of the prompt texts corresponding to the target data processing task, determine multiple initial prompt texts; The first target algorithm is determined according to the algorithm selection strategy, and the multiple initial prompt texts are optimized according to the first target algorithm to obtain multiple candidate prompt texts; The plurality of candidate prompt texts are evaluated to obtain evaluation results, and a plurality of intermediate prompt texts are determined from the plurality of candidate prompt texts based on the evaluation results; The multiple intermediate prompt texts are optimized and evaluated to obtain the target prompt text, and the target data processing task is performed based on the target prompt text.
[0005] According to a second aspect of the embodiments of this specification, a prompt text determining device is provided, comprising: The determination module is configured to determine multiple initial prompt texts based on the prompt text training data corresponding to the target data processing task. The optimization module is configured to determine a first target algorithm based on an algorithm selection strategy, and optimize the plurality of initial prompt texts according to the first target algorithm to obtain a plurality of candidate prompt texts; An evaluation module is configured to evaluate the plurality of candidate prompt texts, obtain evaluation results, and determine a plurality of intermediate prompt texts from the plurality of candidate prompt texts based on the evaluation results. The processing module is configured to optimize and evaluate the plurality of intermediate prompt texts to obtain a target prompt text, and to perform the target data processing task based on the target prompt text.
[0006] According to a third aspect of the embodiments of this specification, a data processing method is provided, comprising: Identify the data to be processed corresponding to the target data processing task; Call the task processing interface, and process the data to be processed and the target prompt text based on the task processing interface to obtain the data processing result corresponding to the data to be processed; The target prompt text is determined according to the method provided in the first aspect of the embodiments of this specification.
[0007] According to a fourth aspect of the embodiments of this specification, a data processing apparatus is provided, comprising: The determination module is configured to determine the data to be processed corresponding to the target data processing task; The calling module is configured to call the task processing interface and process the data to be processed and the target prompt text based on the task processing interface to obtain the data processing result corresponding to the data to be processed. The target prompt text is determined according to the method provided in the first aspect of the embodiments of this specification.
[0008] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the above method.
[0009] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores a computer program / instructions that, when executed by a processor, implement the steps of the above-described method.
[0010] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described method.
[0011] One embodiment of this specification provides a method for determining prompt text, comprising: determining a plurality of initial prompt texts based on prompt text training data corresponding to a target data processing task; determining a first target algorithm based on an algorithm selection strategy, and optimizing the plurality of initial prompt texts according to the first target algorithm to obtain a plurality of candidate prompt texts; evaluating the plurality of candidate prompt texts to obtain evaluation results, and determining a plurality of intermediate prompt texts from the plurality of candidate prompt texts based on the evaluation results; optimizing and evaluating the plurality of intermediate prompt texts to obtain a target prompt text, so as to execute the target data processing task according to the target prompt text.
[0012] The above method determines multiple initial prompt texts based on the training data of prompt texts corresponding to the target data processing task. After selecting a suitable first target algorithm according to the algorithm selection strategy, the first target algorithm is used to optimize the multiple initial prompt texts. The optimized candidate prompt texts are then evaluated. After determining the intermediate prompt texts based on the evaluation results, the intermediate prompt texts are further optimized and evaluated to obtain the final optimized target prompt text. Because the initial prompt texts are optimized and evaluated multiple times, the optimization of the target prompt text can be effectively adapted to the specific target data processing task, further improving the optimization effect of the target prompt text and making the processing effect of the target data processing task executed based on the target prompt text better. Attached Figure Description
[0013] Figure 1 This is a schematic diagram illustrating an application scenario of a method for determining prompt text provided in one embodiment of this specification; Figure 2 This is a flowchart illustrating a method for determining prompt text according to one embodiment of this specification; Figure 3 This is a training architecture diagram of a prompt text determination method provided in one embodiment of this specification; Figure 4 This is a flowchart illustrating the processing steps of a method for determining prompt text, provided in one embodiment of this specification. Figure 5 This is a schematic diagram of a prompt text determining device provided in one embodiment of this specification; Figure 6 This is a flowchart illustrating a data processing method provided in one embodiment of this specification; Figure 7 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this specification; Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0014] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0015] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0016] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0017] Furthermore, 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 one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0018] In one or more embodiments of this specification, a large model refers to a deep learning model with a large number of model parameters, typically containing hundreds of millions, tens of billions, hundreds of billions, trillions, or even tens of trillions of model parameters. A large model can also be called a foundation model. It is pre-trained using large-scale unlabeled corpora to produce a pre-trained model with hundreds of millions of parameters. Such models can adapt to a wide range of downstream tasks and have good generalization ability. Examples include Large Language Models (LLMs) and multi-modal pre-training models.
[0019] In practical applications, large models only require a small number of samples to fine-tune the pre-trained model before they can be applied to different tasks. Large models can be widely used in fields such as Natural Language Processing (NLP) and Computer Vision. Specifically, they can be applied to computer vision tasks such as Visual Question Answering (VQA), Image Captioning (IC), and Image Generation, as well as NLP tasks such as text-based sentiment classification, text summarization, and machine translation. The main application scenarios for large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.
[0020] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0021] COT: Chain of Thought, a reasoning method, particularly in natural language processing, refers to a model demonstrating its reasoning process by progressively breaking down complex reasoning tasks into a series of simple steps. This approach helps improve the transparency and interpretability of model decisions.
[0022] RAG: Retrieval-Augmented Generation, is a technique that combines information retrieval and text generation. In this approach, the model not only generates text based on its own knowledge but also retrieves relevant information from external knowledge sources to enhance the generated content, thereby improving the accuracy and contextual relevance of the generated text.
[0023] In-Context Learning: This refers to a model's ability to learn and adapt its behavior within a given specific context. Simply put, it means that within a provided example context, the model can understand and mimic patterns, thereby demonstrating better generalization ability on new data.
[0024] Self-Reflection: In the field of artificial intelligence, especially machine learning, self-reflection refers to a model's ability to evaluate its own output and adjust its subsequent behavior or predictions accordingly. This ability allows the model to identify errors and improve its performance.
[0025] API: Application Programming Interface, is a set of rules that define how software components communicate with each other. It allows different software applications to interact with each other without needing to know the details of each other's internal workings.
[0026] This specification provides a method for determining prompt text, and also relates to a prompt text determination device, a data processing method, a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0027] See Figure 1 , Figure 1 The illustration shows an application scenario of a prompt text determination method according to an embodiment of this specification, which specifically includes the following steps.
[0028] Based on the training data of the prompt texts corresponding to the target data processing task, determine multiple initial prompt texts; The first target algorithm is determined according to the algorithm selection strategy, and the multiple initial prompt texts are optimized according to the first target algorithm to obtain multiple candidate prompt texts; The plurality of candidate prompt texts are evaluated to obtain evaluation results, and a plurality of intermediate prompt texts are determined from the plurality of candidate prompt texts based on the evaluation results; The multiple intermediate prompt texts are optimized and evaluated to obtain the target prompt text, and the target data processing task is performed based on the target prompt text.
[0029] In practice, Figure 1The system includes a terminal device 102 and a cloud-side device 104, where the cloud-side device 104 can be understood as a platform for prompt word optimization. Specifically, the user can send prompt text training data corresponding to the target data processing task to the cloud-side device 104 through the terminal device 102. The cloud-side device 104 can construct multiple initial prompt texts based on the prompt text training data, determine a first target algorithm according to the algorithm selection strategy, optimize the multiple initial prompt texts according to the first target algorithm to obtain multiple candidate prompt texts, evaluate the multiple candidate prompt texts to obtain evaluation results, and determine multiple intermediate prompt texts from the multiple candidate prompt texts based on the evaluation results. The above steps are repeated to optimize and evaluate the multiple intermediate prompt texts to obtain the final optimized target prompt text, so that the target data processing task can be executed based on the target prompt text.
[0030] The edge device 102 may include a browser, an app (application), or a web application such as an H5 (Hypertext Markup Language 5) application, a lightweight application (also known as a mini-program), or a cloud application. The edge device can be developed based on a software development kit (SDK) provided by the server, such as a real-time communication (RTC) SDK. The edge device can be deployed in an electronic device and depends on the device's operation or certain apps within the device to run. The electronic device may have a display screen and support information browsing, such as a personal mobile terminal like a mobile phone, tablet, or personal computer. Various other types of applications can also be configured in the electronic device, such as human-computer interaction applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platform software.
[0031] Cloud-side device 104 can be understood as a server providing various services, including physical servers and cloud servers. Examples include servers providing communication services to multiple clients, servers supporting backend training of models used on clients, and servers processing data sent by clients. It should be noted that cloud-side device 104 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. Cloud-side device 104 can also be a server for a distributed system, or a server integrated with blockchain. Cloud-side device 104 can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
[0032] It is worth noting that the prompt text determination method provided in the embodiments of this specification can be executed by the cloud-side device 104. In other embodiments of this specification, the prompt text training framework can be deployed in the edge device 102, so that the edge device 102 can also have similar functions to the cloud-side device 104, thereby executing the prompt text determination method provided in the embodiments of this specification. In other embodiments, the prompt text determination method provided in the embodiments of this specification can also be jointly executed by the edge device 102 and the cloud-side device 104.
[0033] See Figure 2 , Figure 2 A flowchart of a prompt text determination method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0034] Step 202: Determine multiple initial prompt texts based on the prompt text training data corresponding to the target data processing task.
[0035] Specifically, the prompt text determination method provided in the embodiments of this specification can be applied to the field of task processing, such as evaluation tasks, labeling tasks, image generation tasks, and text generation tasks. Taking an evaluation task as an example, this prompt text determination method can be used to determine the prompt text corresponding to the evaluation task, and use the prompt text as an instruction to enable the evaluation model to execute the evaluation task and obtain the evaluation result. For example, in the field of vehicle sales, in order to conduct statistical analysis of vehicle sales, vehicle sales companies need to classify and label all public opinion data of the vehicle sales company. For this classification and labeling task, the prompt text determination method can be used to determine the prompt text corresponding to the classification and labeling task, and use this prompt text as the prompt word instruction for the classification and labeling model. It is understood that the application field of the prompt text determination method provided in the embodiments of this specification is not limited.
[0036] The target data processing task can be understood as the data processing task to be performed, such as an evaluation task, classification task, or labeling task. The prompt text training data can include the task description of the target data processing task, the corresponding text data, the label information of the text data, and training parameters. For example, if the target data processing task is a public opinion information processing task related to vehicle sales, then the text data could be text data about vehicle sales, such as comments and posts from vehicle buyers on purchasing platforms. The label information corresponding to the text data can be understood as the evaluation results of the text data, such as the attitude of vehicle buyers' comments being "positive," "negative," "good," or "bad." Training parameters could be, for example, training round thresholds. The initial prompt text can be understood as the initialized prompt text that needs to be optimized.
[0037] Based on this, the data processing task to be performed can be determined, and the corresponding prompt text training data can be determined. Based on the prompt text training data, multiple initial prompt texts can be constructed.
[0038] In practical applications, training parameters can be preset or user-defined; this specification does not limit this in the embodiments.
[0039] In one embodiment of this specification, the initial prompt text may be extracted from prompt text training data or constructed based on prompt text training data.
[0040] In practical applications, see Figure 3 , Figure 3This diagram illustrates a training architecture for a prompt text determination method according to an embodiment of this specification. The prompt text training framework may include a data receiving module, a data preprocessing module, a generator, an evaluator, an optimizer, operators, and an output module. The data receiving module receives prompt text training data input by the user. The data preprocessing module preprocesses the prompt text training data, such as performing deduplication. The generator generates initial prompt text. The operators optimize and improve the generated initial prompt text. The optimizer decides which operators to use to optimize which parts of the prompt text. The evaluator evaluates the optimized prompt text and obtains the corresponding evaluation results as gradients, which are then passed to the optimizer for subsequent iterations and optimizations. Specifically, the prompt text training framework can optimize prompt text for tasks in different domains, obtaining multiple target prompt texts corresponding to multiple domains. These target prompt texts can be stored as data for cold starts in the same domain.
[0041] In specific implementation, the step of determining multiple initial prompt texts based on the prompt text training data corresponding to the target data processing task includes: Using a generator, the language processing model is invoked to process the training data of the prompt text corresponding to the target data processing task, generating multiple initial prompt texts.
[0042] The language processing model can be an LLM model, a machine learning model, a neural network model, a large language model, etc.
[0043] Specifically, the generator can call multiple identical or different language processing models to process the training data of the prompt text corresponding to the target data processing task and construct multiple initial prompt texts.
[0044] For example, the generator can call language processing model 1 to construct initial prompt texts 1 and 2, call language processing model 2 to construct initial prompt text 3, and call language processing model 3 again to construct initial prompt texts 4 and 5.
[0045] In summary, constructing the initial prompt text by calling the language processing model facilitates further evaluation and optimization of the initial prompt text.
[0046] Step 204: Determine the first target algorithm according to the algorithm selection strategy, and optimize the multiple initial prompt texts according to the first target algorithm to obtain multiple candidate prompt texts.
[0047] The algorithm selection strategy can be understood as a strategy used to select an algorithm. The first target algorithm can be used to optimize the initial prompt text. The first target algorithm can be understood as an operator. Algorithm selection strategies include, but are not limited to, random selection strategies and gradient-based selection strategies; the embodiments in this specification do not limit these. Candidate prompt texts can be understood as prompt texts obtained after optimizing the initial prompt text; the number of candidate prompt texts can be less than the number of initial prompt texts.
[0048] In specific implementation, determining the first target algorithm based on the algorithm selection strategy includes: Based on the algorithm selection strategy, the first target algorithm is determined from multiple algorithms; The step of determining the first target algorithm from multiple algorithms according to the algorithm selection strategy includes: Randomly select one algorithm from multiple algorithms as the first target algorithm; and / or Based on the initial evaluation results of the multiple initial prompt texts, the first target algorithm is determined from the multiple algorithms.
[0049] The initial evaluation results of multiple initial prompt texts can be understood as the gradient value of each initial prompt text. Multiple algorithms can be understood as multiple operators.
[0050] In practical applications, the operator library can include multiple operators, such as COT, RAG, In-Context Learning, and Self-Reflection. Based on this, different operators can be selected from the operator library to optimize the initial prompt text according to the algorithm selection strategy.
[0051] Specifically, in one embodiment of this specification, any one of the multiple algorithms can be randomly selected as the first target algorithm.
[0052] In another embodiment of this specification, a first target algorithm can be determined from multiple algorithms based on the gradient value of each initial prompt text. Furthermore, the first target algorithm can also be pre-configured based on task information corresponding to the target data processing task. This specification does not limit this aspect.
[0053] Specifically, determining the first target algorithm from multiple algorithms according to the algorithm selection strategy includes: Using an optimizer, the first target algorithm is determined from the plurality of algorithms based on the algorithm selection strategy.
[0054] Specifically, based on the idea of gradient descent, the gradient descent optimizer decides which operators to use to modify and optimize the candidate suggestion text, while the evaluator evaluates the optimized suggestion text and feeds it back to the optimizer. This iterative optimization continues until convergence. In this process, the system can adaptively learn which operators and optimizers to use for optimization, finding a better optimization path.
[0055] Further, the step of optimizing the plurality of initial prompt texts according to the first target algorithm to obtain a plurality of candidate prompt texts includes: The optimizer is used to determine the text to be optimized among the plurality of initial prompt texts; Based on the first target algorithm, the text to be optimized is optimized to obtain multiple candidate prompt texts.
[0056] The text to be optimized in the multiple initial prompt texts can be understood as the part of the multiple initial prompt texts that needs to be optimized.
[0057] Specifically, an optimizer can be used to determine the parts of multiple initial prompt texts that need optimization, and then optimize these parts according to the first objective algorithm to obtain multiple candidate prompt texts. Multiple initial prompt texts can be optimized using a selected operator (i.e., the first objective algorithm), with a preset number of optimizations (evolution / fission) to ultimately obtain multiple candidate prompt texts.
[0058] In one embodiment of this specification, the text portion requiring optimization in each initial prompt text can be optimized to obtain optimized initial prompt texts as multiple candidate prompt texts. Understandably, in this case, the number of initial prompt texts equals the number of candidate prompt texts. In another embodiment of this specification, while optimizing the text portion requiring optimization in each initial prompt text, the multiple initial prompt texts can be filtered according to a pre-set optimization quantity. Optimized initial prompt texts that meet the optimization quality criteria are then used as candidate prompt texts. Understandably, in this case, the number of initial prompt texts is greater than the number of candidate prompt texts.
[0059] In practical applications, an evaluator can be used to train and score N initial prompt texts to obtain gradient values of multiple initial prompt texts. M initial prompt texts whose gradient values reach a preset gradient value threshold are retained as candidate prompt texts. Based on the gradient values of multiple initial prompt texts, different operators are used to optimize the M candidate prompt texts. The optimization process is then determined based on a preset number of optimization steps, where M is less than N.
[0060] In summary, by introducing operators and optimizers, the system can adapt to the latest update methods. Furthermore, based on the idea of gradient descent, the system can dynamically explore and discover optimized paths for prompt text generation, improving the efficiency and effectiveness of prompt text generation.
[0061] Step 206: Evaluate the multiple candidate prompt texts, obtain evaluation results, and determine multiple intermediate prompt texts from the multiple candidate prompt texts based on the evaluation results.
[0062] Specifically, an evaluator can be used to evaluate multiple candidate prompt texts, obtain evaluation results for multiple candidate prompt texts, and determine multiple intermediate prompt texts from the multiple candidate prompt texts based on the evaluation results.
[0063] In practical applications, an evaluator can be used to train and score N candidate prompt texts, obtain N gradients, and retain the M intermediate prompt texts with higher scores, controlled by the prompt_pool_size parameter.
[0064] In addition, the training data for the prompt text can include a training set and a test set. During optimization and evaluation, each round of optimization and evaluation can be performed on the training set and the test set. The size of the training data and the test data can be determined according to actual needs.
[0065] Step 208: Optimize and evaluate the multiple intermediate prompt texts to obtain the target prompt text, and perform the target data processing task according to the target prompt text.
[0066] The target prompt text can be understood as the optimization prompt text obtained after the final optimization is completed.
[0067] In practical applications, optimization can be stopped when the preset training round threshold is reached, and the target prompt text can be obtained; or optimization can be stopped when the user-defined optimization goal is met, and the target prompt text can be obtained.
[0068] In specific implementation, optimizing and evaluating the plurality of intermediate prompt texts to obtain the target prompt text includes: Using an optimizer, a second target algorithm corresponding to the plurality of intermediate prompt texts is determined based on the evaluation results; According to the second target algorithm, the multiple intermediate prompt texts are optimized to obtain multiple optimized intermediate prompt texts; Continue evaluating the multiple optimized intermediate prompt texts until an intermediate prompt text that meets the optimization stopping condition is obtained, and then determine it as the target prompt text.
[0069] The second objective algorithm can be understood as the operator selected from multiple operators.
[0070] Specifically, when optimizing and evaluating multiple intermediate prompt texts, an iterative process can be performed. That is, an optimizer can be used to determine the second target algorithm corresponding to multiple intermediate prompt texts based on the evaluation results. The second target algorithm is then used to optimize the multiple intermediate prompt texts, resulting in multiple optimized intermediate prompt texts. The optimized intermediate prompt texts are then evaluated to obtain evaluation results. Based on the evaluation results, multiple intermediate prompt texts are further selected from the multiple optimized intermediate prompt texts, and the optimization and evaluation process is repeated for these multiple intermediate prompt texts. Finally, the intermediate prompt texts that meet the optimization stopping condition are determined as the final optimized target prompt texts.
[0071] In practical applications, the optimizer acquires N gradients and decides on different operators (i.e., the secondary objective algorithm) to continue optimizing M intermediate prompt texts. The number of optimizations (evolution / fission) is a preset number. The choice of optimizer can also be controlled by parameters. This process is repeated until the required number of training rounds is reached or the user's goal is met.
[0072] Furthermore, the step of using an optimizer to determine the second target algorithm corresponding to the plurality of intermediate prompt texts based on the evaluation results includes: Using an optimizer, a second target algorithm corresponding to the plurality of intermediate prompt texts is determined from among multiple algorithms based on the gradient values of the plurality of intermediate prompt texts contained in the evaluation results.
[0073] The number of intermediate suggestion texts can be less than the number of candidate suggestion texts. The evaluation result includes the gradient values of multiple candidate suggestion texts. Since multiple intermediate suggestion texts are determined from multiple candidate suggestion texts, the evaluation result also includes the gradient values of multiple intermediate suggestion texts.
[0074] Specifically, the evaluator can evaluate the gradient values of multiple intermediate prompt texts, and the optimizer can select a second objective algorithm from multiple algorithms based on the gradient values of the multiple intermediate prompt texts. This second objective algorithm can be used to further optimize the intermediate prompt texts.
[0075] In summary, based on the idea of gradient descent, the system can dynamically explore and discover optimized paths for prompt text, resulting in significant improvements in both the efficiency and effectiveness of prompt text generation. In practical applications, the step of performing the target data processing task based on the target prompt text includes: Generate a task processing interface based on the target prompt text; The task processing interface is used to execute the target data processing task.
[0076] In practical applications, after obtaining the target prompt text with the highest final optimized score, a task processing interface is generated based on the target prompt text and made available to users of the target data processing task in the form of an API.
[0077] In summary, the above method determines multiple initial prompt texts based on the training data of prompt texts corresponding to the target data processing task. After selecting a suitable first target algorithm according to the algorithm selection strategy, the first target algorithm is used to optimize the multiple initial prompt texts. The optimized candidate prompt texts are then evaluated, and intermediate prompt texts are determined based on the evaluation results. The intermediate prompt texts are then further optimized and evaluated. This process is repeated iteratively to process the training data of prompt texts corresponding to the specific target data processing task, resulting in the final optimized target prompt text. This ensures that the optimization of the target prompt text can be effectively adapted to the specific target data processing task, further improving the optimization effect of the target prompt text and making the processing effect of the target data processing task performed based on the target prompt text even better.
[0078] The following is in conjunction with the appendix Figure 4 Taking the application of the prompt text determination method provided in this specification in prompt text optimization as an example, the prompt text determination method will be further explained. Among them, Figure 4 The present specification illustrates a flowchart of a method for determining prompt text according to an embodiment of this specification, which specifically includes the following steps.
[0079] Step 402: Using the generator, call multiple language processing models to process the training data of the prompt text corresponding to the target data processing task and construct multiple prompt texts.
[0080] Specifically, using a generator, multiple prompt texts (i.e., task outputs) are output from the input prompt text training data (including task descriptions and task definitions).
[0081] Step 404: Use an evaluator to evaluate the plurality of prompt texts, obtain evaluation results, and select a plurality of prompt texts that meet the criteria from the plurality of prompt texts based on the evaluation results.
[0082] Specifically, an evaluator can be used to evaluate multiple prompt texts based on preset optimization metrics to obtain evaluation results (i.e., gradients).
[0083] Alternatively, before evaluating the multiple prompt texts, you can first use an optimizer to optimize the multiple prompt texts, and then evaluate the optimized multiple prompt texts.
[0084] Step 406: Using an optimizer, determine the first target algorithm according to the algorithm selection strategy, and optimize the multiple prompt texts that meet the indicators according to the first target algorithm to obtain multiple prompt texts.
[0085] Specifically, an optimizer can be used to select different operators from multiple operators based on the algorithm selection strategy, and optimize the task description, task definition and task output according to the operators.
[0086] Then, the evaluator and optimizer can be used to continue the optimization process of steps 404 to 406 above for multiple prompt texts until the final optimized target prompt text is obtained.
[0087] In practical applications, the system can receive user-input task descriptions, determine evaluation metrics and optimization goals, and receive user-configured training parameters and training datasets. If no user configuration is provided, pre-set default training parameters can be used. The training dataset is split into training and testing sets, and the training data in the training dataset is preprocessed. The system reads the training parameters, constructs multiple prompt texts, optimizes these prompt texts using operators, and obtains N prompt texts based on a preset optimization number. An evaluator scores these N prompt texts, obtaining N gradients, and retains the M prompt texts with the highest scores. The optimizer can then obtain these N gradients and decide on different operators to further optimize the M prompt texts, optimizing them by a preset number. This process is repeated until a final optimized target prompt text with a higher score than the other prompt texts is obtained. Based on this target prompt text, it is provided to the user via an API interface for API calls.
[0088] In summary, the above method determines multiple initial prompt texts based on the training data of prompt texts corresponding to the target data processing task. After selecting a suitable first target algorithm according to the algorithm selection strategy, the first target algorithm is used to optimize the multiple initial prompt texts. The optimized candidate prompt texts are then evaluated, and intermediate prompt texts are determined based on the evaluation results. The intermediate prompt texts are then further optimized and evaluated. This process is repeated iteratively to process the training data of prompt texts corresponding to the specific target data processing task, resulting in the final optimized target prompt text. This ensures that the optimization of the target prompt text can be effectively adapted to the specific target data processing task, further improving the optimization effect of the target prompt text and making the processing effect of the target data processing task performed based on the target prompt text even better.
[0089] Corresponding to the above method embodiments, this specification also provides embodiments of a prompt text determination device. Figure 5A schematic diagram of a prompt text determining device according to one embodiment of this specification is shown. Figure 5 As shown, the device includes: The determination module 502 is configured to determine multiple initial prompt texts based on the prompt text training data corresponding to the target data processing task. The optimization module 504 is configured to determine a first target algorithm according to the algorithm selection strategy, and optimize the plurality of initial prompt texts according to the first target algorithm to obtain a plurality of candidate prompt texts; Evaluation module 506 is configured to evaluate the plurality of candidate prompt texts, obtain evaluation results, and determine a plurality of intermediate prompt texts from the plurality of candidate prompt texts based on the evaluation results; The processing module 508 is configured to optimize and evaluate the plurality of intermediate prompt texts to obtain a target prompt text, so as to perform the target data processing task based on the target prompt text.
[0090] In an optional embodiment, the optimization module 504 is further configured to: Based on the algorithm selection strategy, the first target algorithm is determined from multiple algorithms; Randomly select one algorithm from multiple algorithms as the first target algorithm; and / or Based on the initial evaluation results of the multiple initial prompt texts, the first target algorithm is determined from the multiple algorithms.
[0091] In an optional embodiment, the optimization module 504 is further configured to: Using an optimizer, the first target algorithm is determined from the plurality of algorithms based on the algorithm selection strategy.
[0092] In an optional embodiment, the optimization module 504 is further configured to: The optimizer is used to determine the text to be optimized among the plurality of initial prompt texts; Based on the first target algorithm, the text to be optimized is optimized to obtain multiple candidate prompt texts.
[0093] In an optional embodiment, the processing module 508 is further configured to: Using an optimizer, a second target algorithm corresponding to the plurality of intermediate prompt texts is determined based on the evaluation results; According to the second target algorithm, the multiple intermediate prompt texts are optimized to obtain multiple optimized intermediate prompt texts; Continue evaluating the multiple optimized intermediate prompt texts until an intermediate prompt text that meets the optimization stopping condition is obtained, and then determine it as the target prompt text.
[0094] In an optional embodiment, the processing module 508 is further configured to: Using an optimizer, a second target algorithm corresponding to the plurality of intermediate prompt texts is determined from among multiple algorithms based on the gradient values of the plurality of intermediate prompt texts contained in the evaluation results.
[0095] In an optional embodiment, the determining module 502 is further configured to: Using a generator, the language processing model is invoked to process the training data of the prompt text corresponding to the target data processing task, generating multiple initial prompt texts.
[0096] In an optional embodiment, the processing module 508 is further configured to: Generate a task processing interface based on the target prompt text; The task processing interface is used to execute the target data processing task.
[0097] In summary, the aforementioned device determines multiple initial prompt texts based on the training data of prompt texts corresponding to the target data processing task. After selecting a suitable first target algorithm according to the algorithm selection strategy, it optimizes the multiple initial prompt texts using the first target algorithm and evaluates the multiple candidate prompt texts obtained from the optimization. After determining the intermediate prompt texts based on the evaluation results, it continues to optimize and evaluate the intermediate prompt texts. By processing the prompt text training data corresponding to the specific target data processing task in a cyclical iterative manner, the final optimized target prompt text is obtained. This allows the optimization of the target prompt text to be effectively adapted to the specific target data processing task, further improving the optimization effect of the target prompt text and making the processing effect of the target data processing task performed based on the target prompt text even better.
[0098] The above is an illustrative scheme of a prompt text determination device according to this embodiment. It should be noted that the technical solution of this prompt text determination device and the technical solution of the prompt text determination method described above belong to the same concept. For details not described in detail in the technical solution of the prompt text determination device, please refer to the description of the technical solution of the prompt text determination method described above.
[0099] See Figure 6 , Figure 6 A flowchart of a data processing method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0100] Step 602: Determine the data to be processed corresponding to the target data processing task; Step 604: Call the task processing interface and process the data to be processed and the target prompt text based on the task processing interface to obtain the data processing result corresponding to the data to be processed; The target prompt text is determined according to the method provided in the first aspect of the embodiments of this specification.
[0101] The target prompt text can be understood as the prompt text corresponding to the target data processing task. The data processing result can be understood as the processing result of the target data processing task.
[0102] Specifically, by calling the task processing interface, the data to be processed and the target prompt text are processed to obtain the data processing result corresponding to the data to be processed.
[0103] The above is an illustrative scheme of a data processing method according to this embodiment. It should be noted that the technical solution of this data processing method and the technical solution of the above-described prompt text determination method belong to the same concept. For details not described in detail in the technical solution of the data processing method, please refer to the description of the technical solution of the above-described prompt text determination method.
[0104] Corresponding to the above method embodiments, this specification also provides data processing apparatus embodiments. Figure 7 A schematic diagram of the structure of a data processing apparatus according to one embodiment of this specification is shown. Figure 7 As shown, the device includes: The determining module 702 is configured to determine the data to be processed corresponding to the target data processing task; The calling module 704 is configured to call the task processing interface and process the data to be processed and the target prompt text based on the task processing interface to obtain the data processing result corresponding to the data to be processed. The target prompt text is determined according to the method provided in the first aspect of the embodiments of this specification.
[0105] The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing apparatus, please refer to the description of the technical solution of the data processing method described above.
[0106] Figure 8A structural block diagram of a computing device 800 according to one embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.
[0107] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0108] In one embodiment of this application, the aforementioned components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0109] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 800 can also be a mobile or stationary server.
[0110] The processor 820 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above method.
[0111] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the computing device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0112] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described method.
[0113] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the computer-readable storage medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0114] An embodiment of this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described method.
[0115] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the above method belong to the same concept, and all details not described in detail in the technical solution of the computer program product can be referred to the description of the technical solution of the above method.
[0116] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0117] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0118] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0119] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0120] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A method for determining prompt text, comprising: Based on the training data of the prompt texts corresponding to the target data processing task, determine multiple initial prompt texts; The first target algorithm is determined according to the algorithm selection strategy, and the multiple initial prompt texts are optimized according to the first target algorithm to obtain multiple candidate prompt texts; The plurality of candidate prompt texts are evaluated to obtain evaluation results, and a plurality of intermediate prompt texts are determined from the plurality of candidate prompt texts based on the evaluation results; The multiple intermediate prompt texts are optimized and evaluated to obtain the target prompt text, and the target data processing task is performed based on the target prompt text.
2. The method according to claim 1, wherein determining the first target algorithm according to the algorithm selection strategy comprises: Based on the algorithm selection strategy, the first target algorithm is determined from multiple algorithms; The step of determining the first target algorithm from multiple algorithms according to the algorithm selection strategy includes: Randomly select one algorithm from multiple algorithms as the first target algorithm; and / or Based on the initial evaluation results of the multiple initial prompt texts, the first target algorithm is determined from the multiple algorithms.
3. The method according to claim 2, wherein determining the first target algorithm from multiple algorithms according to an algorithm selection strategy comprises: Using an optimizer, the first target algorithm is determined from the plurality of algorithms based on the algorithm selection strategy.
4. The method according to claim 1, wherein optimizing the plurality of initial prompt texts according to the first target algorithm to obtain a plurality of candidate prompt texts includes: The optimizer is used to determine the text to be optimized among the plurality of initial prompt texts; Based on the first target algorithm, the text to be optimized is optimized to obtain multiple candidate prompt texts.
5. The method according to claim 1, wherein optimizing and evaluating the plurality of intermediate prompt texts to obtain the target prompt text includes: Using an optimizer, a second target algorithm corresponding to the plurality of intermediate prompt texts is determined based on the evaluation results; According to the second target algorithm, the multiple intermediate prompt texts are optimized to obtain multiple optimized intermediate prompt texts; Continue evaluating the multiple optimized intermediate prompt texts until an intermediate prompt text that meets the optimization stopping condition is obtained, and then determine it as the target prompt text.
6. The method according to claim 5, wherein the step of using an optimizer to determine the second target algorithm corresponding to the plurality of intermediate prompt texts based on the evaluation results includes: Using an optimizer, a second target algorithm corresponding to the plurality of intermediate prompt texts is determined from among multiple algorithms based on the gradient values of the plurality of intermediate prompt texts contained in the evaluation results.
7. The method according to any one of claims 1-6, wherein determining a plurality of initial prompt texts based on the prompt text training data corresponding to the target data processing task includes: Using a generator, the language processing model is invoked to process the training data of the prompt text corresponding to the target data processing task, generating multiple initial prompt texts.
8. The method according to any one of claims 1-6, wherein performing the target data processing task based on the target prompt text comprises: Generate a task processing interface based on the target prompt text; The task processing interface is used to execute the target data processing task.
9. A data processing method, comprising: Determine the data to be processed corresponding to the target data processing task; Call the task processing interface, and process the data to be processed and the target prompt text based on the task processing interface to obtain the data processing result corresponding to the data to be processed; The target prompt text is determined by the method according to any one of claims 1-8.
10. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 9.
11. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 9.
12. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 9.