Artificial intelligence-based data generation method and apparatus, computer device, and medium

By filtering from a question-answer database and training an evaluation model, the system automatically constructs target suggestions that are most similar to the user's input question. This solves the problems of insufficient flexibility and targeting caused by manually selecting example data in existing technologies, and achieves more accurate suggestion generation.

CN119046432BActive Publication Date: 2026-07-31PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN TECH (SHENZHEN) CO LTD
Filing Date
2024-08-22
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing large language models rely on manual selection of example data from labeled datasets as cues in context learning, which lacks flexibility and specificity, resulting in an inflexible and inaccurate example selection process.

Method used

Training samples are obtained from a pre-defined question-answer database. Candidate examples are selected through inverted index queries and example scoring strategies. Positive and negative samples are constructed, an evaluation model is trained, and a target suggestion with the highest similarity to the user's input question is generated.

Benefits of technology

The suggestion selection process of the large language model has been optimized, improving the flexibility and relevance of example selection, and generating more accurate target suggestions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046432B_ABST
    Figure CN119046432B_ABST
Patent Text Reader

Abstract

This application belongs to the fields of artificial intelligence and fintech, and relates to a data generation method, apparatus, computer device, and storage medium based on artificial intelligence. The method includes: searching for and obtaining candidate examples corresponding to training samples from a question-answer database; scoring the candidate examples to obtain scores; selecting a specified number of first examples with the highest scores from the candidate examples and constructing positive samples based on the first examples; filtering the positive samples from the candidate examples to construct negative samples; training an initial evaluation model based on the positive and negative samples to obtain an evaluation model; calculating the similarity score between the user-input question and the data pairs in the question-answer database based on the evaluation model to obtain a similarity score; and selecting the target data pair with the highest similarity score from the data pairs and using it to generate target prompts for the question. The prompt construction method based on the evaluation model proposed in this application improves the flexibility and targeting of example selection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields 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 Technology

[0002] With the rapid development of artificial intelligence technology, large language models are increasingly being 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 remarkable contextual learning capabilities. That is, they can quickly adapt to and simulate human writing styles, logical thinking, and even domain-specific expertise by analyzing a small number of similar question answer examples, thus providing relatively accurate and reasonable answers even on tasks that have not been directly trained.

[0003] However, current context learning mechanisms in large language models still have significant limitations. Traditional approaches rely on manually selecting example data from labeled datasets as "prompts" for the model when learning new tasks. While this method improves the model's generalization ability to some extent, it lacks flexibility and specificity in the example selection process. Summary of the Invention

[0004] The purpose of this application is to propose a data generation method, apparatus, computer device, and storage medium based on artificial intelligence, to address the problem that existing context learning mechanisms for large language models rely on manually selecting example data from labeled datasets as prompts for the model when learning new tasks. While this method improves the model's generalization ability to some extent, it lacks flexibility and specificity in the example selection process.

[0005] To address the aforementioned technical problems, this application provides an artificial intelligence-based data generation method, employing the following technical solution:

[0006] Retrieve training samples from a pre-defined question-answer database;

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

[0008] The candidate examples are scored based on a preset example scoring strategy to obtain the scores of the candidate examples;

[0009] Select 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] The positive samples are filtered from the candidate samples to obtain a second sample, and negative samples are constructed based on the second sample;

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

[0012] The system obtains the user's input question and calculates the similarity score between the question and all data pairs in the question-answer database based on the evaluation model.

[0013] Select the target data pairs with the highest similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

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

[0015] Based on the training samples, an inverted index query is performed on the question-answer database to obtain the relevance scores between the training samples and each data pair contained in the question-answer database.

[0016] All the data pairs are sorted based on the relevance scores to obtain a sorted list of data pairs.

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

[0018] The specified data pair is used 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] The candidate examples are scored based on a preset likelihood function to obtain the corresponding preliminary scores;

[0021] Based on the preliminary score, the candidate examples are sorted to obtain a corresponding sorted list;

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

[0023] The specified candidate example, the first candidate example, and the second candidate example are calculated and processed based on a preset comparison algorithm to obtain the comparison score of the specified candidate example;

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

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

[0026] Obtain the preset negative sample screening strategy;

