Method for determining prompt information, data processing method and electronic device

By determining candidate prompt features in the feature space and generating predictive prompt information, and automatically generating target prompt information in combination with labeled data evaluation, the problem of large language models being sensitive to prompt information is solved, and the accuracy and efficiency of model inference results are improved.

CN119760392APending Publication Date: 2025-04-04LENOVO (BEIJING) LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411749691.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

Large language models are more sensitive to prompt information (prompt), which may be completely different from the answers obtained under different prompt information. It is difficult for the existing technology to automatically generate high-quality prompt information to improve the accuracy of model inference results.

Method used

By determining candidate prompt features in the feature space, generating predictive prompt information based on the big model, combining labeled data for evaluation, and automatically generating target prompt information to improve the accuracy of the big model inference results.

Benefits of technology

It realizes automatic generation of high-quality prompt information, improves the accuracy of large-scale model inference results, reduces the cost of prompt information tuning, and reduces the need for fine-tuning of large-scale model weights.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760392A_ABST
    Figure CN119760392A_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for determining prompt information, a data processing method, and an electronic device, which relate to the field of artificial intelligence technology, and in particular to technical fields such as large models and generative models. The specific implementation scheme is: determining at least one candidate prompt feature, wherein the candidate prompt feature is used to characterize the feature data of the prompt information in the feature space, the prompt information has the semantics of natural language, and the candidate prompt feature is determined based on the value in the feature space; based on at least one candidate prompt feature, and the matching first input information and first output information, at least one prediction prompt information for guiding the reasoning of the large model is generated based on the large model, and the at least one prediction prompt information corresponds one-to-one with the at least one candidate prompt feature; based on the at least one prediction prompt information, the target prompt information is determined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to technical fields such as large models and generative models. More specifically, the present disclosure provides a method for determining prompt information, a data processing method, and an electronic device. Background Art

[0002] As a large model, the Large Language Model (LLM) has attracted much attention due to its excellent language ability and demonstrated "intelligence". The LLM can meet some practical daily needs, such as document summarization, copywriting generation, and can also answer some knowledge-based questions. Summary of the invention

[0003] The present disclosure provides a method for determining prompt information, a data processing method and an electronic device.

[0004] According to one aspect of the present disclosure, a method for determining prompt information is provided, comprising: determining at least one candidate prompt feature, wherein the candidate prompt feature is used to characterize feature data of the prompt information in a feature space, the prompt information has the semantics of a natural language, and the candidate prompt feature is determined based on a value in the feature space; based on at least one candidate prompt feature, and matching first input information and first output information, generating at least one prediction prompt information for guiding reasoning of the large model based on a large model, wherein the at least one prediction prompt information corresponds one-to-one to the at least one candidate prompt feature; and determining target prompt information based on the at least one prediction prompt information.

[0005] According to another embodiment of the present disclosure, determining target prompt information based on at least one prediction prompt information includes: using labeled data to evaluate at least one prediction prompt information respectively to obtain a first evaluation value of each of the at least one prediction prompt information; determining the target prompt information from at least one prediction prompt information based on the first evaluation value of each of the at least one prediction prompt information.

[0006] According to another embodiment of the present disclosure, the annotated data includes second input information and second output information; at least one prediction prompt information is evaluated separately using the annotated data to obtain a first evaluation value of each of the at least one prediction prompt information, including: generating prediction output information corresponding to the second input information based on a large model according to the prediction prompt information and the second input information; and determining the first evaluation value of the prediction prompt information according to the difference between the second output information and the prediction output information.

[0007] According to another embodiment of the present disclosure, determining at least one candidate prompt feature includes: taking values ​​in the feature space to obtain multiple prompt features; determining a second evaluation value of each of the multiple prompt features; and determining at least one candidate prompt feature from the multiple prompt features based on the second evaluation values ​​of each of the multiple prompt features.

[0008] According to another embodiment of the present disclosure, determining at least one candidate prompt feature includes: determining an initial prompt feature and a second evaluation value of the initial prompt feature; updating the value of the initial prompt feature in the feature space according to the difference between the second evaluation value of the initial prompt feature and the target evaluation value until the updated initial prompt feature satisfies a termination condition; and determining the updated initial prompt feature that satisfies the termination condition as a candidate prompt feature.

[0009] According to another embodiment of the present disclosure, the termination condition includes at least one of the following: the number of updates reaches the target number; the similarity between the prompt information determined based on the initial prompt features before the update and the prompt information determined based on the initial prompt features after the update is greater than or equal to the similarity threshold.

[0010] According to another embodiment of the present disclosure, based on at least one candidate prompt feature, and matching first input information and first output information, generating at least one prediction prompt information for guiding large model reasoning based on a large model includes: performing feature extraction on the matching first input information and first output information to obtain a first feature; fusing the first feature with the candidate prompt feature to obtain a second feature; and processing the second feature based on the large model to obtain prediction prompt information.

