Table-based question-and-answer optimization methods, devices, electronic equipment, and readable storage media

CN117874161BActive Publication Date: 2026-09-01BEIJING SINOVOICE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311733887.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-15
Publication Date
2026-09-01
Estimated Expiration
2043-12-15

AI Technical Summary

Technical Problem

[0005]有鉴于此,本申请提供了一种表格问答优化方法、装置、电子设备及可读存储介质,以解决相关技术的RAG大模型对表格内容的问答效果差的问题

Benefits of technology

[0038]从上述技术方案可以看出,本申请提供了一种表格问答优化方法、装置、电子设备及可读存储介质,通过获取目标问题和目标表格,并确定目标问题对应的计算问题类型,以及获取计算问题类型对应的函数调用信息,可以获得目标问题所属的计算问题类型对应的函数调用信息。然后根据目标表格、目标问题以及函数调用信息生成第一指令,并将第一指令输入检索增强生成大模型,可以使得第一指令与目标问题所属的计算问题类型更加匹配。检索增强生成大模型可以根据第一指令所指示函数调用信息,对回答该目标问题所需的函数调用信息进行分析,获得目标表格的函数调用参数。通过获取检索增强生成大模型输出的第一提示词,根据目标表格、目标问题以及第一提示词生成第二指令,并将第二指令输入检索增强生成大模型,由于第一提示词包括目标表格对应的函数调用参数,因此,可以使得第二指令与目标表格更加匹配,然后检索增强生成大模型根据第二指令,从目标表格的表格内容中获取目标问题的答案并输出第一答复文本,可以提高第一答复文本的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117874161B_ABST
    Figure CN117874161B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, electronic device, and readable storage medium for optimizing table-based question answering, relating to the field of knowledge question answering technology. The method includes: acquiring a target question and a target table, determining the computational problem type corresponding to the target question, and acquiring function call information corresponding to the computational problem type; generating a first instruction based on the target table, the target question, and the function call information, inputting the first instruction into a retrieval enhancement generation model, and acquiring a first prompt word output by the retrieval enhancement generation model; the first prompt word includes function call parameters corresponding to the target table; generating a second instruction based on the target table, the target question, and the first prompt word, inputting the second instruction into the retrieval enhancement generation model, and acquiring a first response text output by the retrieval enhancement generation model. This can improve the question-answering effect for table content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of knowledge question answering technology, and in particular to a table-based question answering optimization method, apparatus, electronic device, and readable storage medium. Background Technology

[0002] Large-scale models are widely used in various fields. However, in the knowledge-based question answering domain, directly using a large-scale model for question answering may result in insufficient knowledge and fabricated answers. Retrieval Augmented Generation (RAG) question answering strategies can enhance the capabilities of large-scale models.

[0003] In related technologies, the RAG large model directly textualizes knowledge and builds an index for retrieval. This knowledge may include information such as images and tables. In practical applications, question-and-answer questions about table content may involve calculation-based questions, such as maximum value, minimum value, summation, and average.

[0004] However, the computational power of the RAG large model in related technologies is limited. For computational question answering, most of them output results based on the probability of the answers in the training corpus, which may result in incorrect answers and poor question answering performance for table content. Summary of the Invention

[0005] In view of this, this application provides a table question-answering optimization method, apparatus, electronic device, and readable storage medium to solve the problem of poor question-answering performance of the RAG large model for table content in related technologies.

[0006] Firstly, this application discloses a method for optimizing table-based question-and-answer formats, the method comprising:

[0007] Obtain the target problem and target table, determine the computational problem type corresponding to the target problem, and obtain the function call information corresponding to the computational problem type;

[0008] A first instruction is generated based on the target table, the target question, and the function call information. The first instruction is then input into the retrieval enhancement generation model, and a first prompt word is obtained from the output of the retrieval enhancement generation model. The first prompt word includes the function call parameters corresponding to the target table.

[0009] A second instruction is generated based on the target table, the target question, and the first prompt word. The second instruction is then input into the retrieval enhancement generation model, and the first response text output by the retrieval enhancement generation model is obtained.

[0010] Optionally, obtaining the function call information corresponding to the computational problem type includes:

[0011] Based on the first instance table, sample problem, and function call method of the calculation function corresponding to the calculation problem type, determine the approach label and answer label;

[0012] The first sample table, the sample question, the function call method, the thought process label, and the answer label are identified as the function call information.

[0013] Optionally, generating the second instruction based on the target table, the target question, and the first prompt word includes:

[0014] The target function is called according to the function call parameters, and the table content of the target table is filtered according to the target function to obtain a filtered table;

[0015] The second instruction is generated based on the target question and the filter table.

[0016] Optionally, before determining the computational problem type corresponding to the target problem, the method further includes:

[0017] Obtain preset prompt information, and generate a second prompt word based on the target table, the target question, and the preset prompt information;

[0018] Input the second prompt word into the retrieval enhancement generation model and obtain the classification result output by the retrieval enhancement generation model;

[0019] Determining the computational problem type corresponding to the target problem includes:

[0020] If the classification result indicates that the target question belongs to the category of computational question answering, then the type of computational question corresponding to the target question is determined.

[0021] Optionally, the method further includes:

[0022] If the classification result indicates that the target question belongs to the regular question-and-answer category, a third instruction is generated based on the target table and the target question.

[0023] The third instruction is input into the retrieval enhancement generation model, and the second response text output by the retrieval enhancement generation model is obtained.

[0024] Optionally, the method further includes:

[0025] Based on the first training table, obtain the table format content and the converted text of the table; wherein, the table format content includes noise content;

[0026] The first question-and-answer text is generated based on the table format content and the table converted text, and is used as the pre-training text input to the large model to be trained.

[0027] If the preset first stopping condition is met, the current large model to be trained is determined as the retrieval enhancement generation large model.

[0028] Optionally, the method further includes:

[0029] Based on the second training table, cells with character lengths greater than a preset character length threshold are filtered to obtain the target cells;

[0030] The second question-and-answer text is generated based on the text content of the target cell, and is used as the instruction to fine-tune the text input to the retrieval enhancement generation large model;

[0031] Upon reaching the preset second stopping condition, the instructions for fine-tuning the retrieved and enhanced large model are completed.

[0032] Secondly, this application provides a form-based question-and-answer optimization device, the device comprising:

[0033] The first acquisition module is used to acquire the target problem and the target table, determine the type of computational problem corresponding to the target problem, and acquire the function call information corresponding to the type of computational problem.

[0034] The first execution module is configured to generate a first instruction based on the target table, the target question, and the function call information, input the first instruction into the retrieval enhancement generation model, and obtain the first prompt word output by the retrieval enhancement generation model; wherein, the first prompt word includes the function call parameters corresponding to the target table;