[0027] The second example is filtered based on the negative sample filtering strategy to obtain the corresponding third example;

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

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

[0030] Obtain the target question and target answer from the target data pair;

[0031] The target problem is formatted to obtain the processed target problem;

[0032] The target answer is formatted to obtain the processed target answer;

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

[0034] Based on the combined text, a target prompt corresponding to the question is generated.

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

[0036] The combined text is then concatenated to obtain the corresponding concatenated text;

[0037] Obtain the preset prompt verification rules;

[0038] The concatenated text is validated based on the aforementioned verification rules;

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

[0040] Furthermore, after the step of filtering out the target data pairs with the highest 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] Invoke the preset large language model;

[0042] Based on the large language model, the target prompt is reasoned to obtain the response result corresponding to the target prompt;

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

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

[0045] To address the aforementioned technical problems, this application also provides an artificial intelligence-based data generation device, which employs the following technical solution:

[0046] The acquisition module is used to obtain training samples from a pre-defined question-answer database;

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

[0048] The scoring module is used to score the candidate examples based on a preset example scoring strategy to obtain the scores of the candidate examples;

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

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

[0051] The training module is used to train a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model.

[0052] The calculation module is used to obtain the question input by the user and calculate the similarity score between the question and all data pairs in the question-answer database based on the evaluation model.

[0053] The generation module is used to filter out the target data pairs with the highest similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

[0054] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:

[0055] Retrieve training samples from a pre-defined question-answer database;

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

[0057] The candidate examples are scored based on a preset example scoring strategy to obtain the scores of the candidate examples;

[0058] Select 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] The positive samples are filtered from the candidate samples to obtain a second sample, and negative samples are constructed based on the second sample;

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

[0061] The system obtains the user's input question and calculates the similarity score between the question and all data pairs in the question-answer database based on the evaluation model.

[0062] Select the target data pairs with the highest similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

[0063] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:

[0064] Retrieve training samples from a pre-defined question-answer database;

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

[0066] The candidate examples are scored based on a preset example scoring strategy to obtain the scores of the candidate examples;

[0067] Select 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] The positive samples are filtered from the candidate samples to obtain a second sample, and negative samples are constructed based on the second sample;

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

[0070] The system obtains the user's input question and calculates the similarity score between the question and all data pairs in the question-answer database based on the evaluation model.

[0071] Select the target data pairs with the highest similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

[0072] Compared with the prior art, the embodiments of this application have the following main advantages:

[0073] This application first obtains training samples from a preset question-answer database; then finds candidate examples corresponding to the training samples from the question-answer database; next, it scores the candidate examples based on a preset example scoring strategy to obtain a score for each candidate example; it then 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; subsequently, it filters the positive samples from the candidate examples to obtain second examples and constructs negative samples based on the second examples; subsequently, it trains a preset initial evaluation model based on the positive and negative samples to obtain a trained evaluation model; further, it obtains the user-input question 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, it selects a target number of target data pairs with the highest similarity scores from all the data pairs and generates target prompts corresponding to the question based on the target data pairs. This application uses a question-and-answer database to obtain training samples and find candidate examples corresponding to the training samples. Then, based on an example scoring strategy, positive and negative samples are selected from the candidate samples. Next, a pre-set initial evaluation model is trained using the positive and negative samples to obtain a trained evaluation model. Subsequently, the user's input question is processed using the evaluation model and the question-and-answer database, enabling the automatic and accurate construction of target prompts corresponding to the question. Unlike existing methods that rely on manual selection of example data from labeled datasets, this application proposes a prompt construction method based on an evaluation model. This effectively optimizes the example selection process in large language models during context learning, improves the flexibility and relevance of example selection, and enhances the accuracy of the generated target prompts. Attached Figure Description

[0074] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0075] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;

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

[0077] Figure 3 This is a schematic diagram of a structure of an embodiment of the artificial intelligence-based data generation apparatus according to this application;

[0078] Figure 4 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation

[0079] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.

[0080] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

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

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

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

[0084] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.

[0085] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.

[0086] It should be noted that the AI-based data generation method provided in this application is generally executed by a server / terminal device, and correspondingly, the AI-based data generation device is generally located in the server / terminal device.