[0011] According to another embodiment of the present disclosure, the second evaluation value is obtained based on an evaluation network, and the evaluation network is trained using training samples, and the training samples are constructed in the following manner: based on the prompt feature sample, and the matching first input sample and first output sample, estimated prompt information for guiding the reasoning of the large model is generated based on the large model; based on the estimated prompt information and the second input sample, estimated output information is generated based on the large model; based on the difference between the estimated output information and the second output sample matching the second input sample, a label characterizing the accuracy of the estimated prompt information is determined; and based on the prompt feature sample and the label, a training sample is constructed.

[0012] According to another aspect of the present disclosure, a data processing method is provided, including: obtaining information to be processed of an object; combining the information to be processed with prompt information into target input information; inputting the target input information into a large model to obtain response information; wherein the prompt information is obtained using the above-mentioned method for determining the prompt information.

[0013] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method provided by the present disclosure.

[0014] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0016] Figure 1 is a schematic flow chart of a method for determining prompt information according to an embodiment of the present disclosure;

[0017] Figure 2 is a schematic diagram of a method for determining prompt information according to an embodiment of the present disclosure;

[0018] Figure 3 is a schematic diagram of the structure of a large model according to an embodiment of the present disclosure;

[0019] Figure 4 is a schematic diagram of a first process of constructing a training sample according to an embodiment of the present disclosure;

[0020] Figure 5 is a schematic diagram of a second process of constructing training samples according to an embodiment of the present disclosure;

[0021] Figure 6 is a schematic diagram of a training evaluation network according to an embodiment of the present disclosure;

[0022] Figure 7 is a schematic diagram of applying an evaluation network to determine a second evaluation value according to an embodiment of the present disclosure;

[0023] Figure 8 is a schematic flow chart of a data processing method according to an embodiment of the present disclosure;

[0024] Fig. 9 is a schematic structural block diagram of a device for determining prompt information according to an embodiment of the present disclosure;

[0025] Fig.10 is a schematic structural block diagram of a data processing device according to an embodiment of the present disclosure; and

[0026] Fig.11It is a structural block diagram of an electronic device used to implement the method for determining prompt information and / or the data processing method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0028] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0029] In the technical solution of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.

[0030] At present, the large language model is more sensitive to prompts, and the answers to different prompts may be completely different. For example, in the test of some LLMs, if the question is "Is the XX model computer from brand A?", the answer of the large language model is "The XX model computer is a gaming laptop series launched by brand B, which is popular among consumers for its high cost performance and good gaming performance. And brand A also has its own gaming laptop product line." However, if the question is "Is the XX model computer from brand A? Please answer [yes] or [no]", the answer of the large language model is "yes".

[0031] In the related technology, pre-configured prompt templates can be used, and there are also some empirical methods for writing high-quality prompts. However, due to the different training sets used by major language models, pre-configured prompt templates and some prompt writing techniques are not universal, and sometimes may even have a negative effect.

[0032] In other technical solutions, the weights of the large language model can be fine-tuned, but fine-tuning the large language model requires preparing a large amount of data, and the cost of training is relatively high.

[0033] The disclosed embodiment aims to provide a method for determining prompt information, which can automatically generate prompt information (prompt) of the large model through the ability of the large model itself, and improve the accuracy of the large model reasoning result through the prompt information. In addition, since the prompt information is automatically generated, compared with the method of manually adjusting the prompt information based on empirical methods, the cost of tuning the prompt information can also be reduced. In addition, compared with the method of fine-tuning the weight of the large model, this method requires less data and does not modify the weight of the large model itself, so it will not affect the performance of the large model itself.

[0034] The technical solution provided by the present disclosure will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0035] Figure 1 It is a schematic flowchart of a method for determining prompt information according to an embodiment of the present disclosure.

[0036] like Figure 1 As shown, the method 100 for determining prompt information may include operations S110 to S130.

[0037] In operation S110, at least one candidate prompt feature is determined, wherein the candidate prompt feature is used to characterize feature data of prompt information in a feature space, the prompt information has natural language semantics, and the candidate prompt feature is determined based on a value in the feature space.

[0038] For example, the difference between prompt features and prompt information is that prompt information has the semantics of natural language. For example, if the prompt information is the text "Have you eaten?", in general, it is necessary to first map the natural language to tokens through a word segmenter. For example, the above text "Have you eaten?" corresponds to three tokens, and then the three tokens are converted into three features in the feature space through the embedding layer. The prompt feature is obtained by skipping the word segmenter and the embedding layer and directly taking values ​​in the feature space after the embedding layer. For example, multiple values ​​are taken from the feature space and processed into a vector, which can be a prompt feature. It should be noted that the prompt feature obtained by taking values ​​in the feature space may or may not have the semantics of natural language, but the prompt feature has a similar effect to the prompt information in natural language form, and both can affect the output results of the large model.

