Data generation method and device based on artificial intelligence, computer equipment and medium

By obtaining training samples and candidate examples from the question-answer database, filtering positive and negative samples, building evaluation models, and generating target prompts, the flexibility and accuracy of selection of large language model prompts in the existing technology are solved, and the flexibility and accuracy of selection of large language model prompts is improved. Generalization ability and prompt quality of the model.

CN119046432AActive Publication Date: 2024-11-29PING AN TECH (SHENZHEN) CO LTD

Patent Information

Application Number
CN202411162356.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2024-11-29
Estimated Expiration
2044-08-22

AI Technical Summary

Technical Problem

The context learning mechanism of existing large language models relies on manual carefully selecting sample data from the annotated data set as a hint for new model learning tasks, which lacks flexibility and targeting, limits the generalization ability of the model.

Method used

Get training samples from the preset question-answer database, find candidate examples, filter positive and negative samples based on scoring strategies, build evaluation models, and generate target prompts through similarity calculations, optimize the example selection process, and improve the accuracy of prompts. .

Benefits of technology

It realizes automatic and accurate construction of target prompts, improves the flexibility and pertinence of sample selection of large language models, and improves the accuracy of generating prompts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046432A_ABST
    Figure CN119046432A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of artificial intelligence and the field of financial science and technology, and relates to a data generation method and device based on artificial intelligence, computer equipment and a storage medium, and the method comprises the steps: searching a candidate example corresponding to an obtained training sample from a question-answer database; performing scoring processing on the candidate examples to obtain scores; screening out a specified number of first examples with the highest score from the candidate examples, and constructing a positive sample based on the first examples; filtering the positive samples from the candidate examples to construct negative samples; training the initial evaluation model based on the positive sample and the negative sample to obtain an evaluation model; performing similarity calculation on the question input by the user and the data pair in the question-answer database based on the evaluation model to obtain a similarity score; and screening a target data pair with the highest similarity score from the data pairs and using the target data pair to generate a target prompt of the problem. According to the prompt construction method based on the evaluation model, the flexibility and pertinence of example selection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence development technology and financial technology, and in particular to artificial intelligence-based data generation methods, devices, computer equipment and storage media. Background Art

[0002] With the rapid development of artificial intelligence technology, large language models are increasingly used in the financial field, becoming an important tool for improving service efficiency and optimizing customer experience. These models, especially large-scale language models based on deep learning, have demonstrated amazing contextual learning capabilities, that is, they can quickly adapt to and simulate human writing style, logical thinking, and even expertise in specific fields by analyzing a small number of examples of answers to similar questions, so that they can give answers with a certain degree of accuracy and rationality on tasks that have not been directly trained.

[0003] However, the current contextual learning mechanism of large language models still has significant limitations. The traditional approach relies on manually selecting example data from annotated datasets as "prompts" for the model to learn new tasks. Although this method improves the generalization ability of the model to a certain extent, it lacks flexibility and pertinence in the example selection process. Summary of the invention

[0004] The purpose of the embodiments of the present application is to propose a data generation method, device, computer equipment and storage medium based on artificial intelligence to solve the problem that the existing context learning mechanism of large language models relies on manually carefully selecting example data from annotated data sets as prompts for the model to learn new tasks. Although this method improves the generalization ability of the model to a certain extent, it lacks flexibility and pertinence in the example selection process.

[0005] In order to solve the above technical problems, the embodiment of the present application provides a data generation method based on artificial intelligence, which adopts the following technical solutions:

[0006] Obtain training samples from a preset question-answer database;

[0007] Finding candidate examples corresponding to the training sample from the question-answer database; wherein the number of the candidate examples is multiple;

[0008] Scoring the candidate examples based on a preset example scoring strategy to obtain scores for the candidate examples;

[0009] Filter out a specified number of first examples with the highest scores from all the candidate examples, and construct positive samples based on the first examples;

[0010] Filtering the positive sample from the candidate examples to obtain a second example, and constructing a negative sample based on the second example;

[0011] Training a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model;

[0012] Obtaining a question input by a user, and calculating the similarity between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score;

[0013] Target data pairs with the highest target number of similarity scores are selected from all the data pairs, and target prompts corresponding to the question are generated based on the target data pairs.

[0014] Furthermore, the step of searching the question-answer database for candidate examples corresponding to the training samples specifically includes:

[0015] Performing inverted index query processing on the question-answer database based on the training sample to obtain a correlation score between the training sample and each data pair included in the question-answer database;

[0016] Sorting all the data pairs based on the correlation scores to obtain a corresponding data pair sorting list;

[0017] Filter out a specified number of specified data pairs with the highest correlation scores from the sorted list of data pairs;

[0018] The designated data pair is taken as the candidate example.

[0019] Furthermore, the step of scoring the candidate examples based on a preset example scoring strategy to obtain the scores of the candidate examples specifically includes:

[0020] Scoring the candidate examples based on a preset likelihood function to obtain corresponding preliminary scores;

[0021] Sorting the candidate examples based on the preliminary scores to obtain a corresponding sorted list;

[0022] Obtaining a first candidate example and a second candidate example adjacent to a specified candidate example in the sorted list; wherein the specified candidate example is any one of all the candidate examples included in the sorted list;

[0023] Performing calculation processing on the designated candidate example, the first candidate example, and the second candidate example based on a preset comparison algorithm to obtain a comparison score of the designated candidate example;