[0087] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0088] Continue to refer to Figure 2 The flowchart illustrates an embodiment of the AI-based data generation method according to this application. The order of steps in the flowchart can be changed, and some steps can be omitted, depending on different needs. The AI-based data generation method provided in this application can be applied to any scenario requiring prompt generation, and therefore can be applied to products in these scenarios, such as prompt generation in the financial insurance field. The AI-based data generation method includes the following steps:

[0089] Step S201: Obtain training samples from a pre-set question-answer database.

[0090] In this embodiment, the artificial intelligence-based data generation method operates on an electronic device (e.g., Figure 1The server / terminal device shown can acquire training samples via wired or wireless connection. It should be noted that the aforementioned wireless connection methods include, but are not limited to, 3G / 4G / 5G connections, Wi-Fi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra-Width Band) connections, and other currently known or future-developed wireless connection methods. In the business scenario of unified search functions in financial enterprises or in the business scenario of question retrieval of relevant documents, this application can specifically be applied to the scenario where financial enterprises generate prompts for large language models that provide search results or question retrieval. The aforementioned question-answer database is a pre-built database storing existing question-answer pairs (data pairs), and the existing question-answer pairs in this database are high-quality data that has been manually organized. The aforementioned training sample can be a data pair (q, doc) randomly selected from the aforementioned question-answer database.

[0091] Step S202: Find candidate examples corresponding to the training samples from the question-answer database; wherein the number of candidate examples is multiple.

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

[0093] Step S203: The candidate examples are scored based on a preset example scoring strategy to obtain the scores of the candidate examples.

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

[0095] Step S204: Select 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 candidate examples can be numerically compared to select a first example with the highest score from all candidate examples, and this first example is used as the positive sample corresponding to the evaluation model, i.e., the aforementioned positive sample. The selection of the specified number of samples is not specifically limited and can be set according to the actual model construction requirements.

[0097] Step S205: Filter the positive samples from the candidate examples to obtain a second example, and construct a negative sample based on the second example.

[0098] In this embodiment, the filtering process can be completed and a corresponding second example obtained by deleting the positive sample from the candidate examples. The specific implementation process of constructing negative samples based on the second example will be described in further detail in subsequent embodiments of this application, and will not be elaborated upon here.

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

[0100] In this embodiment, the initial evaluation model specifically adopts a dual-tower model. The dual-tower model structure includes: 1. Input layer: User question q: converted into a fixed-length vector representation through a word embedding layer (such as BERT's embedding layer). Database question q_i: also converted into a fixed-length vector representation 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: 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 fixed-dimensional vector representation. The training objective of the dual-tower model is: using cosine similarity as a similarity metric, the goal is to maximize the similarity of positive samples (q, q_j) and minimize the similarity of negative samples (q, q_m).

[0101] Specifically, the training process of the evaluation model includes: 1) Data preparation: Combining positive and negative samples into training batches. 2) Forward propagation: Inputting each (q, q_j) pair into the dual-tower model, resulting in two vectors v_q and v_q_j. Calculating the cosine similarity sim(v_q, v_q_j). For negative samples, similarly calculating sim(v_q, v_q_m). 3) Loss function: Using binary cross-entropy loss to maximize the similarity of positive samples and minimize the similarity of negative samples. 4) Backpropagation and optimization: Updating the parameters of the dual-tower model based on the gradient of the loss function. Using an optimizer (such as Adam) to perform gradient descent. 5) Iterative training: Repeating the above steps until the model's performance on the validation set no longer significantly improves or reaches the preset number of training epochs, thus obtaining the trained evaluation model.

[0102] Step S207: Obtain the question input by the user, and calculate the similarity score between the question and all data pairs in the question-answer database based on the evaluation model.

[0103] In this embodiment, after obtaining the user's input question, the question is input into a trained evaluation model, which is then used to calculate the similarity score between the question and all data pairs in the question-answer database.

[0104] Step S208: Select the target data pairs with the highest similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs.

[0105] In this embodiment, the target data pairs with the highest similarity scores can be selected from all the data pairs by comparing the numerical similarity scores of all the data pairs. The numerical selection of the target number is not specifically limited and can be set according to the actual business needs. Furthermore, the specific implementation process of generating target prompts corresponding to the question based on the target data pairs will be described in further detail in subsequent embodiments of this application, and will not be elaborated upon here.