[0039] For example, at least some of the prompt features may be selected from a plurality of prompt features as candidate prompt features, or the values ​​of the prompt features in the feature space may be updated, and then the updated prompt features may be used as candidate prompt features.

[0040] In operation S120, at least one prediction prompt information for guiding the reasoning of the large model is generated based on the large model according to at least one candidate prompt feature, and the matching first input information and first output information, and the at least one prediction prompt information corresponds one-to-one to at least one candidate prompt feature.

[0041] For example, the data types of the first input information and the first output information may be text, and the matching of the first input information and the first output information may indicate that the first input information and the first output information are semantically related, for example, the first input information is a question and the first output information is an answer to the question.

[0042] For example, the first input information and the first output information can be processed by a word segmenter and an embedding layer to extract features and obtain the first features of the two. Then, the first feature and the candidate prompt feature can be fused to obtain the second feature. The fusion method can be feature splicing, and then the second feature is processed based on the large model to obtain the prediction prompt information. In addition, the large model can be guided to output the prediction prompt information through the first prompt template. The first prompt template will guide the large model to infer the task requirements through the first input information and the first output information, so that the task requirements inferred by the large model are the prediction prompt information.

[0043] In operation S130, target prompt information is determined according to at least one predicted prompt information.

[0044] For example, each piece of prediction prompt information may be evaluated, and the prediction prompt information with relatively high quality may be selected as the target prompt information.

[0045] It should be noted that the large model mentioned in this application may not be limited to a large language model, but may also be a diffusion model (used for text-to-image, text-to-image, etc.), a multimodal model (multimodal information-to-text, etc.) and other large models.

[0046] The method for determining prompt information provided by the embodiment of the present disclosure can automatically generate prompt information of the large model through the ability of the large model itself, and improve the accuracy of the reasoning result of the large model through the prompt information. In addition, since the prompt information is automatically generated, compared with the method of manually adjusting the prompt information based on empirical methods, the cost of tuning the prompt information can also be reduced. In addition, compared with the method of fine-tuning the weight of the large model, this method requires less data and does not modify the weight of the large model itself, so it will not affect the performance of the large model itself.

[0047] According to another embodiment of the present disclosure, the method for determining prompt information may include the following operations: taking values ​​in the feature space to obtain multiple prompt features, then determining the second evaluation values ​​of each of the multiple prompt features, and then determining at least one candidate prompt feature from the multiple prompt features based on the second evaluation values ​​of each of the multiple prompt features. Next, at least one prediction prompt information for guiding the reasoning of the large model can be generated based on the large model according to the at least one candidate prompt feature, and the matching first input information and first output information. Then, the target prompt information is determined according to the at least one prediction prompt information.

[0048] For example, the prompt feature can be determined by randomly selecting values ​​in the feature space. Taking the prompt feature dimension of 4096 as an example, the value range of each dimension can be [-1,1]. 4096 elements can be randomly selected in each value range, and the 4096 elements can constitute a prompt feature.

[0049] Next, the second evaluation value of the prompt information can be evaluated by a trained evaluation network, and the training method of the evaluation network is described below. After obtaining the second evaluation value of each prompt feature, the prompt feature with an evaluation value greater than or equal to the evaluation value threshold can be determined as a candidate prompt feature.

[0050] This embodiment ensures the quality of the candidate prompt features by randomly taking values ​​in the feature space and using the evaluation network to screen out the candidate prompt features, thereby ensuring the quality of the target prompt information generated based on the candidate prompt features, so as to improve the reasoning effect of the large model.

[0051] According to another embodiment of the present disclosure, the method for determining prompt information may include the following operations: determining an initial prompt feature and a second evaluation value of the initial prompt feature, and then updating the value of the initial prompt feature in the feature space according to the difference between the second evaluation value of the initial prompt feature and the target evaluation value, until the updated initial prompt feature satisfies a termination condition, and then determining the updated initial prompt feature that satisfies the termination condition as a candidate prompt feature. Next, at least one prediction prompt information for guiding the reasoning of the large model may be generated based on the large model according to at least one candidate prompt feature, and the matching first input information and first output information. Then, the target prompt information is determined according to the at least one prediction prompt information.

[0052] For example, some initial prompt features can be obtained by randomly taking values ​​in the feature space. Alternatively, some prompt feature samples are used in the process of training the evaluation network, and some prompt feature samples can be selected as initial prompt features. For example, the evaluation network can be pre-trained, and the second evaluation value of the initial prompt feature can be evaluated by the evaluation network.