[0035] The second execution module is used to generate a second instruction based on the target table, the target question, and the first prompt word, input the second instruction into the retrieval enhancement generation model, and obtain the first response text output by the retrieval enhancement generation model.

[0036] Thirdly, this application provides an electronic device comprising: a processor, a memory, and a computer program or instructions stored in the memory and executable on the processor, wherein the processor executes the computer program or instructions to implement the steps of the method described in the first aspect.

[0037] Fourthly, this application provides a readable storage medium storing a computer program or instructions that, when executed by a processor of an electronic device, cause the electronic device to perform the steps of the method described in the first aspect.

[0038] As can be seen from the above technical solution, this application provides a table-based question-and-answer optimization method, apparatus, electronic device, and readable storage medium. By acquiring the target question and target table, determining the computational problem type corresponding to the target question, and acquiring the function call information corresponding to the computational problem type, the function call information corresponding to the computational problem type to which the target question belongs can be obtained. Then, a first instruction is generated based on the target table, target question, and function call information, and the first instruction is input into a retrieval enhancement generation model, which can make the first instruction more closely match the computational problem type to which the target question belongs. The retrieval enhancement generation model can analyze the function call information required to answer the target question based on the function call information indicated by the first instruction, and obtain the function call parameters of the target table. By acquiring the first prompt word output by the retrieval enhancement generation model, a second instruction is generated based on the target table, target question, and first prompt word, and the second instruction is input into the retrieval enhancement generation model. Since the first prompt word includes the function call parameters corresponding to the target table, the second instruction can be more closely matched with the target table. Then, the retrieval enhancement generation model obtains the answer to the target question from the table content of the target table based on the second instruction and outputs the first response text, which can improve the accuracy of the first response text.

[0039] Compared to existing RAG large models, which mostly output results based on the probability of answers in the training corpus for computational question answering, the table question answering optimization method in this application makes the input instructions of the retrieval enhancement generation large model more closely matched with the type of computational question and the target table through function calls. This can improve the accuracy of the output results of the retrieval enhancement generation large model, thereby improving the question answering effect of the retrieval enhancement generation large model on table content. Attached Figure Description

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

[0041] Figure 1 One of the flowcharts of a table-based question-and-answer optimization method provided in this application embodiment;

[0042] Figure 2 A second flowchart illustrating the steps of a table-based question-and-answer optimization method provided in this application embodiment;

[0043] Figure 3 A block diagram of a form question-and-answer optimization device provided in an embodiment of this application;

[0044] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0045] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0046] In related technologies, large-scale models struggle with question answering in private domains, such as internal company knowledge bases. RAG's question answering strategy addresses this by retrieving knowledge from a private knowledge base and providing the retrieved information as prompts to the large model, allowing it to answer questions based on that knowledge. However, private knowledge is often not idealized text; it may contain images, tables, and other information. While tables can be converted to text, they lose their unique knowledge structure.

[0047] It's important to note that language models typically only accept text input, unless it's a multimodal model, which often simply adds image formats. Most large-scale language models currently don't support input formats other than text, so tables are generally converted to plain text, comma-separated values ​​(CSV), Markdown, or HyperText Markup Language (HTML) formats.

[0048] For large RAG models in related technologies, the conversion of tables to text typically involves no special processing; the converted text is obtained by directly concatenating table headers and content. During question-answering, if the retrieved knowledge is located within a table, the large RAG model may fail to understand the table's structure, leading to incorrect answers. Furthermore, question-answering questions involving table content often involves calculations such as maximum / minimum value calculations, summations, and averages. Since the large model's training approach is to predict the following text based on the preceding context, it usually outputs results based on the probabilities of answers in the training corpus, meaning its computational power is limited. Therefore, for computational question-answering, the large RAG model may output incorrect answers.

[0049] Figure 1 One of the flowcharts for a table-based question-and-answer optimization method provided in this application embodiment is as follows: Figure 1As shown, the table-based question-and-answer optimization method may include the following steps:

[0050] Step 101: Obtain the target problem and target table, determine the computational problem type corresponding to the target problem, and obtain the function call information corresponding to the computational problem type.

[0051] In this embodiment, the target question can be a question that needs to be answered by the RAG large model. The target table can contain relevant knowledge about the target question, that is, the knowledge to answer the target question is in the target table. The target question and the target table can be input by the user, or the target question can be input by the user, and the target table can be retrieved from a preset knowledge base or database based on the target question. The table question-answering optimization method provided in this embodiment can be applied to scenarios of retrieval enhancement to generate question answers, such as a question-answering system based on the RAG large model. This question-answering system retrieves relevant knowledge from the knowledge base or database based on the target question and finds it in a table. The retrieved table is determined as the target table, and then the target table is provided to the RAG large model through a prompt, so that the RAG large model can answer the target question based on the relevant knowledge in the target table. This is only an example, and this embodiment does not limit the scope of the application.

[0052] It's important to note that large-scale models inherently suffer from insufficient computational power. Furthermore, their input length is typically 2000-4000 characters. When the converted text from a table is lengthy or requires computation to answer a question, large-scale models struggle with question answering. Theoretically, large-scale models can generate code to calculate the answer based on the table content and the question, but this requires powerful code generation and logical reasoning capabilities, making most large-scale models unreliable. Even chatbots (Chat Generative Pre-trained Transformer, ChatGPT) have limited computational power. Examples include pre-trained and fine-tuned large language models (Llama), Baichuan, ChatGLM, and Wenxin Yiyan, especially smaller language models, which tend to make significantly more mistakes in their responses.

[0053] In this embodiment, if the target question is a computational question-and-answer problem, it is processed using function calls. These computational question-and-answer problems can include maximum value queries, minimum value queries, column enumeration queries, sorting queries, average queries, summation queries, and counting queries. The function definitions, function call methods, and function return values ​​corresponding to each type of computational question can be pre-defined.

[0054] For example, for maximum value queries, the `maximum` function can be used. The function call is `maximum_value_query(column, topk, filters)`, and the return value can be in the default format. Because the final answer to the problem cannot be determined, the function return value can be the entire row of elements from the final result. The model's understanding capability is relied upon to select appropriate columns and values ​​based on the function's return value when generating the final answer. Here, the `column` parameter indicates which column of the table to query for the maximum value, the `topk` parameter indicates the top few largest values ​​to retrieve, and the `filters` parameter represents the filtering conditions. The format of `filters` can be defined as `[{key:value,…}]`, where `key` is the column name and `value` is the value.