[0106] This application uses a question-and-answer database to obtain training samples and find candidate examples corresponding to the training samples. Then, based on an example scoring strategy, positive and negative samples are selected from the candidate samples. Next, a pre-set initial evaluation model is trained using the positive and negative samples to obtain a trained evaluation model. Subsequently, the user's input question is processed using the evaluation model and the question-and-answer database, enabling the automatic and accurate construction of target prompts corresponding to the question. Unlike existing methods that rely on manual selection of example data from labeled datasets, this application proposes a prompt construction method based on an evaluation model. This effectively optimizes the example selection process in large language models during context learning, improves the flexibility and relevance of example selection, and enhances the accuracy of the generated target prompts.

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

[0108] Based on the training samples, an inverted index query is performed on the question-answer database to obtain the relevance scores between the training samples and each data pair contained in the question-answer database.

[0109] In this embodiment, the training samples are first segmented to obtain corresponding vocabulary. Then, based on the obtained vocabulary, an inverted index query is performed on the question-answer database to obtain the relevance score between the training samples and each data pair contained in the question-answer database. Specifically, the inverted index query process includes: traversing each term in the vocabulary; searching for the data pair ID list corresponding to each term in the inverted index of the question-answer database; for each term, collecting its corresponding data pair IDs and calculating the relevance score between these data pairs and the term; where TF-IDF can be used to evaluate the importance of the term in the data pair; if a data pair appears in the data pair ID lists of multiple terms, its relevance score is accumulated.

[0110] In this embodiment, the process of building an inverted index for the question-answer database includes: 1. Initializing the data structure: Creating a data structure (such as a hash table or dictionary) to store the inverted index. This structure maps terms to a list of data pair IDs containing those terms. Specifically, all data pairs pre-stored in the question-answer database are read, and each data pair is segmented into corresponding terms. 2. Traversing the segmentation results: For each data pair, its segmentation results are traversed. For each term, it is checked whether it is already in the inverted index. If it is not in the inverted index, the term is added to the index, and its corresponding list of data pair IDs is initialized to contain the current data pair IDs. If it is in the inverted index, the current data pair ID is added to the list of data pair IDs corresponding to the term. 3. Storing the inverted index: The constructed inverted index is saved to disk or memory for subsequent retrieval.

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

[0112] In this embodiment, the process of generating the sorted list of data pairs includes: sorting each data pair contained in the question-answer database according to the accumulated relevance score. A list is created containing tuples of (data pair ID, accumulated score), and sorted in descending order of score to obtain the aforementioned sorted list of data pairs.

[0113] Select a specified number of specified data pairs with the highest relevance scores from the sorted list of data pairs.

[0114] In this embodiment, the selection of the specified number of values ​​is not specifically limited, and can be set according to the actual example selection requirements.

[0115] The specified data pair is used as the candidate example.

[0116] This application performs an inverted index query on the question-answer database based on the training samples to obtain a relevance score between the training samples and each data pair contained in the question-answer database. Then, it sorts all the data pairs based on the relevance scores to obtain a sorted list of data pairs. Next, it selects a specified number of data pairs with the highest relevance scores from the sorted list. These specified data pairs are then used as candidate examples. This application, by performing an inverted index query on the question-answer database based on the training samples, can quickly and accurately retrieve relevant data pairs corresponding to the training samples from the question-answer database and obtain candidate examples based on keyword matching. This improves the intelligence of candidate example generation and ensures the 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 the corresponding preliminary scores.

[0119] In this embodiment, the likelihood function can specifically be the likelihood function of a language model. By using this likelihood function to perform a preliminary score on the candidate examples, a preliminary score corresponding to each candidate example is obtained. 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 likelihood function P(doc|q, q_j, doc_j) is used to calculate the preliminary score s_j. Here, P(doc|q, q_j, doc_j) represents the probability or likelihood of generating the response document doc_j given a query q, a specific query q_j, and the corresponding response document doc_j. A higher probability value generally means a stronger relevance between the response document doc_j and 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 can be sorted according to the preliminary scores from largest to smallest to obtain the corresponding sorted list.