[0053] For example, the network parameters of the large model and the trained evaluation network can be frozen, the target evaluation value can be 1, for example, the evaluation network can be used to process the initial prompt feature, the evaluation network outputs the second evaluation value of the initial prompt feature, and then based on the loss function, the loss value is calculated according to the second evaluation value and the target evaluation value. Then, back propagation is performed based on the loss value to update the initial prompt feature, so that the second evaluation value of the initial prompt feature after multiple iterations will be close to the target evaluation value.

[0054] For example, the termination condition includes: the number of updates reaches the target number. For another example, the termination condition includes: the similarity between the prompt information determined based on the initial prompt feature before the update and the prompt information determined based on the initial prompt feature after the update is greater than or equal to the similarity threshold. For example, the prompt information can be generated based on the initial prompt feature. During the iteration process, the prompt information generated by the initial prompt feature changes very little or no longer changes, and the iteration can be stopped.

[0055] This embodiment iteratively updates the initial prompt features until the termination condition is met, so that the quality of the candidate prompt features can be improved through iteration, thereby ensuring the quality of the target prompt information generated based on the candidate prompt features, so that the large model can be inferred more accurately.

[0056] According to another embodiment of the present disclosure, the above-mentioned process of generating at least one prediction prompt information based on a large model according to at least one candidate prompt feature, and the matching first input information and first output information may include the following operations: performing feature extraction on the matching first input information and first output information to obtain a first feature, then fusing the first feature with the candidate prompt feature to obtain a second feature, and then processing the second feature based on the large model to obtain the prediction prompt information.

[0057] For example, the first input information and the first output information can be converted into a first feature through a word segmenter and an embedding layer, and then the first feature and the candidate prompt feature are spliced ​​or otherwise fused to obtain a second feature. Then, the second feature is processed using a large model, for example, the large model includes a multi-layer transformer, a head network, and a decoder, and these network structures are used to process the second feature to obtain prediction prompt information.

[0058] This embodiment effectively combines the first input information, the first output information and the candidate prompt features through feature extraction and fusion operations, so that the large model can generate prediction prompt information based on richer information.

[0059] According to another embodiment of the present disclosure, the process of determining the target prompt information based on at least one prediction prompt information may include: using the labeled data to evaluate the at least one prediction prompt information respectively, and obtaining the first evaluation value of each of the at least one prediction prompt information. Then, based on the first evaluation value of each of the at least one prediction prompt information, the target prompt information is determined from the at least one prediction prompt information. For example, the prediction prompt information with a higher first evaluation value may be determined as the target prompt information. After generating the prediction prompt information, this embodiment evaluates the prediction prompt information, and then selects the prediction prompt information with a higher first evaluation value as the target prompt information, so that the target prompt information can more accurately guide the reasoning of the large model, thereby improving the accuracy of the target prompt information, and then enabling the large model to output more accurate results.

[0060] In one example, the annotated data includes the second input information and the second output information, and the predicted output information corresponding to the second input information can be generated based on the large model according to the predicted prompt information and the second input information. For example, the predicted prompt information, the second input information, and the second prompt template can be combined and input into the large model, and the large model generates the predicted output information for answering the second input information.

[0061] Then, the first evaluation value of the predicted prompt information can be determined based on the difference between the second output information and the predicted output information. The evaluation index used to determine the first evaluation value can be selected according to the actual situation. For example, if the task of the second input information is a multiple-choice question, the distance between the probability distribution output by the large model and the actual distribution can be calculated. The distance may include L2 distance or cross entropy. For another example, if the task of the second input information is a generation task such as text summarization, the first evaluation value can be determined by indicators such as ROUGE (Recall-Oriented Understudy for Gisting Evaluation) and BLEU (Bilingual Evaluation Understudy).

[0062] This technical solution generates predicted output information based on a large model by utilizing predicted prompt information and annotated second input information, and determines a first evaluation value by comparing the predicted prompt information with the annotated second output information, so that higher-quality target prompt information can be screened from the predicted prompt information.

[0063] Figure 2 It is a schematic diagram of a method for determining prompt information according to an embodiment of the present disclosure.

[0064] like Figure 2 As shown, in this embodiment, the method for determining prompt information may include the following operations.

[0065] First determine some candidate prompt features 201. For example, multiple prompt features can be sampled from the feature space, and then the second evaluation values ​​of the multiple prompt features can be determined. Then, based on the second evaluation values ​​of the multiple prompt features, at least one candidate prompt feature 201 can be determined from the multiple prompt features. For another example, some initial prompt features can be sampled and the second evaluation values ​​of the initial prompt features can be determined. Then, based on the difference between the second evaluation value of the initial prompt feature and the target evaluation value, the value of the initial prompt feature in the feature space is updated until the updated initial prompt feature meets the termination condition. Then, the updated initial prompt feature that meets the termination condition is determined as the candidate prompt feature 201.