[0024] The comparison score is used as a designated score for the designated candidate example.

[0025] Furthermore, the step of constructing a negative sample based on the second example specifically includes:

[0026] Get the preset negative sample screening strategy;

[0027] Performing screening processing on the second example based on the negative sample screening strategy to obtain a corresponding third example;

[0028] The third example is taken as the negative sample.

[0029] Furthermore, the step of generating a target prompt corresponding to the question based on the target data pair specifically includes:

[0030] Obtaining a target question and a target answer in the target data pair;

[0031] Formatting the target problem to obtain a processed target problem;

[0032] Formatting the target answer to obtain a processed target answer;

[0033] Combining the processed target question and the processed target answer to obtain a corresponding combined text;

[0034] A target prompt corresponding to the question is generated based on the combined text.

[0035] Furthermore, the step of generating a target prompt corresponding to the question based on the combined text specifically includes:

[0036] Performing splicing processing on the combined text to obtain corresponding spliced ​​text;

[0037] Get the preset prompt verification rules;

[0038] Verifying the concatenated text based on the prompt verification rule;

[0039] If the concatenated text passes the verification, the concatenated text is used as the target prompt corresponding to the question.

[0040] Furthermore, after the step of selecting target data pairs with the highest target number of similarity scores from all the data pairs and generating target prompts corresponding to the question based on the target data pairs, the method further includes:

[0041] Call the preset large language model;

[0042] Performing inference processing on the target prompt based on the large language model to obtain a response result corresponding to the target prompt;

[0043] Receiving the response result returned by the large language model;

[0044] The response result is sent to the user.

[0045] In order to solve the above technical problems, the embodiment of the present application further provides a data generation device based on artificial intelligence, which adopts the following technical solution:

[0046] An acquisition module, used to acquire training samples from a preset question-answer database;

[0047] A search module, used to search for candidate examples corresponding to the training sample from the question-answer database; wherein the number of the candidate examples is multiple;

[0048] A scoring module, used to score the candidate examples based on a preset example scoring strategy to obtain a score for the candidate examples;

[0049] A screening module, used for screening out a specified number of first examples with the highest scores from all the candidate examples, and constructing positive samples based on the first examples;

[0050] A construction module, configured to filter the positive sample from the candidate sample to obtain a second sample, and construct a negative sample based on the second sample;

[0051] A training module, used for training a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model;

[0052] A calculation module, used for obtaining a question input by a user, and performing similarity calculation between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score;

[0053] A generation module is used to select target data pairs with the highest target number of similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

[0054] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0055] Obtain training samples from a preset question-answer database;

[0056] Finding candidate examples corresponding to the training sample from the question-answer database; wherein the number of the candidate examples is multiple;

[0057] Scoring the candidate examples based on a preset example scoring strategy to obtain scores for the candidate examples;

[0058] Filter out a specified number of first examples with the highest scores from all the candidate examples, and construct positive samples based on the first examples;

[0059] Filtering the positive sample from the candidate examples to obtain a second example, and constructing a negative sample based on the second example;

[0060] Training a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model;

[0061] Obtaining a question input by a user, and calculating the similarity between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score;

[0062] Target data pairs with the highest target number of similarity scores are selected from all the data pairs, and target prompts corresponding to the question are generated based on the target data pairs.

[0063] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0064] Obtain training samples from a preset question-answer database;

[0065] Finding candidate examples corresponding to the training sample from the question-answer database; wherein the number of the candidate examples is multiple;

[0066] Scoring the candidate examples based on a preset example scoring strategy to obtain scores for the candidate examples;

[0067] Filter out a specified number of first examples with the highest scores from all the candidate examples, and construct positive samples based on the first examples;

[0068] Filtering the positive sample from the candidate examples to obtain a second example, and constructing a negative sample based on the second example;

[0069] Training a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model;

[0070] Obtaining a question input by a user, and calculating the similarity between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score;

[0071] Target data pairs with the highest target number of similarity scores are selected from all the data pairs, and target prompts corresponding to the question are generated based on the target data pairs.

[0072] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0073] The present application first obtains training samples from a preset question-answer database; and searches for candidate examples corresponding to the training samples from the question-answer database; then scores the candidate examples based on a preset example scoring strategy to obtain scores for the candidate examples; and selects a specified number of first examples with the highest scores from all the candidate examples, and constructs positive samples based on the first examples; then filters the positive samples from the candidate examples to obtain second examples, and constructs negative samples based on the second examples; subsequently, trains a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model; further obtains a question input by the user, and calculates the similarity between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score; finally, selects a target number of target data pairs with the highest similarity scores from all the data pairs, and generates a target prompt corresponding to the question based on the target data pairs. This application obtains training samples based on the use of a question-answer database and finds candidate examples corresponding to the training samples, then screens out positive samples and negative samples from the candidate examples based on the use of an example scoring strategy, and then trains a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model, and then processes the user input questions based on the evaluation model and the use of the question-answer database, so as to automatically and accurately construct a target prompt corresponding to the question. Different from the existing method that relies on manually carefully selecting example data from annotated data sets as prompts, this application proposes a prompt construction method based on an evaluation model, which effectively optimizes the example selection process in the prompts of large language models in contextual learning, improves the flexibility and pertinence of example selection, and improves the accuracy of the generated target prompts. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0075] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0076] Figure 2 A flowchart of an embodiment of the artificial intelligence-based data generation method according to the present application;