[0055] In this embodiment, the cognitive processing capabilities and zero-shot capability of a large model can be leveraged. By setting appropriate prompts, the large model can complete problem classification operations without specialized training. Specifically, multiple problem types can be preset, such as maximum value query, minimum value query, column enumeration query, sorting query, mean query, and summation query. A prompt is generated based on the preset problem type, table example, problem classification labels, target table, and target problem. This prompt is input into the RAG large model, and the classification result output by the RAG large model is obtained. Based on the classification result, the computational problem type to which the target problem belongs is determined.

[0056] In this embodiment, for different computational problem types, corresponding function call information can be pre-stored for each type, and can be directly read from the storage location when needed. The function call information may include a sample table, sample problem, computation function, and function call method corresponding to that computational problem type. Furthermore, thought tags can be added to the function call information to improve the ability to retrieve and enhance the thought process chain for generating large models.

[0057] Optionally, obtaining the function call information corresponding to the computational problem type includes:

[0058] Based on the first instance table, sample problem, and function call method of the calculation function corresponding to the calculation problem type, determine the approach label and answer label;

[0059] The first sample table, the sample question, the function call method, the thought process label, and the answer label are identified as the function call information.

[0060] In this embodiment, the first sample table can be a sample table provided to the retrieval enhancement generative large model for function call analysis. The sample problem and the calculation function can be pre-defined sample problems and calculation functions corresponding to the calculation problem type. The first sample table can be the same or different for different calculation problem types; this embodiment does not impose any restrictions on this.

[0061] In one specific implementation, the sample problem could be "Which two regions have the highest grain prices in areas where wheat is the staple food?", and the calculation function could be a maximum value query function, such as maximum_value_query(column, topk, filters). The first sample table could be as shown in Example 1 below.

[0062] Example 1:

[0063]

[0064] It should be noted that the table format in Example 1 above is only an example, and other table formats can also be used as the first example table. This application does not limit this.

[0065] In this embodiment, the content of the thought process tag represents the thought process itself. The content of the answer tag represents the answer to the thought process. Setting thought process tags is intended to further stimulate the thought chain capability of the retrieval-enhanced large model and improve the table-based question-and-answer performance of the retrieval-enhanced large model. The thought chain capability refers to the ability to analyze step by step; generating analysis steps and then inputting them into the large model yields better results than directly having the large model generate the results.

[0066] For example, idea tags and answer tags can be as shown in Example 2 below.

[0067] Example 2:

[0068] |Approach|: This problem involves finding the maximum value, and we need to query two values. The target column is "grain price", and the query condition is "staple grain type" is "millet". Based on the table structure, the column name to be queried should be "grain price (yuan / kg)", so the parameter "column" is "grain price (yuan / kg)", the parameter "topk" is "2", and the parameter "filters" is "[{"staple grain type":"millet"}]".

[0069] |Answer|: maximum_value_query("Grain price (yuan / kg)",2,[{"Staple grain type":"Millet"}]).

[0070] In this embodiment, instruction text can be generated based on the first example table, sample question, function call method, thought process tag, and answer tag, which serves as the function call information for this embodiment.

[0071] In this embodiment, based on the computational problem type described in the target problem, the first example table, sample problem, and function call method of the computational function corresponding to that computational problem type are specifically obtained. By determining the thought process label and the answer label, the "thought process" and the "answer" obtained from the analysis of this type of computational problem can be obtained. This allows the obtained function call information to be input into the retrieval enhancement generation model. That is, after inputting the first instruction, the thought process label and the answer label can help the retrieval enhancement generation model analyze the target table and the target problem, stimulate the thinking chain ability of the retrieval enhancement generation model, and thus improve the accuracy of the first prompt word output by the retrieval enhancement generation model.

[0072] Step 102: Generate a first instruction based on the target table, the target question, and the function call information, and input the first instruction into the retrieval enhancement generation model, and obtain the first prompt word output by the retrieval enhancement generation model; wherein, the first prompt word includes the function call parameters corresponding to the target table.

[0073] In this embodiment, certain instruction statements can be added based on the obtained target table, target problem, and function call information to generate the final instruction text, which serves as the first instruction in this embodiment. The first instruction can be as shown in Example 3 below.

[0074] Example 3:

[0075] You are a programmer skilled in table manipulation. I have a table and a question. I will provide you with the table header and some sample data. I will also provide you with a function and tell you how to call it. I hope you can generate the appropriate call parameters based on the table and the question.

[0076] You need to explain the problem-solving process. Note that the column names in the table header will not be exactly the same as the column names in the problem. You need to modify them according to the table. Then, based on your thinking, tell the function how to call it.

[0077] Now I will give you an example, the table structure is as follows:

[0078]

[0079] The question is, "Which two regions where wheat is the staple food have the highest grain prices?"

[0080] The function is: maximum_value_query(column, topk, filters). Its function is to find the maximum value based on the conditions. The parameter "column" indicates which column to sort by, the parameter "topk" indicates that the top few largest values ​​should be returned, and the parameter "filters" is a list of dictionaries. The parameter "filters" is the filtering condition. If no condition is set, the parameter "filters" is empty. The key of the dictionary represents the column name, and the value represents the condition value.

[0081] You must answer in the following format:

[0082] |Approach|: This problem involves finding the maximum value, specifically two values. The target column is "grain price," and the query condition is "staple grain type" as "millet." Based on the table structure, the column to be queried should be "grain price (yuan / kg)." Therefore, the parameter "column" is "grain price (yuan / kg)," the parameter "topk" is "2," and the parameter "filters" is "[{"staple grain type":"millet"}]." Thus, we can deduce...

[0083] |Answer|: maximum_value_query("Grain price (yuan / kg)",2,[{"Staple grain type":"Millet"}]).

[0084] Below I will give you a new form and questions. Please return the results according to the requirements above.

[0085] The table structure is as follows:

[0086]

[0087] The question is, "Who is the oldest student?"

[0088] The function is: maximum_value_query(column, topk, filters). The function's functionality and parameters are as described above. Please answer according to the agreed format.

[0089] In this embodiment, by inputting the first instruction into the retrieval enhancement generation model, the model can learn the analysis process by referring to the tag learning process. Specifically, it learns how to obtain the function call parameters corresponding to the sample questions in the answer tags based on the function call method of the calculation function and the first example table. Thus, the retrieval enhancement generation model can obtain the function call parameters corresponding to the answer to the target question based on the function call method of the calculation function and the target table, and output a first prompt word, which includes the function call parameters corresponding to the target table.