[0066] Next, at least one prediction prompt information 203 for guiding the large model LLM reasoning can be generated based on the large model LLM according to at least one candidate prompt feature 201, and the matching first input information 2021 and first output information 2022.

[0067] Next, the prediction output information 205 corresponding to the second input information 2041 can be generated based on the large model LLM according to the prediction prompt information 203 and the second input information 2041. Then, the prediction prompt information 203 can be evaluated according to the difference between the second output information 2042 and the prediction output information 205, for example, a first evaluation value of the prediction prompt information 203 can be obtained.

[0068] In some embodiments, the target prompt information 206 may be determined from the at least one predicted prompt information 203 according to the first evaluation value of each of the at least one predicted prompt information 203 .

[0069] In other embodiments, after obtaining the first evaluation value, the next candidate prompt information can be selected by an updating method, and then the above process is repeated. After a certain number of iterations, or after the first evaluation value reaches the set target accuracy, the target prompt information 206 can be obtained. In this embodiment, there can be multiple updating methods for selecting the next candidate prompt information, such as using a method based on Upper Confidence bound (UCB), or a method based on Bayesian optimization, or a gradient-based method, which is not limited in this embodiment.

[0070] Figure 3 It is a schematic diagram of the structure of a large model according to an embodiment of the present disclosure.

[0071] like Figure 3As shown, the infrastructure of the large model LLM may include a word segmenter M1, an embedding layer M2, a Transformer network M3, a Head network M4 and a decoder M5, wherein the word segmenter M1 is used to map input text and other types of data into tokens, the embedding layer M2 is used to map tokens into vectors of a specific dimension, for example, into vectors of 4096 dimensions, the Head network M4 is used to map vectors of a specific dimension back to tokens, and the decoder M5 is used to map tokens into output information of the large model LLM.

[0072] On the basis of the above infrastructure, an evaluation network M6 can be added, and the evaluation network M6 can be set between the Transformer network M3 and the Head network M4, and the evaluation network M6 and the Head network M4 are in a parallel relationship, so that the features output by the Transformer network M3 can be input into the evaluation network M6, and the evaluation network M6 is used to evaluate the features by classification or logistic regression to obtain a second evaluation value, and at the same time, the evaluation network M6 will not affect the input of the Head network M4.

[0073] Figure 4 is a schematic diagram of a first process of constructing a training sample according to an embodiment of the present disclosure, Figure 5 is a schematic diagram of the second process of constructing training samples according to an embodiment of the present disclosure.

[0074] In this embodiment, the training evaluation network needs to first construct a training sample, and the training sample includes a prompt feature sample and a label. According to the prompt feature sample, and the matching first input sample and first output sample, the estimated prompt information for guiding the reasoning of the large model can be generated based on the large model. Then, according to the estimated prompt information and the second input sample, the estimated output information is generated based on the large model. Then, according to the difference between the estimated output information and the second output sample matching the second input sample, a label representing the accuracy of the estimated prompt information is determined. Then, according to the prompt feature sample and the label, the training sample is constructed. The process of constructing the training sample is described in detail below.

[0075] like Figure 4As shown, a value can be taken in the feature space, and a prompt feature sample Sample_soft prompt can be determined according to the value. Then, the estimated prompt information Pre_real prompt can be generated based on the prompt feature sample Sample_soft prompt. For example, some matching input-output data pairs can be pre-configured, and each input-output data pair can include a first input sample Input1 and a first output sample Output1. The first input sample Input1 and the first output sample Output1 are similar to the first input information and the second input information mentioned above. Then, the large model LLM generates the estimated prompt information Pre_real prompt for guiding the reasoning of the large model LLM based on the prompt feature sample Sample_soft prompt, the input-output data pair and the first prompt template Prompt1. Exemplarily, the first input sample Input1, the first output sample Output1 and the first prompt template Prompt1 can be combined, and then input into the word segmenter M1 and the embedding layer M2 in the large model LLM to obtain the first intermediate feature F1_1, and then the first intermediate feature F1_1 is fused with the prompt feature sample Sample_softprompt by splicing or other methods to obtain the second intermediate feature, and then the second intermediate feature is input into the Transformer network M3, and the Transformer network M3 will output the third intermediate feature F2_1. The third intermediate feature F2_1 will be processed by the Head network M4 and the decoder M5 in the large model LLM to obtain the estimated prompt information Pre_real prompt.