[0077] Figure 3 is a structural schematic diagram of an embodiment of an artificial intelligence-based data generation device according to the present application;

[0078] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0079] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0080] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0081] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0082] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0083] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0084] The terminal devices 101, 102, and 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, and the like.

[0085] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0086] It should be noted that the artificial intelligence-based data generation method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the artificial intelligence-based data generation device is generally set in the server / terminal device.

[0087] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0088] Continue to refer Figure 2 , showing a flow chart of an embodiment of the artificial intelligence-based data generation method according to the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The artificial intelligence-based data generation method provided in the embodiment of the present application can be applied to any scenario where prompt generation is required, and the artificial intelligence-based data generation method can be applied to products in these scenarios, for example, prompt generation in the financial insurance field. The artificial intelligence-based data generation method comprises the following steps:

[0089] Step S201, obtaining training samples from a preset question-answer database.

[0090] In this embodiment, the electronic device (e.g. Figure 1The server / terminal device shown in the figure) can obtain training samples through a wired connection or a wireless connection. It should be noted that the above-mentioned wireless connection method may include but is not limited to 3G / 4G / 5G connection, Wi-Fi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (Ultra Wi DeBand) connection, and other wireless connection methods currently known or to be developed in the future. In the business scenario of the unified search function of a financial enterprise or in the business scenario of question retrieval for related documents, the present application can be specifically applied to the scenario of generating prompts for a large language model used by a financial enterprise to provide search results or question retrieval. The above-mentioned question-answer database is a pre-constructed database that stores existing question-answer pairs (data pairs), and the existing question-answer pairs in the question-answer database are high-quality data that have been manually sorted. The above-mentioned training sample can be a data pair (q, doc) randomly selected from the above-mentioned question-answer database.

[0091] Step S202, searching the question-answer database for candidate examples corresponding to the training sample; wherein the number of the candidate examples is multiple.

[0092] In this embodiment, the specific implementation process of searching the question-answer database for candidate examples corresponding to the training samples will be described in further detail in subsequent specific embodiments of the present application and will not be elaborated on here.

[0093] Step S203: score the candidate examples based on a preset example scoring strategy to obtain scores for the candidate examples.

[0094] In this embodiment, the above-mentioned specific implementation process of scoring the candidate examples based on the preset example scoring strategy to obtain the scoring of the candidate examples will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated in detail here.

[0095] Step S204: Filter out a specified number of first examples with the highest scores from all the candidate examples, and construct positive samples based on the first examples.

[0096] In this embodiment, the scores of all the candidate examples can be numerically compared to select a specified number of first examples with the highest scores from all the candidate examples, and the first examples can be used as positive examples corresponding to the evaluation model, i.e., the positive samples. There is no specific limitation on the selection of the numerical value of the specified number, which can be set according to the actual model building requirements.

[0097] Step S205 , filtering the positive sample from the candidate examples to obtain a second example, and constructing a negative sample based on the second example.

[0098] In this embodiment, the positive sample can be deleted from the candidate examples to complete the filtering process and obtain the corresponding second example. The specific implementation process of constructing the negative sample based on the second example will be further described in detail in the subsequent specific embodiments of this application, and will not be elaborated here.

[0099] Step S206: training a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model.

[0100] In this embodiment, the above-mentioned initial evaluation model specifically adopts a dual-tower model. The model structure of the dual-tower model includes: 1. Input layer: User question q: converted into a vector representation of a fixed length through a word embedding layer (such as the embedding layer of BERT). Database question q_i: also converted into a vector representation of a fixed length through a word embedding layer. 2. Dual-tower structure: two independent towers: each tower processes one type of input (q or q_i) and extracts deep features through multiple Transformer layers (or other types of neural network layers). Shared parameters: In order to simplify the model, the two towers can use the same network structure and parameters. 3. Output layer: The output of each tower is a vector representation of a fixed dimension. The training goal of the dual-tower model is: using cosine similarity as the similarity metric, the goal is to make the similarity of positive samples (q, q_j) as high as possible and the similarity of negative samples (q, q_m) as low as possible.

[0101] Specifically, the training process of the evaluation model includes: 1) Prepare data: combine positive samples and negative samples into training batches. 2) Forward propagation: input each (q, q_j) pair into the dual-tower model to obtain two vectors v_q and v_q_j respectively. Calculate the cosine similarity sim(v_q, v_q_j). For negative samples, sim(v_q, v_q_m) is also calculated. 3) Loss function: Use binary cross entropy loss to maximize the similarity of positive samples and minimize the similarity of negative samples. 4) Back propagation and optimization: Update the parameters of the dual-tower model according to the gradient of the loss function. Use an optimizer (such as Adam) to perform gradient descent. 5) Iterative training: Repeat the above steps until the performance of the model on the validation set is no longer significantly improved or the preset training rounds are reached, thereby obtaining a trained evaluation model.

[0102] Step S207: obtaining the question input by the user, and performing similarity calculation between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score.

[0103] In this embodiment, after obtaining the question input by the user, the question is input into the trained evaluation model, so as to use the evaluation model to calculate the similarity between the question and all data pairs in the question-answer database to obtain a corresponding similarity score.