[0122] Obtain a first candidate example and a second candidate example that are adjacent to a specified candidate example in the sorted list; wherein, the specified candidate example is any one of all candidate examples contained 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. Here, "adjacent" refers to physical proximity. Specifically, if one example is ranked first or last, the two examples preceding or following it are selected; otherwise, the two examples preceding and following it are selected.

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

[0125] In this embodiment, the formula for calculating the comparison score in the comparison algorithm aims to evaluate the relative quality and uniqueness of a candidate example in a broader context by comparing the likelihood change of a candidate example (q_j, doc_j) when considered alone with respect to its neighboring examples. Specifically, the comparison algorithm 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), calculates the likelihood of the document doc_j given query q and a 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, since the latter two terms are two variations of subtracting this base likelihood. The second term, P(doc|q,q_j,doc_j,q_l,doc_l), calculates the likelihood of document doc_j when the candidate example (q_j,doc_j) is considered together with its left-adjacent example (q_l,doc_l). This reflects the possible changes in the relationship between doc_j and q_j after considering the additional information from adjacent examples. The third term, P(doc|q,q_j,doc_j,q_m,doc_m), is similar to the second term, but this time considers the right-adjacent example (q_m,doc_m). This also evaluates the possible changes in the relationship between doc_j and q_j under the influence of additional information (the right-adjacent example).

[0126] The contrastive algorithm evaluates the likelihood difference of (q_j, doc_j) when considered alone (the first item) versus when considering its neighboring examples (the latter two items). A high S_j value indicates that (q_j, doc_j) has a high likelihood when considered alone, and this likelihood does not decrease significantly after adding neighboring examples, and may even increase due to some complementary effect. This usually means that (q_j, doc_j) has 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 their performance differences under individual and combined conditions. This method helps identify candidate examples that perform well when considered alone and maintain their advantage or uniqueness when combined with other examples. This is particularly important for tasks such as information retrieval, question answering systems, or document ranking, as they require accurate evaluation of 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 the designated score for the specified candidate example.

[0128] In this embodiment, generally, a large language model performs better when it receives more examples. For evaluating an example, if it acts alone on the large language model, its performance should be roughly the same as having more examples, or only slightly different. Therefore, this application proposes comparing the effect of (q_j, doc_j) as a single example versus its effect when it is used in conjunction with other examples as model examples. This approach is more effective in reflecting the importance of the example than the initial score s_j.

[0129] This application scores candidate examples based on a preset likelihood function to obtain a preliminary score; then, it sorts the candidate examples based on the preliminary score to obtain a sorted list; next, it obtains a first candidate example and a second candidate example adjacent to a specified candidate example in the sorted list; subsequently, it calculates a comparison score for the specified candidate example, the first candidate example, and the second candidate example based on a preset comparison algorithm; finally, it uses the comparison score as the specified score for the specified candidate example. This application, by using a likelihood function and a comparison algorithm to score candidate examples, can quickly and accurately generate scores for the candidate examples, ensuring the accuracy of the obtained scores. This facilitates the subsequent accurate evaluation of the quality of each candidate example based on its score, and enables the accurate construction of positive samples for the subsequent evaluation model based on the candidate example's score.

[0130] In some alternative implementations, the step S205 of constructing negative samples based on the second example includes the following steps:

[0131] Obtain the preset negative sample screening strategy.

[0132] In this embodiment, the selection of the negative sample screening strategy is not specifically limited and can be set according to the actual sample construction needs. The negative sample screening strategy may include random screening. Alternatively, it may include a strategy of selecting a certain number of examples as negative samples sequentially from the second selection examples according to the scores from low to high. The numerical value of the aforementioned "certain number" is not specifically limited and can be determined according to the actual sample construction needs.

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

[0134] In this embodiment, the second example can be filtered according to the strategy content of the negative sample screening strategy to select examples that meet the screening conditions of the negative sample screening strategy and use them as the third example.

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

[0136] In this embodiment, for example, for a training sample (q, doc), the k-th rated examples (q_j, doc_j) are obtained and used as positive samples to evaluate model training. Then, examples (q_m, doc_m) with ratings from k+1 to k+d are selected and used as negative samples to evaluate model training. Here, k is the specified number mentioned above, and the values ​​of k and d are not specifically limited and can be set according to the actual model training requirements.