[0076] like Figure 5 As shown, after obtaining the estimated prompt information Pre_real prompt, the estimated prompt information Pre_real prompt, the second input sample Input2 and the second prompt template Prompt2 can be combined and then input into the large model LLM, and the large model LLM outputs the estimated output information Pre_out. Next, the label Label can be determined based on the difference between the estimated output information Pre_out and the second output sample Output2. For example, if the task of the second input sample Input2 is a multiple-choice question, the distance between the probability distribution output by the large model LLM and the actual distribution can be calculated, and the distance can be determined as the label Label. For another example, if the task of the second input sample Input2 is a generation task such as a text summary, the accuracy can be determined by indicators such as ROUGE and BLEU, and the accuracy can be determined as the label Label.

[0077] Through the above method, multiple prompt feature samples Sample_soft prompt can be obtained, and each prompt feature sample Sample_soft prompt corresponds to a label Label, thereby obtaining a training sample. The above describes the process of constructing a training sample.

[0078] Figure 6 It is a schematic diagram of a training evaluation network according to an embodiment of the present disclosure.

[0079] like Figure 6 As shown, after obtaining the training samples, the training samples can be used to train the evaluation network M6. During the training process, similar to the process of constructing the training samples above, the first input sample Input1, the first output sample Output1 and the first prompt template Prompt1 can be combined, and then input into the word segmenter M1 and the embedding layer M2 in the large model LLM to obtain the first intermediate feature F1_1, and then the first intermediate feature F1_1 is fused with the prompt feature sample Sample_soft prompt by splicing or other means to obtain the second intermediate feature, and then the second intermediate feature is input into the Transformer network M3, and the Transformer network M3 will output the third intermediate feature F2_1. Next, the third intermediate feature F2_1 is input into the evaluation network M6, and the evaluation network M6 calculates the probability distribution of the prediction accuracy Pre_value1, and then calculates the loss value Loss according to the difference between the probability distribution of the prediction accuracy Pre_value1 and the actual accuracy represented by the label Label, and then adjusts the network parameters of the evaluation network M6 based on the loss value Loss until the evaluation network M6 converges to obtain the trained evaluation network M6. In addition, during the training of the evaluation network M6, the parameters of the large model LLM are frozen and do not need to be adjusted. After the trained evaluation network M6 is obtained through training in the above manner, the evaluation network M6 can be used to determine the second evaluation value of the prompt feature.

[0080] Figure 7 It is a schematic principle diagram of applying an evaluation network to determine a second evaluation value according to an embodiment of the present disclosure.

[0081] like Figure 7As shown, the first prompt template Prompt1, the first input information Input3, and the first output information Output3 can be combined, and then input into the word segmenter M1 and the embedding layer M2 in the large model LLM to obtain the first intermediate feature F1_2, and then the first intermediate feature F1_2 is fused with the prompt feature Soft prompt by splicing or other methods to obtain the second intermediate feature, and then the second intermediate feature is input into the Transformer network M3 in the large model LLM, and the Transformer network M3 will output the third intermediate feature F2_2. Next, the third intermediate feature F2_2 is input into the evaluation network M6, and the evaluation network M6 outputs the second evaluation value Pre_value2. Then, the candidate prompt features can be screened based on the second evaluation value Pre_value2, or the initial prompt features can be updated based on the second evaluation value Pre_value2 to obtain the candidate prompt features.

[0082] Figure 8 is a schematic flow chart of a data processing method according to an embodiment of the present disclosure.

[0083] like Figure 8 As shown, the data processing method 800 may include operations S810 to S830.

[0084] In operation S810, information to be processed of an object is obtained.

[0085] In operation S820, the information to be processed and the prompt information are combined into target input information.

[0086] For example, the object may be a user, and the user may input information through a front-end operation page, and the information input by the user may be determined as information to be processed. The data type of the information to be processed may be text.

[0087] For example, the prompt information may be generated using the method for determining the prompt information described above. In some embodiments, the prompt information corresponding to different application scenarios may be different, for example, the prompt information corresponding to the question-and-answer scenario and the summary generation scenario is different. The application scenario may be determined first based on the information to be processed. Then, the candidate prompt information corresponding to the application scenario among multiple candidate prompt information may be determined as the prompt information. The prompt information is then combined with the information to be processed into the target input information.

[0088] In operation S830, the target input information is input to the large model to obtain response information.

[0089] Fig. 9 It is a schematic structural block diagram of a device for determining prompt information according to an embodiment of the present disclosure.

[0090] like Fig. 9As shown, the apparatus 900 for determining prompt information may include a candidate prompt determining module 910 , a prediction prompt generating module 920 , and a target prompt determining module 930 .

[0091] The candidate prompt determination module 910 is used to determine at least one candidate prompt feature, wherein the candidate prompt feature is used to represent feature data of prompt information in a feature space, the prompt information has natural language semantics, and the candidate prompt feature is determined based on the value in the feature space.