[0104] Step S208, selecting target data pairs with the highest target number of similarity scores from all the data pairs, and generating target prompts corresponding to the question based on the target data pairs.

[0105] In this embodiment, all similarity scores output by the evaluation model can be numerically compared to select the target number of target data pairs with the highest similarity score from all the data pairs. There is no specific limitation on the numerical selection of the above target number, which can be set according to the actual business quantity requirements. In addition, the specific implementation process of generating the target prompt corresponding to the problem based on the target data pair will be further described in detail in the subsequent specific embodiments of this application, and will not be elaborated on here.

[0106] This application obtains training samples based on the use of a question-answer database and finds candidate examples corresponding to the training samples, then screens out positive samples and negative samples from the candidate examples based on the use of an example scoring strategy, and then trains a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model, and then processes the user input questions based on the evaluation model and the use of the question-answer database, so as to automatically and accurately construct a target prompt corresponding to the question. Different from the existing method that relies on manually carefully selecting example data from annotated data sets as prompts, this application proposes a prompt construction method based on an evaluation model, which effectively optimizes the example selection process in the prompts of large language models in contextual learning, improves the flexibility and pertinence of example selection, and improves the accuracy of the generated target prompts.

[0107] In some optional implementations, step S202 includes the following steps:

[0108] An inverted index query process is performed on the question-answer database based on the training sample to obtain a correlation score between the training sample and each data pair included in the question-answer database.

[0109] In this embodiment, the training sample may first be segmented to obtain the corresponding vocabulary, and then the question-answer database may be subjected to inverted index query processing based on the obtained vocabulary to obtain the correlation score between the training sample and each data pair contained in the question-answer database. Specifically, the process of inverted index query processing specifically includes: traversing each term in the above-mentioned vocabulary. Searching for a list of data pair IDs corresponding to each term in the inverted index of the question-answer database. For each term, collect its corresponding data pair ID, and calculate the correlation score between these data pairs and the term. Among them, TF-IDF can be used to evaluate the importance of a term in a data pair. If a data pair appears in the data pair ID lists of multiple terms, its correlation score is accumulated.

[0110] In this embodiment, the process of constructing an inverted index for the question-answer database includes: 1. Initializing the data structure: Create a data structure (such as a hash table or a dictionary) to store the inverted index. This structure maps terms to a list of data pair IDs containing the terms. Among them, all data pairs stored in the question-answer database in advance are read, and each data pair is segmented to split into corresponding terms. 2. Traversing the segmentation results: For each data pair, traverse its segmentation results. For each term, check whether it is already in the inverted index. If it is not in the inverted index, add the term to the index and initialize its corresponding data pair ID list to a list containing the current data pair ID. If it is in the inverted index, add the current data pair ID to the data pair ID list corresponding to the term. 3. Storing the inverted index: Save the constructed inverted index to disk or memory for subsequent retrieval.

[0111] All the data pairs are sorted based on the correlation scores to obtain a corresponding data pair sorting list.

[0112] In this embodiment, the process of generating the data pair sorting list includes: sorting the data pairs contained in the question-answer database according to the cumulative relevance scores, creating a list containing tuples of (data pair ID, cumulative score) and arranging them in descending order of scores, thereby obtaining the above data pair sorting list.

[0113] A specified number of data pairs with the highest correlation scores are selected from the sorted list of data pairs.

[0114] In this embodiment, there is no specific limitation on the selection of the numerical value of the above-mentioned specified number, and it can be set according to the actual example selection requirements.

[0115] The designated data pair is taken as the candidate example.

[0116] The present application performs an inverted index query process on the question-answer database based on the training sample to obtain the correlation score between the training sample and each data pair contained in the question-answer database; then sorts all the data pairs based on the correlation score to obtain a corresponding data pair sorting list; then filters out a specified number of specified data pairs with the highest correlation score from the data pair sorting list; and subsequently uses the specified data pairs as the candidate examples. The present application performs an inverted index query process on the question-answer database based on the training sample by means of an inverted index query, which can realize fast and accurate retrieval of relevant data pairs corresponding to the training sample in the question-answer database, and obtain candidate examples based on keyword matching, thereby improving the intelligence of candidate example generation and ensuring the data accuracy of the obtained candidate examples.

[0117] In some optional implementations of this embodiment, step S203 includes the following steps:

[0118] The candidate examples are scored based on a preset likelihood function to obtain corresponding preliminary scores.

[0119] In this embodiment, the likelihood function may specifically adopt the likelihood function of the language model. The candidate examples are preliminarily scored using the likelihood function, thereby obtaining a preliminary score corresponding to the candidate examples. The goal of the preliminary scoring stage is to evaluate the quality or relevance of each candidate example (q_j, doc_j) individually without considering the influence of other candidate examples. Specifically, the preliminary score s_j is calculated using the likelihood function P(doc|q,q_j,doc_j). Among them, P(doc|q,q_j,doc_j) represents the probability or likelihood of generating the answer document doc_j given the query q, the specific query q_j and the corresponding answer document doc_j. The higher this probability value is, it usually means that the answer document doc_j is more relevant to the query q_j.

[0120] The candidate examples are sorted based on the preliminary scores to obtain a corresponding sorted list.

[0121] In this embodiment, the candidate examples may be sorted in descending order of the preliminary scores, thereby obtaining a corresponding sorted list.