[0090] In the embodiments of the present application, the first prompt may also be specified to be output according to the output format of "thinking process" and "answer", that is, the first prompt includes thinking process text and answer text. Wherein, the thinking process text may be the thinking process generated by the retrieval-augmented generation large language model by referring to the thinking process label, according to the target question and the target table. The answer text may include function call parameters corresponding to the target table obtained by the retrieval-augmented generation large language model. In this way, the chain-of-thought capability of the retrieval-augmented generation large language model can be further stimulated through the thinking process text and the answer text, thereby improving the table question answering effect of the retrieval-augmented generation large language model.

[0091] In a specific embodiment, the first prompt can be as shown in Example 4 below.

[0092] Example 4:

[0093] |Thinking Process|: This question is a maximum value query, which requires querying 1 value. The target column to be queried is "age", and the query condition is empty. According to the structure of the table, the column name to be queried is "age", so the parameter "column" is "age", the parameter "topk" is "1", and the parameter "filters" is "None". It can be obtained that,

[0094] |Answer|: maximum_value_query("age", 1, filters=None).

[0095] In the above Example 4, the content corresponding to "|Thinking Process|" is the thinking process text in the first prompt, and the content corresponding to "|Answer|" is the answer text in the first prompt.

[0096] Step 103: Generate a second instruction according to the target table, the target question and the first prompt, input the second instruction into the retrieval-augmented generation large language model, and obtain the first reply text output by the retrieval-augmented generation large language model.

[0097] In the embodiments of the present application, an instruction text can be generated according to the target table, the target question and the first prompt, which is used as the second instruction in the embodiments of the present application. Specifically, the target table, the target question, and the label text and answer text in the first prompt can be combined into an instruction text, and then the instruction text is input as the second instruction into the retrieval-augmented generation large language model.

[0098] Optionally, the generating a second instruction according to the target table, the target question and the first prompt includes:

[0099] calling a target function according to the function call parameters, and filtering the table content of the target table according to the target function to obtain a filtered table;

[0100] The second instruction is generated based on the target question and the filter table.

[0101] In this embodiment, after obtaining the function call parameters corresponding to the target table, the corresponding target function can be directly called according to the function call parameters. The target function then filters the table content of the target table, selecting the table content related to the target question. For example, it can filter out the rows, columns, or cells containing relevant knowledge of the target question, and then combine this with the table header content to generate a filtered table. Based on the target question and the filtered table, certain instruction statements can be added to generate instruction text, which serves as the second instruction in this embodiment.

[0102] In this embodiment, a filtered table is obtained by calling a target function according to function call parameters and filtering the content of the target table based on the target function; a second instruction is then generated based on the target question and the filtered table. This reduces the difficulty of understanding the second instruction, allowing the large-scale retrieval enhancement generation model to easily obtain the answer to the target question based on the filtered table. It also reduces the computational requirements of the large-scale retrieval enhancement generation model, making it applicable to question-answering systems based on small-scale language models or large models with insufficient computational power, thereby improving the practicality of the table-based question-answering method in this embodiment.

[0103] In this embodiment, the second instruction can be directly input into the retrieval enhancement generation model, and then the first response text output by the retrieval enhancement generation model can be obtained. Specifically, the retrieval enhancement generation model is used to obtain the target answer corresponding to the target question according to the filtering table in the second instruction, and generate the first response text according to the target answer.

[0104] In one specific implementation, as shown in Example 5 below.

[0105] Example 5:

[0106] Enter the second command:

[0107] Given question: Who is the oldest student?

[0108] After searching and calculating, the following table content was selected. Please use the calculation results to answer the questions above.

[0109]

[0110]

[0111] Output the first response text:

[0112] The oldest student is Xiaoming.

[0113] In related technologies, document tables can be converted into database tables, and then Structured Query Language (SQL) can be used for table-based question answering. However, the style of tables in documents is often inconsistent with that of database tables, making document tables more arbitrary. Transferring document tables to a database may introduce errors. Generating SQL using a large model and then processing it will also introduce errors and heavily rely on the understanding and logical reasoning capabilities of the large model, which is generally not possessed by large models.

[0114] In this embodiment, by acquiring the target question and target table, determining the computational problem type corresponding to the target question, and acquiring the function call information corresponding to the computational problem type, the function call information corresponding to the computational problem type to which the target question belongs can be obtained. Then, a first instruction is generated based on the target table, target question, and function call information, and input into the retrieval enhancement generation model. This makes the first instruction more closely match the computational problem type to which the target question belongs. The retrieval enhancement generation model can analyze the function call information required to answer the target question based on the function call information indicated by the first instruction, obtaining the function call parameters of the target table. By acquiring the first prompt word output by the retrieval enhancement generation model, a second instruction is generated based on the target table, target question, and first prompt word, and input into the retrieval enhancement generation model. Since the first prompt word includes the function call parameters corresponding to the target table, the second instruction can be more closely matched with the target table. Then, the retrieval enhancement generation model obtains the answer to the target question from the table content of the target table based on the second instruction and outputs the first response text, which can improve the accuracy of the first response text.

[0115] Compared to existing RAG large models, which mostly output results based on the probability of answers in the training corpus for computational question answering, the table question answering optimization method in this application makes the input instructions of the retrieval enhancement generation large model more closely matched with the type of computational question and the target table through function calls. This can improve the accuracy of the output results of the retrieval enhancement generation large model, thereby improving the question answering effect of the retrieval enhancement generation large model on table content.

[0116] Figure 2 This is the second step in the flowchart of a table-based question-and-answer optimization method provided in this application embodiment, as follows: Figure 2 As shown, the method includes:

[0117] Step 201: Obtain the target problem and target table, determine the computational problem type corresponding to the target problem, and obtain the function call information corresponding to the computational problem type.

[0118] Optionally, the method for determining the computational problem type corresponding to the target problem further includes:

[0119] Obtain preset prompt information, and generate a second prompt word based on the target table, the target question, and the preset prompt information;

[0120] Input the second prompt word into the retrieval enhancement generation model and obtain the classification result output by the retrieval enhancement generation model;

[0121] Determining the computational problem type corresponding to the target problem includes:

[0122] If the classification result indicates that the target question belongs to the category of computational question answering, then the type of computational question corresponding to the target question is determined.

[0123] In this embodiment, the table can be divided into computational question-and-answer and regular question-and-answer types. Computational question-and-answer types may include maximum value queries, minimum value queries, column enumeration queries, sorting queries, mean queries, summation queries, and counting queries. Regular question-and-answer types include regular queries, which refer to query methods where the retrieval enhancement generative model can directly obtain the answer to the question based on the table's content. Computational question-and-answer types can be processed using function calls as described in the previous embodiments, and will not be elaborated further here.

