Large model prompt data processing method and device, electronic equipment and storage medium
By dynamically generating target prompts, the problem of insufficient accuracy of existing prompts is solved, and the accuracy of answers generated by large models in database query statements is improved.
Patent Information
- Application Number
- CN202311754725.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-19
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-12-19
AI Technical Summary
The accuracy of existing prompts is low, resulting in the output of large models not meeting user needs, especially when generating database query statements, where existing methods cannot accurately determine the specific requirements of user requests.
By obtaining the target prompt question, determining the matching target retrieval database, performing a search to obtain the target retrieval results, and concatenating them with the basic prompt to generate the target prompt, the system dynamically generates question and answer examples to improve accuracy.
It improves the accuracy of model-suggested data, ensuring the precision of the answers output by large models, especially when generating database query statements, thus better meeting user needs.
Smart Images

Figure CN117633194B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, specifically to artificial intelligence, natural language processing, and large model technology. Background Technology
[0002] Currently, large-scale models have achieved significant results in artificial intelligence fields such as natural language processing, computer vision, and speech recognition. A "prompt" is text or instructions provided to a large-scale model to guide it in generating specific outputs. It is a text paragraph provided by the user when interacting with the large-scale model, describing the information, responses, and text the user wants to obtain from the model. The purpose of a prompt is to guide the large-scale model to produce the desired response, allowing for better control over the generated output. The appropriateness of the prompt directly affects the accuracy of the large-scale model's output. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, and storage medium for processing large model hint data, which can improve the accuracy of model hint data and thus improve the accuracy of large models outputting answers based on model hint data.
[0004] In a first aspect, embodiments of this disclosure provide a method for processing large model hint data, including:
[0005] Obtain the target prompt question and determine the target retrieval database that matches the target prompt question;
[0006] The target retrieval database is searched based on the target prompt question to obtain target retrieval results matching the target prompt question; wherein, the target retrieval results include the target retrieval question and the target retrieval answer;
[0007] The target retrieval result is concatenated with the basic prompt of the target suggestion question to obtain the target prompt.
[0008] Secondly, embodiments of this disclosure provide a large model hint data processing apparatus, including:
[0009] The target retrieval database determination module is used to obtain the target prompt question and determine the target retrieval database that matches the target prompt question;
[0010] The target retrieval result acquisition module is used to search the target retrieval database based on the target prompt question to obtain the target retrieval result matching the target prompt question; wherein, the target retrieval result includes the target retrieval question and the target retrieval answer;
[0011] The target prompt acquisition module is used to concatenate the target retrieval results with the basic prompt of the target prompt question to obtain the target prompt.
[0012] Thirdly, embodiments of this disclosure provide an electronic device, including:
[0013] At least one processor; and
[0014] A memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the large model hint data processing method provided in the first aspect embodiment.
[0016] Fourthly, embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the large model hint data processing method provided in the first aspect embodiment.
[0017] Fifthly, this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the large model hint data processing method provided in the first aspect embodiment.
[0018] This embodiment of the disclosure obtains the target prompt question, determines the target retrieval database matching the target prompt question, and searches the target retrieval database according to the target prompt question to obtain target retrieval results that match the target prompt question, including the target retrieval question and the target retrieval answer. Then, the target retrieval results are used as example questions and answers, and concatenated with the basic prompt of the target prompt question to obtain the target prompt prompt. Since the example questions and answers in the target prompt prompt are dynamically generated based on the target prompt question, they better meet the answer generation requirements of the target prompt question. This can solve the problem that existing prompt prompts have low accuracy, leading to unsatisfactory answers output by large models, thus improving the accuracy of model prompt data and consequently improving the accuracy of answers output by large models based on model prompt data.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0020] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0021] Figure 1 This is a flowchart of a large model hint data processing method provided in an embodiment of this disclosure;
[0022] Figure 2 This is a flowchart of a large model hint data processing method provided in an embodiment of this disclosure;
[0023] Figure 3 This is a flowchart illustrating an example of an SQL generation prompt based on a large language model pre-generated in an embodiment of this disclosure;
[0024] Figure 4 This is a flowchart of a large model hint data processing method provided in an embodiment of this disclosure;
[0025] Figure 5 This is a flowchart illustrating an example of generating a prompt based on a question-and-answer text vector database provided in this embodiment of the disclosure;
[0026] Figure 6 This is a structural diagram of a large model prompting data processing device provided in an embodiment of this disclosure;
[0027] Figure 7 This is a schematic diagram of the structure of an electronic device used to implement the large model prompting data processing method of the present disclosure embodiments. Detailed Implementation
[0028] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0029] Currently, prompts for input models typically include two generation methods: zero-shot (without examples) or few-shot (with static examples). However, the prompts generated by these methods are not strongly correlated with the actual answer that needs to be given.
[0030] In a specific example, let's take the generation of a database query statement using a large model based on a prompt (Structured Query Language). A prompt without an example can include the following:
[0031] The existing MySQL table `project` contains engineering information. Please write an SQL statement to answer the question based on the problem.
[0032] ```
[0033] CREATE TABLE `Project`(
[0034] `id` varchar(32) NOT NULL COMMENT 'Engineering No.',
[0035] `name` varchar(128) DEFAULT NULL COMMENT 'Construction Unit Name',
[0036] `status` varchar(32) DEFAULT NULL COMMENT 'Engineering Status',
[0037] `location` text COMMENT 'Engineering Location',
[0038] `revenue` int(11) DEFAULT NULL COMMENT 'Engineering Revenue', )
[0040] ```
[0041] Question: Please list all projects where the construction unit is Engineering Department 1
[0042] The above prompt example does not include sample content, causing the large model to be unable to accurately determine the user's specific requirements for generating SQL statements based on this prompt.
[0043] Correspondingly, a prompt providing static examples may include the following content:
[0044] The existing MySQL table `project` contains engineering information. Please write an SQL statement to answer the question based on the problem.
[0045] ```
[0046] CREATE TABLE `project`(
[0047] `id` varchar(32) NOT NULL COMMENT 'Engineering No.',
[0048] `name` varchar(128) DEFAULT NULL COMMENT 'Construction Unit Name',
[0049] `status` varchar(32) DEFAULT NULL COMMENT 'project status',
[0050] `location` text COMMENT 'project location',
[0051] `revenue` int(11) DEFAULT NULL COMMENT 'project revenue', )
[0053] ```
[0054] Please refer to the following specific example:
[0055] Question: Please provide information on all uncompleted projects
[0056] Answer:
[0057] ```sql
[0058] select * from project where status != 'completed'
[0059] ```
[0060] Question: Please list all projects where the construction unit is Engineering Department 1
[0061] In the above few-shot example, the example content includes:
[0062] ```sql
[0063] select * from project where status != 'completed'
[0064] ```
[0065] However, the example required for the answer to the user's question is:
[0066] ```sql
[0067] select * from project where name = 'Engineering Department 1'
[0068] ```
[0069] In addition, if the answer to the user's requirement involves SQL functions such as group by (grouping statistics) or sum (summing), the answer content output by the large model based on static examples will also differ significantly from the given examples.
[0070] Therefore, existing prompts without examples or static examples may not match the questions raised by users, and the role of large models in providing answer data based on current prompts is very limited.
[0071] In one example Figure 1 This is a flowchart of a large model prompt data processing method provided in this embodiment. This embodiment is applicable to situations where prompts are generated based on dynamically generated examples. This method can be executed by a large model prompt data processing device, which can be implemented in software and / or hardware and is generally integrated into an electronic device. This electronic device can be a terminal device or a server device, as long as it can be used for data processing and cooperate with a large model. This embodiment does not limit the specific type of electronic device. Accordingly, as... Figure 1 As shown, the method includes the following operations:
[0072] S110. Obtain the target prompt question and determine the target retrieval database that matches the target prompt question.
[0073] The target prompt question can be a prompt question that needs to be input into a large model. The target retrieval database can be a database used to determine the example content corresponding to the target prompt question.
[0074] In this embodiment of the disclosure, after determining the target prompt question to be input into the large model, a target retrieval database matching the target prompt question can be determined first. Optionally, the target retrieval database can be pre-built, for example, by collecting various sets of question and answer data to construct the target retrieval database based on each set of data. Each set of data in the target retrieval database can include a question and a corresponding answer, wherein the number of answers corresponding to the question can be one or more. The type of target retrieval database can be configured according to actual needs. For example, it can be a text vector database, or a database constructed from keywords, key words, and short phrases, as long as it can be used to provide retrieval matching functionality for the target prompt question to output corresponding example content. This embodiment of the disclosure does not limit the type of target retrieval database or the data content and data type stored in the target retrieval database.
[0075] Optionally, the type of target prompt question can be arbitrary. For example, a target prompt question can be used to prompt the target model to generate database query statements, i.e., SQL statements; a target prompt question can also be used to prompt the target model to generate programming statements or programs corresponding to a certain programming language; or, a target prompt question can also be used to prompt the target model to generate strategy content in a certain aspect, such as business processing flow, knowledge point answering process, food preparation tutorial, or weight loss schedule.
[0076] S120. Search the target retrieval database according to the target prompt question to obtain the target retrieval result matching the target prompt question; wherein, the target retrieval result includes the target retrieval question and the target retrieval answer.
[0077] The target search results are the results obtained by inputting the target query as a query into the target search database. The target search question can be one of the questions included in the target search results. The target search answer can be one of the answers included in the target search results. The target search question and target search answer form a data set of questions and answers. The target search answer can be used to answer the target search question.
[0078] Because the target retrieval database stores data sets of various questions and answers, when a target hint question is input into the database for matching, the search results will include both the target retrieval question and the target retrieval answer. The content of the target retrieval question and the target hint question can be the same or different. Understandably, since the data stored in the target retrieval database is pre-processed, in most cases, the target retrieval question and the target hint question will match in type, but the included question content may differ. However, the target retrieval answer must match the target retrieval question and can serve as a standard reference for solving the target retrieval question.
[0079] In a specific example, taking the generation of SQL statements as an illustration, suppose the target prompt question is "Question: Please list all projects where the construction company is Engineering Department One". Then, the target search results retrieved from the target search database based on this target prompt question could be:
[0080] Question: Please list all projects for which the construction company is the Second Engineering Department.
[0081] answer:
[0082] SQL
[0083] SELECT * FROM project WHERE name = 'Engineering Department 2'
[0084] ```
[0085] In the example above, the target search question is "Question: Please list all projects for which the construction company is the Engineering Department II", and the target search answer is:
[0086] SQL
[0087] SELECT * FROM project WHERE name = 'Engineering Department 2'
[0088] ```
[0089] In another specific example, the translation scenario is taken as an example for illustration. Assuming the target prompt question is "Question: Please translate "你好" into English", then the target retrieval result retrieved from the target retrieval database based on the target prompt question can be:
[0090] Question: Please translate "早上好" into English
[0091] Answer: Good Morning!
[0092] In the above example, the target retrieval question is "Please translate "你好" into English", and the target retrieval answer is "Good Morning!".
[0093] S130: Concatenate the target retrieval result with the basic prompt of the target prompt question to obtain the target prompt.
[0094] The basic prompt can be a prompt composed of basic data and the target prompt question, without example content. The basic data can be data that provides reference or analysis for the target prompt question. The target prompt can be a prompt obtained by combining the target retrieval result and the basic prompt.
[0095] Correspondingly, after the target retrieval result is retrieved, the target retrieval result can be used as dynamic example content and added to the basic prompt of the target prompt question to obtain the target prompt through concatenation.
[0096] In a specific example, the target prompt can be the following content:
[0097] The existing mysql table project contains engineering information. Please write the sql statement to answer the question according to the question.
[0098] ```
[0099] CREATE TABLE `project` (
[0100] `id` varchar(32) NOT NULL COMMENT 'Project No.',
[0101] `name` varchar(128) DEFAULT NULL COMMENT 'Construction Unit Name',
[0102] `status` varchar(32) DEFAULT NULL COMMENT 'Project Status',
[0103] `location` text COMMENT 'Project Location',
[0104] `revenue` int(11) DEFAULT NULL COMMENT 'Project Revenue', )
[0106] ```
[0107] Please refer to the specific example below:
[0108] Question: Please list all projects where the construction unit is the First Construction Department
[0109] Answer:
[0110] ```sql
[0111] select * from project where name = 'First Construction Department'
[0112] ```
[0113] Question: Please list all projects where the construction unit is the First Engineering Department
[0114] In the above target prompt, the target prompt question is "Please list all projects where the construction unit is the First Engineering Department". The content of the base prompt for the target prompt question is:
[0115] The existing MySQL table project contains project information. Please write the SQL statement to answer the question based on the question.
[0116] ```
[0117] CREATE TABLE `project` (
[0118] `id` varchar(32) NOT NULL COMMENT 'Project Number',
[0119] `name` varchar(128) DEFAULT NULL COMMENT 'Construction Unit Name',
[0120] `status` varchar(32) DEFAULT NULL COMMENT 'Project Status',
[0121] `location` text COMMENT 'Project Location',
[0122] `revenue` int(11) DEFAULT NULL COMMENT 'Project Revenue', )
[0124] ```
[0125] Please refer to the specific example below:
[0126] The content of the target retrieval result is:
[0127] Question: Please list all projects where the construction unit is Construction Department 1
[0128] Answer:
[0129] ```sql
[0130] select * from project where name = 'Construction Department 1'
[0131] ```
[0132] It can be seen that, since the target prompt includes question-answer examples that meet the answer requirements of the target prompt question, after the target prompt is input into the large model, the large model can parse the received target prompt, and refer to the example content such as the target retrieval question and target retrieval answer in the target prompt, to output the answer content matching the target prompt question, and the accuracy of the output answer content is higher.
[0133] In the embodiment of the present disclosure, after the target prompt question is obtained, the target retrieval database matching the target prompt question is determined, and the target retrieval database is retrieved according to the target prompt question, to obtain a target retrieval result matching the target prompt question and including the target retrieval question and the target retrieval answer, and then the target retrieval result is used as a question-answer example, which is concatenated with the basic prompt of the target prompt question to obtain the target prompt. Since the question-answer example in the target prompt is dynamically generated based on the target prompt question, it is more in line with the answer generation requirements of the target prompt question, and can solve the problem that the answer output by the large model does not meet the requirements due to low accuracy of the existing prompt, which can improve the accuracy of the model prompt data, and further improve the accuracy of the answer output by the large model based on the model prompt data.
[0134] In one example, Figure 2This is a flowchart of a large model prompt data processing method provided in this disclosure embodiment. Based on the technical solutions of the above embodiments, this disclosure embodiment has made optimizations and improvements, using the target skeleton feature database as the target retrieval database, and provides a variety of specific optional implementation methods for retrieving the target retrieval database according to the target prompt question to obtain the target retrieval results matching the target prompt question.
[0135] like Figure 2 The large model hint data processing method shown includes:
[0136] S210. Obtain the target prompt question and determine the target skeleton feature database that matches the target prompt question.
[0137] In an optional embodiment of this disclosure, the target retrieval database may include a target skeleton feature database, wherein the data in the target skeleton feature database may be a combination of questions, answers, and skeleton features.
[0138] The target skeleton feature database stores data sets that can include not only questions and corresponding answer data, but also skeleton features. Skeleton features can be understood as features composed of keywords, key fields, or key text vector information in the data. Optionally, skeleton features can be features corresponding to the answer data in the data set.
[0139] Optionally, the target skeleton feature database can be pre-configured. For example, when using a large model to output SQL statements, the query can be used as the question, the corresponding SQL statement as the answer, and the key fields of the SQL statement as skeleton features, thus constructing a data set consisting of "query + SQL statement + SQL skeleton features". When using a large model to output program content of a certain language type, the program function or program type can be used as the question, the corresponding program content as the answer, and the key fields of the program content as skeleton features, thus constructing a data set consisting of "program function (or program type) + program content + program content skeleton features".
[0140] S220. Determine the initial prompt for the target prompt question.
[0141] The initial prompt can be a preliminary prompt built based on the target prompt question. Optionally, the initial prompt may include static examples, or it may not include examples.
[0142] In this embodiment of the disclosure, when it is determined that the target skeleton feature database is used as the target retrieval database, after obtaining the target prompt question, a corresponding primary prompt can be generated based on the target prompt question.
[0143] In an optional embodiment of this disclosure, determining the initial prompt of the target prompt question may include: determining the example content of the question answer in the initial prompt; and concatenating the example content of the question answer in the initial prompt and the basic data of the initial prompt to obtain the initial prompt.
[0144] The example content of the initial prompt can be static, including both the question and its corresponding answer. Static example content means that the question and answer content in the example content may not necessarily match the target prompt question perfectly. For example, the example content of the initial prompt can be randomly generated based on the technical field of the target prompt question. The base data of the initial prompt can be the base data corresponding to the target prompt question.
[0145] Optionally, the initial prompt can consist of basic data, the target prompt question, and static example content. The static example content can be empty or not. By constructing the initial prompt and inputting it into a large model for processing, the output answer corresponding to the target prompt question can be pre-generated. This facilitates the use of the intelligent and automated performance of the large model to automatically preprocess the answer content of the target prompt question.
[0146] In a specific example, suppose the target prompt is "Please list all projects for which the construction company is Engineering Department One". Based on the target prompt, a primary prompt without example content can be generated. The primary prompt can include the following:
[0147] The existing MySQL table 'project' contains project information. Please write the SQL statement to answer this question.
[0148] ```
[0149] CREATE TABLE `Project`(
[0150] `id`varchar(32)NOT NULL COMMENT'Project Number',
[0151] `name`varchar(128)DEFAULT NULL COMMENT'Construction Unit Name',
[0152] `status` varchar(32) DEFAULT NULL COMMENT 'Project Status',
[0153] `location` text COMMENT 'Project Location',
[0154] `revenue` int(11) DEFAULT NULL COMMENT 'Project Revenue', )
[0156] ```
[0157] Question: Please list all projects where the construction unit is Engineering Department 1
[0158] Optionally, a primary prompt including static sample content may also be generated based on the target prompt question described above, and the primary prompt may include the following content:
[0159] The existing MySQL table "project" contains project information. Please write an SQL statement to answer this question based on the problem description.
[0160] ```
[0161] CREATE TABLE `project` (
[0162] `id` varchar(32) NOT NULL COMMENT 'Project ID',
[0163] `name` varchar(128) DEFAULT NULL COMMENT 'Construction Unit Name',
[0164] `status` varchar(32) DEFAULT NULL COMMENT 'Project Status',
[0165] `location` text COMMENT 'Project Location',
[0166] `revenue` int(11) DEFAULT NULL COMMENT 'Project Revenue', )
[0168] ```
[0169] Please refer to the specific example below:
[0170] Question: Please provide information on all projects that have not been completed
[0171] Answer:
[0172] SQL
[0173] select*from project where status! ='Complete'
[0174] ```
[0175] Question: Please list all projects for which the construction company is Engineering Department 1.
[0176] S230. Input the initial prompt into the target large model to generate an initial example answer through the target large model.
[0177] The target large model can be any type of large model capable of processing prompts and outputting corresponding answers, such as GPT (Generative Pre-Training) or LLM (Large Language Model) models. This embodiment does not limit the type of the target large model.
[0178] The initial example answer can be the answer pre-generated by the target model based on the initial prompt after the initial prompt is input into the target model.
[0179] Understandably, because the example content in the primary prompt is empty or static, the initial example answer output by the target model based on the primary prompt has a low degree of fit with the target prompt question.
[0180] S240. Calculate the answer skeleton features of the initial example answer.
[0181] Among them, the answer skeleton feature can be a feature composed of key information extracted from the initial example answer.
[0182] Accordingly, after obtaining the initial example answer, the answer skeleton features of the initial example answer can be extracted. It is understandable that the answer skeleton features can effectively reflect the key features of the initial example answer.
[0183] In an optional embodiment of this disclosure, calculating the answer skeleton features of the initial example answer may include: extracting keywords and semantic vectors of the initial example answer; and generating the answer skeleton features of the initial example answer based on the keywords and semantic vectors of the initial example answer.
[0184] In a specific example, taking the generation of SQL statements from a large model as an illustration, the SQL statements pre-generated by the large model are used as initial example answers, and the SQL skeleton features in the pre-generated SQL statements are extracted. Optionally, the SQL skeleton features may include at least one of the following:
[0185] 1) SQL functions, such as SUM, COUNT (a function that counts the number of cells containing numbers and the number of numbers in a parameter list), GROUP BY, and SORDER (a function that sorts array elements), etc.
[0186] 2) Column names included in the SQL statement;
[0187] 3) The comparison conditions used in SQL, such as LIKE, =", "<", and ">".
[0188] 4) Vectors with SQL semantics.
[0189] The above technical solution extracts key information such as keywords and semantic vectors from the initial example answer as answer skeleton features. This allows the answer skeleton features to include rich feature information from the initial example answer, thereby improving the matching degree between the target retrieval results and the target prompt question. It can be understood that the richer the answer skeleton features, the higher the matching degree between the target retrieval results and the target prompt question. The higher the matching degree between the target retrieval results and the target prompt question, the more significant the positive impact of the target retrieval results on the large model's generation of the target answer.
[0190] S250. Search the target skeleton feature database according to the answer skeleton features to obtain the target retrieval result matching the target prompt question.
[0191] Accordingly, after calculating the skeleton features of each answer in the initial example answer, these skeleton features can be used as queries and input into the target skeleton feature database for retrieval and matching. Optionally, there can be one or more answer skeleton features. Based on each answer skeleton feature, multiple retrieval results can be retrieved from the target skeleton feature database. After obtaining the retrieval results of each answer skeleton feature in the target skeleton feature database, these results can be filtered, and the retrieval result that best matches the target prompt question can be selected as the target retrieval result.
[0192] The above technical solution utilizes a target large model to pre-generate initial example answers for a primary prompt constructed based on the target prompt question. Then, based on the answer skeleton features of the initial example answers, it searches the target skeleton feature database to obtain the target retrieval question and target retrieval answer that match the target prompt question, which are then used as the final target retrieval results. These target retrieval results are added as example content to the basic prompt question of the target prompt question, enabling dynamic example configuration in the prompt question and improving the relevance and fit between the prompt question and the target prompt question.
[0193] In one optional embodiment of this disclosure, the step of retrieving the target skeleton feature database based on the answer skeleton features to obtain the target retrieval result matching the target prompt question may include: retrieving the target skeleton feature database based on the answer skeleton features to obtain multiple candidate retrieval results; and determining the target retrieval result based on the statistical quantity of each candidate retrieval result.
[0194] Among them, the alternative search results are preliminary search results obtained by searching the target skeleton feature database based on the answer skeleton features.
[0195] Understandably, each answer skeleton feature can correspond to one or more alternative search results. The alternative search results retrieved for each answer skeleton feature can be the same, different, or partially the same. Therefore, after retrieving multiple alternative search results from the target skeleton feature database based on the answer skeleton features, the number of searches corresponding to each alternative search result can be counted to obtain the statistical count of each alternative search result. Then, the target search result can be selected from the alternative search results based on the statistical count of each alternative search result.
[0196] Understandably, the statistical count of alternative search results can effectively reflect their matching degree with the target prompt question. A larger statistical count of alternative search results indicates a higher recall rate, a higher relevance and fit with the target prompt question, and in other words, a higher accuracy of the target prompt constructed using the alternative search results as example content. Therefore, the accuracy of target search results determined based on the statistical count of each alternative search result is relatively high.
[0197] In one optional embodiment of this disclosure, determining the target search result based on the statistical quantity of each of the candidate search results may include: determining the target candidate search result based on the statistical quantity of each of the candidate search results; and, if it is determined that the target candidate search result is unique, using the target candidate search result as the target search result.
[0198] Among them, the target candidate search results can be the candidate search results with the largest number of statistical values.
[0199] In this embodiment of the disclosure, after analyzing and statistically obtaining the statistical quantity of each candidate search result, the statistical quantity of each candidate search result can be further analyzed, and the candidate search result corresponding to the maximum value of the statistical quantity can be determined as the target candidate search result. Furthermore, if there is only one target candidate search result, there is no need to perform further filtering, and that target candidate search result can be directly used as the target search result.
[0200] In a specific example, suppose the candidate search results corresponding to answer skeleton feature 1 are results A and B, the candidate search results corresponding to answer skeleton feature 2 are results A and C, and the candidate search results corresponding to answer skeleton feature 3 are results A and D. Then the statistical number of candidate search results A is 3, and the value of this statistical number is the largest. Therefore, result A can be directly used as the target search result.
[0201] In one optional embodiment of this disclosure, determining the target search result based on the statistical quantity of each of the candidate search results may include: determining the target candidate search result based on the statistical quantity of each of the candidate search results; when there are multiple target candidate search results, calculating the text similarity between the target search question and the target hint question of the target candidate search result; and determining the target search result from each of the target candidate search results based on the ranking result of the text similarity.
[0202] Furthermore, if there are multiple target candidate search results, i.e., multiple maximum statistical values, then a second round of filtering is needed to determine the target search result. This second filtering can be performed by first calculating the text similarity between the target search question and the target suggestion question for each candidate search result, then ranking the calculated text similarity scores, and selecting the candidate search result with the highest text similarity value as the target search result.
[0203] In a specific example, suppose the candidate search results corresponding to answer skeleton feature 1 are result A and result B, the candidate search results corresponding to answer skeleton feature 2 are result A and result C, and the candidate search results corresponding to answer skeleton feature 3 are result B and result D. Then the statistical count of result A and result B is 2, and the value of this statistical count is the largest. Therefore, result A and result B can be used as the target search results.
[0204] In a concrete example, let's take generating SQL statements using a large model as an illustration. Assume the target query is `query0`. If there are two candidate search results, one including `queryA+sqlA` and the other including `queryB+sqlB`, we can calculate the text similarity between `query0` and `queryA`, obtaining similarity result A, and the text similarity between `query0` and `queryB`, obtaining similarity result B. Furthermore, we determine the relationship between similarity results A and B. If the value of similarity result A is greater than the value of similarity result B, then `queryA+sqlA` can be used as the target search result.
[0205] The above technical solution, when there are multiple target candidate search results, can further improve the matching degree between target search results and target prompt questions by calculating the text similarity between the target search question included in each target candidate search result and the target prompt question, and by performing secondary screening of each target candidate search result based on the text similarity.
[0206] S260. The target retrieval result is concatenated with the basic prompt of the target prompt question to obtain the target prompt.
[0207] In an optional embodiment of this disclosure, after obtaining the target prompt, the method may further include: inputting the target prompt into the target large model to obtain the target answer output by the target large model based on the target prompt; and performing target data processing operations based on the target answer.
[0208] The target answer can be the output of the target model after parsing and processing the target prompt. The target data processing operation can be a certain type of data operation that needs to be performed.
[0209] Accordingly, after receiving the target prompt, it can be input into the target model. The target model parses and processes the received target prompt, specifically analyzing the target question in the prompt by referring to the example content of the target retrieval results, and then outputs the target answer corresponding to the target question in the prompt. Users can then perform some target data processing operations based on the target answer corresponding to the target question.
[0210] The above technical solution performs target data processing operations on the target answer output by the target prompt through the target large model. It can improve the efficiency of target data processing operations by leveraging the intelligence and automation performance of the target large model.
[0211] For example, when the target prompt question instructs the target big model to generate the corresponding SQL statement, the user can process the data in the database based on the SQL statement output by the target big model, such as performing data processing operations like extracting, updating, deleting, inserting, and creating data. Therefore, even if the user lacks SQL skills, they can quickly and accurately perform data processing operations on the database as needed using the target big model.
[0212] For example, when a target prompt question instructs the target model to generate a corresponding software program, the user can perform corresponding data processing operations on the software program output by the target prompt based on the target model. This could involve using a log monitoring program to perform real-time log monitoring of the system logs, or using a ticketing program to purchase tickets online. Therefore, even if a user lacks software development capabilities, they can quickly and accurately obtain the corresponding software program using the target model and perform data processing operations as needed.
[0213] Currently, the technology for converting natural language into SQL statements is abbreviated as nl2sql (Natural Language to Structured Query Language). nl2sql solutions can be generated using a large language model, requiring a prompt to be input into the large language model to generate the nl2sql. This disclosure provides a solution for database question answering based on natural language processing. Figure 3 This is a flowchart illustrating an example of a SQL generation prompt based on a large language model pre-generated in an embodiment of this disclosure. In a specific example, such as... Figure 3 As shown, taking the application scenario of generating SQL statements from a target large model as an example, the above-mentioned large model-driven data processing method can include the following operations:
[0214] Step 1: Take the input query as the target prompt question, and use a method without examples or static examples to construct a primary prompt. Then, input the primary prompt into the large language model so that the large language model can pre-generate the initial SQL based on the primary prompt.
[0215] Step 2: Based on the initial SQL pre-generated in Step 1, calculate the SQL skeleton features. Optionally, the SQL skeleton features may include at least one of the following:
[0216] 1) SQL functions, such as SUM, COUNT, GROUP BY, and SORDER;
[0217] 2) The column names included in the SQL statement;
[0218] 3) The comparison conditions used in SQL, such as LIKE;
[0219] 4) Vectors with SQL semantics.
[0220] Step 3: Based on the SQL skeleton features generated in Step 2, perform a retrieval and recall operation on the SQL skeleton database to obtain multiple candidate query / SQL results. Further, rank the candidate query / SQL results by their statistical count, and select the SQL with the highest statistical count as the target retrieval result. If there are multiple SQLs with the highest statistical count, calculate the similarity between the query corresponding to the SQL with the highest statistical count and the input query. Use the calculated similarity as the basis for a secondary ranking, and select the query / SQL result with the highest similarity as the final example content.
[0221] This will give you sample query / SQL information, which can be used as a dynamically generated example and appended to the prompt along with the input query to get the target prompt.
[0222] The above technical solution utilizes a large model to pre-generate a primary prompt for the target prompt question. Based on the answer skeleton features of the initial example answer, it searches the target skeleton feature database to obtain multiple candidate search results matching the target prompt question. Furthermore, it determines the target search result based on the statistical quantity of each candidate search result. This target search result is then used as example content and concatenated with the basic prompt of the target prompt question to obtain the target prompt. This achieves a dynamic generation of example content in the prompt, making the generated prompt more reasonable and improving the accuracy of the model's prompt data. Ultimately, this enhances the accuracy of the large model's output answer based on the model's prompt data.
[0223] In one example Figure 4 This is a flowchart of a large model prompt data processing method provided in this disclosure embodiment. This disclosure embodiment optimizes and improves upon the technical solutions of the above embodiments, using a question-answer text vector database as the target retrieval database, and provides various specific optional implementation methods for retrieving the target retrieval database based on the target prompt question to obtain the target retrieval results matching the target prompt question.
[0224] likeFigure 4 The large model hint data processing method shown includes:
[0225] S310. Obtain the target prompt question and determine the question answer text vector database that matches the target prompt question.
[0226] S320. Calculate the text similarity between the target prompt question and each search object in the target retrieval database.
[0227] The question-answer text vector database can be a pre-built database of question and answer data, which stores the semantic vector information of the question and answer data. The retrieval objects in the target retrieval database can be groups of semantic vector data of questions and answers.
[0228] S330. Based on the text similarity between the target prompt question and each search object in the target retrieval database, determine the target retrieval result that matches the target prompt question.
[0229] Understandably, while dynamically generated example content, obtained by pre-generating initial example answers to the target hint question using a large model, is closer to the target hint question in terms of accuracy and reasonableness, there may be a performance penalty due to the secondary application of the large model. If performance is a concern, the question-answer text vector database can be used as the target retrieval database. After obtaining the target hint question, the database can be directly searched and matched against it. During this process, the text similarity between the target hint question and the questions included in the target retrieval database can be calculated, and the retrieval object with the highest text similarity interpretation result can be used as the target retrieval result matching the target hint question.
[0230] S340. The target retrieval result is concatenated with the basic prompt of the target prompt question to obtain the target prompt.
[0231] In an optional embodiment of this disclosure, after obtaining the target prompt, the method may further include: inputting the target prompt into the target large model to obtain the target answer output by the target large model based on the target prompt; and performing target data processing operations based on the target answer.
[0232] Accordingly, after receiving the target prompt, it can be input into the target model. The target model parses and processes the received target prompt, specifically analyzing the target question in the prompt by referring to the example content of the target retrieval results, and then outputs the target answer corresponding to the target question in the prompt. Users can then perform some target data processing operations based on the target answer corresponding to the target question.
[0233] The above technical solution performs target data processing operations on the target answer output by the target prompt through the target large model. It can improve the efficiency of target data processing operations by leveraging the intelligence and automation performance of the target large model.
[0234] For example, when the target prompt question instructs the target big model to generate the corresponding SQL statement, the user can process the data in the database based on the SQL statement output by the target big model, such as performing data processing operations like extracting, updating, deleting, inserting, and creating data. Therefore, even if the user lacks SQL skills, they can quickly and accurately perform data processing operations on the database as needed using the target big model.
[0235] For example, when a target prompt question instructs the target model to generate a corresponding software program, the user can perform corresponding data processing operations on the software program output by the target prompt based on the target model. This could involve using a log monitoring program to perform real-time log monitoring of the system logs, or using a ticketing program to purchase tickets online. Therefore, even if a user lacks software development capabilities, they can quickly and accurately obtain the corresponding software program using the target model and perform data processing operations as needed.
[0236] Figure 5 This is a flowchart illustrating an example of generating a prompt based on a question-and-answer text vector database, as provided in this embodiment of the disclosure. In a specific example, such as... Figure 5 As shown, taking the application scenario of generating SQL statements from a target large model as an example, the above-mentioned large model-driven data processing method can include the following operations:
[0237] Step 1: Build an offline text vector database for queries / sql, where queries in the query / sql data group can be semantically vectorized.
[0238] Step 2: Determine the query that needs to be input into the large model.
[0239] Step 3: When it is necessary to generate the SQL corresponding to the query using the large model, retrieve the target retrieval query that matches the query from the query / SQL text vector database. The target retrieval query has a high similarity to the query input to the large model.
[0240] Step 4: Determine the target retrieval SQL corresponding to the target retrieval query in the text vector database based on the target retrieval query, and obtain the retrieved query / SQL pair.
[0241] Step 5: Build a basic prompt based on the query, and add the retrieved query / SQL as an example pair to the basic prompt to obtain the final target prompt.
[0242] Step 6: Input the target prompt into the large model so that the large model can reference the example content in the target prompt and output the matching SQL answer for the query included in the target prompt.
[0243] The above technical solution uses a question-and-answer text vector database as the target retrieval database. It then searches this database based on the target prompt question to obtain target retrieval results matching the target prompt question, including both the target retrieval question and the target retrieval answer. These target retrieval results are then used as example questions / answers and concatenated with the base prompt of the target prompt question to obtain the target prompt. Since the example questions / answers in the target prompt are dynamically generated based on the target prompt question, they better meet the answer generation requirements of the target prompt question. This solves the problem of low accuracy in existing prompts, which leads to unsatisfactory answers output by large models. It not only reduces the performance requirements for model prompt data generation but also improves the accuracy and generation efficiency of model prompt data, thereby increasing the accuracy of answers output by large models based on the model prompt data.
[0244] It should be noted that any arrangement or combination of the technical features in the above embodiments also falls within the protection scope of this disclosure.
[0245] In one example Figure 6This is a structural diagram of a large model prompt data processing device provided in an embodiment of this disclosure. This embodiment is applicable to situations where prompts are generated based on dynamically generated examples. The device is implemented through software and / or hardware and is specifically configured in an electronic device. This electronic device can be a terminal device or a server device, as long as it can be used for data processing and cooperate with a large model. This embodiment does not limit the specific type of electronic device.
[0246] like Figure 6 The large model prompt data processing device 400 shown includes: a target retrieval database determination module 410, a target retrieval result acquisition module 420, and a target prompt acquisition module 430. Among them,
[0247] The target retrieval database determination module 410 is used to obtain the target prompt question and determine the target retrieval database that matches the target prompt question;
[0248] The target retrieval result acquisition module 420 is used to search the target retrieval database according to the target prompt question to obtain the target retrieval result matching the target prompt question; wherein, the target retrieval result includes the target retrieval question and the target retrieval answer;
[0249] The target prompt acquisition module 430 is used to concatenate the target retrieval result with the basic prompt of the target prompt question to obtain the target prompt.
[0250] This embodiment of the disclosure obtains the target prompt question, determines the target retrieval database matching the target prompt question, and searches the target retrieval database according to the target prompt question to obtain target retrieval results that match the target prompt question, including the target retrieval question and the target retrieval answer. Then, the target retrieval results are used as example questions and answers, and concatenated with the basic prompt of the target prompt question to obtain the target prompt prompt. Since the example questions and answers in the target prompt prompt are dynamically generated based on the target prompt question, they better meet the answer generation requirements of the target prompt question. This can solve the problem that existing prompt prompts have low accuracy, leading to unsatisfactory answers output by large models, thus improving the accuracy of model prompt data and consequently improving the accuracy of answers output by large models based on model prompt data.
[0251] Optionally, the target retrieval database includes a target skeleton feature database, wherein the data in the target skeleton feature database is a combination of questions, answers, and skeleton features; the target retrieval result acquisition module 420 is specifically used for: determining the initial prompt of the target prompt question; inputting the initial prompt question into the target large model to generate an initial example answer through the target large model; calculating the answer skeleton features of the initial example answer; and retrieving the target skeleton feature database based on the answer skeleton features to obtain the target retrieval result matching the target prompt question.
[0252] Optionally, the target retrieval result acquisition module 420 is specifically used to: determine the example content of the question and answer in the primary prompt; and concatenate the example content of the question and answer in the primary prompt and the basic data of the primary prompt to obtain the primary prompt.
[0253] Optionally, the target retrieval result acquisition module 420 is specifically used to: extract the keywords and semantic vectors of the initial example answer; and generate the answer skeleton features of the initial example answer based on the keywords and semantic vectors of the initial example answer.
[0254] Optionally, the target retrieval result acquisition module 420 is specifically used for: retrieving the target skeleton feature database based on the answer skeleton features to obtain multiple candidate retrieval results; and determining the target retrieval result based on the statistical quantity of each candidate retrieval result.
[0255] Optionally, the target retrieval result acquisition module 420 is specifically used to: determine the target candidate retrieval result based on the statistical quantity of each of the candidate retrieval results; and, if the target candidate retrieval result is determined to be unique, use the target candidate retrieval result as the target retrieval result.
[0256] Optionally, the target retrieval result acquisition module 420 is specifically used for: determining target candidate retrieval results based on the statistical quantity of each of the candidate retrieval results; when it is determined that there are multiple target candidate retrieval results, calculating the text similarity between the target retrieval question and the target prompt question of the target candidate retrieval results; and determining the target retrieval result from each of the target candidate retrieval results based on the ranking result of the text similarity.
[0257] Optionally, the target retrieval database includes a question-answer text vector database; the target retrieval result acquisition module 420 is specifically used to: calculate the text similarity between the target prompt question and each retrieval object in the target retrieval database; and determine the target retrieval result matching the target prompt question based on the text similarity between the target prompt question and each retrieval object in the target retrieval database.
[0258] Optionally, the above-mentioned device further includes a target data processing module, configured to: input the target prompt into the target large model to obtain the target answer output by the target large model according to the target prompt; and perform target data processing operations according to the target answer.
[0259] Optionally, the target suggestion question is used to prompt the target large model to generate a database query statement.
[0260] The aforementioned large model hint data processing device can execute the large model hint data processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the large model hint data processing method provided in any embodiment of this disclosure.
[0261] Since the large model hint data processing device described above is an apparatus capable of executing the large model hint data processing method in the embodiments of this disclosure, those skilled in the art can understand the specific implementation methods and various variations of the large model hint data processing device in this embodiment based on the large model hint data processing method described in the embodiments of this disclosure. Therefore, how the large model hint data processing device implements the large model hint data processing method in the embodiments of this disclosure will not be described in detail here. Any apparatus used by those skilled in the art to implement the large model hint data processing method in the embodiments of this disclosure falls within the scope of protection of this disclosure.
[0262] In one example, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0263] Figure 7 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0264] like Figure 7As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 502 or a computer program loaded from storage unit 508 into random access memory (RAM) 503. RAM 503 may also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.
[0265] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0266] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as large model hint data processing methods.
[0267] For example, in some embodiments, the large model hint data processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by computing unit 501, one or more steps of the large model hint data processing method described above may be performed. Alternatively, in other embodiments, computing unit 501 may be configured to perform the large model hint data processing method by any other suitable means (e.g., by means of firmware).
[0268] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0269] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0270] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0271] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0272] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0273] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, also known as cloud computing servers or cloud hosts, which are hosting products within the cloud computing service ecosystem to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers integrated with blockchain technology.
[0274] This embodiment of the disclosure obtains the target prompt question, determines the target retrieval database matching the target prompt question, and searches the target retrieval database according to the target prompt question to obtain target retrieval results that match the target prompt question, including the target retrieval question and the target retrieval answer. Then, the target retrieval results are used as example questions and answers, and concatenated with the basic prompt of the target prompt question to obtain the target prompt prompt. Since the example questions and answers in the target prompt prompt are dynamically generated based on the target prompt question, they better meet the answer generation requirements of the target prompt question. This can solve the problem that existing prompt prompts have low accuracy, leading to unsatisfactory answers output by large models, thus improving the accuracy of model prompt data and consequently improving the accuracy of answers output by large models based on model prompt data.
[0275] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0276] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for processing large model hint data, comprising: Obtain the target prompt question and determine the target retrieval database that matches the target prompt question; The target retrieval database includes a target skeleton feature database, and the data in the target skeleton feature database is a combination of questions, answers, and skeleton features; The target retrieval database is searched based on the target prompt question to obtain target retrieval results matching the target prompt question; wherein, the target retrieval results include the target retrieval question and the target retrieval answer; The target retrieval result is concatenated with the basic prompt of the target suggestion question to obtain the target prompt. The step of searching the target retrieval database based on the target prompt question to obtain the target retrieval results matching the target prompt question includes: Determine the initial prompt for the target prompt question; The initial prompt is input into the target large model to generate an initial example answer. Calculate the answer skeleton features of the initial example answer; the answer skeleton features are features composed of keywords and semantic vectors extracted from the initial example answer; The target skeleton feature database is searched based on the answer skeleton features to obtain the target retrieval result matching the target prompt question.
2. The method according to claim 1, wherein, Determine the initial prompt for the target prompt question, including: Determine the example content of the answer to the question in the initial prompt; The initial prompt is obtained by concatenating the example content of the question and answer in the initial prompt with the basic data of the initial prompt.
3. The method according to claim 1, wherein, The calculation of the answer skeleton features of the initial example answer includes: Extract the keywords and semantic vectors from the initial example answer; The answer skeleton features of the initial example answer are generated based on the keywords and semantic vectors of the initial example answer.
4. The method according to claim 1, wherein, The step of searching the target skeleton feature database based on the answer skeleton features to obtain the target retrieval result matching the target prompt question includes: The target skeleton feature database is searched based on the answer skeleton features to obtain multiple alternative search results; The target search result is determined based on the statistical number of each of the candidate search results.
5. The method according to claim 4, wherein, Determining the target search result based on the statistical quantity of each of the candidate search results includes: The target candidate search results are determined based on the statistical quantity of each of the candidate search results; If it is determined that the target candidate search result is unique, the target candidate search result shall be used as the target search result.
6. The method according to claim 4, wherein, Determining the target search result based on the statistical quantity of each of the candidate search results includes: The target candidate search results are determined based on the statistical quantity of each of the candidate search results; When there are multiple target candidate search results, calculate the text similarity between the target search question and the target suggestion question of the target candidate search results; Based on the ranking results of the text similarity, the target retrieval result is determined from each of the target candidate retrieval results.
7. The method according to claim 1, wherein, The target retrieval database includes a question-and-answer text vector database; The step of searching the target retrieval database based on the target prompt question to obtain the target retrieval results matching the target prompt question includes: Calculate the text similarity between the target prompt question and each search object in the target retrieval database; Based on the text similarity between the target prompt question and each search object in the target retrieval database, the target retrieval result matching the target prompt question is determined.
8. The method according to any one of claims 1-7, further comprising: The target prompt is input into the target model to obtain the target answer output by the target model based on the target prompt. Perform target data processing operations based on the target answer.
9. The method according to any one of claims 1-7, wherein, The target suggestion question is used to prompt the target large model to generate database query statements.
10. A large model hint data processing device, comprising: The target retrieval database determination module is used to obtain the target prompt question and determine the target retrieval database that matches the target prompt question; The target retrieval database includes a target skeleton feature database, and the data in the target skeleton feature database is a combination of questions, answers, and skeleton features; The target retrieval result acquisition module is used to search the target retrieval database based on the target prompt question to obtain the target retrieval result matching the target prompt question; wherein, the target retrieval result includes the target retrieval question and the target retrieval answer; The target prompt acquisition module is used to concatenate the target retrieval result with the basic prompt of the target prompt question to obtain the target prompt. The target retrieval result acquisition module is also used for: Determine the initial prompt for the target prompt question; The initial prompt is input into the target large model to generate an initial example answer. Calculate the answer skeleton features of the initial example answer; the answer skeleton features are features composed of keywords and semantic vectors extracted from the initial example answer; The target skeleton feature database is searched based on the answer skeleton features to obtain the target retrieval result matching the target prompt question.
11. The apparatus according to claim 10, wherein, The target retrieval result acquisition module is also used for: Determine the example content of the answer to the question in the initial prompt; The initial prompt is obtained by concatenating the example content of the question and answer in the initial prompt with the basic data of the initial prompt.
12. The apparatus according to claim 10, wherein, The target retrieval result acquisition module is also used for: Extract the keywords and semantic vectors from the initial example answer; The answer skeleton features of the initial example answer are generated based on the keywords and semantic vectors of the initial example answer.
13. The apparatus according to claim 10, wherein, The target retrieval result acquisition module is also used for: The target skeleton feature database is searched based on the answer skeleton features to obtain multiple alternative search results; The target search result is determined based on the statistical number of each of the candidate search results.
14. The apparatus according to claim 13, wherein, The target retrieval result acquisition module is also used for: The target candidate search results are determined based on the statistical quantity of each of the candidate search results; If it is determined that the target candidate search result is unique, the target candidate search result shall be used as the target search result.
15. The apparatus according to claim 13, wherein, The target retrieval result acquisition module is also used for: The target candidate search results are determined based on the statistical quantity of each of the candidate search results; When there are multiple target candidate search results, calculate the text similarity between the target search question and the target suggestion question of the target candidate search results; Based on the ranking results of the text similarity, the target retrieval result is determined from each of the target candidate retrieval results.
16. The apparatus according to claim 10, wherein, The target retrieval database includes a question-and-answer text vector database; the target retrieval result acquisition module is also used for: Calculate the text similarity between the target prompt question and each search object in the target retrieval database; Based on the text similarity between the target prompt question and each search object in the target retrieval database, the target retrieval result matching the target prompt question is determined.
17. The apparatus according to any one of claims 10-16, further comprising a target data processing module, configured to: The target prompt is input into the target model to obtain the target answer output by the target model based on the target prompt. Perform target data processing operations based on the target answer.
18. The apparatus according to any one of claims 10-16, wherein, The target suggestion question is used to prompt the target large model to generate database query statements.
19. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the large model hint data processing method according to any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the large model hint data processing method according to any one of claims 1-9.
21. A computer program product comprising a computer program, wherein, When executed by a processor, the computer program implements the large model hint data processing method as described in any one of claims 1-9.
Citation Information
Patent Citations
Question and answer method and device, electronic equipment and readable storage medium
CN116662518A