[0122] Obtain a first candidate example and a second candidate example adjacent to a specified candidate example in the sorted list; wherein the specified candidate example is any one of all the candidate examples included in the sorted list.

[0123] In this embodiment, two examples (q_l, doc_l) and (q_m, doc_m) adjacent to the specified candidate example (q_j, doc_j) are selected from the sorted list. Adjacent here refers to the physical order. If it is ranked first / last, the two examples behind or before it are taken; if not, the two examples before and after it are taken.

[0124] The designated candidate example, the first candidate example, and the second candidate example are calculated and processed based on a preset comparison algorithm to obtain a comparison score of the designated candidate example.

[0125] In this embodiment, the calculation formula of the contrast algorithm contrast score is intended to evaluate the relative quality and uniqueness of the candidate example in a broader context by comparing the likelihood change of the candidate example (q_j, doc_j) when it is considered alone and when its neighboring examples are considered. Specifically, the above contrast algorithm specifically includes: Sj = 2*P(doc|q,qj,docj)-P(doc|q,qj,docj,ql,doc l)-P(doc|q,qj,docj,qm,docm), where the first term: 2*P(doc|q,q_j,doc_j), this part calculates the likelihood of the document doc_j under the given query q and the specific query q_j when the candidate example (q_j,doc_j) is considered alone, and doubles it. The purpose of doubling is to make it easier to observe the difference in subsequent calculations, because the subsequent two terms are two variants of subtracting this basic likelihood. The second term: P(doc|q,q_j,doc_j,q_l,doc_l), this part calculates the likelihood of document doc_j when the candidate example (q_j,doc_j) is considered together with its left neighboring example (q_l,doc_l). This reflects the possible change in the relationship between doc_j and q_j after considering the additional information of the neighboring examples. The third term: P(doc|q,q_j,doc_j,q_m,doc_m), is similar to the second term, but this time the right neighboring example (q_m,doc_m) is considered. This also evaluates the possible change in the relationship between doc_j and q_j under the influence of the additional information (the right neighboring example).

[0126] The contrastive algorithm evaluates the difference in likelihood between (q_j,doc_j) when considered alone (the first term) and when considering its neighboring examples (the second two terms). If the value of S_j is high, it means that (q_j,doc_j) has a high likelihood when considered alone, and this likelihood has not dropped significantly after adding neighboring examples, and may even be improved due to some complementary effect. This usually means that (q_j,doc_j) has a high uniqueness or importance in its context. The core idea of ​​contrastive scoring is to reveal the relative quality of candidate examples in a broader context by comparing the performance differences between candidate examples under individual and combined conditions. This method helps to identify candidate examples that perform well when considered alone and can still maintain their advantages or uniqueness when combined with other examples. This is particularly important for tasks such as information retrieval, question answering systems, or document ranking, because they need to accurately evaluate the quality of each candidate result in order to provide users with the most relevant and useful information.

[0127] The comparison score is used as a designated score for the designated candidate example.

[0128] In this embodiment, generally, the larger language model performs better when it receives more examples. For evaluating an example, if it acts on the larger language model alone, it should be similar to having more examples, or the difference is smaller. Therefore, the present application proposes to compare the effect of (q_j, doc_j) as the only example and the effect of it being used as a model example with other examples, so that it can better reflect the importance of the example than the preliminary score s_j.

[0129] The present application scores the candidate examples based on a preset likelihood function to obtain a corresponding preliminary score; then sorts the candidate examples based on the preliminary score to obtain a corresponding sorted list; then obtains the first candidate example and the second candidate example adjacent to the specified candidate example in the sorted list; subsequently, the specified candidate example, the first candidate example and the second candidate example are calculated based on a preset comparison algorithm to obtain a comparison score of the specified candidate example; finally, the comparison score is used as the specified score of the specified candidate example. The present application scores the candidate examples based on the likelihood function and the use of a comparison algorithm, so that the scores of the candidate examples can be generated quickly and accurately, and the accuracy of the scores of the obtained candidate examples can be ensured. This is conducive to the subsequent use of the scores of the candidate examples to accurately evaluate the quality of each candidate example, and to complete the accurate construction of the positive samples of the subsequent evaluation model based on the scores of the candidate examples.

[0130] In some optional implementations, the constructing a negative sample based on the second example in step S205 includes the following steps:

[0131] Get the preset negative sample filtering strategy.

[0132] In this embodiment, the selection of the above-mentioned negative sample screening strategy is not specifically limited, and can be set according to the actual sample construction requirements. The above-mentioned negative sample screening strategy may include random screening. Or it may also include a strategy of selecting a certain number of examples from the second example as negative samples in order from low to high scores. Among them, the selection of the above-mentioned certain number of values ​​is not specifically limited, and can be determined according to the actual sample construction requirements.

[0133] The second example is screened based on the negative sample screening strategy to obtain a corresponding third example.

[0134] In this embodiment, the second example may be screened according to the policy content of the negative sample screening strategy to screen out examples that meet the screening conditions of the negative sample screening strategy and serve as the third example.

[0135] The third example is taken as the negative sample.

[0136] In this embodiment, for a training sample (q, doc), examples (q_j, doc_j) with scores in the top k are obtained as positive samples for evaluation model training. Then examples (q_m, doc_m) with scores in the bottom k+1 to k+d are selected as negative samples for evaluation model training. Wherein, k is the above-specified number, and the values ​​of k and d are not specifically limited and can be set according to actual model training requirements.