[0092] The prediction prompt generation module 920 is used to generate at least one prediction prompt information for guiding large model reasoning based on the large model according to at least one candidate prompt feature, and matching first input information and first output information, and the at least one prediction prompt information corresponds one-to-one to at least one candidate prompt feature.

[0093] The target prompt determination module 930 is used to determine target prompt information according to at least one predicted prompt information.

[0094] According to another embodiment of the present disclosure, the target prompt determination module includes: an evaluation submodule and a target prompt determination submodule. The evaluation submodule is used to evaluate at least one prediction prompt information respectively using the labeled data to obtain a first evaluation value of each of the at least one prediction prompt information. The target prompt determination submodule is used to determine the target prompt information from the at least one prediction prompt information according to the first evaluation value of each of the at least one prediction prompt information.

[0095] According to another embodiment of the present disclosure, the annotated data includes second input information and second output information; the evaluation submodule includes: a generation unit and a first evaluation value determination unit. The generation unit is used to generate predicted output information corresponding to the second input information based on the large model according to the predicted prompt information and the second input information. The first evaluation value determination unit is used to determine the first evaluation value of the predicted prompt information according to the difference between the second output information and the predicted output information.

[0096] According to another embodiment of the present disclosure, the candidate prompt determination module includes: a value taking submodule, a first determination submodule, and a second determination submodule. The value taking submodule is used to take values ​​in the feature space to obtain multiple prompt features. The first determination submodule is used to determine the second evaluation value of each of the multiple prompt features. The second determination submodule is used to determine at least one candidate prompt feature from the multiple prompt features according to the second evaluation values ​​of each of the multiple prompt features.

[0097] According to another embodiment of the present disclosure, the candidate prompt determination module includes: a third determination submodule, an update submodule and a fourth determination submodule. The third determination submodule is used to determine the initial prompt feature and the second evaluation value of the initial prompt feature. The update submodule is used to update the value of the initial prompt feature in the feature space according to the difference between the second evaluation value of the initial prompt feature and the target evaluation value, until the updated initial prompt feature meets the termination condition. The fourth determination submodule is used to determine the updated initial prompt feature that meets the termination condition as a candidate prompt feature.

[0098] According to another embodiment of the present disclosure, the termination condition includes at least one of the following: the number of updates reaches the target number; the similarity between the prompt information determined based on the initial prompt features before the update and the prompt information determined based on the initial prompt features after the update is greater than or equal to the similarity threshold.

[0099] According to another embodiment of the present disclosure, the prediction prompt generation module includes: an extraction submodule, a fusion submodule and a processing submodule. The extraction submodule is used to extract features from the matched first input information and the first output information to obtain a first feature. The fusion submodule is used to fuse the first feature and the candidate prompt feature to obtain a second feature. The processing submodule is used to process the second feature based on the large model to obtain prediction prompt information.

[0100] According to another embodiment of the present disclosure, the second evaluation value is obtained based on an evaluation network, and the evaluation network is obtained by training using training samples, and the training samples are constructed by the following modules: an estimation prompt generation module, an estimation output generation module, a label determination module, and a construction module. The estimation prompt generation module is used to generate estimation prompt information for guiding the reasoning of the large model based on the large model according to the prompt feature sample, and the matching first input sample and the first output sample. The estimation output generation module is used to generate estimation output information based on the large model according to the estimation prompt information and the second input sample. The label determination module is used to determine a label that characterizes the accuracy of the estimation prompt information based on the difference between the estimation output information and the second output sample that matches the second input sample. The construction module is used to construct a training sample based on the prompt feature sample and the label.

[0101] Fig.10 It is a schematic structural block diagram of a data processing device according to an embodiment of the present disclosure.

[0102] like Fig.10 As shown, the data processing device 1000 may include an acquisition module 1010 , a combination module 1020 and an obtaining module 1030 .

[0103] The acquisition module 1010 is used to acquire the to-be-processed information of the object.

[0104] The combining module 1020 is used to combine the information to be processed and the prompt information into target input information, wherein the prompt information is obtained by using the above-mentioned device for determining the prompt information.

[0105] The acquisition module 1030 is used to input the target input information into the large model to obtain response information.

[0106] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, comprising at least one processor; and a memory communicatively connected to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute at least one of the above-mentioned method for determining prompt information and data processing method.

[0107] According to an embodiment of the present disclosure, the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute at least one of the above-mentioned method for determining prompt information and data processing method.

[0108] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, including a computer program, and when the computer program is executed by a processor, at least one of the above-mentioned method for determining prompt information and the data processing method is implemented.

