Data processing method, apparatus and computing device cluster
Patent Information
- Application Number
- CN202510458107.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2026-10-20
AI Technical Summary
然而这两种APO需要进行多次计算,耗费大量时间,降低了提示词的生成效率
[0080]关于第二方面至第七方面中任一种可选的实现方式所带来的技术效果可参见第一方面或第一方面中任一种可选的实现方式所带来的技术效果。此处不再赘述。本申请在上述各方面提供的实现方式的基础上,还可以进一步组合以提供更多实现方式。
Smart Images

Figure HDA0005357195660000011 
Figure HDA0005357195660000012 
Figure HDA0005357195660000021
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to a data processing method, apparatus, and cluster of computing devices. Background Technology
[0002] With the release of large language models (LLMs) such as ChatGPT, many vendors have begun to research the application of large language models in reasoning tasks such as multimodal content generation, content reasoning, and text generation.
[0003] To improve the accuracy of LLM inference results, prompt words can be optimized using Auto Prompt Optimization (APO) technology to guide LLM inference.
[0004] Awareness Points (APOs) generate prompts based on user input. These prompts guide the user's inference task, the inference process, and an output example. The generated prompts help the LLM (Layered Learning Model) perform inference and produce results that satisfy the user's input. Typically, APOs can be optimized by calculating model gradients or token probabilities, or by evaluating inference results. However, both of these methods require multiple calculations, consuming significant time and reducing the efficiency of prompt generation. Summary of the Invention
[0005] This application provides a data processing method, apparatus, and computing device cluster to improve the efficiency of prompt word generation.
[0006] Firstly, this application provides a data processing method. It receives a first prompt word sent by a user, and simultaneously executes steps to obtain the user's intent based on the first prompt word and retrieves a first instance matching the first prompt word from a sample database. Then, it calls a first model, using the user's intent and the first instance as input to obtain a second prompt word.
[0007] Optionally, the first cue word includes descriptive information used to describe the reasoning task. The sample database includes multiple samples, each containing examples of descriptive information and reasoning results obtained by reasoning from the descriptive information.
[0008] Based on the first aspect, prompt word generation is performed using user intent and the first instance, eliminating the need to calculate model gradients or token probabilities to optimize prompt words. This shortens prompt word generation time and improves generation efficiency. Furthermore, by leveraging user intent, the professionalism and accuracy of the second prompt word are enhanced. Utilizing the first instance in the sample database that matches the first prompt word further improves the generation of the second prompt word. This eliminates the need to rely on the inference model's reasoning results to improve prompt word accuracy, reducing interaction between the prompt word generation process and the inference model, thus further reducing generation time and increasing efficiency.
[0009] In one optional implementation, the process involves invoking a first model, taking the user's intent and a first instance as input to obtain a second prompt word, and then: invoking the first model again, taking the user's intent and the first instance as input to obtain a third prompt word, and evaluating the third prompt word. If the third prompt word passes the evaluation, it is designated as the second prompt word; if the second prompt word fails the evaluation, a new third prompt word is obtained based on the user's intent, role-based cues, and the first instance, and the new third prompt word is evaluated. This process is repeated until the most recently obtained third prompt word passes the evaluation, at which point the evaluated third prompt word is designated as the second prompt word.
[0010] Based on this optional implementation method, the generated third prompt word is evaluated, and the third prompt word that passes the evaluation is used as the second prompt word. By adding an evaluation step, it is ensured that the second prompt word meets the user's needs, thereby improving the reliability and accuracy of the second prompt word.
[0011] In one alternative implementation, the evaluation of the third prompt word includes: evaluating the third prompt word based on the description information of the reasoning task; determining that the third prompt word has passed the evaluation if it matches the description information of the reasoning task; and determining that the third prompt word has failed the evaluation if it does not match the description information of the reasoning task.
[0012] Based on this optional implementation method, the reliability and accuracy of the second prompt word are improved through self-evaluation.
[0013] In one alternative implementation, evaluating the third prompt word includes: providing an evaluation interface, which includes the third prompt word; and determining that the third prompt word evaluation passed in response to a user's confirmation operation based on the evaluation interface, or determining that the third prompt word evaluation failed in response to a user's modification operation based on the evaluation interface.
[0014] Based on this optional implementation method, by adding an interaction with the user and using user feedback to evaluate the third prompt word, the reliability and accuracy of the second prompt word can be improved, ensuring that the second prompt word meets the user's needs.
[0015] In one alternative implementation, the sample database also includes a sample selection model for obtaining the first sample that matches the first prompt word.
[0016] In this way, the first example can be quickly selected through the sample selection model, thereby improving the generation efficiency of the second prompt word.
[0017] In one alternative implementation, after calling the first model and taking the user's intent and the first example as input to obtain the second prompt word, multiple historical records are retrieved. Based on these historical records, the example selection model is updated to obtain a new example selection model.
[0018] Each history record includes the first historical prompt, a historical example selected using the first historical prompt, and feedback for the third historical prompt. The third historical prompt is generated from the first historical prompt. Feedback includes confirmation or modification actions.
[0019] Optionally, the multiple history records include a first history record, which includes the feedback of the first prompt word, the first example, and the third prompt word.
[0020] Optionally, the new sample selection model is used to select samples from the sample database in the next time period.
[0021] Optionally, updating the sample selection model based on multiple historical records to obtain a new sample selection model includes: inputting the historical first prompt word and historical sample from multiple historical records into the sample selection model; calculating the loss between the predicted feedback of each historical record output by the sample selection model and the feedback of the historical third prompt word from multiple historical records using a loss function to obtain the loss function value of the sample selection model; adjusting the model parameters of the sample selection model based on the loss function value of the sample selection model; stopping the adjustment of the sample selection model when the loss function of the sample selection model converges and the loss function value of the sample selection model is less than a threshold, thus obtaining a new sample selection model.
[0022] In this way, by continuously updating the sample selection model, the sample retrieval capability of the sample selection model is improved, thereby enhancing the generation effect of prompt words.
[0023] In one optional implementation, a first model is invoked, and the user's intent and a first instance are used as inputs to obtain a second prompt word. This includes: decomposing the user's intent to form at least one of a thought chain and a process orchestration for the reasoning task; the thought chain is used to indicate the sub-tasks included in the reasoning task and the execution logic between different sub-tasks; the process orchestration includes generating the sub-stages included in the second prompt word and the execution logic between different sub-stages; the process orchestration is used to guide the first model to generate the second prompt word; and the first model is invoked, and at least one of the thought chain, process orchestration, or role prompts for the reasoning task, as well as the user's intent and the first instance, are used as inputs to obtain the second prompt word.
[0024] The role cues are used to indicate the role of the second model in performing the reasoning task.
[0025] Optionally, the role prompt is determined based on the first prompt word.
[0026] In this optional implementation, the model is guided through process orchestration to generate prompts one by one, ensuring the accuracy of the second prompt and avoiding missed steps. During prompt generation, a thought chain is added to the prompts, dividing the reasoning task into multiple sub-tasks. In subsequent model reasoning, the second prompt guides the model to execute each sub-task sequentially, reducing the processing difficulty of each sub-task, ensuring the accuracy of the model's reasoning results, and preventing missed steps.
[0027] In one alternative implementation, the first instance includes multiple sub-instances, and the similarity between different sub-instances is less than a similarity threshold.
[0028] This allows for increased sample diversity and detail during the second prompt generation process based on multiple sub-samples, thus enabling better generation of the second prompt.
[0029] In one alternative implementation, the multiple subsamples include a first subsample and a second subsample, wherein the second subsample is obtained by transforming the first subsample.
[0030] Optionally, a sample database is retrieved based on the first prompt word to obtain multiple first candidate samples that match the first prompt word. These first candidate samples are then filtered according to their similarity, retaining first sub-samples whose similarity to other first candidate samples is less than a similarity threshold. The sample database is then retrieved based on these first sub-samples to obtain multiple second candidate samples that match them. These second candidate samples are then filtered according to their similarity, retaining second sub-samples whose similarity to other second candidate samples is less than a similarity threshold. The first and second sub-samples are then identified as sub-samples, resulting in the first sample.
[0031] Based on this optional implementation, the generation of the second prompt word can be better achieved by increasing the diversity of sub-samples in the first sample.
[0032] In one optional implementation, obtaining a first instance matching the first prompt word from the sample database includes: forming a first search term based on the description information of the reasoning task; forming a second search term based on the first search term; the second search term includes one or more of the following: synonyms of the first search term, antonyms of the first search term, translated terms of the first search term, rearranged first search term, or style-transformed first search term; querying the sample database based on the first search term and the second search term to obtain the first instance.
[0033] Based on this optional implementation method, during the query of the sample database, the search terms are expanded to increase the diversity of search terms, thereby increasing the diversity and number of sub-samples, and thus increasing the reliability of the second suggestion terms.
[0034] In one optional implementation, after calling the first model, taking the user's intent and the first example as input, and obtaining the second prompt word, the second model is guided to perform an inference task based on the second prompt word, obtaining the inference result corresponding to the inference task. The first prompt word and the inference result corresponding to the inference task are then used as new examples and written into the example database.
[0035] Based on this optional implementation method, the sample database is periodically updated by collecting samples, thereby increasing the number and diversity of samples in the sample database.
[0036] In one alternative implementation, after invoking the first model, taking the user's intent and the first example as input, and obtaining the second prompt word, the second prompt word is written to a prompt word database. The prompt word database includes various prompt words to provide corresponding target prompt words for different inference tasks.
[0037] Based on this optional implementation, in subsequent large-scale model applications, a target prompt word template matching the user-input task description can be selected from the prompt word library. This template is then populated with the user-input task description to obtain the prompt word corresponding to the task description. Using the prompt word corresponding to the task description as input to the large-scale model improves its inference results.
[0038] In one alternative implementation, after calling the first model, taking the user's intent and the first instance as input to the first model, and obtaining the second prompt word, the second prompt word is output.
[0039] This can improve the efficiency of prompt word generation.
[0040] In one alternative implementation, the first prompt word may include one or more of the following types: text, image, or audio.
[0041] Optionally, the second cue word may include one or more of the following types: text, image, or audio.
[0042] In this way, prompt word generation can be achieved in multimodal scenarios.
[0043] In one alternative implementation, before calling the first model, taking the user's intent and the first instance as input to the first model, and obtaining the second prompt word, a feedback interface is provided. The feedback interface includes the user's intent and the first instance. In response to the user's confirmation operation based on the input of the feedback interface, the first model is called, taking the user's intent and the first instance as input to the first model, and obtaining the second prompt word.
[0044] Optionally, based on the user's intent and the first example, a second prompt word is obtained, including: calling the first model, using the user's intent and the first example as input to the first model, obtaining a third prompt word, and evaluating the third prompt word. If the third prompt word passes the evaluation, it is determined as the second prompt word; if the second prompt word fails the evaluation, based on calling the first model, using the user's intent and the first example as input to the first model, obtaining a new third prompt word, evaluating the new third prompt word, and repeating this process until the latest obtained third prompt word passes the evaluation, at which point the evaluated third prompt word is determined as the second prompt word.
[0045] Based on this optional implementation method, a segmented reasoning approach is used to provide the user's intent, the first instance, and the generated third prompt. Furthermore, after adopting the user's intent and the first instance, the third prompt is generated. This improves the likelihood that the generated third prompt meets the user's needs, thereby enhancing the reliability of the second prompt.
[0046] Secondly, this application provides a data processing apparatus, which includes a processing module and a communication module.
[0047] The communication module is used to receive a first prompt word sent by the user; the first prompt word includes descriptive information describing the reasoning task; the descriptive information of the reasoning task is used to indicate the input, output or reasoning function implemented by the reasoning task.
[0048] The processing module performs the following operations in parallel: based on a first prompt word, it obtains the user's intent and retrieves a first instance matching the first prompt word from the sample database; it then calls a first model, taking the user's intent and the first instance as input to obtain a second prompt word. The first and second prompt words indicate the inference task, where the role prompt indicates the model's role in performing the inference task. The sample database includes multiple instances, each containing descriptive information examples and inference result examples obtained by reasoning from the descriptive information examples. The second prompt word guides the model to perform inference and obtain the inference result corresponding to the inference task.
[0049] In one optional implementation, the processing module is specifically used to: invoke a first model, taking the user's intent and a first instance as input to the first model to obtain a third prompt word, and evaluate the third prompt word. If the third prompt word passes the evaluation, it is determined as the second prompt word; if the second prompt word fails the evaluation, a new third prompt word is obtained based on the user's intent, role cues, and the first instance, and the new third prompt word is evaluated. This process is repeated until the latest obtained third prompt word passes the evaluation, at which point the evaluated third prompt word is determined as the second prompt word.
[0050] In one optional implementation, the processing module is specifically used to: evaluate the third prompt word based on the description information of the reasoning task; determine that the third prompt word has passed the evaluation if it matches the description information of the reasoning task; and determine that the third prompt word has failed the evaluation if it does not match the description information of the reasoning task.
[0051] In one optional implementation, the processing module is specifically used to: provide an evaluation interface, which includes a third prompt word; and, in response to a user's confirmation operation based on input from the evaluation interface, determine that the third prompt word evaluation has passed, or in response to a user's modification operation based on input from the evaluation interface, determine that the third prompt word evaluation has failed.
[0052] In one alternative implementation, the sample database also includes a sample selection model for obtaining the first sample that matches the first prompt word.
[0053] In one optional implementation, the processing module is further configured to: retrieve multiple historical records; and update the sample selection model based on these historical records to obtain a new sample selection model.
[0054] Each history record includes the first historical prompt, a historical example selected using the first historical prompt, and feedback for the third historical prompt. The third historical prompt is generated from the first historical prompt. Feedback includes confirmation or modification actions.
[0055] Optionally, the multiple history records include a first history record, which includes the feedback of the first prompt word, the first example, and the third prompt word.
[0056] Optionally, the new sample selection model is used to select samples from the sample database in the next time period.
[0057] Optionally, the processing module is further specifically used to: input the first historical prompt word and historical examples from multiple historical records into the sample selection model; calculate the loss between the predicted feedback of each historical record output by the sample selection model and the feedback of the third historical prompt word from multiple historical records through the loss function, obtain the loss function value of the sample selection model; adjust the model parameters of the sample selection model according to the loss function value of the sample selection model; and stop adjusting the sample selection model when the loss function of the sample selection model converges and the loss function value of the sample selection model is less than a threshold, thereby obtaining a new sample selection model.
[0058] In one optional implementation, the processing module is further specifically used to: decompose the user's intent to form at least one of a thought chain and a process orchestration for the reasoning task; the thought chain is used to indicate the sub-tasks included in the reasoning task and the execution logic between different sub-tasks; the process orchestration includes the sub-stages included in generating the second prompt word and the execution logic between different sub-stages; the process orchestration is used to guide the first model to generate the second prompt word; and call the first model, taking at least one of the thought chain, process orchestration, or role prompts for the reasoning task, as well as the user's intent and the first instance, as input to the first model to obtain the second prompt word.
[0059] The role cues are used to indicate the role of the second model in performing the reasoning task.
[0060] Optionally, the role prompt is determined based on the first prompt word.
[0061] In one alternative implementation, the first instance includes multiple sub-instances, and the similarity between different sub-instances is less than a similarity threshold.
[0062] In one alternative implementation, the multiple subsamples include a first subsample and a second subsample, wherein the second subsample is obtained by transforming the first subsample.
[0063] Optionally, the processing module is further configured to: retrieve a sample database based on the first prompt word to obtain multiple first candidate samples that match the first prompt word; filter the multiple first candidate samples according to the similarity between the candidate samples, retaining first sub-samples among the multiple first candidate samples whose similarity between the candidate samples is less than a similarity threshold; retrieve a sample database based on the first sub-samples to obtain multiple second candidate samples that match the first sub-samples; filter the multiple second candidate samples according to the similarity between the candidate samples, retaining second sub-samples among the multiple second candidate samples whose similarity between the candidate samples is less than a similarity threshold; and determine the first sub-sample and the second sub-sample as sub-samples to obtain the first sample.
[0064] In one optional implementation, the processing module is specifically used to: form a first search term based on the description information of the reasoning task; form a second search term based on the first search term; the second search term includes one or more of the following: synonyms of the first search term, antonyms of the first search term, translated terms of the first search term, rearranged first search term, or style-transformed first search term; and query the sample database based on the first and second search terms to obtain the first sample.
[0065] In an optional implementation, the processing module is further configured to guide the second model to perform an inference task based on the second prompt word, and obtain the inference result corresponding to the inference task. The first prompt word and the inference result corresponding to the inference task are then used as new examples and written into the example database.
[0066] In an optional implementation, the processing module is further configured to: write the second cue word into a cue word database. The cue word database includes a variety of cue words, used to provide corresponding target cue words for different inference tasks.
[0067] In an alternative implementation, the processing module is further configured to: after calling the first model, taking the user's intent and the first instance as input to the first model, and obtaining the second prompt word, output the second prompt word.
[0068] In one alternative implementation, the first prompt word may include one or more of the following types: text, image, or audio.
[0069] Optionally, the second cue word may include one or more of the following types: text, image, or audio.
[0070] In one alternative implementation, the processing module is further configured to provide a feedback interface, which includes: the user's intent and a first instance; in response to the user's confirmation operation based on the input of the feedback interface, the module invokes a first model, takes the user's intent and the first instance as input to the first model, and obtains a second prompt word.
[0071] Optionally, the processing module is further configured to: call the first model, use the user's intent and the first instance as input to the first model to obtain a third prompt word, and evaluate the third prompt word. If the third prompt word passes the evaluation, the third prompt word is determined as the second prompt word; if the second prompt word fails the evaluation, based on calling the first model, use the user's intent and the first instance as input to the first model to obtain a new third prompt word, evaluate the new third prompt word, and repeat this process until the latest obtained third prompt word passes the evaluation, at which point the evaluated third prompt word is determined as the second prompt word.
[0072] Thirdly, this application provides a data processing system, which includes a client and a data processing device.
[0073] The client is used to send a first prompt word to the data processing device; the first prompt word includes descriptive information for describing the reasoning task; the descriptive information for the reasoning task is used to indicate the input, output or reasoning function implemented by the reasoning task.
[0074] The data processing device is used to receive a first prompt word and perform the following operations in parallel: based on the first prompt word, obtain the user's intent and retrieve a first instance matching the first prompt word from the sample database; and invoke a first model, taking the user's intent and the first instance as input to the first model to obtain a second prompt word; the first prompt word and the second prompt word indicate a reasoning task, wherein the sample database includes multiple instances, the instances include descriptive information examples and inference result examples obtained by reasoning from the descriptive information examples, and the second prompt word is used to guide the model to perform reasoning to obtain the reasoning result corresponding to the reasoning task.
[0075] Fourthly, this application provides a cloud system comprising a cloud management platform and infrastructure. The infrastructure provides a prompt word generation service, and the cloud management platform manages the infrastructure. The infrastructure includes at least one data center. The cloud management platform receives a first prompt word sent by a user and sends instructions to the infrastructure. In response to the instructions, the infrastructure performs parallel operations based on the first prompt word to obtain the user's intent, retrieves a first instance matching the first prompt word from a sample database, and invokes a first model, using the user's intent and the first instance as input to the first model to obtain a second prompt word. The first and second prompt words indicate a reasoning task.
[0076] Optionally, the first prompt word includes descriptive information for describing the inference task, the sample database includes multiple samples, the samples include descriptive information examples and inference result examples corresponding to the descriptive information examples, and the second prompt word is used to guide the model to perform inference and obtain the inference result corresponding to the inference task.
[0077] Fifthly, this application provides a computing device cluster, including at least one computing device, each computing device including a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs the method in the first aspect or any optional implementation of the first aspect.
[0078] Sixthly, this application provides a computer program product that, when executed by a cluster of computing devices, causes the cluster of computing devices to perform the method in the first aspect or any of the optional implementations of the first aspect.
[0079] In a seventh aspect, this application provides a computer-readable storage medium including computer program instructions. When the computer program instructions are executed by a server, the server executes the instructions in the computer program stored in the computer-readable storage medium to perform the method in the first aspect or any optional implementation thereof.
[0080] The technical effects of any of the optional implementations of aspects two through seven can be found in the first aspect or the technical effects of any of the optional implementations of aspect one. Further details are omitted here. Based on the implementations provided in the above aspects, this application can be further combined to provide more implementations. Attached Figure Description
[0081] Figure 1A This is a schematic diagram of a prompt word generation process based on gradient optimization;
[0082] Figure 1B This is a schematic diagram of a prompt word generation process based on gradient-free optimization;
[0083] Figure 2 A schematic diagram of the structure of a data processing system provided in this application;
[0084] Figure 3 A schematic diagram of the structure of a data processing device provided in this application;
[0085] Figure 4A A schematic diagram illustrating an application scenario of a data processing system provided in this application;
[0086] Figure 4B This application provides an illustration of an application scenario for a data processing system. Figure 2 ;
[0087] Figure 4C This application provides an illustration of an application scenario for a data processing system. Figure 3 ;
[0088] Figure 5A schematic diagram of a system architecture is provided for this application;
[0089] Figure 6 A flowchart illustrating a data processing method provided in this application;
[0090] Figure 7A A schematic diagram of an interface for obtaining the first prompt word provided in this application;
[0091] Figure 7B An interface diagram for obtaining the first prompt word provided in this application Figure 2 ;
[0092] Figure 8 A flowchart illustrating the generation of prompt words provided in this application;
[0093] Figure 9 A schematic diagram of a second prompt word provided for this application;
[0094] Figure 10 A schematic diagram of a sample retrieval process provided for this application;
[0095] Figure 11 This application provides a flowchart for generating prompt words. Figure 2 ;
[0096] Figure 12 A schematic diagram of a prompt word evaluation interface provided for this application;
[0097] Figure 13 This application provides a flowchart for generating prompt words. Figure 3 ;
[0098] Figure 14 A schematic diagram of a segmented reasoning interface provided in this application;
[0099] Figure 15A A flowchart illustrating an updated sample selection model provided in this application;
[0100] Figure 15B A flowchart illustrating a data processing method provided in this application. Figure 2 ;
[0101] Figure 16 A schematic diagram of the structure of a data processing device provided in this application Figure 2 ;
[0102] Figure 17 A schematic diagram of the result of a computing device provided in this application;
[0103] Figure 18 This application provides a schematic diagram of the structure of a computing device cluster;
[0104] Figure 19 This application provides a schematic diagram of network connections between computing devices in a computing device cluster. Detailed Implementation
[0105] Large language models (LLMs) are deep learning models trained on large amounts of text data that can generate natural language text or understand the meaning of language text. LLMs can handle various natural language tasks, such as text classification, question answering, and dialogue, and also show potential in handling complex tasks such as code generation and vulnerability detection. In this paper, the term "large language model" may also be used. In one example, an LLM can be trained using a generative deep neural network model based on a transformer architecture, such as a large transformer-based bidirectional encoder representation (BERT) model, a transformer-based decoder representation (GPT) model, a transformer-based text-to-text-transfer-transformer (T5) model, a model combining autoregression and autoencoder (XLNet) model, or a transformer-based deepseek-R1 model. This application does not limit the specific type of large language model.
[0106] Since the accuracy of LLM inference results is related to the prompts input into the LLM, the accuracy of LLM inference results can be improved by adjusting the user's input using APO to generate prompts. These prompts then guide the LLM inference process.
[0107] APO can adjust the initial prompts for user input using either gradient optimization or no-gradient optimization methods to form prompts.
[0108] The gradient optimization method obtains the prompt word by calculating the model gradient or word (token) probability. Taking the calculation of the model gradient as an example... Figure 1A As shown, the initial prompt word is input into the LLM (Liquid Mover Model). The LLM performs inference based on the initial prompt word, calculating the model gradient during the inference process. If the LLM model gradient is greater than a preset gradient, the initial prompt word is adjusted, and the adjusted initial prompt word is input into the LLM. The model gradient of the LLM is calculated when processing the adjusted prompt word, until the LLM model gradient is less than or equal to the preset gradient, resulting in an optimized prompt word. The optimized prompt word is then input into the LLM to obtain the LLM inference result.
[0109] Gradient-free optimization involves using a model to evaluate initial prompt words and then deriving new prompt words based on the evaluation results. For example... Figure 1BAs shown, the initial prompt words input by the user are fed into the evaluation model, which then obtains a score for each initial prompt word. If the score is lower than a scoring threshold, the initial prompt words are adjusted. The adjusted initial prompt words are then input into the evaluation model again, and this process continues until the score of the latest initial prompt word is greater than or equal to the scoring threshold. The latest initial prompt word is then used as the optimized prompt word, and the optimized prompt word is output. The evaluation model can be an LLM (Limited Learning Model) or a model used for inference.
[0110] From the above Figure 1A It is known that gradient-based methods require modification of the inference process of the model used for inference (such as LLM). If the inference process of the model used for inference (such as LLM) cannot be changed, prompt words cannot be obtained through gradient-based methods. On the other hand, non-gradient optimization methods require multiple interactions with the inference model (such as LLM), which consumes a lot of time and thus reduces the efficiency of prompt word generation.
[0111] Based on this, to improve the efficiency of prompt generation, this application provides a data processing method that generates prompts based on user intent and a first instance. This eliminates the need to calculate model gradients or token probabilities to optimize prompts, thereby shortening the generation time and improving efficiency. Furthermore, by leveraging user intent, the method enhances the professionalism and accuracy of the second prompt. Utilizing first instances in the sample database that match the first prompt further improves the generation of the second prompt. This method does not rely on an inference model to evaluate the inference results of the prompts to improve accuracy, thus reducing interaction between the prompt generation process and the inference model, further reducing generation time and improving efficiency.
[0112] Specifically, the system receives a first cue word sent by the user. This first cue word is used to indicate descriptive information for the reasoning task. Based on the first cue word, the user's intent is obtained, and a first instance matching the first cue word is retrieved from the sample database. Then, a first model is invoked, with the user's intent and the first instance serving as input to the first model, to obtain a second cue word that indicates the same reasoning task as the first cue word.
[0113] The technical solution provided in this application can be used not only in prompt word generation scenarios to achieve prompt word generation, but also in other scenarios. For example, the technical solution provided in this application can also be used in model reasoning scenarios, information retrieval scenarios, or multimodal content generation scenarios, improving the accuracy of processing results (reasoning results, retrieval results, or generation effects) by enhancing the accuracy of prompt words. As another example, the technical solution provided in this application can also be used in intelligent dialogue scenarios to improve the accuracy of dialogue templates, thereby improving customer service response efficiency. Furthermore, the technical solution provided in this application can also be used in product testing scenarios (e.g., interface testing scenarios, system testing scenarios, software testing scenarios, pipeline testing scenarios, or communication testing scenarios) to improve the reliability of product testing results by enhancing the accuracy of test cases.
[0114] Furthermore, the technical solution provided in this application is applicable not only to large models proposed by current AI technology, but also to large models proposed by future AI technology.
[0115] Furthermore, the processing of prompts, descriptive information of reasoning tasks, reasoning results, and user feedback in the technical solution of this application, including collection, storage, use, processing, transmission, provision, and disclosure, all comply with relevant laws and regulations and do not violate public order and good morals. For example, in the technical solution of this application, the processing of prompts, descriptive information of reasoning tasks, reasoning results, and user feedback is carried out with the user's authorization, which is stated uniformly here and will not be repeated below.
[0116] The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application. A brief introduction to some concepts that may be involved in this application is given below.
[0117] Cloud computing environment: An entity that provides cloud services using basic resources under the cloud computing model. A cloud computing environment includes cloud data centers and cloud service platforms.
[0118] Cloud data centers, used to provide cloud services, include a large amount of basic resources owned by cloud service providers (including computing clusters, storage resources, and network resources). In this document, cloud data centers may also be referred to as infrastructure or cloud platforms, and this application does not limit the terminology.
[0119] Cloud service platforms are used to manage infrastructure. In some alternatives, cloud service platforms may also be called cloud management platforms or cloud computing platforms.
[0120] A host refers to a physical server deployed in a cloud data center. The physical resources of a host include the physical central processing unit (CPU) and memory devices. Each host runs virtualization software, which virtualizes some physical resources into virtual resources for use by instances. For example, the virtualization software virtualizes the CPU into a virtual CPU (vCPU). The host also has resources such as memory channels, cache channels, caches, network input / output (I / O) bandwidth, and storage I / O bandwidth that are shared by the instances running on the host.
[0121] Instance: A compute node running on a host machine. Common instances include virtual machines (VMs) or containers. Each instance consumes some or all of the host machine's virtual resources. Typically, instances deployed on compute nodes can be used for data transfer, data computation, etc.
[0122] Prompts: Also known as hints, they guide the LLM to generate expected responses, code, articles, or other content. Typically, prompts can include role hints, task descriptions, and examples.
[0123] One approach is cue engineering, a human-computer interaction design method that provides LLMs with detailed cue words and suggestions. Through cue engineering, users provide specific instructions, questions, or context to the LLM, forming cue words. These cue words are then input into the LLM to guide it in generating expected responses, code, articles, or other text. By providing clear cue points, cue engineering can guide LLMs to express the required information more accurately and purposefully in language generation tasks.
[0124] Role cues, also known as expert profiling, are an output optimization strategy used to assign specific individuals or roles to an LLM, guiding the LLM to provide more relevant, domain-specific, and context-specific responses.
[0125] Examples: Also known as paradigms or examples, these are used to guide the LLM in understanding the task requirements of inference, thereby generating more accurate responses that meet expectations. Typically, examples include a set of concrete input-output examples.
[0126] Task description: This can also be called task requirements or task description information, which indicates the tasks that the LLM needs to perform and the functions that the LLM implements.
[0127] Mind Chain: An improved cue word strategy that ensures successful task completion by breaking down the processing stages of a complex task indicated by a cue word into multiple sub-processing stages and guiding the LLM through these sub-processing stages one by one. It helps ensure that each sub-processing stage of the task is properly handled, avoiding the omission of critical information or steps. These sub-processing stages can also be called sub-tasks or other names.
[0128] Self-assessment: A method for checking the output of an LLM (Limited Management System), referring to the LLM process's self-review and evaluation of the output before it is released, to ensure the quality and accuracy of the output. In some alternative methods, self-assessment may also be called self-inspection or other names; this application does not limit this terminology.
[0129] Offline feedback: refers to a module in the knowledge base that iteratively updates the parameters of the sample selection model according to machine learning algorithms based on the user's historical data (such as the prompt words in the embodiments of this application) until the set requirements are met.
[0130] Online feedback: refers to selecting examples from the knowledge base based on user feedback and task description information input by the user, using a model trained offline.
[0131] Retrieval-Augmented Generation (RAG) is a model that combines information retrieval and language generation techniques. When the model needs to generate text or answer questions, it first retrieves task-relevant information from a large collection of documents, and then uses this retrieved information to guide text generation. RAG significantly improves the quality and accuracy of generated text because it can reference information from external knowledge bases to support its generated content. RAG models perform exceptionally well in natural language processing tasks such as question-answering systems, document generation, and intelligent assistants.
[0132] Word embeddings are a technique that transforms text data into low-dimensional dense vector representations. These vectors capture semantic information within the text, allowing the similarity and differences between texts to be measured by the distance between vectors. Word embeddings are widely used in various natural language processing tasks, such as information retrieval, text classification, and clustering. Through word embeddings, models can better understand and process text data, improving task performance.
[0133] The terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0134] The following description, in conjunction with the accompanying drawings, provides an exemplary introduction to some application scenarios and system architectures that may be involved in this application.
[0135] In a first optional implementation, the data processing method provided in this application can be applied to a cloud system, which includes a cloud management platform and infrastructure. The infrastructure includes at least one data center. The infrastructure provides cloud services, such as prompt word generation services, AI inference services, content generation services, test case generation services, product testing services, or dialogue services. The cloud management platform manages the infrastructure. Taking prompt word generation service as an example, the cloud management platform receives a first prompt word sent by the user and sends instructions to the infrastructure. The infrastructure responds to the instructions by performing parallel operations based on the first prompt word to obtain the user's intent, retrieving a first instance matching the first prompt word from a sample database, and invoking a first model, using the user's intent and the first instance as input to the first model to obtain a second prompt word.
[0136] In the second alternative implementation, the data processing method provided in this application can also be applied to a local server to provide prompt word generation or AI reasoning functions via a local area network.
[0137] In a third optional implementation, the data processing method provided in this application can also be applied to a terminal device. The terminal device has an application deployed on it. Responding to the application's launch command, the terminal device runs the application, generates prompts, outputs inference results, outputs generated content, or outputs AI-processed content (such as text, images, video, or audio). This application can be an AI-based application, such as an image processing application, a video editing application, or a search engine application, or it can have a model invocation interface that enables prompt generation or model inference.
[0138] The three optional implementation methods described above are merely application scenarios for different data processing methods. In other embodiments, the data processing method may have other application scenarios, which are not limited in this application.
[0139] For example, taking the application of data processing methods to cloud services provided by cloud-side servers as an example, such as... Figure 2 As shown, Figure 2This is a schematic diagram of the data processing system provided in this application. The data processing system shown includes a client 20, a cloud service platform 30, and infrastructure 10. This data processing system can be used for tasks such as prompt word generation, model training, model inference, product testing, retrieval, dialogue, or other tasks involving AI scenarios. In some alternative implementations, the data processing system may also be called a prompt word generation system, dialogue system, testing system, or other names; this application does not limit its scope in this regard.
[0140] In the first optional implementation, the client 20 can be a computer running an application, which can be a physical machine or a virtual machine. For example, if the computer running the application is a physical computing device, it can be a host or a terminal. The terminal can also be called a terminal device, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. Terminals can be mobile phones, tablets, laptops, desktop computers, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in autonomous driving, wireless terminals in smart healthcare, wireless terminals in education systems, terminals in banks, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of this application do not limit the specific technology or device form used by the client 20.
[0141] In the second alternative implementation, client 20 can be an application, such as an intelligent question-answering application, a content generation application, a prompt word generation application, a financial application, or other AI applications. Alternatively, client 20 can also be a web client. Client 20 runs on a terminal device, which can include, but is not limited to, mobile phones, tablets, laptops, or in-vehicle terminals.
[0142] The two implementation methods described above are merely different ways of implementing the client 20. In practical applications, the client 20 can also have other implementation methods. For example, the client 20 can be a software module running on any one or more hosts in the computing cluster 110. This application does not limit this.
[0143] In an alternative scenario, infrastructure 10 includes a data processing unit 120, a large model, a knowledge base 130, and a computing cluster 110.
[0144] The data processing device 120 is used to implement the data processing method provided in this application.
[0145] Large models are used to perform model inference, generate prompts, or interpret user intent.
[0146] In a first alternative scenario, infrastructure 10 may deploy multiple large models, such as a first model, a second model, and a third model. The first model is used to perform prompt word generation. The second model is used to perform model inference. The third model is used to resolve user intent. The first, second, and third models may have the same model structure, or they may have different model structures. Alternatively, at least two of the first, second, and third models may have different model structures; this application does not impose any limitations on this.
[0147] In the second alternative scenario, a large model can also be deployed in infrastructure 10. This large model is a multi-task model that can perform execution model inference, execution prompt word generation, and user intent parsing.
[0148] The two optional scenarios described above are merely illustrative of different large models deployed in infrastructure 10. In other optional scenarios, infrastructure 10 may also deploy large models in other ways. For example, infrastructure 10 may deploy a large model used for generating execution prompts and for parsing user intent. Another example is the deployment of the first and third models described above in infrastructure 10. This application does not limit this.
[0149] The knowledge base 130 is used to provide various examples to the data processing device 120.
[0150] A computing cluster 110 refers to a collection of computers connected via a local area network or the Internet, which includes multiple hosts. Each host can deploy one or more instances.
[0151] In some alternative approaches, the data processing device 120 may be deployed independently within a single instance of infrastructure 10. Alternatively, the data processing device 120 may be deployed distributed across multiple instances of infrastructure 10.
[0152] Similarly, large models can be deployed independently in one instance of Infrastructure 10, or distributed across multiple instances of Infrastructure 10.
[0153] In the first alternative scenario, when multiple large models are deployed in infrastructure 10, the multiple large models can be deployed on a single instance of infrastructure 10. Alternatively, the multiple large models can be deployed on multiple instances of infrastructure 10; for example, the first model is deployed on the first instance, the second model on the second instance, and the third model on the third instance. Another example is that the first model is distributed across the first and second instances, the second model is distributed across the third and fourth instances, and the third model is distributed across the fifth and sixth instances. Yet another example is that the first and third models are deployed on the same instance, and the third model is deployed on another instance.
[0154] In the second alternative scenario, where a large model is deployed within infrastructure 10, this large model can be deployed independently on a single instance of infrastructure 10. Alternatively, different network layers within this large model can be deployed on different instances of infrastructure 10.
[0155] The two optional scenarios mentioned above are merely different implementations of deploying large models in infrastructure 10. In other embodiments, infrastructure 10 may also deploy large models using other deployment methods, which are not limited in this application.
[0156] In one alternative approach, knowledge base 130 can be deployed within infrastructure 10. For example, knowledge base 130 can be deployed on a single instance of infrastructure 10. Alternatively, knowledge base 130 can be deployed in a distributed manner across multiple instances of infrastructure 10.
[0157] Alternatively, in another alternative approach, knowledge base 130 may reside on another platform, with infrastructure 10 providing an access interface to the knowledge base 130. Data processing device 120 accesses the knowledge base 130 through this access interface to obtain samples. Figure 2 As shown, the data processing device 120 is abstracted into a data processing service by the cloud service provider on the cloud service platform 30 and provided to the user. After the user purchases the data processing service on the cloud service platform 30 through the client 20, the cloud environment utilizes the data processing device 120 deployed on the infrastructure 10 to provide data processing services (e.g., prompt word generation service). When using the data processing service, the user can upload initial prompt words to the cloud environment through the application program interface (API) or graphical user interface (GUI) in the client 20. The data processing device 120 in the cloud environment receives the initial prompt words uploaded by the user and executes the data processing method provided in this application. The data processing device 120 sends optimized prompt words or inference results, etc., to the user through the API or GUI.
[0158] In addition, in some alternative ways, the functions of the data processing device 120 may also be performed by the infrastructure 10 or other components in the infrastructure 10, and this application does not limit the implementation method.
[0159] The following combination Figure 2 The modules included in the data processing apparatus 120 will be described by way of example.
[0160] like Figure 2 As shown, the data processing device 120 includes a user intent understanding module 121, a task example selection module 122, a prompt word generation module 123, and a feedback module 124.
[0161] The functions implemented by the user intent understanding module 121, the task example selection module 122, the prompt word generation module 123, and the feedback module 124 can be completed by the infrastructure 10 or other components of the infrastructure 10, and this application does not limit their implementation.
[0162] The following provides an illustrative explanation of the connection relationships between the user intent understanding module 121, the task example selection module 122, the prompt word generation module 123, and the feedback module 124, as well as the functions implemented by each module.
[0163] First, the connection relationship between the user intent understanding module 121, the task example selection module 122, the prompt word generation module 123, and the feedback module 124 is illustrated by example. Second, the functions implemented by each module are illustrated by example.
[0164] Please continue reading. Figure 2 The user intent module and task example selection module 122 are connected to the prompt word generation module 123, and the prompt word generation module 123 is connected to the feedback module 124. The feedback module 124 is connected to the user intent understanding module 121 and the task example selection module 122, respectively.
[0165] The user intent understanding module 121 provides user intent parsing functionality. This module receives a description of the reasoning task input by the user, parses the description to obtain the user's intent. The implementation method for parsing the description of the reasoning task can be found below. Figure 8 The provided embodiments are not described in detail here.
[0166] The task example selection module 122 is used to query the knowledge base based on the description information of the reasoning task and obtain the first example that matches the description information of the reasoning task. For the implementation method of obtaining the first example, please refer to the following... Figure 10 The provided embodiments are not described in detail here.
[0167] The first instance that matches the description information of the reasoning task can be an instance whose task type is the same as the task type of the reasoning task. Alternatively, the first instance that matches the description information of the reasoning task can be an instance whose task scenario is the same as the task scenario of the reasoning task. Or, the first instance that matches the description information of the reasoning task can be an instance whose description information and the description information of the reasoning task have a similarity greater than or equal to a similarity threshold.
[0168] The prompt word generation module 123 is used to generate initial prompt words by calling the first model based on the user's intent and the first instance. For the implementation method of generating initial prompt words, please refer to the following... Figure 8 The embodiments provided are not described in detail herein.
[0169] The feedback module 124 evaluates the initial prompt word. If the initial prompt word fails the evaluation, it sends the evaluation result to the prompt word generation module 123, causing the prompt word generation module 123 to re-execute prompt word generation until the prompt word evaluation passes. It also sends the evaluated prompt word to the client.
[0170] In some optional ways, the feedback module 124 can perform a self-evaluation of the initial prompt word.
[0171] In other alternative approaches, the feedback module 124 may provide an initial prompt word, receive user feedback based on the initial prompt word, and evaluate the initial prompt word based on the feedback. The feedback may be whether the user accepts or rejects the initial prompt word. Alternatively, the feedback may be a user confirmation or modification input.
[0172] In some alternative embodiments, the data processing device 120 may also include an inference module. Figure 2 (Not shown in the image). The feedback module 124 is also used to send a prompt word indicating that the evaluation has passed to the inference module. The inference module is used to receive the prompt word sent by the feedback module 124, call the second model, use the prompt word as input to the second model, obtain the inference result, and send the inference result to the client.
[0173] based on Figure 2The provided data processing device 120, during the prompt word generation process, acquires the user's intent and the first instance, and generates prompt words based on the user's intent and the first instance. This eliminates the need to calculate model gradients or token probabilities to optimize the prompt words, thereby shortening the prompt word generation time and improving efficiency. Furthermore, the data processing device 120 enhances the professionalism and accuracy of the prompt words by understanding the user's intent and utilizes the first instance in the sample database that matches the user's input to improve the generation effect. It does not rely on the inference model's inference results based on the prompt words to improve accuracy, thus reducing interaction between the prompt word generation process and the inference model, further reducing generation time and improving efficiency.
[0174] The above Figure 2 The provided data processing apparatus 120 is merely illustrative and should not be construed as limiting the data processing apparatus 120. In other embodiments, the data processing apparatus 120 may also have other grouping methods, such as... Figure 3 As shown, relative to Figure 2 The provided data processing device 120, in Figure 3 The data processing device 120 may also include a data collection module 125, a data processing module 126, and a sample selection model training module 127.
[0175] The data collection module 125 collects sample data and sends the collected sample data to the data processing module 126. The sample data includes a first sample obtained from an open-source data source and a second sample generated by the data processing device 120 over a past period. The first sample includes input samples and corresponding inference result samples. The second sample includes historical inputs and corresponding historical inference results.
[0176] In some optional scenarios, the data collection module 125 can collect sample data at preset intervals, thereby periodically updating the sample database and increasing the number and diversity of samples in the sample database.
[0177] The data processing module 126 is used to preprocess the sample data to obtain preprocessed sample data, and then write the preprocessed sample data into the knowledge base. Preprocessing may include, but is not limited to, data cleaning, sample expansion, or sample style transformation. Data cleaning may involve selecting sample samples with low similarity among the sample samples in the sample data. Alternatively, data cleaning may involve removing incomplete sample samples from the sample data. Alternatively, data cleaning may also involve selecting sample samples from the sample data whose task scenarios are the same as or different from those of samples in the sample database. For example, when the data processing device 120 provides data processing services for a specific field (e.g., education, product customer service, product testing, medical, or financial fields), sample samples from the sample data whose task scenarios are the same as those of samples in the sample database are selected. As another example, when the data processing device 120 provides data processing services for a general field, to improve sample diversity, sample samples from the sample data whose task scenarios are different from those of samples in the sample database are selected.
[0178] The example selection model training module 127 is used to acquire historical description information of historical reasoning tasks received by the data processing device 120 over a past period, selected historical examples matching the historical description information, and user feedback on historical initial prompts generated from the historical description information. The example selection model is trained using the historical description information of the historical reasoning tasks, the selected historical examples matching the historical description information, and the user feedback on historical initial prompts generated from the historical description information. The example selection model is used to provide the aforementioned first example to the task example selection module 122. In some optional ways, the example selection model may also be called an example selection strategy, example selection rule, or other names, which are not limited in this application. The implementation method of the task example selection module 122 training the example selection model can be referred to as follows. Figure 15A The provided embodiments are not described in detail here.
[0179] In some optional scenarios, the example selection model training module 127 can also be used to collect direct and indirect user feedback, using it as supervisory signals to update the example selection model. Direct feedback can be the prompt word adoption rate, while indirect feedback can be metrics such as satisfaction ratings.
[0180] Thus, the example selection model training module 127 can achieve personalized and rapid iteration of the example selection model. Furthermore, it continuously adjusts the example selection model optimization measures based on user feedback to maintain efficient operation and improve user experience.
[0181] In some alternative approaches, the functions implemented by the data collection module 125, the data processing module 126, and the sample selection model training module 127 can be performed by the infrastructure 10 or other components of the infrastructure 10, and this application does not limit their implementation.
[0182] based on Figure 3 The provided data processing device 120 can collect sample data, expand the knowledge base, and train the sample selection model through the sample data during the data processing process, thereby improving the matching degree between the selected first sample and the user's input, and thus improving the accuracy of the final prompt words.
[0183] Based on the above Figure 2 and Figure 3 The provided data processing device 120 provides several application scenarios, which illustrate the applicable scenarios of the data processing system.
[0184] (1) Model Development Scenarios
[0185] In model development scenarios, the data processing system provides prompt word generation services to model developers, enabling them to create prompt word libraries using the generated prompt words. These prompt word libraries offer a variety of prompt word templates.
[0186] In subsequent model inference applications, a target prompt word template matching the user-input task description can be selected from the prompt word library. This template is then populated with the user-input task description to obtain prompt words corresponding to the task description. Using these prompt words as input to the model improves its inference results.
[0187] Please see Figure 4A , Figure 4A This is a schematic diagram illustrating an application scenario of a data processing system provided in this application. The application scenario shown includes a development client, a data processing device 120, a large model, and a sample knowledge base. The sample knowledge base provides various prompt word examples, each of which includes a task description information example and the corresponding prompt word.
[0188] In this application scenario, the prompt word generation process includes stages ① to ⑤, where:
[0189] Phase 1: Developers send description information of the inference task to the data processing device 120 through a client application.
[0190] In stage ②, the data processing device 120 analyzes the user's intent based on the description information of the reasoning task to obtain the user's intent.
[0191] In stage ③, the data processing device 120 queries the sample knowledge base based on the description information of the reasoning task to obtain prompt word samples that match the description information.
[0192] In stage 4, the data processing device 120 calls the large model, taking the user's intent and the prompt word sample as input to the large model, and obtains the prompt word.
[0193] Phase 5: The data processing device 120 sends a prompt to the development client.
[0194] based on Figure 4A In the provided embodiments, in a model development scenario, the data processing device 120 generates prompts based on the user's intent and prompt word examples. This eliminates the need to calculate model gradients or token probabilities to optimize the prompts, thereby shortening the prompt generation time and improving efficiency. Furthermore, the data processing device 120 enhances the professionalism and accuracy of the prompts by incorporating user intent and utilizes prompt word examples matching the user input from a sample database to improve the generation effect. This eliminates the need to rely on the inference model's reasoning results based on the prompts to improve accuracy, thus reducing interaction between the prompt generation device and the inference model, further reducing generation time and improving efficiency.
[0195] (2) Product testing scenarios
[0196] In product testing scenarios, the data processing system provides test case generation services to testers, enabling them to use the generated test cases to perform product testing.
[0197] Please see Figure 4B , Figure 4B This application provides an illustration of an application scenario for a data processing system. Figure 2 The application scenarios shown include a test client, a data processing device 120, a large model, and a test case knowledge base. The test case knowledge base provides various test examples, each including a test task description example and the corresponding test cases.
[0198] In this application scenario, the test case generation process includes stages ① to ⑤, where:
[0199] Phase 1: Testers send a description of the test task to the data processing device 120 via the test client.
[0200] In stage ②, the data processing device 120 analyzes the user intent based on the description information of the test task to obtain the user's intent.
[0201] Phase ③: The data processing device 120 queries the test case knowledge base based on the description information of the test task to obtain the target test sample that matches the description information.
[0202] In stage 4, the data processing device 120 calls the large model, taking the user's intent and the target test case as input to the large model to obtain test cases.
[0203] Phase 5: The data processing device 120 sends test cases to the test client.
[0204] based on Figure 4B In the provided embodiments, test cases are generated by the data processing device 120 in the product testing scenario, thereby improving the efficiency of test case generation and thus improving the efficiency of product testing. In addition, the data processing device 120 generates test cases based on user intent and test samples, ensuring the accuracy of the generated test cases, thereby improving the quality of test cases and enhancing the product testing effect.
[0205] (3) Intelligent Customer Service Scenarios
[0206] In intelligent customer service scenarios, data processing systems provide conversation template generation services to enable customer service personnel to respond to customer inquiries more efficiently. In some optional scenarios, customer service personnel can be real or virtual.
[0207] Please see Figure 4C , Figure 4C This application provides an illustration of an application scenario for a data processing system. Figure 3 The application scenarios shown include an intelligent customer service terminal, a data processing device 120, a large model, and a conversation sample knowledge base. The conversation sample knowledge base provides various conversation samples, each including a customer question example and a corresponding conversation template.
[0208] In this application scenario, the test case generation process includes stages ① to ⑦, where:
[0209] Phase 1: The intelligent client receives the first session of user input.
[0210] The first session can be a problem description, a task description, or a query request.
[0211] Phase ②: The intelligent client sends the first session of user input to the data processing device 120.
[0212] In stage ③, the data processing device 120 performs user intent parsing based on the first session to obtain the user's intent.
[0213] In stage 4, the data processing device 120 queries the session knowledge base based on the first session to obtain a target session sample that matches the first session.
[0214] In stage 5, the data processing device 120 calls the large model, taking the user's intent and the target session example as input to the large model to obtain the session template.
[0215] Phase 6: The data processing device 120 sends a conversation template to the intelligent client.
[0216] Phase 7: The intelligent client provides a second session to the user based on the session template.
[0217] The second session is a response to the first session.
[0218] based on Figure 4C In the provided embodiment, in an intelligent customer service scenario, a conversation template is generated by the data processing device 120, improving the efficiency of conversation template generation and thus enhancing the response efficiency in the dialogue scenario. Furthermore, the data processing device 120 generates the conversation template based on the user's intent and conversation examples, ensuring the accuracy of the generated conversation template and thus responding to customer inquiries more effectively.
[0219] The above Figure 4A , Figure 4B and Figure 4C The data processing device 120 may be used for different application scenarios in some embodiments, but this application does not limit it to other application scenarios.
[0220] above Figures 2 to 4C In this process, the data processing device 120 calls the large model to generate prompt words. During the generation of prompt words, the data processing device 120 implements the data processing method provided in this application. The implementation process of the data processing method can be found below. Figures 6 to 15B The provided embodiments are not described in detail here.
[0221] The following is combined Figure 5 The system architecture provided in the embodiments of this application will be described in detail.
[0222] Figure 5 This is a schematic diagram of the system architecture provided for an embodiment of this application. Figure 5 As shown, the system architecture 500 includes an execution device 510, a training device 520, a database 530, a client device 540, a data storage system 550, and a data acquisition device 560.
[0223] The execution device 510 includes a computing module 511, an I / O interface 512, a preprocessing module 513, and a preprocessing module 514.
[0224] The calculation module 511 may include a large model.
[0225] The data acquisition device 560 is used to collect training samples. These training samples can include descriptive information about the inference task, initial prompts, optimized prompts, or examples. After collecting the training samples, the data acquisition device 560 stores them in the database 530.
[0226] Training device 520 can train the model based on the training samples maintained in database 530, using the aforementioned large model.
[0227] In a first alternative scenario, multiple large models, such as a first model, a second model, and a third model, are deployed in the data processing device 120. The training device 520 can train a model for generating prompt words (e.g., the first model in this embodiment) based on first training samples maintained in the database 530 to obtain the first model. A model for parsing user intent is trained based on third training samples maintained in the database 530 to obtain the third model. And a model for reasoning is trained based on second training samples maintained in the database 520 to obtain the second model.
[0228] The first training sample includes multiple descriptive information samples and corresponding prompt word samples for each descriptive information sample. The second training sample includes multiple prompt word samples and corresponding inference result samples for each prompt word sample. The third training sample includes multiple descriptive information samples and corresponding user intents for each descriptive information sample.
[0229] In the second alternative scenario, a large model is deployed in the data processing device 120. The training device 520 can train the initial large model based on the fourth training samples maintained in the database 530 to obtain the large model. The fourth training samples include multiple descriptive information samples and inference result samples corresponding to each descriptive information sample.
[0230] It should be noted that in practical applications, the training samples (first training sample, second training sample, third training sample, or fourth training sample) maintained in database 530 may not all originate from the data acquisition device 560; they may also be received from other devices. For example, the training samples (first training sample, second training sample, third training sample, or fourth training sample) maintained in database 530 may also be uploaded by client device 540. Furthermore, it should be noted that the training device 520 may not necessarily train the large model entirely based on the training samples (first training sample, second training sample, third training sample, or fourth training sample) maintained in database 530; it may also obtain training samples (first training sample, second training sample, third training sample, or fourth training sample) from the cloud or other devices for model training. The above description should not be construed as limiting the embodiments of this application.
[0231] The two optional scenarios mentioned above are merely different ways for the training device 520 to train the model. In other embodiments, the training device 520 can also implement model training in other ways.
[0232] The following example illustrates the training process of training device 520 using the training of the first model as an example. Similarly, the training process of the second model, the third model, or the large model can refer to the training of the first model.
[0233] Training device 520 acquires an initial model, using multiple descriptive information samples from the first training sample as input to the initial model, and outputting training prompt word samples corresponding to the descriptive information samples from the multiple descriptive information samples output by the initial model. The error between the training prompt word samples corresponding to the descriptive information samples in the multiple descriptive information samples and the prompt word samples corresponding to each descriptive information sample is calculated using a loss function, yielding the loss function value. The model parameters of the initial model are adjusted based on the training loss function value, resulting in an adjusted initial model. Multiple descriptive information samples from the first training sample are then input into the adjusted initial model, and this process is repeated until the loss function of the adjusted initial model converges and its value is less than a specific threshold. At this point, the initial model training is complete, and the trained initial model is determined as the first model. The model parameters can be weights.
[0234] In some alternative approaches, training device 520 may train the initial model using a centralized training method. Alternatively, training device 520 may train the initial model using a distributed training method.
[0235] The large model (or the first model, the second model, and the third model) obtained from training device 520 can be applied to different systems or devices, such as... Figure 5The execution device 510 shown can be a terminal, such as a mobile phone terminal, tablet computer, laptop computer, augmented reality (AR) / virtual reality (VR) device, vehicle terminal, etc., or it can be a server, etc. Alternatively, the execution device 510 can also be the aforementioned infrastructure 10.
[0236] Specifically, the training device 520 can transfer the trained large model (or the first model, the second model, and the third model) to the execution device 510.
[0237] In an alternative example, execution device 510 and training device 520 are different physical devices. Exemplarily, execution device 510 and training device 520 are chip systems deployed on different physical devices. For example, execution device 510 may include a GPU, central processing unit, other general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0238] In another alternative example, the execution device 510 and the training device 520 are deployed in the same physical device, or the execution device 510 and the training device 520 are in the same physical device.
[0239] In some alternative approaches, if the execution device 510 and the training device 520 are the same physical device, the training device 520 can configure the trained first model to itself and use the trained first model to implement the prompt word generation function to be implemented by the model.
[0240] In other alternative approaches, the training device 520 can configure the trained first model to multiple execution devices, so that each execution device can implement the prompt word generation function to be implemented by the first model. In processing the prompt word generation function of the above embodiments, the first model can also implement some functions that a large language model can achieve, etc.
[0241] Furthermore, based on the function performed by the execution device 510, the execution device 510 can be further subdivided into, for example... Figure 5 The architecture shown is in Figure 5In the process, the execution device 510 is configured with an input / output (I / O) interface 512, a calculation module 511, a preprocessing module 513, and a preprocessing module 514.
[0242] The I / O interface 512 is used for data interaction with external devices. Users can input description information of inference tasks or other data into the I / O interface 512 through the client device 540.
[0243] Preprocessing modules 513 and 514 are used to preprocess the description information of the inference task received from the I / O interface 512. It should be understood that preprocessing modules 513 and 514 may be absent, or only one preprocessing module may be used. When preprocessing modules 513 and 514 are absent, the calculation module 511 can directly process the description information of the inference task.
[0244] During the preprocessing of the description information of the reasoning task by the execution device 510, or during the calculation module 511 of the execution device 510 performing calculations and other related processes, the execution device 510 can call data, code, etc. in the data storage system 550 for corresponding processing, or store the data, instructions, etc. obtained from the corresponding processing into the data storage system 550.
[0245] Finally, the I / O interface 512 provides the processing result (e.g., a prompt word or inference result obtained based on the method provided in the embodiments of this application) to the client device 540, thereby providing it to the user.
[0246] exist Figure 5 In the system architecture shown, the user can manually provide task description information, which can be done through the interface provided by I / O interface 512. Alternatively, the client device 540 can automatically send the inference task description information to I / O interface 512. If user authorization is required for the client device 540 to automatically send the inference task description information, the user can set the corresponding permissions in the client device 540. The user can view the output results of the execution device 510 on the client device 540, which can be presented in various ways such as display, sound, or animation. The client device 540 can also act as a data acquisition terminal, collecting data such as... Figure 5 The description information of the inference task input I / O interface 512 and the output results of the output I / O interface 512 are used as new sample data and stored in the database 530. Alternatively, data can be collected directly from the I / O interface 512 without going through the client device 540. Figure 5The description information of the inference task of the input I / O interface 512 and the output results of the output I / O interface 512 are stored in the database 530 as new sample data.
[0247] It is worth noting that, Figure 5 This is merely a schematic diagram of a system architecture provided in an embodiment of this application. Figure 5 The positional relationships between the devices, components, modules, etc., shown do not constitute any limitation; for example, in Figure 5 In this context, the data storage system 550 is an external storage device relative to the execution device 510. However, in other cases, the data storage system 550 may also be placed within the execution device 510. It should be understood that the aforementioned execution device 510 may be deployed within the client device 540.
[0248] From the perspective of model inference:
[0249] In this embodiment of the application, the computing module 511 of the execution device 510 can obtain the code stored in the data storage system 550 to perform model inference.
[0250] In this embodiment of the application, the computing module 511 of the execution device 510 may include hardware circuits (such as ASIC, FPGA, general-purpose processor, DSP, microprocessor or controller, etc.) or combinations of these hardware circuits. For example, the training device 520 may be a hardware system with instruction execution function, such as CPU, DSP, etc., or a hardware system without instruction execution function, such as ASIC, FPGA, etc., or a combination of the above-mentioned hardware system without instruction execution function and hardware system with instruction execution function.
[0251] Specifically, the computing module 511 of the execution device 510 can be a hardware system with the function of executing instructions. The data processing method provided in this application embodiment can be software code stored in the memory. The computing module 511 of the execution device 510 can obtain the software code from the memory and execute the obtained software code to perform model inference.
[0252] It should be understood that the computing module 511 of the execution device 510 can be a combination of a hardware system without the function of executing instructions and a hardware system with the function of executing instructions. Some steps of model reasoning can also be implemented by the hardware system without the function of executing instructions in the computing module 511 of the execution device 510, which is not limited here.
[0253] From the training side of the model:
[0254] In this embodiment of the application, the training device 520 can access the memory ( Figure 5(Not shown in the diagram, but can be integrated into the training device 520 or deployed separately from the training device 520) The code stored in the diagram implements the data processing-related steps in the embodiments of this application.
[0255] In this embodiment of the application, the training device 520 may include hardware circuits (such as ASIC, FPGA, general-purpose processor, DSP, microprocessor or microcontroller, etc.) or combinations of these hardware circuits. For example, the training device 520 may be a hardware system with instruction execution function, such as CPU, DSP, etc., or a hardware system without instruction execution function, such as ASIC, FPGA, etc., or a combination of the above-mentioned hardware system without instruction execution function and hardware system with instruction execution function.
[0256] It should be understood that the training device 520 can be a combination of a hardware system without instruction execution function and a hardware system with instruction execution function. Some steps related to data processing provided in the embodiments of this application can also be implemented by the hardware system in the training device 520 without instruction execution function, which is not limited here.
[0257] The large model in this embodiment can be applied to prompt word generation scenarios to perform prompt word generation tasks, conversation template generation tasks, or test case generation tasks. It can also be used in model inference scenarios to perform code generation tasks, content generation tasks, content recommendation tasks, or retrieval tasks. Alternatively, it can be used in product testing scenarios to perform test script generation tasks or software testing tasks.
[0258] Based on the above Figures 2 to 5 The provided system architecture, using the prompt word generation scenario as an example, is combined with... Figures 6 to 15B The implementation of the data processing method provided in this application is illustrated by way of example. Similarly, the implementation of the data processing method in model reasoning scenarios or product testing scenarios can refer to the implementation in the prompt word generation scenario.
[0259] Please see Figure 6 , Figure 6 The first flowchart illustrates a data processing method provided in this application, which includes steps S610 to S650.
[0260] S610, the data processing device 120 receives the first prompt word sent by the user.
[0261] In some alternative implementations, the first prompt word may also be called the initial prompt information, task information, initial prompt word, original prompt word, prompt word, or other names. This application does not limit this.
[0262] In one optional implementation, the first prompt word may include descriptive information about the inference task. This descriptive information describes the inference task to be performed. In some optional implementations, the inference task may be, but is not limited to, a retrieval task, a question-answering task, a content generation task, a health diagnosis task, or other AI tasks. Content generation tasks may include, but are not limited to, code generation tasks, multimodal content generation tasks, image generation tasks, text generation tasks, or audio generation tasks.
[0263] In some alternative approaches, the descriptive information of the reasoning task may include, but is not limited to: the type of reasoning task, the input of the reasoning task, the output of the reasoning task, or the reasoning function implemented by the reasoning task.
[0264] The types of reasoning tasks may include, but are not limited to: retrieval tasks, question-answering tasks, content generation, or health diagnosis.
[0265] The input to an inference task can be the data that the inference task needs to process.
[0266] The output of an inference task refers to the expected output of the inference task, which includes, but is not limited to, text, images, audio, video, code, or other types of output.
[0267] The reasoning function implemented by the reasoning task can be the function that the reasoning task is to achieve, such as retrieval, answering questions, generating content, or health diagnosis.
[0268] For example, if the first prompt is "Build a travel assistant that can automatically process and optimize travel expenses", the type of inference task is: travel processing. The input to the inference task is "Build a travel assistant", and the function to be implemented is "to automatically process and optimize travel expenses".
[0269] For example, taking the first prompt as "Build a diagnostic assistant that can provide preliminary diagnostic suggestions based on medical record data", the inference task type is health diagnosis. The input to the inference task is "Build a diagnostic assistant", and the function to be implemented is "to provide preliminary diagnostic suggestions based on medical record data".
[0270] The following is an exemplary description of how the data processing device 120 receives the first prompt word.
[0271] In a first alternative implementation, the data processing device 120 is deployed on infrastructure 10. The first prompt word can be uploaded by the user via client 20.
[0272] For example, infrastructure 10 provides a prompt input interface to client 20. The user inputs a description of the inference task based on this interface. Client 20 uses the user-input description as a first prompt and sends it to cloud service platform 30. Cloud service platform 30 receives the first prompt and sends an instruction to infrastructure 10, which carries the first prompt. Infrastructure 10 responds to the instruction and processes the first prompt through data processing device 120.
[0273] For example, Infrastructure 10 provides such as Figure 7A The input interface is shown in Figure (a). This input interface displays input boxes. The user inputs data based on the input interface, and infrastructure 10 responds to the input by providing, for example... Figure 7A The input interface is shown in Figure (b). Figure 7A In Figure (b), the input box displays: "Build a travel assistant that can automatically process and optimize travel expenses." The user clicks... Figure 7A The "Send" control in Figure (b). Client 20 sends "Build a travel assistant that can automatically process and optimize travel expenses" as the first prompt to infrastructure 10.
[0274] In a second alternative implementation, the data processing device 120 is deployed on a terminal device. The first prompt can be input by the user based on the user interface of the terminal device. The above-described S610 can be replaced by the data processing device 120 receiving the first prompt input by the user.
[0275] For example, in response to an application launch command, the terminal device launches the application and provides, for instance, the application itself. Figure 7B The user interface 701 is shown in Figure (a). This user interface 701 includes a content display area and a prompt input area. The prompt input area includes a control for the type of reasoning task. For example... Figure 7B As shown in Figure (a), the reasoning task type controls displayed in the prompt input area include: "Intelligent Writing," "PPT Creation," "Image Generation," and "Translation." The user clicks on the reasoning task type control and enters the first prompt word. For example, if the user clicks the "PPT Creation" control, the terminal device provides... Figure 7B The user interface 702 is shown in Figure (b). This user interface 702 displays a prompt input view, which includes a function area and input boxes. The function area provides multiple scene controls, each with different functions. For example... Figure 7B Figure (b) shows multiple scene controls including "General," "Training Materials," "Performance Report," and "Product Showcase." Users select the target scene control from these controls and click the input box to enter a description. Figure 7BIn the user interface 703 shown in Figure (c), the user selects "Product Display" and enters the description information of product AA, "Product XXXX of AA," in the input box. The user clicks... Figure 7B The "Send" control in diagram (c) is used. The terminal device generates the first prompt based on the product display and the description information of product AA, "XXXX of product AA". For example... Figure 7B As shown in Figure (d), the terminal device outputs a user interface 704. In this user interface 704, the content display area displays the first prompt: "Help me generate a PPT, the theme is AA product, and the scenario is product display".
[0276] The two optional implementations described above are merely different ways in which the data processing device 120 receives the first prompt word. In other embodiments, the data processing device 120 may also have other implementations for receiving the first prompt word. This application does not limit this.
[0277] S620, the data processing device 120 obtains the user's intent based on the first prompt word.
[0278] In some alternative implementations, the user's intent can be used to describe the task requirements of the reasoning task, that is, the core goal or requirement that the user expects the model to understand and complete through the first cue word.
[0279] In some alternative approaches, the user's intent may include, but is not limited to: intent keywords for the reasoning task, instructions, usage scenarios, or task requirements.
[0280] For example, if the first prompt is "Help me generate a PPT, the theme is AA product, and the scenario is product display", the user's intent can include the instruction: generate a PPT document, the usage scenario is product display, the intent keywords are AA product and product display, and the task requirements include: generate a PPT of AA product and display AA product.
[0281] For example, if the first prompt is "Build a travel assistant that can automatically process and optimize travel expenses", the user's intent can include the instruction: build a travel assistant, the use case: travel expense reimbursement scenario, the intent keywords include travel expense reimbursement, and the task requirements include building a travel assistant and automatically processing travel expenses.
[0282] The above description of the user's intent is merely an illustrative example. In practical applications, the user's intent may include other content, which this application does not limit.
[0283] The following provides several optional implementation methods to illustrate how to parse user intent.
[0284] In the first alternative implementation, the data processing device 120 can identify the user's intent by keyword matching.
[0285] For example, the data processing device 120 can segment the first prompt word and preprocess it. The data processing device 120 queries a keyword database based on the processed first prompt word to obtain intent keywords that match the processed first prompt word in the keyword database, as well as a score for each intent keyword. The user's intent is determined based on the score of each intent keyword.
[0286] The data processing device 120 may use a word segmentation tool to segment the first prompt word. This application does not limit the specific type of word segmentation tool.
[0287] The keyword library includes multiple intents and multiple intent keywords corresponding to each intent.
[0288] The score of an intent keyword can be determined by the weight of the intent keyword.
[0289] In some optional examples, the intent keyword in the keyword library that matches the processed first prompt word can be an intent keyword in the keyword library that exactly matches the preprocessed first prompt word. Alternatively, the intent keyword in the keyword library that matches the processed first prompt word can also be an intent keyword in the keyword library that fuzzily matches the preprocessed first prompt word.
[0290] Taking the first prompt word as "build a travel assistant that can automatically process and optimize travel expenses" as an example, the data processing device 120 uses a word segmentation tool to divide the first prompt word into multiple candidate words: "build", "a", "travel assistant", "can", "automatic processing", "and", "optimize" and "travel expenses". After removing the stop words "can" and "and" from the candidate words, the processed first prompt word becomes "build", "a", "travel assistant", "automatic processing", "optimize", and "travel expenses".
[0291] The data processing device 120 performs exact or fuzzy matching between the preprocessed first prompt word and keywords in the keyword database to obtain intent keywords matching the processed first prompt word: "Create Travel Expense Report", "Create Travel Approval", "Create Travel Assistant", and "Automatic Travel Expense Processing". The data processing device 120 determines the score corresponding to each of "Create Travel Expense Report", "Create Travel Approval", "Create Travel Assistant", and "Automatic Travel Expense Processing". Based on the intent keyword with a score greater than a threshold and the highest score, the data processing device 120 identifies the user's intent. For example, if the score for "Create Travel Assistant" is greater than the threshold and has the highest score, the user's intent is determined to be "Create Travel Assistant".
[0292] In the second alternative implementation, the data processing device 120 can identify the user's intent through template matching.
[0293] The data processing device 120 stores a template library, which includes multiple intents and one or more templates corresponding to each intent. Each template includes a fixed sentence structure or keyword combination that the user may input. In some alternative ways, the template may be a list of keywords. In other alternative ways, the template may be a complex sentence structure that includes variables and grammatical rules.
[0294] For example, the data processing device 120 segments the first prompt word to obtain a preprocessed first prompt word. The data processing device 120 then queries a template library based on the preprocessed first prompt word to obtain a target template in the template library that matches the preprocessed first prompt word. The intent corresponding to this target template is then determined as the user's intent.
[0295] In some optional approaches, the data processing device 120 can query a template library based on the preprocessed first prompt word to identify multiple candidate templates in the template library that match the preprocessed first prompt word. The matching degree between each candidate template and the preprocessed first prompt word is calculated. The candidate template with the highest matching degree and a matching degree greater than a threshold is determined as the target template that matches the preprocessed first prompt word.
[0296] Among them, multiple candidate templates include templates that are precisely matched with the first prompt word after preprocessing in the template library and templates that are fuzzy matched with the first prompt word after preprocessing in the template library.
[0297] The data processing device 120 can calculate the matching degree between each candidate template and the preprocessed first prompt word by using a weighted scoring method or a Boolean matching method.
[0298] In a third alternative implementation, the data processing device 120 can obtain the user's intent through feature recognition.
[0299] For example, the data processing device 120 can extract the features of the first prompt word and use a classification model to identify the features of the first prompt word to obtain the user's intent.
[0300] In some alternative approaches, the data processing device 120 may extract features of the first prompt word via word embedding. Alternatively, the data processing device 120 may extract features of the first prompt word via a neural network-based model.
[0301] In some alternative approaches, the classification model can be a Naive Bayes-based model. Alternatively, the classification model can be a Support Vector Machine-based model. Or, the classification model can be a Random Forest-based model. This application does not limit the specific type of classification model.
[0302] In a fourth alternative implementation, the data processing device 120 can use an intent recognition model to analyze the intent of the first prompt word and obtain the user's intent.
[0303] In some alternative approaches, the intent recognition model may also be called a third model, intent parsing model, intent understanding model, intent acquisition model, or other names, which are not limited in this application.
[0304] In some alternative approaches, the intent recognition model can be a neural network-based model. For example, an intent recognition model based on a recurrent neural network. Another example is an intent recognition model based on a convolutional neural network. Yet another example is an intent recognition model based on a transformer. This application does not limit the specific type of intent recognition model.
[0305] The four optional implementation methods described above are merely different ways to identify user intent. In other embodiments, the data processing device 120 may also employ other implementation methods to obtain the user intent. For example, the data processing device 120 may cluster the first prompt word to obtain the user intent. Alternatively, the data processing device 120 may utilize multiple models to perform intent parsing on the first prompt word, obtaining candidate intents output by each model. The data processing device 120 then fuses the multiple candidate intents to obtain the user intent. This application does not limit the scope of the application in this regard.
[0306] In one alternative implementation, the data processing device 120 may also obtain a role prompt based on the first prompt word.
[0307] In some alternative implementations, role cues are used to indicate the model's role in performing inference tasks.
[0308] In some alternative approaches, role-based cues are related to the user's intent.
[0309] For example, if the first prompt is "Help me generate a PPT, the theme is AA product, and the scenario is product presentation", the role prompts can include: PPT creation expert, product introduction expert, or AA product engineer.
[0310] For example, if the first prompt is "Build a travel assistant that can automatically process and optimize travel expenses", the role prompts include financial expert or travel management expert.
[0311] The following is an exemplary description of how the data processing device 120 receives role prompts.
[0312] In the first alternative implementation, the data processing device 120 can determine the role prompt based on the user's intent.
[0313] In a first optional example, the data processing device 120 queries a role database based on the user's intent and retrieves role prompts from the role database that match the user's intent. The role database includes multiple intents and one or more roles corresponding to each intent.
[0314] For example, if the user's intent is "create a travel assistant", the role prompts will be "travel management expert" which is exactly matched with the user's intent and "financial expert" which is fuzzy matched with the user's intent.
[0315] In the second alternative example, the data processing device 120 queries the mapping relationship between the user's intent and the role based on the user's intent, and obtains the role prompt corresponding to the user's intent.
[0316] The mapping relationship between intent and role is used to indicate the mapping relationship between user intent and corresponding role prompts. For example, if the user intent is "Create a travel assistant", the role "Travel Management Expert" corresponding to "Create a travel assistant" is determined as the user intent and the corresponding role prompt.
[0317] In a third alternative example, the data processing device 120 can recommend roles based on the user's intent and obtain role prompts.
[0318] For example, the data processing device 120 can input the user's intent into a role recommendation model to obtain role prompts. The role recommendation model can be based on a machine learning model, or it can be based on a neural network model; this application does not limit the specific type of the role recommendation model. Additionally, in some optional embodiments, the role recommendation model can also be called a third-party model, a recommendation model, a role recognition model, a role prediction model, or other names; this application does not limit this. The above three optional examples are merely different implementations of the data processing device 120 determining role prompts based on the user's intent. In other embodiments, the data processing device 120 can also use other implementations to determine user prompts. For example, the data processing device 120 can select multiple candidate roles from a role database based on the user's intent. The data processing device 120 calculates the score for each candidate role and determines the candidate role with the highest score (or a candidate role with a score greater than a score threshold) as the role prompt. This application does not limit this approach.
[0319] In a second alternative implementation, the data processing device 120 may determine the role prompt based on the first prompt word.
[0320] In a first optional example, the data processing device 120 can determine the role prompt based on the first prompt word through keyword matching or template matching. The methods for keyword matching or template matching can be referenced in the aforementioned methods for determining user intent, and will not be elaborated upon here.
[0321] In a second alternative example, the data processing device 120 can determine the task type of the reasoning task based on the first prompt word. Based on the mapping relationship between the task type and the role, a role prompt is obtained. For example, if the first prompt word is "build a travel assistant that can automatically process and optimize travel expenses," and the task type of the reasoning task is travel processing, then the role prompt is determined to be either "travel processing expert" or "travel reimbursement expert."
[0322] In a third alternative example, the data processing device 120 can also obtain a role prompt based on the task scenario indicated by the first prompt word and the mapping relationship between the task scenario and the role. For example, if the first prompt word is "build a travel assistant that can automatically process and optimize travel expenses", and the task scenario of the reasoning task is a financial processing scenario, then a financial expert is selected as the role prompt.
[0323] In a fourth alternative example, the data processing device 120 can also use the first prompt word as input to the role recommendation model to obtain role prompts.
[0324] The above four optional examples are just some of the different ways in which the data processing device 120 determines the role prompt based on the first prompt word. In other embodiments, the data processing device 120 may also use other implementation methods to determine the role prompt.
[0325] The two optional implementation methods described above are merely different ways for the data processing device 120 to determine the role prompt. In other embodiments, the data processing device 120 may also use other implementation methods to determine the role prompt. For example, the data processing device 120 provides a role selection interface, which includes multiple roles. In response to a user's selection operation based on the role selection interface, the data processing device 120 determines the role selected by the user as the role prompt. This application does not limit this aspect.
[0326] In an alternative implementation, the data processing device 120 can also invoke a large model, using the first prompt word as input to the large model, to obtain the user's intent and role prompts.
[0327] S630, the data processing device 120 retrieves the first instance that matches the first prompt word from the sample database.
[0328] In some optional implementations, the sample database includes multiple samples and a corresponding sample description for each sample. Each sample includes an initial prompt word and an optimized prompt word output by the model. The sample description may include, but is not limited to, the task type, task scenario, or intent keyword corresponding to the sample.
[0329] The first example can be a sample from the sample database that matches the task type or task scenario with the first prompt word. Alternatively, the first example can also be a sample that matches the intent keyword with the first prompt word. Here, "match" can be an exact match or a fuzzy match.
[0330] The following is an exemplary description of how the data processing device 120 obtains the first instance that matches the first prompt word from the sample database.
[0331] In a first alternative implementation, the data processing device 120 can extract intent keywords from the first prompt and use the intent keywords as search terms. Based on the search terms, it retrieves a first example from the sample database.
[0332] The data processing device 120 can call the large model to provide the Retrieval-Augmented Generation (RAG) function to retrieve the first instance that meets the search terms from the sample database.
[0333] In the second optional implementation, the data processing device 120 can form search terms based on the description information of the reasoning task, and retrieve the first example from the sample database based on the search terms. The search terms can be the task type or task scenario from the description information of the reasoning task.
[0334] In a third alternative implementation, the data processing device 120 can extract intent keywords from the first prompt and form search terms based on the intent keywords and the description information of the reasoning task. A search is then performed in the sample database based on the search terms to obtain the first sample.
[0335] In a fourth alternative implementation, the data processing device 120 can query the sample database based on the description information of the reasoning task and obtain the first sample from the sample database.
[0336] In the first alternative approach, the data processing device 120 invokes the large model, uses the description information of the reasoning task as input to the sample selection model, and uses the sample selection model to query the sample database to obtain the first sample.
[0337] In one optional example, the sample selection model formulates a retrieval statement based on the description information of the inference task. It then queries a sample database based on this retrieval statement to obtain multiple candidate samples related to the description information of the inference task. These candidate samples are then sorted in descending order of relevance to the description information of the inference task, resulting in a candidate sample sequence, which is output as the first sample. For example, the sample selection model converts the retrieval statement into a first word vector. Using this first word vector, it queries the sample database and identifies samples in the database whose second word vector differs from the first word vector by a difference threshold less than or equal to this threshold as multiple candidate samples related to the description information of the inference task.
[0338] In some alternative approaches, the sample selection model may include a first sub-model and a second sub-model. The first sub-model queries a sample database based on the description information of the inference task to obtain multiple candidate samples related to the description information of the inference task. The second sub-model sorts the multiple candidate samples according to the degree of relevance between each candidate sample and the description information of the inference task, thus obtaining a candidate sample sequence.
[0339] In the second optional example, after sorting multiple candidate samples, the sample selection model removes candidate samples whose relevance is less than a relevance threshold, resulting in a processed candidate sample sequence, which is then output as the first sample. Alternatively, the first preset number of candidate samples in the candidate sample sequence can be output as the first sample.
[0340] The two optional examples above are just different implementations of the sample selection model to retrieve the first sample. In other embodiments, the sample selection model can also use other implementations for sample retrieval.
[0341] In one alternative example, the search statement can be descriptive information, or it can be search information generated based on the descriptive information, such as search terms extracted from the descriptive information or expanded descriptive information.
[0342] The above four optional implementation methods are merely different ways for the data processing device 120 to obtain the first instance matching the first prompt word. In other embodiments, the data processing device 120 may also use other implementation methods to obtain the first instance. For example, the data processing device 120 may use the following... Figure 10 The provided embodiments are used to obtain the first example. This application does not limit the scope of the application.
[0343] S640, the data processing device 120 obtains the second prompt word based on the user's intention and the first example.
[0344] The second cue word is an optimized version of the first cue word, and both the second and first cue words indicate the same reasoning task. In some alternative approaches, the second cue word may also be called an optimized cue word, an adjusted cue word, or other names, which are not limited in this application.
[0345] The following is an example of how to obtain the second prompt word.
[0346] In a first alternative implementation, the data processing device 120 can invoke a large model (or a first model), using the user's intent and the first example as input to the large model (or the first model) to obtain a second prompt word. For example... Figure 6 As shown, the data processing device 120 calls the first model, takes the user's intent, role prompt (optionally), and first example as input to the first model, and obtains the second prompt word.
[0347] In a second optional implementation, the data processing device 120 can further acquire a prompt information template, fill the prompt information template with the user's intent and the first example, and obtain a second prompt word. The prompt information template includes background input, task instructions, and paradigm prompts. For example, the description information of the reasoning task can be used as the background input of the prompt information template, the user's intent as the task instructions, and the first example as the paradigm prompts to obtain the second prompt word.
[0348] The above two optional implementation methods are merely different ways for the data processing device 120 to obtain the second prompt word. In other embodiments, the data processing device 120 can also use other implementation methods to obtain the second prompt word. For example, in a third optional implementation method, the data processing device 120 can determine the requirement list of the reasoning task according to the user's intention, use the requirement request of the reasoning task as the background input of the prompt information template, use the role prompt of the first prompt word as the role prompt of the prompt information template, and use the first example as the paradigm prompt to obtain the second prompt word. As another example, the data processing device 120 can also refer to the following... Figure 8 , Figure 11 or Figure 13 The provided embodiment obtains a second prompt word. This application does not limit this.
[0349] In one optional implementation, to improve the reliability of the second prompt word, the data processing device 120 can evaluate the generated prompt word, and if the evaluation passes, obtain the second prompt word. For details on the implementation of the prompt word evaluation, please refer to the display. Figures 11 to 14 The provided embodiments are not described in detail here.
[0350] S650, the data processing device 120 calls the second model, uses the second prompt word as input to the second model, and obtains the reasoning result (optionally).
[0351] The inference result indicates the output of the model after processing the second prompt word. This inference result can include, but is not limited to: text, query results, generated multimodal content, graphs, tables, audio, and video. Multimodal content includes: images generated from text, translated text, videos generated from text, and style-transformed images.
[0352] based on Figure 6 In the provided embodiments, the data processing device 120 generates prompts based on user intent and a first instance in a prompt generation scenario. This eliminates the need to calculate model gradients or token probabilities to optimize the prompts, thereby shortening the prompt generation time and improving efficiency. Furthermore, compared to adjusting the prompt APO by evaluating inference results, this application enhances the professionalism and accuracy of the second prompt based on user intent and utilizes a first instance in the sample database that matches the first prompt to improve the generation effect of the second prompt. This eliminates the need to rely on the inference model's inference results to improve the accuracy of the prompts, thus reducing interaction between the prompt generation process and the inference model, further reducing generation time and improving efficiency.
[0353] above Figure 6 The data processing method provided in this application is described using the data processing device 120 as an example. In some optional implementations, the data processing method provided in this application can also be executed by other devices. For example, the computing device may include, but is not limited to: terminal devices, chips (general-purpose processing chips or accelerator chips) in terminal devices, servers, virtual servers, cloud platforms or cloud services with prompt word generation (or inference) functions, network services, computing nodes, or other electronic devices or clusters that can refer to the execution of the data processing method provided in the embodiments of this application.
[0354] In addition, the above Figure 6 The data processing method provided in this application is illustrated using model reasoning based on the generated second prompt word as an example. In other embodiments, after generating the second prompt word, the data processing device 120 may also output the second prompt word or write the prompt word into a prompt word database.
[0355] In one alternative implementation, to improve the reasoning performance of the model, the data processing device 120 may also obtain role prompts based on the first prompts during the generation of the second prompt, and form a thought chain or process arrangement based on the user's intent. The data processing device obtains the second prompt based on at least one of the role prompts, thought chains or process arrangements, the user's intent, and the first example.
[0356] The process orchestration is used to guide the first model in generating the second prompt word. In some optional embodiments, the process orchestration includes the sub-stages involved in generating the second prompt word and the execution logic between different sub-stages. In some optional embodiments, the process orchestration may also be referred to as a prompt generation thought chain, a prompt word generation process, or other names, which are not limited in this application.
[0357] For example, taking the first prompt as "Build a travel assistant that can automatically process and optimize travel expenses", the process orchestration instructs the first model to follow these steps: Sub-stage 1: Determine the user's intent to build a travel assistant that automatically processes and optimizes travel expenses → Sub-stage 2: Analyze the first example → Sub-stage 3: Extract the user's intent → Sub-stage 4: Build a thought process for how to build a travel assistant → Sub-stage 5: Design the output format of the travel assistant → Sub-stage 6: Determine the variables in the second prompt → Sub-stage 7: Output the execution logic of the second prompt and generate the second prompt.
[0358] In one alternative implementation, the data processing device 120 can generate a process orchestration based on the user's intent. For example, the data processing device 120 can decompose the user's intent using a third model to generate a process orchestration. Alternatively, the data processing device 120 can query a process orchestration database based on the user's intent, obtain a process orchestration template matching the user's intent, and then fill the template with the user's intent to obtain the process orchestration.
[0359] In a first alternative approach, the data processing device 120 can use the user's intent, role cues, and a first example as input to the first model to obtain a second cue word.
[0360] In the second alternative approach, the data processing device 120 can use the user's intent, thought process, and first example as input to the large model, the first model, to obtain the second prompt word.
[0361] In a third alternative approach, the data processing device 120 can use the user's intent, process arrangement, and first example as input to the large model, the first model, to obtain the second prompt word.
[0362] In the fourth alternative approach, the data processing device 120 can use the user's intent, thought process, workflow arrangement, role prompts, and the first example as input to the large model, the first model, to obtain the second prompt word.
[0363] In the fifth alternative approach, the data processing device 120 can use the user's intent, thought chain, role cues, and the first example as input to the large model, the first model, to obtain the second cue word.
[0364] The four optional methods described above are merely different ways for the data processing device 120 to generate the second prompt word with different inputs. In other embodiments, the data processing device 120 may also use other data to generate the second prompt word. For example, the first prompt word, the user's intent, the flow arrangement, the role prompt, and the first example may be used as inputs to the large model, the first model, to obtain the second prompt word. This application does not limit this. Figure 8 As shown, Figure 8 The present application provides a flowchart for generating prompt words, which includes steps S641 to S642.
[0365] S641, the data processing device 120 decomposes the user's intent and forms a thought chain or process arrangement for the reasoning task.
[0366] Among them, the thought chain is used to indicate the subtasks included in the reasoning task, as well as the execution logic between different subtasks.
[0367] In one alternative implementation, the data processing device 120 breaks down the user's intent into multiple executable subtasks. These subtasks are then linked together in a logical order to form a thought chain.
[0368] The following provides several optional methods to illustrate how the data processing device 120 can decipher the user's intent.
[0369] In a first alternative approach, the data processing device 120 can decompose the user's intent based on rules. For example, the data processing device 120 utilizes a predefined rule base (e.g., a knowledge graph) to obtain task templates in the rule base that match the user's intent, and determines the multiple subtasks included in the task templates as executable subtasks. The rule base includes multiple task templates and multiple subtasks included in each task template.
[0370] In the second alternative approach, the data processing device 120 can invoke a large model, taking the user's intent as input to the large model, to obtain multiple executable subtasks.
[0371] The two optional methods mentioned above are merely different ways of implementing the data processing device 120 in interpreting the user's intent. In other embodiments, the data processing device 120 may also use other methods to interpret the user's intent, and this application does not limit this.
[0372] S642, the data processing device 120 calls the first model and takes at least one of the process arrangement, reasoning task thought chain or role prompt, user intent, and first example as input to the first model to obtain the second prompt word.
[0373] like Figure 8 As shown, the data processing device 120 takes the process arrangement, the thought chain of the reasoning task, the role prompts, the user's intent, and the first example as input to the first model to obtain the second prompt word.
[0374] In one alternative implementation, the data processing device 120 may obtain the second prompt word by referring to the above-described S640.
[0375] In another optional implementation, the data processing device 120 forms a prompt information template including multiple subtasks based on the execution logic between the subtasks indicated by the thought chain. This prompt information template includes multiple logically executed subtasks and a data segment corresponding to each subtask. The data processing device 120 fills the corresponding data segment of the subtask in the prompt information template with the user's intent, role prompts, and the first example to obtain the second prompt word.
[0376] In some alternative approaches, the role prompts of the data processing device 120 may be the same or different in different subtasks. For example, the data processing device 120 may determine the role prompts corresponding to the subtask based on the task type, task scenario, or intent of the subtask.
[0377] For example, taking the reasoning task of building a travel assistant as an example, the construction of the travel assistant includes three sub-tasks: generating a business requirement list, understanding the code logic, and generating code. The second prompt word is as follows: Figure 9 As shown, the role prompt for the subtask of generating the business requirement list is: "Please play the role of a travel management expert, responsible for professionally helping users analyze and refine their requirements, and generating a business requirement list for travel expense processing." The background input is: "Automatically process and optimize travel expenses." The task instruction is: "Based on the above business requirement information, please organize, analyze, and refine the requirements, following the examples below, to generate a standardized business requirement list." The paradigm prompts are examples of travel expense review and travel reimbursement processes.
[0378] In the code logic understanding subtask, the role prompt is "Please play the role of a senior financial application developer, responsible for professionally writing travel expense processing code", the background input is "Business list "1. Requirement 1: [Requirement description], 2. Requirement 2: [Requirement description]", and the task instruction is "Please design travel expense processing code based on the above requirement list, and explain the design logic in detail and in an easy-to-understand way".
[0379] In the code generation subtask, the task instruction is: "Based on the design concept, and following the example of travel processing, write a travel assistant program that meets the requirements, including comments [and other coding style requirements] for key steps." The paradigm hints are the program code for the travel expense review example and the travel reimbursement process example in the sample database.
[0380] The above Figure 9 The second prompt word shown, along with the number of subtasks included in the prompt word and the execution logic between each subtask, is merely an illustrative example. The number of subtasks and the execution logic in the second prompt word, as well as the field information of each subtask, can be adjusted according to the actual application scenario.
[0381] based on Figure 8 In the provided embodiment, during the generation of prompt words, the data processing device 120 guides the first model to generate prompt words step by step through process arrangement, ensuring the accuracy of the second prompt words and avoiding omissions in steps. Furthermore, a thought chain is added to the prompt words, dividing the reasoning task into multiple sub-tasks. Thus, during subsequent model reasoning, the second prompt words can guide the model to execute each sub-task sequentially, reducing the processing difficulty of each sub-task, ensuring the accuracy of the model's reasoning results, and avoiding omissions in steps.
[0382] In one alternative implementation, to increase the reliability of the second prompt word, the first sample may include multiple sub-samples. In this way, the data processing device 120 can increase sample diversity and detailed information during the second prompt word generation process based on multiple sub-samples, so as to better realize the generation of the second prompt word.
[0383] In some optional approaches, the similarity between different subsamples within multiple subsamples is less than a similarity threshold. This ensures the diversity of subsamples in the first sample, thereby better achieving the generation of the second prompt word.
[0384] The similarity threshold can be 0.5, 0.6, 0.7 or other values, and this application does not limit it.
[0385] In some optional examples, the similarity between different subsamples can be obtained through vector similarity calculation methods, such as vector cosine similarity calculation method, Euclidean distance calculation method, etc.
[0386] For example, the data processing device 120 can retrieve a sample database based on a first prompt word to obtain multiple first candidate samples that match the first prompt word. The multiple first candidate samples are then filtered according to the similarity between them, and first target candidate samples with a similarity less than a similarity threshold are retained. These first target candidate samples are then used as sub-samples, and multiple sub-samples are determined as the first sample. For instance, the data processing device 120 uses the first prompt word as input to a sample selection model, obtains first candidate samples through the model, and filters multiple first candidate samples to obtain the first sample.
[0387] In some optional examples, during the candidate sample selection process, if the number of first target candidate samples is less than the preset number of samples, the data processing device 120 can retrieve samples from the sample database based on the first target candidate samples to obtain multiple second candidate samples that match the first target candidate samples. The multiple second candidate samples are then selected based on the similarity between the candidate samples, retaining the second target candidate samples whose similarity is less than a similarity threshold. The first target candidate samples and the second target candidate samples are then determined as sub-samples to obtain the first sample. For example, the data processing device 120 uses the first target candidate samples as input to a sample selection model, obtains second candidate samples through the sample selection model, and selects multiple second candidate samples to obtain the second target candidate samples.
[0388] The preset number of samples can be 2, 3, 4 or other values, and this application does not limit this.
[0389] In some alternative approaches, the first target candidate sample may also be referred to as the first subsample or other names, and the second target candidate sample may also be referred to as the second subsample or other names. This application does not limit this.
[0390] In some optional examples, to increase the diversity of subsamples, after obtaining the first target candidate sample, the data processing device 120 modifies the input or output fields of the first target candidate sample to obtain the second target candidate sample. The first target candidate sample and the second target candidate sample are then determined as subsamples to obtain the first sample.
[0391] In one alternative implementation, to increase the diversity and number of subsamples, the data processing device 120 can use multiple search terms to query the sample database during the query process to obtain the first sample. Thus, by increasing the diversity of search terms, the diversity and number of subsamples are increased, thereby increasing the reliability of the second suggestion term.
[0392] Please see Figure 10 , Figure 10 The flowchart of an example retrieval provided in this application includes S631 to S633.
[0393] S631, the data processing device 120 forms the first search term based on the description information of the reasoning task.
[0394] In some optional implementations, the data processing device 120 may use the task type or task scenario in the description information of the reasoning task as the first search term. Alternatively, the data processing device 120 may use features of the description information of the reasoning task as the first search term. Alternatively, the data processing device 120 may use keywords (or key words) in the description information of the reasoning task as the first search term.
[0395] S632, the data processing device 120 generates a second search term based on the first search term.
[0396] The second search term includes one or more of the following: a synonym of the first search term, an antonym of the first search term, a translated term of the first search term, a rearranged first search term, or a first search term after style transformation.
[0397] In one optional implementation, the data processing device 120 can query a search term database based on the first search term to obtain synonyms, antonyms, translated terms, rearranged first search terms, or style-transformed first search terms, thus obtaining a second search term. The search term includes multiple search terms and their corresponding synonyms, antonyms, translated terms, rearranged search terms, or style-transformed search terms.
[0398] In another optional implementation, the data processing device 120 can call a large model based on the first search term to translate and expand the first search term from Chinese to English to obtain a third search term. The data processing device 120 then rearranges the third search term according to a preset word sorting rule to obtain a fourth search term. The data processing device 120 then calls the large model to perform a style transformation on the fourth search term to obtain a fifth search term. The third, fourth, and fifth search terms are then determined as the second search term.
[0399] S633, the data processing device 120 queries the sample database based on the first search term and the second search term to obtain the first sample.
[0400] In one optional implementation, the data processing device 120 can query a sample database based on a first search term to obtain multiple third candidate samples that match the first search term. The data processing device 120 can also query the sample database based on a second search term to obtain multiple fourth candidate samples that match the second search term. A preset similarity rule is then used to measure the similarity or matching degree between the third and fourth candidate samples, thereby obtaining the first sample. The preset similarity rule is a vector similarity calculation method, such as vector cosine similarity calculation or Euclidean distance calculation. The first sample is the candidate sample with the highest similarity score. For example, the data processing device 120 can use the first and second search terms as input to a sample selection model, and query the sample database through the sample selection model to obtain the first sample.
[0401] In another alternative implementation, after acquiring multiple third candidate samples and multiple fourth candidate samples, the data processing device 120 filters the multiple third candidate samples and multiple fourth candidate samples according to the similarity between the candidate samples, retains the target candidate sample whose similarity between the candidate samples is less than the similarity threshold, and determines the target candidate sample as the first sample.
[0402] based on Figure 10 In the provided embodiment, during the process of querying the sample database, the data processing device 120 expands the search terms to increase the diversity of search terms, thereby increasing the diversity and number of sub-samples, and thus increasing the reliability of the second suggestion term.
[0403] In one alternative implementation, to improve the matching degree between the sample and the inference task, the data processing device 120 can also evaluate the complexity of the inference task, select a target sample selection strategy according to the complexity of the inference task, and select candidate samples according to the target sample selection strategy to obtain the first sample.
[0404] In some alternative approaches, the complexity of the reasoning task can be evaluated using a task evaluation model.
[0405] In some alternative approaches, the data processing device 120 can obtain the target sample selection strategy based on the mapping relationship between complexity and sample selection strategy.
[0406] In the first optional example, when the complexity of the reasoning task meets the complexity corresponding to the first sample selection strategy, the data processing device 120 selects candidate samples according to the first sample selection strategy to obtain the first sample.
[0407] For example, the data processing device 120 filters multiple first candidate samples according to the similarity between candidate samples to obtain a first sample.
[0408] In the second alternative example, when the complexity of the reasoning task meets the complexity corresponding to the second sample selection strategy, the data processing device 120 selects candidate samples according to the second sample selection strategy to obtain the first sample.
[0409] For example, the data processing device 120 retrieves a sample database based on a first prompt word to obtain multiple first candidate samples that match the first prompt word, and obtains a first target candidate sample from the first candidate samples based on the similarity between the candidate samples. The data processing device 120 retrieves a sample database based on the first target candidate sample to obtain multiple second candidate samples that match the first target candidate sample. Second target candidate samples with similarity less than a similarity threshold are selected based on the similarity between the candidate samples. The first target candidate sample and the second target candidate sample are determined as sub-samples to obtain the first sample.
[0410] In the third alternative example, when the complexity of the reasoning task meets the complexity corresponding to the third sample selection strategy, the data processing device 120 selects candidate samples according to the third sample selection strategy to obtain the first sample.
[0411] For example, the data processing device 120 refers to the above. Figure 10 In the provided embodiment, candidate samples are selected to obtain the first sample.
[0412] The three optional examples described above are merely different implementations of adaptively selecting the sample selection strategy based on the complexity of the inference task. In other embodiments, the data processing device 120 may also employ a different implementation to select the sample selection strategy. For example, the data processing device 120 may invoke a recommendation model, using the description information of the inference task as input to the recommendation model, to obtain the target sample selection strategy. This application does not limit this approach.
[0413] In one alternative implementation, to improve the reliability and accuracy of the second prompt word, the data processing device 120 may evaluate the generated prompt word and use the prompt word that passes the evaluation as the second prompt word.
[0414] The following is combined Figures 11 to 13 An example is provided to illustrate how the evaluation prompts are implemented.
[0415] Please see Figure 11 , Figure 11 This application provides a flowchart for generating prompt words. Figure 2 The process of generating prompt words includes steps S110 to S140.
[0416] S110, the data processing device 120 obtains a third prompt word based on the user's intention and the first example.
[0417] In an alternative implementation, the data processing device 120 may refer to S640 or the above-described method. Figure 8 The provided embodiments yield a third prompt word, which is not limited in this application.
[0418] In some alternative approaches, the third prompt word may also be called the initial prompt word or other names, which are not limited in this application.
[0419] S120, the data processing device 120 evaluates the third prompt word.
[0420] In a first alternative implementation, the data processing device 120 may evaluate the generated third prompt word using a self-evaluation method.
[0421] For example, the data processing device 120 compares the third prompt word with the description information of the reasoning task. If the third prompt word matches the description information of the reasoning task, it is determined that the third prompt word has passed the evaluation. If the third prompt word does not match the description information of the reasoning task, it is determined that the third prompt word has failed the evaluation.
[0422] In some optional embodiments, the data processing device 120 may acquire the first requirement information from the third prompt word and obtain the second requirement information of the reasoning task based on the description information of the reasoning task. The data processing device 120 compares the first requirement information with the second requirement information. If the first requirement information includes the second requirement information, or the similarity between the first requirement information and the second requirement information is greater than or equal to a similarity threshold, the third prompt word is determined to match the description information of the reasoning task. If the first requirement information does not include the second requirement information, or the first requirement information includes part of the second requirement information, or the similarity between the first requirement information and the second requirement information is less than a similarity threshold, the third prompt word is determined to not match the description information of the reasoning task.
[0423] In other alternative methods, the data processing device 120 may also obtain the generated description information of the reasoning task from the third prompt word and compare the generated description information with the description information of the reasoning task. If the similarity between the generated description information and the description information of the reasoning task is greater than or equal to a similarity threshold, it is determined that the third prompt word matches the description information of the reasoning task. If the similarity between the generated description information and the description information of the reasoning task is less than the similarity threshold, it is determined that the third prompt word does not match the description information of the reasoning task.
[0424] In addition, in some optional implementations, the data processing device 120 may also call a large model (such as a first model or other models), take the third prompt word and the description information of the reasoning task as input, and use the large model to determine whether the description information of the reasoning task is fully contained in the third prompt word. If it is contained, it is determined that the third prompt word matches the description information of the reasoning task; if it is not contained, it is determined that the third prompt word does not match the description information of the reasoning task.
[0425] In the second alternative implementation, the data processing device 120 evaluates the generated third prompt word based on user feedback information.
[0426] For example, the data processing device 120 provides a first interface, such as Figure 12 As shown in Figure (a), the first interface includes a third prompt word, a "Confirm" control, and a "Modify" control. When the user clicks the "Confirm" control on the first interface to input a confirmation operation, the data processing device 120, in response to the user's confirmation operation based on the first interface, determines that the third prompt word evaluation has passed. When the user clicks the "Modify" control on the first interface to input a modification operation, the data processing device 120, in response to the user's modification operation based on the first interface, determines that the third prompt word evaluation has failed. In some alternative embodiments, the first interface may also be referred to as an evaluation interface, a prompt word evaluation interface, a prompt word feedback interface, or other names; this application does not limit this to any particular name.
[0427] In some optional methods, after the user clicks the "Modify" control, the data processing device 120 provides, for example... Figure 12 The prompt generation interface is shown in Figure (b). This prompt generation interface displays a "Prompt generation in progress" field.
[0428] In some alternative methods, after the user clicks the "Modify" control, they can provide information such as... Figure 12 The modification interface is shown in Figure (c). This modification interface includes a prompt input box, an "Edit" control, and an "OK" control. Figure 12 As shown in Figure (c), the prompt input box displays "Build a travel assistant that can automatically process and optimize travel expenses." If the user clicks the "Confirm" control, meaning the user does not modify the first prompt, the data processing device 120 re-executes S640 to generate a new third prompt. If the user clicks the "Edit" control, meaning the user modifies the first prompt, the prompt input box becomes editable, and the user can click on the prompt input box to modify its content. Figure 12As shown in Figure (d), the user modifies the content in the prompt word input box, forming a new first prompt word: "Build a travel assistant that can automatically process and optimize travel expense reimbursement." When the user clicks the "Confirm" control, the data processing device 120 responds to the user's modification operation based on the first interface input, obtains the new first prompt word, and re-executes the above steps S620 to S640 to generate a new third prompt word.
[0429] In some alternative examples, the modification interface may also include a role prompt box and an intent input box, which the user can modify after clicking the "Edit" control.
[0430] In a third alternative implementation, the data processing device 120 combines self-evaluation with user feedback to evaluate the third prompt word.
[0431] For example, the data processing device 120 compares the third prompt word with the description information of the reasoning task to obtain an evaluation interface for the third prompt word. The data processing device 120 provides an evaluation result interface, which displays the evaluation result of the third prompt word, a "regenerate" control, and a "confirm" control. If the user clicks the "confirm" control, the data processing device 120 determines the third prompt word as the second prompt word. If the user clicks the "regenerate" control, the data processing device 120 obtains a new third prompt word based on the user's intent, role prompts, and the first example, and compares the new third prompt word with the description information of the reasoning task.
[0432] The evaluation results include whether the third prompt word evaluation is passed or not.
[0433] In some optional methods, if the third prompt fails the evaluation, the evaluation result interface can also display the differences between the third prompt and the description information of the reasoning task, as well as the similarities between the third prompt and the description information of the reasoning task. Thus, during the regeneration of the third prompt, the data processing device 120 can retain the similarities between the third prompt and the description information of the reasoning task, focusing on the differences, so that the newly generated third prompt can meet the user's needs (or the description information of the reasoning task), thereby reducing the number of times the third prompt needs to be regenerated and improving the efficiency of prompt generation.
[0434] In a fourth optional implementation, the data processing device 120 can further detect the syntax of the third prompt word, the relevance between the third prompt word and the descriptive information of the inference task, and the inference effect of the third prompt word, to obtain the syntax score, relevance score, and inference effect score of the third prompt word. Based on the syntax score, relevance score, and inference effect score of the third prompt word, the data processing device 120 obtains an evaluation score for the third prompt word. If the evaluation score is greater than or equal to a scoring threshold, the third prompt word is determined to have passed the evaluation. If the evaluation score is less than the scoring threshold, the third prompt word is determined to have failed the evaluation.
[0435] In some alternative approaches, the inference effect of the third cue word can be predicted rather than derived from actual inference about the third cue word.
[0436] In some alternative approaches, the evaluation score for the third prompt word can be the sum of the grammatical score, relevance score, and inference effect score of the third prompt word, or the average or weighted average of the grammatical score, relevance score, and inference effect score of the third prompt word.
[0437] The four optional implementation methods described above are merely different ways for the data processing device 120 to evaluate the third prompt word. In other embodiments, the data processing device 120 may also employ other implementation methods to evaluate the third prompt word. For example, the data processing device 120 combines self-evaluation and user feedback information, and determines that the third prompt word evaluation is successful if the third prompt word matches the description information of the reasoning task and the user confirms the operation based on the first interface. If the third prompt word does not match the description information of the reasoning task or the user modifies the operation based on the first interface, the third prompt word evaluation is determined to be unsuccessful.
[0438] S130, if the third prompt word passes the evaluation, the third prompt word is determined as the second prompt word.
[0439] S140, if the second prompt word fails the evaluation, a new third prompt word is obtained based on the user's intent, role prompts, and the first example. The new third prompt word is evaluated, and this process is repeated until the latest third prompt word passes the evaluation. The third prompt word that passes the evaluation is then determined as the second prompt word.
[0440] In the first alternative implementation, the user does not update the first prompt word. The data processing device 120, based on the user's intent, role prompts, and the first example, refers to the above... Figure 9 An example is provided to obtain a new third prompt word. For the implementation of generating the new third prompt word, please refer to S640 above or the above... Figure 8 The provided embodiments are not described in detail here.
[0441] In the second optional implementation, the user updates the first prompt word. The data processing device 120, referring to steps S620 to S630 above, re-performs intent parsing and sample retrieval to obtain the user's new intent, new role prompt, and new first sample. Based on the user's new intent, new role prompt, and new first sample, the data processing device 120, referring to the above... Figure 8 An example is provided to obtain a new third prompt word.
[0442] The two optional implementation methods described above are merely different ways to generate a new third prompt word. In other embodiments, the data processing device 120 may also use other implementation methods to generate a new third prompt word. For example, if the data processing device 120 does not update the first prompt word, it refers to S620 to S640 above to obtain a new third prompt word. As another example, if the data processing device 120 updates the first prompt word, it re-executes S620 above to obtain a new third prompt word based on the user's new intent, the new role prompt, and the first example. Yet another example, if the data processing device 120 updates the first prompt word, it re-executes S630 above to obtain a new third prompt word based on the user's intent, the role prompt, and the new first example. This application does not limit this.
[0443] In one alternative implementation, after obtaining the new third prompt word, the data processing device 120 may evaluate the new third prompt word with reference to the above-described S120.
[0444] based on Figure 11 In the provided embodiment, the data processing device 120 evaluates the generated third prompt word and uses the third prompt word that passes the evaluation as the second prompt word. By adding an evaluation step, it ensures that the second prompt word meets the user's needs, thereby improving the reliability and accuracy of the second prompt word.
[0445] In one alternative implementation, to improve the reliability of the second prompt word and enhance the user's understanding of it, the data processing device 120, after acquiring the user's intent, role prompt, and first instance, provides the user's intent, role prompt, and first instance through segmented reasoning, thereby generating the second prompt word.
[0446] like Figure 13 As shown, Figure 13 This application provides a flowchart for generating prompt words. Figure 3 The process of generating prompt words includes steps S121 to S124.
[0447] S121, the data processing device 120 provides the user's intent and first instance to the client 20.
[0448] In some alternative implementations, the data processing device 120 can provide the user's intent and first example to the client 20 via a user interface. For example... Figure 14 As shown, the data processing device 120 provides, for example Figure 14 The second interface shown in Figure (a) displays the user's intent: "Create Travel Assistant," a first example: "Travel Expense Review Example," and "Modify" and "Accept" controls. In some optional ways, the data processing device 120 can also provide role prompts, such as... Figure 14 As shown in Figure (a), the second interface also displays a role prompt: "Travel Management Expert". In some alternative methods, the second interface may also be called a feedback interface, intent feedback interface, sample feedback interface, or other names, which are not limited in this application.
[0449] In an alternative implementation, where the data processing device 120 is deployed on a terminal device, the above-described S121 can be replaced by the data processing device 120 providing the user's intent, role prompts, and a first instance.
[0450] S122, in response to the first adoption operation, the data processing device 120 obtains a third prompt word based on the user's intent and the first example.
[0451] In some alternative implementations, the first acceptance operation is used to indicate to the user the user's intent to accept the first example, the role prompt, and the first instance. In some alternative implementations, the first acceptance operation may also be called the first operation, the confirmation operation, or other names, and this application does not limit this.
[0452] The first adoption operation can be a contact-based operation, such as tapping, long-pressing, swiping, double-tapping, or clicking on controls in the interface. Alternatively, the first adoption operation can be a contactless operation, such as gesture input, physical buttons, or voice input. Alternatively, the first adoption operation can also be a typing operation, such as typing with a mouse or keyboard.
[0453] Based on the above Figure 14 Taking Figure (a) as an example, the user can click the "Accept" control to enter the first acceptance operation, and the data processing device 120 provides, for example, Figure 13 The prompt generation interface is shown in Figure (b). The prompt generation interface displays a "Prompt generation in progress" field.
[0454] In one alternative implementation, the data processing device 120 may obtain the third prompt word by referring to the above-described S110, which will not be described in detail here.
[0455] In one alternative implementation, when a user inputs a modification operation, the data processing device 120 executes the above-described S620 to S630, regenerates the user's intent, role prompts, and first instance, and provides the regenerated user intent, role prompts, and first instance to the client 20.
[0456] S123, the data processing device 120 provides the third prompt word to the client 20.
[0457] In some alternative implementations, the data processing device 120 may provide a third prompt to the client 20 via a user interface.
[0458] As mentioned above Figure 14 As shown in Figure (b), after generating the third prompt word, the data processing device 120 provides, as shown in Figure (b), ... Figure 14 The first interface is shown in Figure (c). This first interface displays a third prompt: "Role prompt: Please play the role of a travel management expert, responsible for professionally helping users analyze and refine their needs, and generating a travel assistant." The background input is: "Automatically process and optimize travel expenses." The task instruction is: "Based on the above business requirements information, and following the examples below for reference, please organize, analyze, and refine the requirements to generate a travel assistant." The paradigm prompts include "Travel Expense Review Example" and "Travel Reimbursement Process Example," as well as "Modify" and "Accept" controls.
[0459] In an alternative implementation, when the data processing device 120 is deployed on a terminal device, the above-described S123 can be replaced by the data processing device 120 providing a third prompt word.
[0460] S124, in response to the second adoption operation, the data processing device 120 determines the third prompt word as the second prompt word.
[0461] In one alternative approach, the second adoption operation may also be referred to as a second operation, a confirmation operation, a prompt confirmation operation, or other names, etc., and the embodiments of this application do not limit this.
[0462] Similar to the first adoption operation described above, the second adoption operation can also be a contact operation, a non-contact operation, or a typing operation.
[0463] like Figure 14 As shown in Figure (c), the user clicks the "Accept" control on the first interface and enters a second acceptance operation. The data processing device 120 responds to the second acceptance operation by providing... Figure 14The third interface shown in Figure (d) includes a "Details" control, a "Reasoning" control, and a "Cancel" control for the second prompt. The user clicks the "Details" control to view the specific content of the second prompt. The user can click the "Reasoning" control to input a third operation. In response to the third operation, the data processing device 120 performs reasoning based on the second prompt and obtains a reasoning result.
[0464] The third operation can also be called a reasoning confirmation operation or other names, and this application does not limit it.
[0465] In some optional examples, the third interface may also include "details," "copy," and "cancel" controls for the second prompt. When the user clicks the "copy" control, the data processing device 120 reads the second prompt and writes it into the cache of the data processing device 120 or the cache of the user's corresponding terminal device, so that the data processing device 120 or the terminal device can perform inference or other tasks (such as testing tasks) based on the cached second prompt.
[0466] In some alternative examples, the third interface may also include a "details" control, a "write" control, and a "cancel" control for the second prompt word. When the user clicks the "write" control, the data processing device 120 writes the second prompt word into the prompt word library.
[0467] In one alternative implementation, when a user inputs a modification operation, the data processing device 120 executes the above-described S122, regenerates the third prompt word, and provides the regenerated third prompt word to the client 20.
[0468] based on Figure 13 In the provided embodiment, the data processing device 120 provides the user's intent, role prompts, first instance, and generated third prompt word using a segmented reasoning approach. Furthermore, after adopting the user's intent, role prompts, and first instance, the third prompt word is generated. This improves the likelihood that the generated third prompt word meets the user's needs, thereby enhancing the reliability of the second prompt word.
[0469] In one alternative implementation, to enhance the richness of the sample database, after the data processing device 120 generates the second prompt word, the first prompt word and the reasoning result obtained by inputting the second prompt word into the second model can be used as samples and written into the sample database.
[0470] In a first optional example, the data processing device 120 may, after generating the inference result, use the first prompt word and the inference result obtained by inputting the second prompt word into the second model as examples and write the examples into the example database.
[0471] In a second optional example, the data processing device 120 may also collect multiple first prompt words and the reasoning results of the corresponding second prompt words received within a preset time period to form multiple samples, and write the multiple samples into a sample database. Alternatively, samples with a similarity lower than a similarity threshold among the multiple samples may be written into the sample database.
[0472] The two optional examples above are just different implementations of how the data processing device 120 triggers the update of the sample database. In other embodiments, the data processing device 120 may have other triggering methods for updating the sample database, which are not limited in this application.
[0473] In one alternative implementation, to improve the selection effect of the sample selection model, the data processing device 120 can continuously optimize the sample selection model simply to improve the generation effect of prompt words.
[0474] like Figure 15A As shown, Figure 15A This application provides a flowchart of an updated sample selection model, which includes steps S151 to S152.
[0475] S151, the data processing device 120 acquires multiple historical records.
[0476] like Figure 15A As shown, the data processing device 120 acquires N historical records: Historical Record 1, Historical Record 2, ..., Historical Record N, where N is a positive integer greater than 2. Historical Record 1 includes feedback on the first prompt word, the first example, and the third prompt word; Historical Record 2 includes feedback on the first prompt word 2, the first example 2, and the third prompt word 2; Historical Record N includes feedback on the first prompt word N, the first example N, and the third prompt word N.
[0477] Each historical record includes the first historical prompt, a historical example selected using the first historical prompt, and feedback from the third historical prompt.
[0478] Among them, the third historical prompt word is generated from the first historical prompt word, and the feedback includes confirmation or modification.
[0479] In some optional methods, multiple history records include a first history record, which includes the feedback from the first prompt word, the first example, and the third prompt word. For example... Figure 15A As shown, the first historical record is historical record 1 among N historical records.
[0480] In some alternative methods, multiple history records can originate from the same user. Alternatively, multiple history records can be generated by at least two users.
[0481] In other alternatives, multiple history records can originate from the same application, or they can originate from different applications.
[0482] In one alternative implementation, during a prompt word generation process, the data processing device 120 records, after completing the prompt word generation, the first prompt word input by the user during the prompt word generation process, the sample retrieved based on the first prompt word, and the user's feedback on the third prompt word generated based on the first prompt word input by the user, and stores them as a historical record in a memory or database.
[0483] "Complete prompt word generation" refers to the data processing device 120 outputting the second prompt word (or reasoning result), and "one prompt word generation process" can refer to the process from the data processing device 120 receiving the first prompt word input by the user to outputting the second prompt word (or reasoning result).
[0484] In some alternative methods, the data processing device 120 reads multiple historical records from a memory or database at preset time intervals. The preset time interval can be 1 day, 3 days, 1 week, or other values; this application does not limit this.
[0485] In other alternative approaches, the data processing device 120 may record the user's feedback type to the generated third prompt word during each prompt word generation process. When the number of modification operations among the recorded feedback types is greater than or equal to a preset threshold, the data processing device 120 reads multiple historical records from a memory or database.
[0486] S152, the data processing device 120 updates the sample selection model based on multiple historical records to obtain a new sample selection model.
[0487] The new sample selection model is used to select samples from the sample database in the next time period.
[0488] In one optional implementation, the data processing device 120 inputs the first historical prompt words and historical examples from multiple historical records into the sample selection model. It calculates the loss between the predicted feedback of each historical record output by the sample selection model and the feedback of the third historical prompt words from multiple historical records using a loss function, thereby obtaining the loss function value of the sample selection model. The model parameters of the sample selection model are adjusted according to the loss function value. When the loss function of the sample selection model converges and the loss function value of the sample selection model is less than a threshold, the adjustment of the sample selection model is stopped, and a new sample selection model is obtained.
[0489] based on Figure 15A The provided embodiments improve the sample retrieval capability of the sample selection model by continuously updating the sample selection model, thereby enhancing the generation effect of prompt words.
[0490] To better illustrate the data processing method provided in this application, in conjunction with the above... Figures 6 to 15A Taking the prompt word generation scenario as an example, the implementation of the data processing method provided in this application will be illustrated.
[0491] For example, taking the data processing device 120 deployed on infrastructure 10 as an example, such as Figure 15B As shown, Figure 15B A flowchart illustrating a data processing method provided in this application. Figure 2 The data processing method consists of stages ① to ⑧. Among them:
[0492] Phase 1: Client 20 obtains the description information of the inference task input by the user.
[0493] In the first alternative approach, the data processing device 120 provides financial services, and the description information of the reasoning task can be "to build a travel assistant that can automatically process and optimize travel expenses".
[0494] In the second alternative approach, the data processing device 120 provides health diagnostic services, and the description information of the reasoning task can be "to build a diagnostic assistant that can provide preliminary diagnostic suggestions based on medical record data".
[0495] In the third alternative approach, the data processing device 120 provides scientific data processing services, and the description information of the reasoning task can be "to build a data processing assistant that can process scientific data".
[0496] In the fourth alternative approach, the data processing device 120 provides educational services, and the description information of the reasoning task can be "to build a learning plan assistant that can generate personalized learning plans based on students' learning data".
[0497] The four optional methods above are merely examples of different descriptive information for inference tasks in different application scenarios. In other embodiments, the descriptive information for inference tasks may also take other forms, which are not limited in this application.
[0498] Phase 2: Client 20 sends description information to data processing device 120.
[0499] In stage ③, the data processing device 120 parses the description information to obtain the user's intent and role prompts.
[0500] Corresponding to the processing in stage ②, in stage ③, the data processing device 120 receives the description information sent by the client 20.
[0501] In one alternative implementation, the data processing device 120 refers to S620 or... Figure 8 The provided embodiments parse the description information to obtain the user's intent and role prompts, which will not be elaborated upon here.
[0502] In the first optional example, the description of the reasoning task is "Build a travel assistant that can automatically process and optimize travel expenses", the user's intent is "travel expense processing", and the role prompts include "financial expert" and "travel management expert".
[0503] In the second alternative example, the description of the reasoning task is "Build a diagnostic assistant that can provide preliminary diagnostic suggestions based on medical record data." The user's intent is "health diagnosis," and the role prompts include "clinician" and "pathologist."
[0504] In the third optional example, the description of the reasoning task is "Build a data processing assistant that can process scientific research data", the user's intent is "scientific research data analysis", and the role prompts include "scientific researcher" and "scientific research data analyst".
[0505] In the fourth optional example, the description of the reasoning task is "Build a learning plan assistant that can generate personalized learning plans based on students' learning data", the user's intent is "learning plan development", and the role prompts include "instructional designer" and "subject matter expert".
[0506] The above four optional examples are merely examples of user intent and role prompts in different application scenarios and should not be construed as limiting the data processing method provided in this application. In other embodiments, user intent and role prompts may take other forms, which are not limited in this application.
[0507] In stage 4, the data processing device 120 retrieves the sample database based on the description information and obtains a second sample that matches the description information.
[0508] In some alternative implementations, the data processing device 120 may refer to S630 or the above-described method. Figure 10 The provided embodiments involve searching sample databases, which will not be elaborated upon here.
[0509] In the first optional example, the description of the reasoning task is "Build a travel assistant that can automatically process and optimize travel expenses". The second example includes "Travel Expense Review Example" and "Travel Reimbursement Process Example".
[0510] In the second optional example, the description of the inference task is "Build a diagnostic assistant that can provide preliminary diagnostic suggestions based on medical record data." The second example includes "Example of medical record data" and "Example of preliminary diagnosis."
[0511] In the third optional example, the description of the reasoning task is "Build a data processing assistant that can process scientific research data", and the second example includes "example of scientific research data" and "example of scientific research paper".
[0512] In the fourth optional example, the description of the reasoning task is "Build a learning plan assistant that can generate personalized learning plans based on students' learning data", and the second example includes "learning data example" and "personalized learning plan example".
[0513] The above four optional examples are merely illustrations of second examples in different application scenarios. In other embodiments, the retrieved second examples may have other forms, which are not limited in this application.
[0514] In stage 5, the data processing device 120 performs sample enhancement based on the second sample to obtain the first sample.
[0515] In one alternative implementation, the first instance includes a second instance and a second instance after enhancement processing. The second instance after enhancement processing may also be referred to as a third instance, a second candidate instance, a second target candidate instance, or other names; this application does not limit the specific name used.
[0516] In some alternative approaches, the data processing device 120 may retrieve a sample database based on the second sample to obtain multiple second candidate samples.
[0517] In some alternative approaches, the data processing device 120 may transform the second sample to obtain a transformed second sample, and retrieve a sample database based on the transformed second sample to obtain multiple second candidate samples.
[0518] The transformation of the second example can be a transformation of the style of the second example, a transformation of the language type of the second example, or a transformation of the task scenario of the second example.
[0519] In stage 6, the data processing device 120 calls the first model, taking the user's intent, role prompts, and the first example as input to the first model to obtain the third prompt word.
[0520] In an alternative implementation, the data processing device 120 may refer to S640 or the above-described method. Figure 8 The provided embodiments yield a third prompt word, which will not be elaborated upon in this application.
[0521] In the first optional example, the description of the reasoning task is "Build a travel assistant that can automatically process and optimize travel expenses," and the third prompt includes "As a travel management expert, please refer to the travel expense review example and travel reimbursement process example to build a travel assistant that can automatically process and optimize travel expenses."
[0522] In the second optional example, the description of the reasoning task is "Build a diagnostic assistant that can provide preliminary diagnostic suggestions based on medical record data." The third prompt includes "As a clinician, please refer to the examples of medical record data and preliminary diagnoses to build a diagnostic assistant that can provide preliminary diagnostic suggestions based on medical record data."
[0523] In the third optional example, the description of the reasoning task is "Build a data processing assistant that can process scientific research data," and the third prompt includes "As a scientific research data analyst, please refer to examples of scientific research data and scientific research papers to build a data processing assistant that can process scientific research data."
[0524] In the fourth optional example, the description of the reasoning task is "Build a learning plan assistant that can generate personalized learning plans based on students' learning data," and the third prompt includes "As an instructional designer, please refer to the learning data example and the personalized learning plan example to build a learning plan assistant that can generate personalized learning plans based on students' learning data."
[0525] The four optional examples described above are merely illustrative of different third prompt words in different application scenarios. In other embodiments, the third prompt word may also include other content, which is not limited in this application.
[0526] In stage 7, the data processing device 120 evaluates the third prompt word.
[0527] In some alternative implementations, the data processing device 120 may refer to the above-described embodiments. Figure 11 The provided embodiments evaluate third prompt words. Further details are omitted here.
[0528] like Figure 15B If the third prompt word evaluation passes, the data processing device 120 determines the third prompt word as the second prompt word (S141). If the third prompt word evaluation fails, the data processing device 120 executes the above-mentioned stage ⑥ (S142) and evaluates the regenerated third prompt word until the latest third prompt word evaluation passes, at which point the data processing device 120 determines the third prompt word as the second prompt word.
[0529] In stage ⑧, the data processing device 120 outputs the second prompt word and sends the second prompt word to the client 20.
[0530] based on Figure 15B The provided embodiments enhance the accuracy and professionalism of prompt word generation by parsing the description information of the inference task input by the user and generating role prompts and the user's intent. Third examples related to the retrieval description information are retrieved from the sample database to improve the prompt word generation effect, reducing model training and tuning time. It eliminates the need to rely on the inference model's inference results based on the prompt words to improve accuracy, thereby reducing the interaction between the prompt word generation process and the inference model, thus reducing prompt word generation time and improving efficiency. Furthermore, a prompt word evaluation step is added to adaptively adjust and optimize the prompt words, improving the task satisfaction of the generated prompt words. In addition, in the prompt word generation scenario, it is not necessary to calculate model gradients or token probabilities to optimize the prompt words, further shortening the prompt word generation time and improving efficiency.
[0531] To achieve the functions described in the above embodiments, the data processing device 120 executes the corresponding hardware results and / or software modules for each function. Those skilled in the art should readily recognize that, based on the units and method steps of the examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0532] The above Figures 2 to 15B This application provides a detailed description of the data processing system, method, and apparatus provided herein. In some other embodiments, this application also provides a data processing apparatus 16, which may have different characteristics from those described above. Figure 2 or Figure 3 The structure of the data processing device 120 shown is illustrated.
[0533] For example, such as Figure 16 As shown, the data processing device 16 may include a storage module 153, a processing module 152, and a communication module 151.
[0534] The storage module 153 is used to store executable computer programs and data from the data processing device 16 during the data processing process, such as first prompt words, user intent, role prompts, sample databases, or generated second prompt words, etc.
[0535] The general module 151 is used to: receive a first prompt word sent by the user. The first prompt word includes descriptive information describing the reasoning task. For example, the general module is used to perform the above... Figure 6 The S610 in the middle.
[0536] Processing module 152 is used for: parallel execution: based on the first prompt word, obtaining the user's intent and retrieving the first instance matching the first prompt word from the sample database; calling the first model, using the user's intent and the first instance as input to the first model, to obtain the second prompt word. The sample database includes multiple instances, including descriptive information examples and inference result examples obtained by reasoning from the descriptive information examples; the second prompt word is used to guide the model to perform inference and obtain the inference result corresponding to the inference task. For example, the processing module is used to instruct the above... Figure 6 S620 to S650.
[0537] The communication module 151, processing module 152, and storage module 153 can be implemented in software or in hardware. For example, the implementation of processing module 152 will be described below. Similarly, the implementation of communication module 151 and storage module 153 can refer to the implementation of processing module 152.
[0538] As an example of a software functional unit, processing module 152 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the computing instance may be one or more. For example, processing module 152 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0539] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0540] As an example of a hardware functional unit, the processing module 152 may include at least one computing device, such as a server. Alternatively, the processing module 152 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.
[0541] The processing module 152 includes multiple computing devices that can be distributed within the same region or in different regions. Similarly, the communication module 151 includes multiple computing devices that can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, the processing module 152 includes multiple computing devices that can be distributed within the same Virtual Private Cloud (VPC) or multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0542] It should be noted that, in other embodiments, the processing module 152 can be used to execute any step in the data processing method. The communication module 151 can be used to execute any step in the data processing method. The storage module 153 can be used to execute any step in the data processing method. The communication module 151, processing module 152, and storage module 153 can all be used to execute any step in the data processing method. The steps implemented by the communication module 151, processing module 152, and storage module 153 can be specified as needed. By implementing different steps in the data processing method through the communication module 151, processing module 152, and storage module 153, all functions of the data processing device 16 are realized.
[0543] This application also provides a computing device for performing the above-described data processing method.
[0544] In some alternative scenarios, the computing device may be a terminal device, a server, or a cloud server.
[0545] In one example, the computing device may include, for example: Figure 16 The data processing device 16 shown includes a communication module 151, a processing module 152, and a storage module 153.
[0546] In another example, such as Figure 17 As shown, the computing device 17 includes a bus 162, a processor 164, a memory 166, and a communication interface 168. The processor 164, the memory 166, and the communication interface 168 communicate with each other via the bus 162. The computing device 17 can be a server or a terminal device. It should be understood that this application does not limit the number of processors 164 and memory 166 in the computing device 17.
[0547] Bus 162 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 17 The bus 162 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 162 may include a path for transmitting information between various components of the computing device 17 (e.g., memory 166, processor 164, communication interface 168).
[0548] Processor 164 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0549] In this application, processor 164 can perform the above-mentioned... Figure 6The provided data processing method includes, for example, receiving a first cue word sent by the user. This first cue word includes descriptive information describing the reasoning task. Based on the first cue word, the user's intent is obtained, and a first instance matching the first cue word is retrieved from the sample database. Then, a first model is invoked, using the user's intent and the first instance as input, to obtain a second cue word indicating the same reasoning task as the first cue word.
[0550] Memory 166 may include volatile memory, such as random access memory (RAM). Processor 164 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0551] The memory 166 stores executable program code, and the processor 164 executes the executable program code to implement the functions of the aforementioned communication module 151, processing module 152, and storage module 153, thereby realizing the data processing method. That is, the memory 166 stores instructions for executing the data processing method.
[0552] The communication interface 168 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 17 and other devices or communication networks.
[0553] The data processing method disclosed in the above embodiments can be applied to processor 164, or implemented by processor 164. Processor 164 can be an integrated circuit chip with signal processing capabilities.
[0554] In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 164 or by instructions in the form of software. The processor 164 can be a general-purpose processor, including a CPU, a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete vacuum tubes or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly embodied in the execution of the hardware decoding processor, or the execution can be completed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 166, and the processor 164 reads the information in memory 166 and completes the steps of the above method in combination with its hardware.
[0555] In one possible implementation, the processor 164 can also be used to execute a data processing method. For specific implementation, please refer to the embodiments provided by the above data processing method. The embodiments of this application will not be repeated here.
[0556] In this embodiment of the application, the chip system may be composed of chips or may include chips and other discrete devices.
[0557] This application also provides a computing device cluster 18 for performing the above-described data processing method.
[0558] In one example, the computing device cluster 18 may include, for example: Figure 16 The data processing device 16 shown includes a communication module 151, a processing module 152, and a storage module 153.
[0559] In another instance, such as Figure 18 As shown, the computing device cluster 18 includes at least one such Figure 17 The computing device 17 shown includes a bus 162, a processor 164, a memory 166, and a communication interface 168. The processor 164, the memory 166, and the communication interface 168 communicate with each other via the bus 162. The computing device 17 can be a server or a terminal device.
[0560] In one possible implementation, one or more computing devices in the computing device cluster 18 can be connected via a network. This network can be a wide area network (WAN), a local area network (LAN), or something similar. Figure 19One possible implementation is shown. For example... Figure 19 As shown, computing devices 17A and 17B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this possible implementation, the memory 166 in computing device 17A stores instructions for executing the functions of communication module 151. Meanwhile, the memory 166 in computing device 17B stores instructions for executing the functions of processing module 152 and storage module 153.
[0561] Figure 19 The connection method between the computing device clusters shown can be based on the data processing method provided in this application. During the data processing process, large model calls and prompt word generation are involved, requiring the processing of a large amount of data. Therefore, it is considered that the functions implemented by the processing module 152 and the storage module 153 are executed by the computing device 17B, and the functions implemented by the communication module 151 are executed by the computing device 17A.
[0562] It should be understood that Figure 19 The functions of the computing device 17A shown can also be performed by multiple computing devices 17. Similarly, the functions of the computing device 17B can also be performed by multiple computing devices 17.
[0563] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the above-described data processing method.
[0564] For example, when a computer program product is run on at least one computing device, it causes the at least one computing device to perform... Figure 6 The data processing method shown.
[0565] This application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be implemented by a computer program instructing related hardware. This program can be stored in the computer-readable storage medium, and when executed, it can include the processes of the above method embodiments. The computer-readable storage medium can be a terminal of any of the foregoing embodiments, such as an internal storage unit including a data transmission end and / or a data receiving end, like a hard disk or memory of the terminal. The computer-readable storage medium can also be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the terminal. Further, the computer-readable storage medium can include both the internal storage unit and the external storage device of the terminal. The computer-readable storage medium is used to store the computer program and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0566] It should be noted that the terms "first" and "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0567] It should be understood that in this application, "at least one (item)" means one or more, "more than one" means two or more, "at least two (items)" means two or three or more, and "and / or" is used to describe the relationship between related objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0568] It should be understood that in the embodiments of this application, "B corresponding to A" means that B is associated with A. For example, B can be determined based on A. It should also be understood that determining B based on A does not mean that B is determined solely based on A; B can also be determined based on A and / or other information. Furthermore, the term "connection" in the embodiments of this application refers to various connection methods, such as direct connection or indirect connection, to achieve communication between devices, and the embodiments of this application do not impose any limitations on this.
[0569] Unless otherwise specified, the term "transmission" in the embodiments of this application refers to bidirectional transmission, encompassing the actions of sending and / or receiving. Specifically, "transmission" in the embodiments of this application includes sending data, receiving data, or both sending and receiving data. In other words, data transmission here includes uplink and / or downlink data transmission. Data may include channels and / or signals; uplink data transmission refers to uplink channel and / or uplink signal transmission, and downlink data transmission refers to downlink channel and / or downlink signal transmission.
[0570] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data processing method, characterized in that, The method includes: Receive a first prompt word sent by the user; the first prompt word includes descriptive information used to describe the reasoning task; Parallel execution: Based on the first prompt word, the user's intent is obtained, and a first instance matching the first prompt word is obtained from the sample database; the sample database includes multiple instances, each instance including a descriptive information instance and a reasoning result instance obtained by reasoning from the descriptive information instance; The first model is invoked, and the user's intent and the first example are used as input to the first model to obtain a second prompt word; the second prompt word is used to guide the second model to perform inference and obtain the inference result corresponding to the inference task.
2. The method according to claim 1, characterized in that, The invocation of the first model, using the user's intent and the first example as input, yields the second prompt word, including: The first model is invoked, and the user's intent and the first example are used as input to the first model to obtain the third prompt word; The third prompt word is evaluated; If the third prompt word passes the evaluation, the third prompt word will be identified as the second prompt word; If the evaluation of the second prompt word fails, the first model is invoked, and the user's intent and the first example are used as input to the first model to obtain a new third prompt word. The new third prompt word is evaluated, and this process is repeated until the latest third prompt word passes the evaluation. The third prompt word that passes the evaluation is then determined as the second prompt word.
3. The method according to claim 2, characterized in that, The evaluation of the third prompt word includes: The third prompt word is evaluated based on the description information of the reasoning task; If the third prompt word matches the description information of the reasoning task, the evaluation of the third prompt word is determined to be successful. If the third prompt does not match the description information of the reasoning task, the evaluation of the third prompt is determined to be unsuccessful.
4. The method according to claim 2, characterized in that, The evaluation of the third prompt word includes: An evaluation interface is provided, which includes the third prompt word; In response to a confirmation operation based on input from the evaluation interface, the evaluation of the third prompt word is determined to be passed; or in response to a modification operation by the user based on input from the first interface, the evaluation of the third prompt word is determined to be failed.
5. The method according to claim 4, characterized in that, The sample database also includes a sample selection model, which is used to obtain a first sample that matches the first prompt word. After calling the first model, taking the user's intent and the first sample as input to obtain the second prompt word, the method further includes: Multiple historical records are retrieved, each of which includes a first historical prompt word, a historical example selected by the first historical prompt word, and feedback from a third historical prompt word; the third historical prompt word is generated from the first historical prompt word; the feedback includes a confirmation operation or a modification operation; the multiple historical records include a first historical record, which includes the first prompt word, the first example, and feedback from the third prompt word; Based on the multiple historical records, the sample selection model is updated to obtain a new sample selection model; the new sample selection model is used to select samples from the sample database in the next time period.
6. The method according to any one of claims 1 to 5, characterized in that, The invocation of the first model, using the user's intent and the first example as input, yields the second prompt word, including: The user's intent is broken down to form at least one of the thought chain and process arrangement of the reasoning task; the thought chain is used to indicate the sub-tasks included in the reasoning task and the execution logic between different sub-tasks; the process arrangement includes the sub-stages included in generating the second prompt word and the execution logic between different sub-stages, and the process arrangement is used to guide the first model to generate the second prompt word; The first model is invoked, and at least one of the reasoning task's thought chain, the process arrangement, or role prompts, along with the user's intent and the first example, is used as input to the first model to obtain a second prompt word; the role prompt is used to indicate the role of the second model in performing the reasoning task, and the role prompt is determined based on the first prompt word.
7. The method according to any one of claims 1 to 6, characterized in that, The first example includes multiple sub-examples, and the similarity between different sub-examples is less than a similarity threshold; Alternatively, the plurality of sub-samples may include a first sub-sample and a second sub-sample, wherein the second sub-sample is obtained based on the first sub-sample.
8. The method according to claim 7, characterized in that, The step of obtaining the first instance matching the first prompt word from the sample database includes: Based on the description information of the reasoning task, the first search term is formed; Based on the first search term, a second search term is formed; the second search term includes one or more of the following: synonyms of the first search term, antonyms of the first search term, translated terms of the first search term, rearranged first search term, or style-transformed first search term; Based on the first search term and the second search term, the sample database is queried to obtain the first sample.
9. The method according to any one of claims 1 to 8, characterized in that, After invoking the first model, taking the user's intent and the first example as input to the first model, and obtaining the second prompt word, the method further includes: Based on the second prompt word, guide the second model to perform the reasoning task and obtain the reasoning result corresponding to the reasoning task; The first prompt word and the reasoning result corresponding to the reasoning task are used as new examples and written into the example database.
10. A data processing apparatus, characterized in that, The device includes: A communication module is used to receive a first prompt word sent by the user; the first prompt word includes descriptive information for describing the reasoning task; The processing module is used to perform the following operations in parallel: based on the first prompt word, obtain the user's intent and obtain the first instance that matches the first prompt word from the sample database; and call the first model, taking the user's intent and the first instance as input to the first model to obtain the second prompt word; The sample database includes multiple samples, each sample including descriptive information examples and inference result examples obtained by reasoning from the descriptive information examples; the second prompt word is used to guide the second model to perform inference and obtain the inference result corresponding to the inference task.
11. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1 to 9.
12. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster performs the method as described in any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a cluster of computing devices, perform the method as described in any one of claims 1 to 9.