[0124] In this embodiment, the search-enhanced generative model's cognitive chain and zero-shot capabilities can be leveraged. By setting appropriate prompts, the model can perform question classification without specialized training. Specifically, multiple question types can be preset, such as regular queries, maximum value queries, minimum value queries, column enumeration queries, sorting queries, mean queries, summation queries, and so on. Based on the preset question types, table examples, question classification labels, target table, and target question, a prompt is generated. This prompt is input into the search-enhanced generative model, and the model's classification results are obtained. Based on these results, it can be determined whether the target question belongs to the regular question-and-answer category or the computational question-and-answer category, and if so, which specific computational question type within the computational question-and-answer category.

[0125] In this embodiment, the preset prompt information can be used to classify questions in the retrieval enhancement generation model, and may include preset question types, a second sample table, and question classification labels. The preset question types may include regular queries, maximum value queries, minimum value queries, column enumeration queries, sorting queries, average queries, summation queries, and so on. The second sample table may be the same as or different from the first sample table; this embodiment does not impose any restrictions on this. The question classification labels may include table questions and question types. Specifically, the question classification labels may include multiple table questions related to the content of the second sample table, and the question types to which each of these table questions belongs.

[0126] In this application, a prompt can be generated by adding certain prompt statements based on the target table, target question, and preset prompt information, serving as the second prompt word in the embodiment of this application. In a specific implementation, the second prompt word may be as shown in Example 6 below.

[0127] Example 6:

[0128] You are a programmer skilled in table manipulation. I have a table and a question. I will provide you with the table header and some sample data. You are asked to categorize the question based on the table content.

[0129] The categories are: regular query, maximum value query, minimum value query, column enumeration query, sorting query, average query, summation query, and counting query.

[0130] Below I will give you an example to show you how to solve the problem. The table structure is as follows:

[0131]

[0132] "What is the grain output of Hebei?" is a "regular query"; "What is the highest grain price?" is a "maximum value query"; "What is the lowest grain price?" is a "minimum value query"; "What are the different types of staple grains?" is a "list enumeration query"; "Sorting staple grain output from highest to lowest" is a "sorting query"; "What is the total grain output?" is a "maximum / minimum value query"; "What is the average grain output?" is a "mean value query"; "What are the different wheat-producing areas?" is a "counting query".

[0133] The table is now available:

[0134]

[0135]

[0136] Please distinguish which type of query "What is Xiaoming's student ID number?" belongs to.

[0137] In this embodiment of the application, the second prompt word is input into the retrieval enhancement generation model. The retrieval enhancement generation model can classify the target question according to the prompt information in the second prompt word and the content of the target table, determine the question type corresponding to the target question, and output the question type corresponding to the target question as the classification result.

[0138] In this embodiment, if the classification result indicates that the question type corresponding to the target question is a regular query, then the target question belongs to the regular question-and-answer category. If the classification result indicates that the question type corresponding to the target question is not a regular query, but rather any of the following computational question types: maximum value query, minimum value query, column enumeration query, sorting query, mean query, summation query, counting query, etc., then the classification result indicates that the target question belongs to the computational question-and-answer category. When the classification result indicates that the target question belongs to the computational question-and-answer category, the computational question type corresponding to the target question can be directly determined based on the classification result, and then processed using the function call method as described in the previous embodiments, which will not be elaborated here.

[0139] In this embodiment, preset prompt information is obtained, and a second prompt word is generated based on the target table, target question, and preset prompt information. The second prompt word is input into a retrieval enhancement generation model, and the classification result output by the retrieval enhancement generation model is obtained. This allows the second prompt word to better match the target table and target question. The retrieval enhancement generation model can classify the target question based on the prompt information indicated by the second prompt word and the content of the target table, easily obtaining the classification result of the target question. Only when the classification result indicates that the target question belongs to a computational question-and-answer category is the step of determining the corresponding computational question type executed, thereby improving the practicality of the table question-and-answer optimization method in this embodiment.

[0140] Step 202: Generate a first instruction based on the target table, the target question, and the function call information, and input the first instruction into the retrieval enhancement generation model, and obtain the first prompt word output by the retrieval enhancement generation model; wherein, the first prompt word includes the function call parameters corresponding to the target table.

[0141] The specific implementation method of this step can be referred to the relevant description in step 102 of the aforementioned embodiment, and will not be repeated here.

[0142] Step 203: Generate a second instruction based on the target table, the target question, and the first prompt word, input the second instruction into the retrieval enhancement generation model, and obtain the first response text output by the retrieval enhancement generation model.

[0143] The specific implementation method of this step can be referred to the relevant description in step 103 of the aforementioned embodiment, and will not be repeated here.

[0144] Step 204: If the classification result indicates that the target question belongs to the regular question-and-answer category, generate a third instruction based on the target table and the target question.

[0145] Step 205: Input the third instruction into the retrieval enhancement generation model and obtain the second response text output by the retrieval enhancement generation model.

[0146] In this embodiment, when the classification result indicates that the target question belongs to the general question-and-answer category, such as a general query, certain instruction statements can be added to the target table and the target question to generate instruction text, which serves as the third instruction in this embodiment. Then, the third instruction is input into the retrieval enhancement generation model. The retrieval enhancement generation model can directly query the content of the target table based on the target question to obtain the answer to the target question, and output the second response text based on the answer to the target question.

[0147] In one specific implementation, reference can be made to Example 7 below.

[0148] Example 7:

[0149] Enter the third command:

[0150] The table is as follows:

[0151]

[0152] Based on the information in the table, please answer what the student ID number is for the student named Xiaoming?

[0153] Output the second response text:

[0154] A: 123456.

[0155] In this embodiment, when the classification result indicates that the target question belongs to the conventional question-and-answer category, a third instruction is generated based on the target table and the target question. This third instruction is then input into the retrieval enhancement generation model, and the second response text output by the model is obtained. Thus, for target questions that do not belong to the computational question-and-answer category, a third instruction can be directly generated based on the target table and the target question. This allows the retrieval enhancement generation model to retrieve the answer to the target question from the target table based on the third instruction, i.e., to perform conventional table-based question-and-answer processing to obtain the second response text. This improves the question-and-answer efficiency of the table optimization method in this application.

[0156] For large RAG models in related technologies, the conversion of tables to text typically involves no special processing; the converted text is obtained by directly concatenating table headers and content. During question-and-answer sessions, if the retrieved knowledge is located within a table, the large RAG model may fail to understand the table's structure, leading to incorrect answers.

[0157] In this embodiment of the application, in order to improve the table understanding and question answering capabilities of the RAG large model, customized training is carried out through ordinary corpus + enhanced corpus during the pre-training and instruction fine-tuning stages of the RAG large model. For regular queries, the RAG large model can directly extract knowledge and answer questions accurately on the table, thereby improving the question answering effect of the RAG large model on table content.