[0137] This application obtains a preset negative sample screening strategy; then, based on the negative sample screening strategy, it filters the second example to obtain a corresponding third example; subsequently, the third example is used as the negative sample. This application, by using the negative sample screening strategy to filter the second example, can quickly and intelligently complete the construction of negative samples, thus improving the efficiency of negative sample construction.

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

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

[0140] In this embodiment, the target question and target answer can be extracted from the target data pair by performing information parsing on the target data pair.

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

[0142] In this embodiment, formatting the target problem means formatting the target problem into a format that a preset large language model can understand. Specifically, formatting may include adding specific prefixes, tags, or separators to indicate the start and end of the problem.

[0143] The target answer is formatted to obtain the 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 the corresponding combined text.

[0146] In this embodiment, the order of the processed target question and the processed target answer in the prompt can be determined, and then the processed target question and the processed target answer can be combined into a complete prompt text, i.e., the combined text, according to this order. During the combination process, specific separators or markers can also be used to process the processed target question and the processed target answer.

[0147] Based on the combined text, a target prompt corresponding to the question is generated.

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

[0149] This application obtains the target question and target answer from 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; subsequently, it combines the processed target question and the processed target answer to obtain a corresponding combined text; and finally, it generates a target prompt corresponding to the question based on the combined text. This application achieves rapid and accurate generation of target prompts based on the combined text by formatting the target question and target answer separately to obtain processed target questions and processed target answers, and then combining the processed target questions and processed target answers to obtain corresponding combined text. This improves the intelligence of target prompt generation and ensures the standardization and accuracy of the 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 text is then concatenated to obtain the corresponding concatenated text.

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

[0153] Obtain the preset prompt verification rules.

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

[0155] The concatenated text is validated based on the aforementioned verification rules.

[0156] In this embodiment, the concatenated text is validated using the aforementioned prompt verification rules to detect whether it meets the input requirements of the large language model. If the concatenated text is found to meet the input requirements of the large language model, it is determined that the concatenated text has passed validation. Conversely, if the concatenated text is found to not meet the input requirements of the large language model, it is determined that the concatenated text has failed validation.

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

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

[0159] This application obtains concatenated text by splicing the combined text; then it acquires preset prompt verification rules; subsequently, it verifies the concatenated text based on the prompt verification rules; if the concatenated text passes verification, it is used as the target prompt corresponding to the question. This application obtains concatenated text by splicing the combined text, and then intelligently verifies the concatenated text based on the prompt verification rules. Only when the concatenated text passes verification will it be used as the target prompt corresponding to the question, thereby effectively ensuring the accuracy of the generated target prompt data.

[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 mentioned above can be generated by self-pre-training or it can be an open-source large language model, such as ChatGLM-6B.

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

[0164] In this embodiment, the target prompt is used as model input and fed into the aforementioned large language model, so that the large language model can perform reasoning processing on the target prompt and output an encounter result like that of west.

[0165] Receive the response result returned by the large language model.

[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 response to the user's input can be completed by sending the important information from the above response results to the user.

[0169] This application utilizes a pre-defined large language model; then, based on the large language model, it performs reasoning processing on the target prompt to obtain a response result corresponding to the target prompt; subsequently, it receives the response result returned by the large language model; and finally, it sends the response result to the user. After obtaining the user's input question, this application generates a target prompt corresponding to the question by evaluating the model's usage, and then uses the large language model to perform reasoning processing on the target prompt to obtain a response result corresponding to the target prompt. This achieves the goal of improving the predictive processing effect of the large language model by using the target prompt, thereby improving the accuracy of the generated response result. Sending the response result returned by the large language model to the user subsequently helps improve user satisfaction.

[0170] It should be understood that the sequence number of each step in the above embodiments does not imply 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 embodiments of the present invention.

[0171] It should be emphasized that, to further ensure the privacy and security of the aforementioned target information, the target information can also be stored in a node of a blockchain.

[0172] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0173] The embodiments of this 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 that knowledge to obtain optimal results.

[0174] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0175] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These 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 methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).