[0137] The present application obtains a preset negative sample screening strategy; then screens the second example based on the negative sample screening strategy to obtain a corresponding third example; and then uses the third example as the negative sample. The present application screens the second example based on the use of the negative sample screening strategy, which can quickly and intelligently complete the construction of negative samples and improve the efficiency of negative sample construction.

[0138] In some optional implementations, the step of generating a target prompt corresponding to the question based on the target data pair in step S208 includes the following steps:

[0139] Obtain a target question and a target answer in the target data pair.

[0140] In this embodiment, the target question and the target answer in the target data pair may be extracted by performing information analysis on the target data pair.

[0141] The target problem is formatted to obtain a processed target problem.

[0142] In this embodiment, formatting the target question means formatting the target question into a format that can be understood by a preset large language model. Specifically, the formatting process may include adding a specific prefix, marker or separator to indicate the beginning and end of the question.

[0143] The target answer is formatted to obtain a processed target answer.

[0144] In this embodiment, the target answer is formatted into an appropriate format to ensure that the target answer is logically consistent with the target question.

[0145] The processed target question and the processed target answer are combined to obtain a corresponding combined text.

[0146] In this embodiment, the processed target question and the processed target answer can be combined into a complete prompt text, i.e., the combined text, by determining the order of the processed target question and the processed target answer in the prompt according to the order. In the combination process, a specific separator or mark can be used to process the processed target question and the processed target answer.

[0147] A target prompt corresponding to the question is generated based on the combined text.

[0148] In this embodiment, the specific implementation process of generating the target prompt corresponding to the question based on the combined text will be described in further detail in subsequent specific embodiments of the present application, and will not be elaborated on here.

[0149] The present application obtains the target question and the target answer in the target data pair; then formats the target question to obtain a processed target question; and formats the target answer to obtain a processed target answer; then combines the processed target question and the processed target answer to obtain a corresponding combined text; and subsequently generates a target prompt corresponding to the question based on the combined text. The present application formats the target question and the target answer in the target data pair to obtain a processed target question and the processed target answer, then combines the processed target question and the processed target answer to obtain a corresponding combined text, and then based on the combined text, it is possible to quickly and accurately generate a target prompt corresponding to the question, thereby improving the intelligence of generating target prompts and ensuring the standardization and accuracy of generated target prompts.

[0150] In some optional implementations of this embodiment, generating a target prompt corresponding to the question based on the combined text includes the following steps:

[0151] The combined texts are spliced ​​to obtain corresponding spliced ​​texts.

[0152] In this embodiment, the combined texts can be spliced ​​into a complete string by calling a pre-built connection component to ensure that the logic between the various parts is clear and there is no missing or repeated information, thereby obtaining the corresponding spliced ​​text.

[0153] Get the preset prompt validation rules.

[0154] In this embodiment, the prompt verification rule is a pre-built verification rule corresponding to the input requirements of the large language model. The rule content of the prompt verification rule may include checking whether the text length, the use of specific tags, the encoding format, etc. meet the input requirements of the large language model.

[0155] The concatenated text is verified based on the prompt verification rules.

[0156] In this embodiment, the spliced ​​text is verified by using the prompt verification rule to detect whether the spliced ​​text meets the input requirements of the large language model. If it is detected that the spliced ​​text meets the input requirements of the large language model, it is determined that the spliced ​​text has passed the verification. If it is detected that the spliced ​​text does not meet the input requirements of the large language model, it is determined that the spliced ​​text has not passed the verification.

[0157] If the concatenated text passes the verification, the concatenated text is used as the target prompt corresponding to the question.

[0158] In this embodiment, only when it is detected that the concatenated text passes the verification, the concatenated text will be used as the target prompt corresponding to the question, thereby ensuring the accuracy of the generated target prompt.

[0159] The present application obtains the corresponding spliced ​​text by splicing the combined text; then obtains the preset prompt verification rules; subsequently verifies the spliced ​​text based on the prompt verification rules; if the spliced ​​text passes the verification, the spliced ​​text is used as the target prompt corresponding to the question. The present application obtains the spliced ​​text by splicing the combined text, and then intelligently verifies the spliced ​​text based on the prompt verification rules. Only when it is detected that the spliced ​​text passes the verification, the spliced ​​text is subsequently used as the target prompt corresponding to the question, thereby effectively ensuring the data accuracy of the generated target prompt.

[0160] In some optional implementations of this embodiment, after step S208, the electronic device may further perform the following steps:

[0161] Call the preset large language model.

[0162] In this embodiment, the large language model can be generated by autonomous pre-training, or can be an open source large language model, such as ChatGLM-6B.

[0163] The target prompt is inferred based on the large language model to obtain a response result corresponding to the target prompt.

[0164] In this embodiment, the target prompt is input as a model into the large language model, so that the target prompt is inferred by the large language model and an encounter result such as the west is output.

[0165] The response result returned by the large language model is received.

[0166] In this embodiment, after receiving the response result returned by the large language model, the response result can be parsed and important information can be extracted according to the response format of the large language model, such as text output, confidence score, related tags and other information.

[0167] The response result is sent to the user.

[0168] In this embodiment, the important information in the above response result can be sent to the user to complete the response processing for the question input by the user.