[0158] Optionally, prior to step 201, the method further includes:

[0159] Based on the first training table, obtain the table format content and the converted text of the table; wherein, the table format content includes noise content;

[0160] The first question-and-answer text is generated based on the table format content and the converted text of the table, and is used as the pre-training text input to the large model to be trained, and the answer output by the large model to be trained is obtained.

[0161] If the preset first stopping condition is met, the current large model to be trained is determined as the retrieval enhancement generation large model.

[0162] In this embodiment, during the pre-training stage of the retrieval-enhanced generative large model, tabular data can be converted into training instructions for training the large model to be trained. The large model to be trained can be a generative pre-trained large language model, such as ChatGLM or baichuan. This is merely an example, and this embodiment does not impose any limitations.

[0163] In this embodiment of the application, the first training table may include one or more tables used for training during the pre-training phase. The first training table may be a document table or a database table, and this embodiment of the application does not impose any limitations on this. For example, the first training table may be as shown in Table 1.

[0164] Table 1 First Training Table

[0165] Name age gender Student ID height Xiaoming 19 male 123456 180 Xiao Hong 18 female 456789 170

[0166] In this embodiment, since the text format selected by the user when converting the table to text is uncertain, the first training table can be converted into various text formats, such as CSV, Markdown, and HTML, during the pre-training stage. In practical applications, tables may include redundant information, such as the title above the table and the notes below it. Redundant information can also be added to the table format content to improve the ability of the large model to be trained to understand redundant information. Table 1 is converted into text in various formats, as shown in formats 1 to 5 in Example 8 below.

[0167] Example 8:

[0168] Format 1:

[0169]

[0170] Format 2:

[0171]

[0172] Format 3:

[0173] Name, Age, Gender, Student ID, Height

[0174] Xiaoming, 19, male, 123456, 180

[0175] Xiao Hong, 18, female, 456789, 170cm tall

[0176] Format 4:

[0177]

[0178]

[0179] In this embodiment, the table format content uses only spaces and line breaks to distinguish rows and columns, without any other markers. The table format content can be left unprocessed and used as ordinary corpus for the training phase, directly inputting it into the large-scale model to be trained. Ordinary corpus can ensure the general capabilities of the large-scale model to be trained. Adding augmented corpus to ordinary corpus can prevent the large-scale model to be trained from suffering severe overfitting and losing its general capabilities. Augmented corpus is used to improve the table comprehension and table question-answering capabilities of the large-scale model to be trained.

[0180] In this embodiment, enhanced corpora can be obtained through different processing methods during the pre-training stage and the instruction fine-tuning stage. During the pre-training stage, the first training table can be converted into text format to obtain table format content and table-converted text. The table format content represents the table structure, and the table-converted text represents the table content. The table format content and table-converted text can be as shown in Example 9 below.

[0181] Example 9:

[0182]

[0183]

[0184] The above is a table. In the table, the name is Xiaoming, the age is 19, the gender is male, ..., the name is Xiaohong, ..., the height is 170.

[0185] In this embodiment, some content can be randomly inserted at the beginning of the table format as noise content. This noise content improves the accuracy of the large model being trained in recognizing the table header. In practical applications, referring to Table 1, the first row "Name, Age, Gender, Student ID, Height" is the table header. However, some tables have other content in the first row instead of a header. By adding noise content to the table format, the large model being trained can learn that the first row is noise content, and the correct header follows, thus improving the model's adaptability to the table. The noise content can be obtained from an open-source corpus. A corpus is constructed using Jieba word segmentation and sentence segmentation using the punctuation marks ".", "?", and "!". A word or sentence is randomly selected from the corpus as the noise content. This is merely an example, and this embodiment does not impose any limitations.

[0186] In this embodiment, during the pre-training stage, a table-based question-and-answer format can be constructed based on the table format content and the converted table text to obtain the first question-and-answer text. This first question-and-answer text is then used as pre-training text to input into the large model to be trained. In one specific implementation, the table can be output in reverse using the converted table text, and the generated first question-and-answer text can be used as pre-training text to input into the large model to be trained, thereby improving the table comprehension ability of the large model to be trained. The first question-and-answer text can be as shown in Example 10 below.

[0187] Example 10:

[0188] Given: Name is Xiaoming, age is 19, gender is male, ..., Name is Xiaohong, ..., height is 170. Create a table containing the above information:

[0189]

[0190] In this embodiment, during the instruction fine-tuning stage, third-party question-and-answer text can be generated based on the table format content. For example, based on the table format content, a row can be directly taken, and questions and answers can be constructed using the table header to obtain the third-party question-and-answer text. In the instruction fine-tuning stage, the table representation can be described in a question-and-answer format, unlike the direct description through table-to-text conversion during the pre-training stage. In the instruction fine-tuning stage, questions and answers can be constructed by extracting knowledge from the table format content, generating multiple third-party question-and-answer texts. These texts are then input as instruction fine-tuning text into the retrieval-enhanced generative model, allowing for instruction fine-tuning. This enables the retrieval-enhanced generative model to learn that it can directly extract knowledge and obtain answers from the table input, thereby improving its table question-and-answer capabilities.

[0191] In this embodiment, the first stopping condition may be that the loss value of the large model to be trained is less than a preset loss threshold, or that the number of training iterations exceeds a preset threshold, etc. This embodiment does not impose any limitations on this. When the first stopping condition is met, it indicates that the large model to be trained has met the preset requirements, and the current large model to be trained can be identified as a retrieval enhancement generation model.

[0192] In this embodiment, during the pre-training stage, table format content and table-converted text are obtained from the first training table, so that the table format content reflects the table structure of the first training table. First question-and-answer text is generated based on the table format content and table-converted text, so that the first question-and-answer text is associated with the table structure. By inputting the first question-and-answer text as pre-training text into the large model to be trained, the large model to be trained can learn the table structure better based on the first question-and-answer text during the pre-training stage, and the understanding ability of the large model to be trained in table questions and answers is improved through the first question-and-answer text. Thus, when the preset first stopping condition is met, the current large model to be trained is determined as the retrieval augmentation generation large model, which can improve the table understanding ability and table question-and-answer ability of the retrieval augmentation generation large model.

[0193] Optionally, the method further includes:

[0194] Based on the second training table, cells with character lengths greater than a preset character length threshold are filtered to obtain the target cells;

[0195] The second question-and-answer text is generated based on the text content of the target cell, and is used as the instruction to fine-tune the text input to the retrieval enhancement generation large model;

[0196] Upon reaching the preset second stopping condition, the instructions for fine-tuning the retrieved and enhanced large model are completed.