[0176] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0177] Further reference Figure 3 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of an artificial intelligence-based data generation device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this 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 filtering module 304, a construction module 305, a training module 306, a calculation module 307, and a generation module 308. Wherein:

[0179] Module 301 is used to obtain training samples from a preset question-answer database;

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

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

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

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

[0184] 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] The calculation module 307 is used to obtain the question input by the user and calculate the similarity between the question and all data pairs in the question-answer database based on the evaluation model to obtain the corresponding similarity score;

[0186] The generation module 308 is used to filter out the target data pairs with the highest 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 with the steps of the artificial intelligence-based data generation method in the aforementioned implementation method, and will not be repeated here.

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

[0189] The query submodule is used to perform an inverted index query on the question-answer database based on the training samples to obtain the relevance scores between the training samples and each data pair contained in the question-answer database.

[0190] The first sorting submodule is used to sort all the data pairs based on the relevance score to obtain a corresponding data pair sorting list;

[0191] The first filtering submodule is used to filter a specified number of specified data pairs with the highest relevance scores from the data pair sorting list;

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

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

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

[0195] The second sorting submodule is used to sort the candidate examples based on the preliminary score to obtain the corresponding sorted list;

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

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

[0198] The second determining submodule is used to use the comparison score as the specified score for the specified candidate example.

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

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

[0201] The second filtering submodule is used to filter the second example based on the negative sample filtering strategy to obtain the corresponding third example;

[0202] The third determining submodule is used to treat the third example as the negative sample.

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

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

[0205] The first processing submodule is used to format the target problem to obtain the processed target problem;

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

[0207] The combination submodule is used to combine the processed target question and the processed target answer to obtain the corresponding combined text;

[0208] A generation 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 generation submodule includes:

[0210] The splicing unit is used to splice the combined text to obtain the corresponding spliced ​​text;

[0211] The acquisition unit is used to acquire preset prompt verification rules;

[0212] A verification unit is used to verify the concatenated text based on the prompt verification rules;

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

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

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

[0216] The reasoning module is used to perform reasoning 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 is used to receive the response result returned by the large language model;

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

[0219] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. 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 via a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), digital digital processors (DSPs), embedded devices, etc.

[0221] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.

[0222] The memory 41 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), 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, magnetic disk, optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, smart memory card (SMC), secure digital card (SD) card, flash card, etc. of the computer device 4. Of course, the memory 41 may also include both the internal storage unit and the external storage device of the computer device 4. In this embodiment, the memory 41 is typically used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for data generation methods based on artificial intelligence. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or will be output.

[0223] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or to process data, for example, to execute 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, which is typically used to establish communication connections between the computer device 4 and other electronic devices.

[0225] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the artificial intelligence-based data generation method described above.

[0226] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0227] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.

Claims

1. A data generation method based on artificial intelligence, characterized in that, Includes the following steps: Retrieve training samples from a pre-defined question-answer database; Retrieve candidate examples corresponding to the training samples from the question-answer database; wherein the number of candidate examples is multiple. The candidate examples are scored based on a preset example scoring strategy to obtain the scores of the candidate examples; Select a specified number of first examples with the highest scores from all the candidate examples, and construct positive samples based on the first examples; The positive samples are filtered from the candidate samples to obtain a second sample, and negative samples are constructed based on the second sample; The preset initial evaluation model is trained based on the positive samples and the negative samples to obtain the trained evaluation model; The system obtains the user's input question and calculates the similarity score between the question and all data pairs in the question-answer database based on the evaluation model. Select the target data pairs with the highest similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs; The step of searching for candidate examples corresponding to the training samples from the question-answer database specifically includes: Based on the training samples, an inverted index query is performed on the question-answer database to obtain the relevance scores between the training samples and each data pair contained in the question-answer database. All the data pairs are sorted based on the relevance scores to obtain a sorted list of data pairs. Filter the specified number of specified data pairs with the highest relevance scores from the sorted list of data pairs; The specified data pair is used as the candidate example; The step of scoring the candidate examples based on a preset example scoring strategy to obtain the scores of the candidate examples specifically includes: The candidate examples are scored based on a preset likelihood function to obtain the corresponding preliminary scores; Based on the preliminary score, the candidate examples are sorted to obtain a corresponding sorted list; Obtain a first candidate example and a second candidate example that are adjacent to a specified candidate example in the sorted list; wherein, the specified candidate example is any one of all candidate examples included in the sorted list; The specified candidate example, the first candidate example, and the second candidate example are calculated and processed based on a preset comparison algorithm to obtain the comparison score of the specified candidate example; The comparison score is used as the designated score for the specified candidate example.