[0169] This application calls a preset large language model; then infers the target prompt based on the large language model to obtain a response result corresponding to the target prompt; then receives the response result returned by the large language model; and subsequently sends the response result to the user. After obtaining the question input by the user, this application generates a target prompt corresponding to the question by using an evaluation model, and then subsequently uses a large language model to infer the target prompt to obtain a response result corresponding to the target prompt, thereby realizing that the use of the target prompt can improve the prediction processing effect of the large language model, thereby improving the accuracy of the generated response result. The response result returned by the large language model is subsequently sent to the user, which is conducive to improving user satisfaction.

[0170] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0171] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target prompts, the above-mentioned target prompts can also be stored in a node of a blockchain.

[0172] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0173] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0174] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0175] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0176] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0177] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a data generation device based on artificial intelligence, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0178] like Figure 3 As shown, the artificial intelligence-based data generation device 300 described in this embodiment includes: an acquisition module 301, a search module 302, a scoring module 303, a screening module 304, a construction module 305, a training module 306, a calculation module 307 and a generation module 308. Among them:

[0179] An acquisition module 301 is used to acquire training samples from a preset question-answer database;

[0180] A search module 302 is used to search for candidate examples corresponding to the training sample from the question-answer database; wherein the number of the candidate examples is multiple;

[0181] A scoring module 303 is used to score the candidate examples based on a preset example scoring strategy to obtain a score for the candidate examples;

[0182] A screening module 304 is used to screen out a specified number of first examples with the highest scores from all the candidate examples, and construct positive samples based on the first examples;

[0183] A construction module 305 is used to filter the positive sample from the candidate samples to obtain a second sample, and construct a negative sample based on the second sample;

[0184] A training module 306 is used to train a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model;

[0185] A calculation module 307 is used to obtain a question input by a user, and perform similarity calculation on the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score;

[0186] The generating module 308 is used to select target data pairs with the highest target number of similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

[0187] In this embodiment, the operations performed by the above modules or units correspond one-to-one to the steps of the artificial intelligence-based data generation method in the aforementioned implementation mode, and will not be repeated here.

[0188] In some optional implementations of this embodiment, the search module 302 includes:

[0189] A query submodule, configured to perform an inverted index query process on the question-answer database based on the training sample to obtain a correlation score between the training sample and each data pair included in the question-answer database;

[0190] A first sorting submodule, used to sort all the data pairs based on the correlation scores to obtain a corresponding data pair sorting list;

[0191] A first screening submodule, configured to screen out a specified number of specified data pairs with the highest correlation scores from the data pair sorting list;

[0192] The first determination submodule is used to take the specified data pair as the candidate example.

[0193] In some optional implementations of this embodiment, the scoring module 303 includes:

[0194] A scoring submodule, used to score the candidate examples based on a preset likelihood function to obtain a corresponding preliminary score;

[0195] A second sorting submodule, configured to sort the candidate examples based on the preliminary scores to obtain a corresponding sorted list;

[0196] A first acquisition submodule is used to acquire a first candidate example and a second candidate example adjacent to a specified candidate example in the sorted list; wherein the specified candidate example is any one of all the candidate examples included in the sorted list;

[0197] a calculation submodule, configured to perform calculation processing on the designated candidate example, the first candidate example, and the second candidate example based on a preset comparison algorithm to obtain a comparison score of the designated candidate example;

[0198] The second determination submodule is configured to use the comparison score as a designated score for the designated candidate example.

[0199] In some optional implementations of this embodiment, the construction module 305 includes:

[0200] The second acquisition submodule is used to obtain a preset negative sample screening strategy;

[0201] A second screening submodule, configured to screen the second example based on the negative sample screening strategy to obtain a corresponding third example;

[0202] The third determination submodule is configured to use the third example as the negative sample.

[0203] In some optional implementations of this embodiment, the generating module 308 includes:

[0204] A third acquisition submodule is used to acquire a target question and a target answer in the target data pair;

[0205] A first processing submodule is used to format the target question to obtain a processed target question;

[0206] The second processing submodule is used to format the target answer to obtain a processed target answer;

[0207] A combination submodule, used for combining the processed target question and the processed target answer to obtain a corresponding combined text;

[0208] A generating submodule is used to generate a target prompt corresponding to the question based on the combined text.

[0209] In some optional implementations of this embodiment, the generating submodule includes:

[0210] A splicing unit, used for splicing the combined text to obtain a corresponding spliced ​​text;

[0211] An acquisition unit, used for acquiring a preset prompt verification rule;

[0212] A verification unit, used for verifying the spliced ​​text based on the prompt verification rule;

[0213] A determination unit is used to use the concatenated text as the target prompt corresponding to the question if the concatenated text passes the verification.

[0214] In some optional implementations of this embodiment, the artificial intelligence-based data generation device further includes:

[0215] The calling module is used to call the preset large language model;

[0216] An inference module, configured to perform inference processing on the target prompt based on the large language model to obtain a response result corresponding to the target prompt;

[0217] A receiving module, used for receiving the response result returned by the large language model;

[0218] A sending module is used to send the response result to the user.

[0219] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0220] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital processors (DSPs), embedded devices, etc.