[0197] In practical applications, questions about table content can be directed not only to the overall content of the table but also to the contents of individual cells. For example, based on Table 2 below, a question might arise regarding the statement "Tianjin is located on the Bohai Bay and has a population of 10 million": "What is the population of Tianjin?"

[0198] Table 2 Second Training Table

[0199] name introduce Beijing Beijing is an ancient city. Tianjin Tianjin is located on the Bohai Bay and has a population of 10 million.

[0200] For RAG large models in related technologies, the text input length is generally 2000-4000 characters. When the table is simple, the RAG large model can read the content of the cells. However, if the table is large and the length of the converted text is long, the RAG large model's ability to extract cell content will be weakened.

[0201] In this embodiment of the application, in order to improve the ability of the retrieval enhancement generation model to crawl the cell content of the table, during the instruction fine-tuning stage of the retrieval enhancement generation model, table question and answer for cells can be constructed to further improve the table understanding and table question and answering capabilities of the retrieval enhancement generation model.

[0202] In this embodiment, the second training table may include one or more tables used for training during the instruction fine-tuning stage. The second training table may be a document table or a database table; this embodiment does not impose any limitations on this. For example, the second training table may be as shown in Table 2. For the second training table, question-and-answer construction may be performed on one or more cells in the second training table, or question-and-answer construction may be performed on each cell in the second training table; this embodiment does not impose any limitations on this.

[0203] In this application, cells with longer text can be filtered from the second training table based on the character length of the text within each cell. Specifically, cells with a character length greater than a preset character length threshold can be filtered from the second training table to obtain the target cells. The character length threshold can be set according to actual application requirements and model size; for example, the character length threshold can be set to 100.

[0204] In this embodiment of the application, for any target cell, a table of questions and answers can be constructed based on the text content of the target cell. Therefore, the number of table questions and answers can be one or more, and this embodiment of the application does not limit this. The specific construction method can adopt the self-instruct method, as shown in Example 11 below.

[0205] Example 11:

[0206] Self-instruct

[0207] Text: Tianjin is located on the Bohai Bay and has a population of 10 million.

[0208] Question: What is the population of Tianjin?

[0209] Answer: 10 million.

[0210] In Example 11 above, based on the text "Tianjin is located on the Bohai Bay and has a population of 10 million." in the target cell of Table 2, the question "Question: What is the population of Tianjin?" and the answer "Answer: 10 million" are constructed using the Self-instruct method.

[0211] In this embodiment, based on the second training table and the constructed questions and answers, certain instruction statements can be added to generate a second question-and-answer text. This text is then input into the retrieval enhancement generation model as instruction fine-tuning text, allowing for instruction fine-tuning of the model. This enables the retrieval enhancement generation model to learn how to extract cell content, improving its understanding of questions related to cell content. Thus, the second question-and-answer text further enhances the table-based question-and-answer capabilities of the retrieval enhancement generation model. The second question-and-answer text can be as shown in Example 12 below.

[0212] Example 12:

[0213] The table is as follows:

[0214]

[0215] Based on the table title, what is the population of Tianjin?

[0216] A: 10 million.

[0217] In this embodiment, the second stopping condition may be that the deviation of the output result of the retrieval enhancement generation model is less than a preset deviation threshold, or that the accuracy improvement of the output result reaches a preset requirement, etc. This embodiment does not limit this. When the second stopping condition is met, it indicates that the retrieval enhancement generation model has reached the requirements of the instruction fine-tuning stage, and is considered to have completed the instruction fine-tuning of the retrieval enhancement generation model.

[0218] In this embodiment, during the instruction fine-tuning stage, target cells are obtained by filtering cells with character lengths greater than a preset character length threshold according to the second training table, and second question-and-answer text is generated based on the text content of the target cells. This allows the second question-and-answer text to be associated with cells with longer character lengths in the second training table. Inputting the second question-and-answer text as instruction fine-tuning text into the retrieval enhancement generation model can enhance the model's ability to capture the content of cells with longer character lengths. For questions related to the content of cells in the table, the answers output by the retrieval enhancement generation model can be more accurate. Therefore, the table understanding and table question-and-answer capabilities of the retrieval enhancement generation model can be further improved through the second question-and-answer text.

[0219] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.

[0220] Figure 3 This is a block diagram of a form question-and-answer optimization device according to an embodiment of this application, such as... Figure 3 As shown, the device 30 includes:

[0221] The first acquisition module 301 is used to acquire the target problem and the target table, determine the type of computation problem corresponding to the target problem, and acquire the function call information corresponding to the type of computation problem.

[0222] The first execution module 302 is configured to generate a first instruction based on the target table, the target question, and the function call information, input the first instruction into the retrieval enhancement generation model, and obtain the first prompt word output by the retrieval enhancement generation model; wherein, the first prompt word includes the function call parameters corresponding to the target table;

[0223] The second execution module 303 is used to generate a second instruction based on the target table, the target question, and the first prompt word, input the second instruction into the retrieval enhancement generation model, and obtain the first response text output by the retrieval enhancement generation model.

[0224] Optionally, the first acquisition module 301 is specifically used for:

[0225] Based on the first instance table, sample problem, and function call method of the calculation function corresponding to the calculation problem type, determine the approach label and answer label;

[0226] The first sample table, the sample question, the function call method, the thought process label, and the answer label are identified as the function call information.

[0227] Optionally, the second execution module 303 is specifically used for:

[0228] The target function is called according to the function call parameters, and the table content of the target table is filtered according to the target function to obtain a filtered table;

[0229] The second instruction is generated based on the target question and the filter table.

[0230] Optionally, the device further includes:

[0231] The second acquisition module is used to acquire preset prompt information before the first acquisition module 301 determines the type of calculation problem corresponding to the target problem, and to generate a second prompt word based on the target table, the target problem and the preset prompt information;

[0232] The third execution module is used to input the second prompt word into the retrieval enhancement generation model and obtain the classification result output by the retrieval enhancement generation model;

[0233] The first acquisition module 301 is specifically used for:

[0234] If the classification result indicates that the target question belongs to the category of computational question answering, then the type of computational question corresponding to the target question is determined.

[0235] Optionally, the device further includes:

[0236] The first generation module is used to generate a third instruction based on the target table and the target question when the classification result indicates that the target question belongs to the regular question-and-answer category.

[0237] The fourth execution module is used to input the third instruction into the retrieval enhancement generation model and obtain the second response text output by the retrieval enhancement generation model.

[0238] Optionally, the device further includes:

[0239] The third acquisition module is used to acquire the table format content and the table converted text based on the first training table; wherein, the table format content includes noise content;