2. The data generation method based on artificial intelligence according to claim 1, characterized in that, The step of constructing negative samples based on the second example specifically includes: Obtain the preset negative sample screening strategy; The second example is filtered based on the negative sample filtering strategy to obtain the corresponding third example; The third example is used as the negative sample. 3.The artificial intelligence-based data generation method of claim 1, wherein, The step of generating target prompts corresponding to the question based on the target data specifically includes: Obtain the target question and target answer from the target data pair; The target problem is formatted to obtain the processed target problem; The target answer is formatted to obtain the processed target answer; The processed target question and the processed target answer are combined to obtain the corresponding combined text. Based on the combined text, a target prompt corresponding to the question is generated. 4.The artificial intelligence-based data generation method of claim 3, wherein, The step of generating a target prompt corresponding to the question based on the combined text specifically includes: The combined text is then concatenated to obtain the corresponding concatenated text; Obtain the preset prompt verification rules; The concatenated text is validated based on the aforementioned verification rules; If the concatenated text passes verification, then the concatenated text will be used as the target prompt corresponding to the question. 5.The artificial intelligence-based data generation method of claim 1, wherein, After the step of selecting the target data pairs with the highest similarity scores from all the data pairs and generating target hints corresponding to the question based on the target data pairs, the method further includes: Invoke the preset large language model; Based on the large language model, the target prompt is reasoned to obtain the response result corresponding to the target prompt; Receive the response result returned by the large language model; The response result is sent to the user.

6. An artificial intelligence-based data generation device, characterized by comprising: include: The acquisition module is used to obtain training samples from a pre-defined question-answer database; A search module is used to search for candidate examples corresponding to the training samples from the question-answer database; wherein the number of candidate examples is multiple. The scoring module is used to score the candidate examples based on a preset example scoring strategy to obtain the scores of the candidate examples; A filtering module is used to filter out a specified number of first examples with the highest scores from all the candidate examples, and to construct positive samples based on the first examples; A construction module is used to filter the positive samples from the candidate examples to obtain a second example, and to construct a negative sample based on the second example; The training module is used to train a preset initial evaluation model based on the positive samples and the negative samples to obtain a trained evaluation model. The calculation module is used to obtain the question input by the user and calculate the similarity score between the question and all data pairs in the question-answer database based on the evaluation model. The generation module is used to filter out the target data pairs with the highest similarity scores from all the data pairs, and generate target prompts corresponding to the question based on the target data pairs; The search module includes: The query submodule is used to perform an inverted index query on the question-answer database based on the training samples to obtain the relevance scores between the training samples and each data pair contained in the question-answer database. The first sorting submodule is used to sort all the data pairs based on the relevance score to obtain a corresponding data pair sorting list; The first filtering submodule is used to filter a specified number of specified data pairs with the highest relevance scores from the data pair sorting list; The first determining submodule is used to select the specified data pair as the candidate example; The scoring module includes: The scoring submodule is used to score the candidate examples based on a preset likelihood function to obtain the corresponding preliminary score; The second sorting submodule is used to sort the candidate examples based on the preliminary score to obtain the corresponding sorted list; The first acquisition submodule is used to acquire a first candidate example and a second candidate example that are adjacent to a specified candidate example in the sorting list; wherein, the specified candidate example is any one of all candidate examples included in the sorting list; The calculation submodule is used to perform calculation processing on the specified candidate example, the first candidate example and the second candidate example based on a preset comparison algorithm to obtain the comparison score of the specified candidate example; The second determining submodule is used to use the comparison score as the specified score for the specified candidate example.

7. A computer device, characterized by It includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the data generation method based on artificial intelligence as described in any one of claims 1 to 5.

8. 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 data generation method based on artificial intelligence as described in any one of claims 1 to 5.