[0221] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0222] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk equipped on the computer device 4, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of a data generation method based on artificial intelligence, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0223] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the computer-readable instructions stored in the memory 41 or process data, such as running the computer-readable instructions of the artificial intelligence-based data generation method.

[0224] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0225] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the artificial intelligence-based data generation method as described above.

[0226] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0227] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A data generation method based on artificial intelligence, characterized in that: The steps include: Obtain training samples from a preset question-answer database; Finding candidate examples corresponding to the training sample from the question-answer database; wherein the number of the candidate examples is multiple; Scoring the candidate examples based on a preset example scoring strategy to obtain scores for the candidate examples; Filter out a specified number of first examples with the highest scores from all the candidate examples, and construct positive samples based on the first examples; Filtering the positive sample from the candidate examples to obtain a second example, and constructing a negative sample based on the second example; Training a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model; Obtaining a question input by a user, and calculating the similarity between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score; Target data pairs with the highest target number of similarity scores are selected from all the data pairs, and target prompts corresponding to the question are generated based on the target data pairs.

2. The artificial intelligence-based data generation method according to claim 1, characterized in that: The step of searching the question-answer database for candidate examples corresponding to the training samples specifically includes: Performing inverted index query processing on the question-answer database based on the training sample to obtain a correlation score between the training sample and each data pair included in the question-answer database; Sorting all the data pairs based on the correlation scores to obtain a corresponding data pair sorting list; Filter out a specified number of specified data pairs with the highest correlation scores from the sorted list of data pairs; The designated data pair is taken as the candidate example.

3. The artificial intelligence-based data generation method according to claim 1, characterized in that: The step of scoring the candidate examples based on the preset example scoring strategy to obtain the scores of the candidate examples specifically includes: Scoring the candidate examples based on a preset likelihood function to obtain corresponding preliminary scores; Sorting the candidate examples based on the preliminary scores to obtain a corresponding sorted list; Obtaining a first candidate example and a second candidate example adjacent to a specified candidate example in the sorted list; wherein the specified candidate example is any one of all the candidate examples included in the sorted list; Performing calculation processing on the designated candidate example, the first candidate example, and the second candidate example based on a preset comparison algorithm to obtain a comparison score of the designated candidate example; The comparison score is used as a designated score for the designated candidate example.

4. The artificial intelligence-based data generation method according to claim 1, characterized in that: The step of constructing a negative sample based on the second example specifically includes: Get the preset negative sample screening strategy; Performing screening processing on the second example based on the negative sample screening strategy to obtain a corresponding third example; The third example is taken as the negative sample.

5. The artificial intelligence-based data generation method according to claim 1, characterized in that: The step of generating a target prompt corresponding to the question based on the target data pair specifically includes: Obtaining a target question and a target answer in the target data pair; Formatting the target problem to obtain a processed target problem; Formatting the target answer to obtain a processed target answer; Combining the processed target question and the processed target answer to obtain a corresponding combined text; A target prompt corresponding to the question is generated based on the combined text.

6. The artificial intelligence-based data generation method according to claim 5, characterized in that: The step of generating a target prompt corresponding to the question based on the combined text specifically includes: Performing splicing processing on the combined text to obtain corresponding spliced ​​text; Get the preset prompt verification rules; Verifying the concatenated text based on the prompt verification rule; If the concatenated text passes the verification, the concatenated text is used as the target prompt corresponding to the question.

7. The artificial intelligence-based data generation method according to claim 1, characterized in that: After the step of selecting target data pairs with the highest target number of similarity scores from all the data pairs and generating target prompts corresponding to the question based on the target data pairs, the method further includes: Call the preset large language model; Performing inference processing on the target prompt based on the large language model to obtain a response result corresponding to the target prompt; Receiving the response result returned by the large language model; The response result is sent to the user.

8. A data generation device based on artificial intelligence, characterized in that: include: An acquisition module, used to acquire training samples from a preset question-answer database; A search module, used to search for candidate examples corresponding to the training sample from the question-answer database; wherein the number of the candidate examples is multiple; A scoring module, used to score the candidate examples based on a preset example scoring strategy to obtain a score for the candidate examples; A screening module, used for screening out a specified number of first examples with the highest scores from all the candidate examples, and constructing positive samples based on the first examples; A construction module, configured to filter the positive sample from the candidate sample to obtain a second sample, and construct a negative sample based on the second sample; A training module, used for training a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model; A calculation module, used for obtaining a question input by a user, and performing similarity calculation between the question and all data pairs in the question-answer database based on the evaluation model to obtain a corresponding similarity score; A generation module is used to select target data pairs with the highest target number of similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

9. A computer device, characterized in that: It comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the artificial intelligence-based data generation method as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the artificial intelligence-based data generation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Question and answer method based on knowledge graph, electronic device, equipment and storage medium

    CN110263133A

  • Question-answer relationship sorting method and device, computer device and storage medium

    CN110442689A

  • Insurance service scene question and answer recommendation method and related equipment thereof

    CN116610784A

  • Cross-lingual language models and pretraining of cross-lingual language models

    US20220318255A1

  • Automatic question answering method and apparatus for man-machine interaction, and intelligent device

    WO2021147421A1

Cited By

  • Multi-modal model visual perception capability detection method and terminal

    CN119338013A

  • Method and device for selecting knowledge base and storage medium

    CN119358657A

  • Training method of recommendation question generation model and recommendation question generation method and device

    CN119719284A