[0240] The fifth execution module is used to generate the first question-and-answer text based on the table format content and the table converted text, and use it as pre-training text input to the large model to be trained;

[0241] The first stopping module is used to determine the current large model to be trained as the retrieval enhancement generation large model when a preset first stopping condition is met.

[0242] Optionally, the device further includes:

[0243] The filtering module is used to filter cells whose character length is greater than a preset character length threshold based on the second training table, and obtain the target cells;

[0244] The sixth execution module is used to generate a second question-and-answer text based on the text content of the target cell, and input the text as an instruction to fine-tune the retrieval enhancement generation model;

[0245] The second stopping module is used to fine-tune the instructions for generating the large model of the search enhancement when a preset second stopping condition is met.

[0246] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0247] This application provides an electronic device, see [link to relevant documentation] Figure 4 The electronic device includes a processor 401, a memory 402, and a computer program 4021 stored in the memory 402 and executable on the processor 401. When the processor executes the computer program 4021, it implements the steps of the table question-and-answer optimization method of the aforementioned embodiment.

[0248] This application provides a readable storage medium storing a computer program or instructions. When the computer program or instructions are executed by a processor of an electronic device, the electronic device performs the steps of the table question-and-answer optimization method as described in the foregoing embodiments.

[0249] As can be seen from the above technical solution, this application provides a table-based question-and-answer optimization method, apparatus, electronic device, and readable storage medium. By acquiring the target question and target table, determining the computational problem type corresponding to the target question, and acquiring the function call information corresponding to the computational problem type, the function call information corresponding to the computational problem type to which the target question belongs can be obtained. Then, a first instruction is generated based on the target table, target question, and function call information, and the first instruction is input into a retrieval enhancement generation model, which can make the first instruction more closely match the computational problem type to which the target question belongs. The retrieval enhancement generation model can analyze the function call information required to answer the target question based on the function call information indicated by the first instruction, and obtain the function call parameters of the target table. By acquiring the first prompt word output by the retrieval enhancement generation model, a second instruction is generated based on the target table, target question, and first prompt word, and the second instruction is input into the retrieval enhancement generation model. Since the first prompt word includes the function call parameters corresponding to the target table, the second instruction can be more closely matched with the target table. Then, the retrieval enhancement generation model obtains the answer to the target question from the table content of the target table based on the second instruction and outputs the first response text, which can improve the accuracy of the first response text.

[0250] Compared to existing RAG large models, which mostly output results based on the probability of answers in the training corpus for computational question answering, the table question answering optimization method in this application makes the input instructions of the retrieval enhancement generation large model more closely matched with the type of computational question and the target table through function calls. This can improve the accuracy of the output results of the retrieval enhancement generation large model, thereby improving the question answering effect of the retrieval enhancement generation large model on table content.

[0251] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0252] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0253] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0254] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0255] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0256] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0257] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0258] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A form question answering optimization method, characterized in that, The method includes: Obtain the target problem and target table, determine the computational problem type corresponding to the target problem, and obtain the function call information corresponding to the computational problem type; A first instruction is generated based on the target table, the target question, and the function call information. The first instruction is then input into the retrieval enhancement generation model, and a first prompt word is obtained from the output of the retrieval enhancement generation model. The first prompt word includes the function call parameters corresponding to the target table. A second instruction is generated based on the target table, the target question, and the first prompt word. The second instruction is then input into the retrieval enhancement generation model, and the first response text output by the retrieval enhancement generation model is obtained.

2. The method according to claim 1, characterized in that, The step of obtaining the function call information corresponding to the computational problem type includes: Based on the first instance table, sample problem, and function call method of the calculation function corresponding to the calculation problem type, determine the approach label and answer label; The first sample table, the sample question, the function call method, the thought process label, and the answer label are identified as the function call information.

3. The method according to claim 1 or 2, characterized in that, The step of generating a second instruction based on the target table, the target question, and the first prompt word includes: The target function is called according to the function call parameters, and the table content of the target table is filtered according to the target function to obtain a filtered table; The second instruction is generated based on the target question and the filter table.

4. The method according to claim 1, characterized in that, Before determining the computational problem type corresponding to the target problem, the method further includes: Obtain preset prompt information, and generate a second prompt word based on the target table, the target question, and the preset prompt information; Input the second prompt word into the retrieval enhancement generation model and obtain the classification result output by the retrieval enhancement generation model; Determining the computational problem type corresponding to the target problem includes: If the classification result indicates that the target question belongs to the category of computational question answering, then the type of computational question corresponding to the target question is determined.

5. The method according to claim 4, characterized in that, The method further includes: If the classification result indicates that the target question belongs to the regular question-and-answer category, a third instruction is generated based on the target table and the target question. The third instruction is input into the retrieval enhancement generation model, and the second response text output by the retrieval enhancement generation model is obtained.

6. The method according to claim 1, characterized in that, The method further includes: Based on the first training table, obtain the table format content and the converted text of the table; wherein, the table format content includes noise content; The first question-and-answer text is generated based on the table format content and the table converted text, and is used as the pre-training text input to the large model to be trained. If the preset first stopping condition is met, the current large model to be trained is determined as the retrieval enhancement generation large model.

7. The method according to claim 1, characterized in that, The method further includes: Based on the second training table, cells with character lengths greater than a preset character length threshold are filtered to obtain the target cells; The second question-and-answer text is generated based on the text content of the target cell, and is used as the instruction to fine-tune the text input to the retrieval enhancement generation large model; Upon reaching the preset second stopping condition, the instructions for fine-tuning the retrieved and enhanced large model are completed.

8. A form-based question-and-answer optimization device, characterized in that, The device includes: The first acquisition module is used to acquire the target problem and the target table, determine the type of computational problem corresponding to the target problem, and acquire the function call information corresponding to the type of computational problem. The first execution module is configured to generate a first instruction based on the target table, the target question, and the function call information, input the first instruction into the retrieval enhancement generation model, and obtain the first prompt word output by the retrieval enhancement generation model; wherein, the first prompt word includes the function call parameters corresponding to the target table; The second execution module is used to generate a second instruction based on the target table, the target question, and the first prompt word, input the second instruction into the retrieval enhancement generation model, and obtain the first response text output by the retrieval enhancement generation model.

9. An electronic device, characterized in that, The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method as described in any one of claims 1-7.

10. A readable storage medium, characterized in that, The readable storage medium stores a computer program or instructions that, when executed by a processor of an electronic device, cause the electronic device to perform the steps of the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Question and answer method and device based on pre-training model, electronic equipment and storage medium

    CN116187347A

  • Data classification method and device, equipment and storage medium

    CN116701636A