[0109] Fig.11 It is a block diagram of an electronic device for implementing the method for determining prompt information and / or the data processing method of the embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0110] like Fig.11 As shown, the device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 to a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0111] A number of components in the device 1100 are connected to the I / O interface 1105, including: an input unit 1106, such as a keyboard, a mouse, etc.; an output unit 1107, such as various types of displays, speakers, etc.; a storage unit 1108, such as a disk, an optical disk, etc.; and a communication unit 1109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1109 allows the device 1100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0112] The computing unit 1101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1101 performs the various methods and processes described above, such as at least one of the above-mentioned methods for determining prompt information and data processing methods. For example, in some embodiments, at least one of the above-mentioned methods for determining prompt information and data processing methods may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded into the RAM 1103 and executed by the computing unit 1101, one or more steps of the above-mentioned methods for determining prompt information and data processing methods described above may be executed. Alternatively, in other embodiments, the computing unit 1101 may be configured in any other appropriate manner (eg, by means of firmware) to execute at least one of the above-mentioned method for determining prompt information and the data processing method.

[0113] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0114] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0115] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0116] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0117] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0118] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0119] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0120] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for determining prompt information, comprising: Determine at least one candidate prompt feature, wherein the candidate prompt feature is used to represent feature data of prompt information in a feature space, the prompt information has natural language semantics, and the candidate prompt feature is determined based on a value in the feature space; According to the at least one candidate prompt feature, and the matching first input information and first output information, at least one prediction prompt information for guiding the reasoning of the large model is generated based on the large model, wherein the at least one prediction prompt information corresponds to the at least one candidate prompt feature in one-to-one manner; Target prompt information is determined according to the at least one predicted prompt information.

2. The method according to claim 1, wherein: The determining the target prompt information according to the at least one prediction prompt information comprises: Using the labeled data, respectively evaluate the at least one prediction prompt information to obtain a first evaluation value of each of the at least one prediction prompt information; The target prompt information is determined from the at least one predicted prompt information according to the first evaluation value of each of the at least one predicted prompt information.

3. The method according to claim 2, wherein: The annotated data includes second input information and second output information; and the using the annotated data to evaluate the at least one prediction prompt information respectively to obtain the first evaluation value of each of the at least one prediction prompt information includes: According to the prediction prompt information and the second input information, generating prediction output information corresponding to the second input information based on the large model; The first evaluation value of the prediction prompt information is determined according to a difference between the second output information and the prediction output information.

4. The method according to claim 1, wherein: Determining at least one candidate prompt feature comprises: Taking values ​​in the feature space to obtain a plurality of prompt features; determining a second evaluation value for each of the plurality of prompt features; The at least one candidate prompt feature is determined from the plurality of prompt features according to the second evaluation values ​​of the respective plurality of prompt features.

5. The method according to claim 1, wherein: Determining at least one candidate prompt feature comprises: determining an initial prompt feature and a second evaluation value of the initial prompt feature; According to the difference between the second evaluation value of the initial prompt feature and the target evaluation value, updating the value of the initial prompt feature in the feature space until the updated initial prompt feature meets the termination condition; The updated initial prompt feature that meets the termination condition is determined as the candidate prompt feature.

6. The method according to claim 5, wherein: The termination condition includes at least one of the following: The number of updates reaches the target number; The similarity between the prompt information determined based on the initial prompt feature before the update and the prompt information determined based on the initial prompt feature after the update is greater than or equal to the similarity threshold.

7. The method according to claim 1, wherein: The generating at least one prediction prompt information for guiding the reasoning of the large model based on the large model according to the at least one candidate prompt feature and the matching first input information and first output information includes: Extracting features from the first input information and the first output information that match each other to obtain a first feature; The first feature and the candidate prompt feature are fused to obtain a second feature; The second feature is processed based on the large model to obtain the prediction prompt information.

8. The method according to any one of claims 4 to 5, wherein: The second evaluation value is obtained based on an evaluation network, the evaluation network is obtained by training using training samples, and the training samples are constructed in the following manner: Generate estimated prompt information for guiding the reasoning of the large model based on the large model according to the prompt feature sample, and the matching first input sample and first output sample; Generate estimated output information based on the large model according to the estimated prompt information and the second input sample; Determining a label representing the accuracy of the estimated prompt information according to a difference between the estimated output information and a second output sample matching the second input sample; The training sample is constructed according to the prompt feature sample and the label.

9. A data processing method, comprising: Get the object's pending information; Combining the information to be processed and the prompt information into target input information; Inputting the target input information into the large model to obtain response information; Wherein, the prompt information is obtained by using the method described in any one of claims 1 to 8.

10. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Prompt information optimization method of generative model, quality detection method and medium

    CN120996110A

  • Model processing method and device, storage medium, electronic equipment and program product

    CN121189491A