Structured data insight generation method and system, and medium
By fine-tuning an open-source natural language model, a data localization and insight generation model was constructed, solving the problems of privacy leakage, manpower consumption, and model illusion when large language models generate data insights, and achieving more efficient and accurate generation of structured data insights.
Patent Information
- Application Number
- PCT/CN2024/114748
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-08-01
- Filing Date
- 2024-08-27
- Publication Date
- 2026-02-05
AI Technical Summary
Existing technologies have problems such as privacy leakage risks, high manpower consumption for dataset annotation, and low model inference accuracy when using large language models to generate data insights, especially the severe model illusion phenomenon in numerical reasoning.
By fine-tuning an open-source natural language model, a data location model and an insight generation model are constructed. The data location model is used to identify and label the problem-related locations in the table, and pre-generated facts are used to generate relevant reasoning facts from the template. Combined with the insight generation model, the final structured data insights are provided.
It reduces the pressure of dataset labeling, improves the interpretability and accuracy of model predictions, reduces the model illusion problem in numerical reasoning, and ensures that the generated data insights are more accurate.
Smart Images

Figure CN2024114748_05022026_PF_FP_ABST
Abstract
Description
A method, system, and medium for generating structured data insights Technical Field This invention relates to the field of data analysis technology, and in particular to a method, system and medium for generating structured data insights. Background Technology Data insight refers to gaining profound insights and understanding through the analysis and interpretation of data. Structured data insight generation refers to generating data insights using structured data (i.e., tables). The generation of data insights needs to be based on different user needs. Data insights are answers to user-posed questions, but these answers require generating a paragraph-style text summary containing the relevant facts and reasoning from the table, based on a given table and the user's query. With technological advancements, large language models (such as GPT-3.5) have demonstrated excellent reasoning capabilities from tables, enabling the generation of simple data insights. Currently, there are two common methods for generating data insights using large models. The first is to directly use pre-trained large models (such as GPT-4), which requires sending data to a third party, posing a risk of privacy breaches. The second is to download open-source large models, deploy them locally, and fine-tune them using relevant data; however, collecting and labeling datasets requires significant manpower. Furthermore, directly using large models for end-to-end predictions carries a higher probability of errors in the reasoning generated by the large models (e.g., calculating averages, sums, maximums, and rankings). Summary of the Invention The main objective of this invention is to provide a method, system, and medium for generating structured data insights, which aims to reduce the pressure of manual annotation during data collection, improve the interpretability and accuracy of model predictions, and reduce the model illusion problem in language models during reasoning (especially numerical reasoning). To achieve the above objectives, this invention proposes a method for generating structured data insights, the method comprising the following steps: Step S10: After fine-tuning the open-source natural language model using the corresponding tables, question and answer datasets, the data localization model and insight generation model are obtained. Step S20: The data location model identifies and marks the locations related to the problem from the table; Step S30: The data location model uses a pre-generated fact method to generate relevant reasoning facts from the template for the table; Step S40: Input the labeled table, questions, and generated reasoning facts into the insight generation model, which then provides the final structured data insights. A further technical solution of the present invention is that step S10 includes a data localization model training task and an insight generation model training task, wherein: (1) Data localization model training task: Input: prompt(T, Q), which inputs table T and question Q in the form of a prompt; Output: Table T* marked with *; (2) Gain insights into generative model training tasks: Input: prompt(T*, Q), which is a prompt containing a table T* marked with an asterisk and a question Q, where T* is generated from the original table T using an algorithm; Output: The answer to the question, A prediction ; When training the data location model and the insight generation model, it is necessary to first obtain the *-displayed table T* from the table T, the question Q, and the labeled answer A. A further technical solution of the present invention is that the step of obtaining the *-displayed table T* from table T, question Q, and the marked answer A includes: Let the original table T, the question Q, and the labeled answer A be the same as table T. Table T has n rows, numbered 1, 2, 3, ..., n. Define the answer generated by the pre-trained model based on the i-th row and question Q as Answer. i Answer i The semantic similarity between the answer A and the question is denoted as Relation. i Relation i ∈ (0, 1], i=1, 2, 3..., n; Let set Relation i The maximum value among ∈(0,1], i=1,2,3…,n is max, and the minimum value is min; Determine if the difference between the maximum value (max) and the minimum value (min) is less than 0.1; If it is less than 0.1, then label the table as T*, which is the original table T; If the value is greater than or equal to 0.1, then the algorithm is used to obtain the final problem-corresponding Zone. * And mark it in the original table T to get T*. A further technical solution of the present invention is that, in step S30, the method for pre-generating facts includes the following steps: Perform type analysis on each column of the table, classifying all columns in the table into three categories: numeric, date, and string; A series of facts are generated based on predefined reasoning templates and tables; The original question and the generated facts are vectorized. Filter out facts relevant to the question; The selected facts, questions, and tables are then input into the language model. A further technical solution of the present invention is that the step of parsing the type of each column of the table and classifying all columns in the table into three categories: numeric, date, and string includes: Determine if the data type of each column in the table is numeric; If so, then determine that the data type of each column in the table is numeric; If not, then check if the data type of each column in the table is date. If so, then determine that the data type of each column in the table is date; If not, then determine that the type of each column in the table is string. A further technical solution of the present invention is that, in the step of generating a series of facts based on predefined reasoning templates and tables, five templates are defined, and each template generates at least three facts. A further technical solution of the present invention is that the step of vectorizing the original problem and the generated facts includes: Vectorize facts in natural language form and filter a number of facts. A further technical solution of the present invention is that the step of filtering out facts relevant to the problem includes: After obtaining the vectorized representations of the question and facts, the cosine similarity value between each fact and the question is calculated. The k facts with the highest cosine similarity values to the question are selected, among which... rows refers to the number of columns in the table, cols refers to the number of rows in the table, and [x] represents the largest integer not greater than x, i.e., x is rounded down. To achieve the above objectives, the present invention also proposes a structured data insight generation system, the system comprising a memory, a processor, and a structured data insight generation program stored on the processor, wherein the structured data insight generation program is executed by the processor to perform the steps of the method described above. To achieve the above objectives, the present invention also proposes a computer-readable storage medium storing a structured data insight generation program, which, when run by a processor, performs the steps of the method described above. The beneficial effects of the structured data insight generation method, system, and medium of this invention are: This invention, through the above technical solution, uses corresponding tables, question and answer datasets to analyze open source data. After fine-tuning the natural language model, a data localization model and an insight generation model are obtained. The data localization model identifies and labels the locations related to the question in the table. The data localization model uses a pre-generated fact method to generate relevant reasoning facts from the template. The labeled table, the question, and the generated reasoning facts are input into the insight generation model, which provides the final structured data insights. This reduces the pressure of manual labeling when collecting data, improves the interpretability and accuracy of model predictions, and reduces the model illusion problem in language models during reasoning (especially numerical reasoning). Attached Figure Description Figure 1 is a flowchart illustrating a preferred embodiment of the structured data insight generation method of the present invention; Figure 2 is a schematic diagram of the overall process of the structured data insight generation method of the present invention; Figure 3 is an overview of the supermarket's monthly sales. Figure 4 is a table diagram showing the results after the relevant areas were found; Figure 5 is a schematic diagram of the data localization model training task; Figure 6 is a schematic diagram of the training task for the insight-generating model; Figure 7 is a flowchart of the algorithm for generating labeled regions; Figure 8 is an overview of product sales; Figure 9 is an overview of the sales situation of the labeled products; Figure 10 is a schematic diagram of the table after the final Zone* labeling; Figure 11 is a flowchart of the pre-generated facts; Figure 12 is a flowchart of type resolution; Figure 13 is a schematic diagram illustrating the input and output of the insight generative model. To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. Detailed Implementation It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention. This invention proposes a method for generating structured data insights. Referring to Figure 1, a preferred embodiment of the method for generating structured data insights includes the following steps: Step S10: After fine-tuning the open-source natural language model using the corresponding tables, questions, and answer datasets, the data localization model and insight generation model are obtained. Step S20: The data location model identifies and marks the locations related to the problem from the table. Step S30: The data location model uses a pre-generated fact method to generate relevant reasoning facts from the template for the table. Step S40: Input the labeled table, questions, and generated reasoning facts into the insight generation model, which then provides the final structured data insights. Furthermore, in this embodiment, step S10 includes a data localization model training task and an insight generation model training task. Among them, (1) Data localization model training task: Input: prompt(T, Q), which inputs table T and question Q in the form of a prompt; Output: Table T* marked with *. (2) Gain insights into generative model training tasks: Input: prompt(T*, Q), which is a prompt containing a table T* marked with an asterisk and a question Q, where T* is generated from the original table T using an algorithm; Output: The answer to the question, A prediction . When training the data location model and the insight generation model, it is necessary to first obtain the *-displayed table T* from the table T, the question Q, and the labeled answer A. Furthermore, in this embodiment, the step of obtaining the *-displayed table T* from table T, question Q, and the marked answer A includes: Let the original table T, the question Q, and the labeled answer A be the same as table T. Table T has n rows, numbered 1, 2, 3, ..., n. Define the answer generated by the pre-trained model based on the i-th row and question Q as Answer. i Answer i The semantic similarity between the answer A and the question is denoted as Relation. i Relation i ∈ (0, 1], i=1, 2, 3..., n; Let set Relation i The maximum value among ∈(0,1], i=1,2,3…,n is max, and the minimum value is min; Determine if the difference between the maximum value (max) and the minimum value (min) is less than 0.1; If it is less than 0.1, then label the table as T*, which is the original table T; If the value is greater than or equal to 0.1, then the algorithm is used to obtain the final problem-corresponding Zone. * And mark it in the original table T to get T*. Furthermore, in this embodiment, the method for pre-generating facts in step S30 includes the following steps: Perform type parsing on each column of the table to categorize all columns into numeric, date, and string types. Three categories. A series of facts are generated based on predefined reasoning templates and tables. This embodiment defines five templates, each of which generates at least three facts. The original question and the generated facts are vectorized. Filter out the facts that are relevant to the question. The selected facts, questions, and tables are then input into the language model. The step of parsing the type of each column in the table and classifying all columns in the table into three categories—numeric, date, and string—includes the following: Determine if the data type of each column in the table is numeric. If so, then the data type of each column in the table is determined to be numeric. If not, then check if the data type of each column in the table is date. If so, then the type of each column in the table is determined to be date. If not, then determine that the type of each column in the table is string. The step of vectorizing the original question and the generated facts includes: Vectorize facts in natural language form and filter a number of facts. The steps for filtering out facts relevant to the question include: After obtaining the vectorized representations of the question and facts, the cosine similarity value between each fact and the question is calculated. The k facts with the highest cosine similarity values to the question are selected, among which... rows refers to the number of columns in the table, cols refers to the number of rows in the table, and [x] represents the largest integer not greater than x, i.e., x is rounded down. The following examples, in conjunction with Figures 2 to 13, further illustrate the structured data insight generation method of the present invention. The overall flowchart of the structured data insight generation method of this invention is shown in Figure 2. After fine-tuning the open-source natural language model using the corresponding table, question, and answer datasets, we obtained the data localization model and the insight generation model. First, the data localization model... input Query input The location is identified and marked with * in the table. Then, the pre-generated fact method is used to generate relevant inferential facts from the template for the table. Finally, the annotated table is... Question Query inputAfter being fed into the insight generation model along with the generated inference facts, the insight generation model provides the final structured data insights. After the model is fine-tuned, the data localization model and the insight generation model collaborate to complete the final result. Structured data insight generation tasks. The following example illustrates their collaborative process. Figure 3 shows a table illustrating the top-selling items in a supermarket over a month, including item name, category, sales revenue, and profit. Different types of goods are categorized into different groups, such as groceries, electronics, clothing and footwear, home goods, and cosmetics / skincare products. The table lists the sales revenue and profit for each item, in yuan. The user's query is: "Which item in the home goods category has the highest profit margin? How does it compare to the highest-profit item across all categories?" First, the fine-tuned data location model locates the rows containing furniture and home decor within the entire table based on the keyword "home furnishings". Then, an asterisk (*) is added before the content of each cell in these rows, resulting in Table* as shown in Figure 4. Then, the relevant facts are obtained by using the pre-generated facts method on the table in Figure 3, as follows: "1. The product names, sorted by profit (yuan) from highest to lowest, are: television, mobile phone, grain and oil, cosmetics... shirts." 2. After sorting by profit (yuan) from highest to lowest, the product category order for household goods is furniture, then home decoration. 3. The average profit (in yuan) for home furnishings that meet the product category is 5000. ... 6. The difference between 7890 and 20678 in the profit (yuan) is
[15234] " Finally, the relevant facts, the *-marked table, and the user question query are input together into the insight generation model, which then generates the answer. Inputting the table and user question query separately into the insight generation model results in the output: "Among the products categorized as home furnishings, the highest profit is in 'home decor,' with a profit of 7890 yuan. Compared to the highest profit across all categories, namely 'mobile phones' (profit of 15234 yuan) within electronics, it can be seen that the profit of 'mobile phones' is higher than that of 'furniture,' by a difference of 7344 yuan." In the above generated answer, the insight generation model mistakenly identified the most profitable product as "mobile phone". After inputting the aforementioned table, user questions, and generated facts into the insight generation model, the model outputs: "Among the products categorized as home furnishings, the highest profit is 'home decor,' with a profit of 7890 yuan. Compared to the highest profit among all categories, namely 'television' (with a profit of 20678 yuan) in electronics, it can be seen that 'mobile phones' have a higher profit than 'furniture,' a difference of 12788 yuan." The model corrects this issue using the input facts. The present invention provides a structured data insight generation method, which mainly involves three aspects: data construction method for fine-tuning models, pre-generated fact input strategy, and arrangement method between models. (1) Data construction method for fine-tuning the model. In the process of model fine-tuning, a large amount of data usually needs to be labeled, which requires a significant amount of manpower and time. This invention proposes an algorithm based on tables, questions, and answers to automatically generate answer-related regions, thereby reducing the pressure of manual labeling. The data localization model training task is illustrated in Figure 5. Input: prompt(T, Q), which inputs table T and question Q in the form of a prompt; Output: Table T* marked with *. (2) Gain insight into the generative model training task, as shown in Figure 6: Input: prompt(T*, Q), which is a prompt containing a table T* marked with an asterisk and a question Q, where T* is generated from the original table T using an algorithm; Output: The answer to the question, A prediction . During training, it is necessary to first obtain the table T* (displayed with an asterisk) from the table T, question Q, and the labeled answer A. The method for obtaining T* is shown in Figure 7. First, suppose the original table T has n rows, and their row numbers (excluding the header) are 1, 2, 3, ..., n. Define the answer generated by the pre-trained model Model based on the i-th row and question Q as Answer. i Answer i The semantic similarity between the answer A and the question is denoted as Relation. i Relation i ∈(0,1], i = 1, 2, 3, ..., n. The pre-trained model here can be any model with tabular question-answering capabilities. Taking Figure 3 as an example, it has 11 rows. The user's query is "Which product categorized as home furnishings has the highest profit margin? How does it compare to the product with the highest profit margin across all categories?" The marked answer A is "Among products categorized as home furnishings, furniture has the highest profit margin, with a profit of 7890 yuan. However, televisions have a profit margin of 20678 yuan, meaning televisions have a higher profit margin than home furnishings. In fact, televisions have a profit margin 12788 yuan higher than furniture, nearly double the profit margin of furniture." The pre-trained model, based on the table header and the content of the third row ("Product Name, Product Category, Sales Revenue (RMB), Profit (RMB) | Snacks, Food & Groceries 43,567 9012"), and the query, generated the answer Answer3 as follows: "In this table, there is only one row of data, namely, the sales revenue of snacks is RMB 43,567 and the profit is RMB 9,012. Since there is only one row of data, it is impossible to determine which product categorized as household goods has the highest profit." The semantic similarity Relation3 between Answer3 and the query is 0.3. The data insight generation model is based on the table header plus a fourth row: "Product Name, Product Category, Sales Revenue (RMB)". The table shows a profit (RMB) of 52,345 yuan for televisions and 20,678 yuan for electronic products. The generated answer, Answer 4, is: "In this table, there is only one row of data, namely, the sales revenue of televisions is RMB 52,345, and the profit is RMB 20,678. Since there is only one row of data, it is impossible to determine which product categorized as household goods has the highest profit." The semantic similarity between Answer 4 and the question query is Relation 3 = 0.6. Similarly, you can obtain the Answers generated by the pre-trained model based on the content of each line. i Their relation to the semantic similarity of the query. i The values are {0.3, 0.3, 0.64, 0.6, 0.3, 0.3, 0.3, 0.64, 0.6, 0.3, 0.3}, i = 1, 2, ..., 11. If Max{Relation i |i=1,2,3,...,n}-Min{Relation i |i=1,2,3,...,n}<0.1, meaning the answer generated by each row and the question Query. i If the difference between the maximum and minimum semantic similarity values of the answer A is less than 0.1, then the entire table is considered a relevant area, and an asterisk (*) should be added to each row. The following example illustrates this. As shown in Table T in Figure 8, the query is "Which product categorized as home furnishings has the highest profit margin? How does it compare to the product with the highest profit margin across all categories?" The marked answer A is: "Among products categorized as home furnishings, furniture has the highest profit margin, at 7890 yuan. However, televisions have a profit margin of 20678 yuan, meaning televisions have a higher profit margin than home furnishings. In fact, televisions have a profit margin 12788 yuan higher than furniture, nearly double the profit margin of furniture." Answer generated by the pre-trained model i The semantic similarity with the labeled answer A is {0.64, 0.64, 0.6}, and the difference between the maximum and minimum values is 0.64-0.6=0.04<0.1. Therefore, we add * to all the cells in the entire table to get table T~*, as shown in Figure 9. If Max{Relation i |i=1,2,3,...,n}-Min{Relation i If |i=1,2,3,…,n}≥0.1, then the search algorithm shown in Table 1 below is used to filter out the relevant regions. Table 1. Algorithm Description Table for Relevant Regions The algorithm for generating the final region is shown in the example below. Please refer to Figure 3 for the table, the question Query, and the labeled answer A. Answers generated by the pre-trained model based on the content of each line i Their relation to the semantic similarity of question Q i The values are {0.3, 0.3, 0.34, 0.6, 0.3, 0.3, 0.3, 0.64, 0.64, 0.3, 0.3}, i = 1, 2, ..., 11. For Relation... i After sorting, the rows {0.64, 0.64, 0.6, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3} correspond to the row numbers {8, 4, 9, 1, 2, 3, 5, 6, 7, 10, 11}, which are Row1, Row2, ..., Row... 11 For example, Row1 is row 8 and Row2 is row 4. Marked Zone *Initially, only the table header "Product Name, Product Category, Sales Revenue (RMB), Profit (RMB)" was included, along with a pre-trained model. The pre-trained model used the table header and the query to generate the answer A0. Due to the lack of specific product data, it was impossible to determine which product categorized as "Home Furnishings" had the highest profit margin. Similarly, it was impossible to compare the highest-profit product within "Home Furnishings" with the highest-profit product across all categories. Pre-trained models use Zone * ∪Row1 represents the table showing "Product Name, Product Category, Sales Revenue (RMB), Profit (RMB) | Furniture & Home Furnishings: 53,789, 7,890". The query then generates answer A1, which states: "In this table, among the products categorized as Home Furnishings, furniture has the highest profit margin, at RMB 7,890. Compared to the highest-profit product across all categories, furniture's profit is the same as its own, because furniture is the highest-profit product within Home Furnishings." The semantic similarity between A0 and the labeled answer A is calculated to be 0.2, and the semantic similarity between A1 and the labeled answer A is 0.64. Since 0.64 > 0.2, the 8th row of table T is added to the zone. * Middle, or Zone * =Zone * ∪Row1. Next, the pre-trained model uses the current Zone*∪Row2 region, i.e., "Product Name | Product Category | Sales Revenue (Yuan) | Profit (Yuan) | Furniture | Home Furnishings | 53,789 | 7,890 | Television | Electronic Products | 52,345 | 20,678", and the query generates the answer A2 as: "In the provided table, furniture is the most profitable product categorized as home furnishings, with a profit of 7,890 yuan. Among all categories, television is the most profitable product, with a profit of 20,678 yuan. Therefore, the profit of television is higher than that of furniture, by a difference of 12,788 yuan." The semantic similarity R² between A2 and the labeled answer A is calculated to be 0.9. 0.9 > 0.64, so add the 4th row of table T to the zone. * Middle, or Zone * =Zone * ∪Row2. Similar to the process of generating A2, A3 generated using Zone* = Zone* ∪ Row3 is: "In the provided table, among the goods categorized as home furnishings, furniture has the highest profit, with a profit of 7,890 yuan. However, among all categories, the highest profit is for televisions, with a profit of 20,678 yuan. Therefore, the profit of televisions is higher than that of furniture, by a difference of 12,788 yuan." The semantic similarity R3 = 0.9, so Zone... * It remains unchanged. And so on, until the final Zone is obtained. * It is {Header, Row1, Row2}, labeled at the end of the diagram, as shown in Figure 10. (2) Pre-generated fact input strategy. During the process of the model generating text based on the table and the question, the generated content often does not match the actual information in the table, especially when numerical calculations are involved. Therefore, this method generates the actual facts in advance and uses them as input to the model during the prediction stage. As shown in Figure 11, the method for pre-generating facts can be broken down into five steps. First, all columns in the table are divided into three categories: numerical, date, and string. Next, a series of facts are generated based on a predefined reasoning template and the table. Then, the original question and the generated facts are vectorized. After that, facts relevant to the question are selected. Finally, the selected facts, the question, and the table are input into the language model. First, type parsing is performed on each column of the table. Type parsing, as defined in this article, refers to classifying each column in a string-formatted table into three categories: numeric, date, and string. The type parsing process for each column is shown in Figure 12. Let's take the table in Figure 3 as an example to illustrate the type parsing process. The table displays the best-selling products of a supermarket over a month, including product name, product category, sales amount, and profit information. The table lists the sales amount and profit for each product, in yuan. After parsing the four columns, the column named {Product Name, Product Category, Sales Amount (Yuan), and Profit (Yuan)} has a numeric type of {String, String, Number, Number}. After type parsing is complete, the second step is to generate several facts based on the reasoning template. Five templates are defined, and each template generates at least three facts. The fact templates defined in this paper are shown in Table 2 below. Each fact template includes several symbols that need to be filled in using information retrieved from the table, and multiple facts can be generated based on the fact template. The [operator] can be a [summation] operation, a [average] operation, or a [calculation] operation. The operation of finding the difference between two numbers, the operation of finding the maximum value and the operation of finding the minimum value refer to finding the rate of change of two values (assuming the two numbers are a and b, the rate of change of b relative to a is ba / a); The data types parsed in the previous step are used to generate [conditions]. [Conditions] (1) When the column is a string type, it is a statement of string inclusion relationships. For example, [the month contains the word "April"]. (2) When the column is a numeric or date type, it is a statement of numeric or date comparisons. (For example, a score greater than 93 or a creation time later than 1993). [Execution Result] is the result of executing some element values or [operators] in a column that meet the [conditions]. Table 2 Fact Template Definition Table For example, in the "Connection" section, the template is "[Condition] [Column Name] is [Result]". In Table T in Figure 7, the [Column Name] is filled with "Product Name", the [Condition] is selected as the numeric type "Profit (Yuan)" column, and it is filled with the numeric comparison "Profit (Yuan) exceeds 13789". The [Result] is filled with the values in the "Product Name" column that satisfy "Profit (Yuan) exceeds 13789". The final result is "Product names with profits (Yuan) exceeding 13789 are [TV, Mobile Phone]". In the "Numerical Operations (Sum, Average)" field, the operator for "[Column Name 2][Condition 2][Column Name 1] is [Result]". The filled result is: "[Product Category][Home Furnishings][Profit (Yuan)][Average] is..."
[5673] ". The third step is to vectorize the facts in natural language form and then filter through a selection of facts. In NLP, a common practice for comparing the similarity of two natural language statements is to use an embedding model to transform the two statements into two vectors, and then calculate their cosine values. For each table, this paper uses the same embedding model to transform the generated natural language facts and natural language questions into vectors. This embedding model is not restricted. For example, the fact "The years with more than 33 matches are 1975, 1977, 1978, 1979, 1980, 1981, 1972, 1973, 1974, 1976" is transformed into an m-dimensional vector (x1, x2, ..., x...) by an AI model. m ). The fourth step, after obtaining the vectorized representations of the question and facts, is to calculate the cosine similarity value between each fact and the question, and select the k facts with the highest cosine similarity value to the question. Where k = ... `rows` refers to the number of columns in the table, `cols` refers to the number of rows in the table, and `[x]` represents the largest integer not greater than x, i.e., rounding down x. Let there be two m-dimensional vectors x and y as (x1, x2, ..., xn). m ), (y1, y2, ..., y m The cosine similarity values of x and y are... For example, the original table had 11 rows and 4 columns. The template above generated 20 facts. Therefore, the top 5 facts with the highest cosine similarity to the question are selected from these 20 facts. Finally, the table marked with *, the question, and the k facts most similar to the question are input into the insight generation model in natural language prompt form to obtain the final answer, as shown in Figure 13. (3) An arrangement of models. This invention introduces an arrangement of models comprising two models: one model is responsible for marking question-related areas in a table with *, and the other model is responsible for answering questions based on the marked table. This strategy divides the process of the model answering table questions into two steps: information search and reasoning. Traditional methods mainly improve the model's performance during the training phase. Information retrieval and reasoning abilities are still implicitly performed by the model during the prediction phase. However, this new training strategy allows the model to explicitly perform these two processes step-by-step during the prediction phase, ensuring that the model focuses more on problem-relevant information during generation, thereby improving the accuracy of the generated results. This makes the model's reasoning process more transparent and improves the model's interpretability. The model is arranged as shown in flowchart 2. The following example illustrates how the data location model and the insight generation model work together: As shown in Figure 3, the table displays the top-selling items for each category in a supermarket over a month, including item name, category, sales revenue, and profit. Different types of goods are categorized into different classes, such as groceries, electronics, clothing and footwear, home goods, and cosmetics / skincare products. The table lists the sales revenue and profit for each item, in yuan. The user's query is: "Which item in the home goods category has the highest profit margin? How does it compare to the highest-profit item across all categories?" First, the data location model locates the rows containing furniture and home decor within the entire table based on the keyword "home furnishings". Then, an asterisk (*) is added before the content of each cell in these rows, as shown in Figure 4. Then, the pre-generated fact method described in the previous section is used to obtain the relevant facts from the table in Figure 3. "1. The [product names] sorted from highest to lowest by [profit (yuan)] are [television, mobile phone, grain and oil, cosmetics... shirts]," 2. After sorting by [profit (yuan)] from highest to lowest, the order of [company] in the product category of home furnishings is furniture, then home decoration. 3. The average profit (in RMB) for products categorized as "Home Furnishings" is 5000. 4...." Input the relevant facts, the table marked with an asterisk, and the questions into the insight generation model. The insight generation model will then generate data insights, as shown in Figure 13. The key point of the structured data insight generation method of this invention is: 1. A dataset annotation generation algorithm: During model fine-tuning, it is usually necessary to annotate a large amount of data, which requires a lot of manpower and time. This invention proposes an algorithm based on tables, questions, and answers to automatically generate answer-related regions, thereby reducing the burden of manual annotation. 2. Pre-generated fact input strategy: During the process of the model generating text based on the table and questions, the pre-generated fact input strategy... The generated data often differs from the actual information in the tables, especially when numerical calculations are involved. Therefore, this method generates the actual facts in advance and uses them as input to the model during the prediction phase. 3. Model Orchestration Strategy: This strategy comprises two models: one model marks question-related areas in the table with an asterisk (*), and the other model answers the questions based on the marked table. This strategy divides the model's answering of table-based questions into two steps: information retrieval and reasoning. Traditional methods primarily enhance the model's information retrieval and reasoning abilities during the training phase, while these two steps remain implicitly executed during the prediction phase. However, this new training strategy allows the model to explicitly execute these two processes step-by-step during the prediction phase, ensuring that the model focuses more on question-related information during generation, thereby improving the accuracy of the generated results. It also makes the model's reasoning process more transparent, enhancing its interpretability. The following is an explanation of the terminology involved in the structured data insight generation method of this invention. Natural Language Model: An AI model used to generate natural language sentences. Model illusion: The phenomenon where AI models generate information that does not match reality. In table-based question answering, it refers to the phenomenon where the model generates information that does not conform to the facts in the table. For example, if the average of several numbers in a table is 10, the text generated by the model might say that their average is 9.87. Training corpus: Text data used to train natural language models. Prompt: refers to a piece of text that provides input to an AI model to guide it in generating a specific output. Pre-trained model: A model that has been trained to perform a specific task on a large amount of data. Model fine-tuning: refers to continuing to train an existing pre-trained model to improve its capabilities in certain aspects. End-to-end: End-to-end means that the data at the input end directly yields the result at the output end. In this article, it refers to the model generating the answer directly from the input table and the question. Non-end-to-end: This corresponds to multi-step problem-solving, which means breaking down a problem into multiple steps and solving them one by one. Embedding model: A model that maps high-dimensional data (such as text, images, and videos) to a low-dimensional space (vectors). The beneficial effects of the structured data insight generation method of this invention are: This invention, through the above technical solution, fine-tunes an open-source natural language model using corresponding tables, question and answer datasets to obtain a data localization model and an insight generation model; the data localization model identifies and labels question-related locations from the table; the data localization model uses pre-generated data from the table... The method of generating facts generates relevant inference facts from templates; the labeled tables, questions and generated inference facts are input into the insight generation model, which provides the final structured data insights. This reduces the pressure of manual annotation when collecting data, improves the interpretability and accuracy of model predictions, and reduces the model illusion problem in language models when reasoning (especially numerical reasoning). To achieve the above objectives, the present invention also proposes a structured data insight generation system, the system including a memory, a processor, and a structured data insight generation program stored on the processor. The structured data insight generation program is executed by the processor to perform the steps of the method described in the above embodiments, which will not be repeated here. To achieve the above objectives, the present invention also proposes a computer-readable storage medium storing a structured data insight generation program, which, when run by a processor, executes the steps described in the above embodiments, and will not be repeated here. The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural changes made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for structured data insight generation, the method comprising: The method comprises the following steps: Step S10, after fine-tuning the open source natural language model using the corresponding table, question and answer dataset, obtaining a data positioning model and an insight generation model; Step S20, the data positioning model identifies and labels the position related to the question from the table; Step S30, the data positioning model generates relevant reasoning facts from the template using the pre-generated fact method for the table; Step S40, input the labeled table, question and generated reasoning fact into the insight generation model, and the insight generation model gives the final structured data insight.
2. The structured data insight generation method of claim 1, wherein, The step S10 comprises a data positioning model training task and an insight generation model training task, wherein: (1) Data positioning model training task: Input: prompt(T, Q), input table T and question Q in the form of prompt; Output: labeled table T*; (2) Insight generation model training task: Input: prompt(T*, Q), input labeled table T* and question Q in the form of prompt, wherein T* is generated from the original table T according to the algorithm; Output: Answer to the question A prediction ; When training the data positioning model and the insight generation model, the labeled table T* is first obtained from the table T, the question Q and the labeled answer A.
3. The structured data insight generation method of claim 2, wherein, The step of obtaining the labeled table T* from the table T, the question Q and the labeled answer A comprises: Let the original table T, the question Q and the labeled answer be A, the table T has n rows, and the row numbers are 1, 2, 3, …, n respectively; Definition of the pre-training model according to the answer Answer generated by the ith row and the question Q i , the answer Answer i The semantic similarity of the answer A marked with the question is recorded as Relation i , Relation i ∈(0, 1], i = 1, 2, 3…, n; Set of records Relation i ∈(0,1], i = 1, 2, 3…, max in n, min in n; Determine whether the difference between the maximum value max and the minimum value min is less than 0.1; If less than 0.1, label the table T*, which is the original table T; If greater than or equal to 0.1, then use algorithm to get final problem corresponding zone Zone * And mark out in the original table T to get T* 4. The structured data insights generation method of claim 1, wherein, In step S30, the pre-generated fact method comprises the following steps: Type analysis is performed on each column of the table, and all columns in the table are divided into three types: numerical value, date and string; A series of facts are generated according to the predefined reasoning template and the table; The original question and the generated fact are vectorized; Screen out the facts related to the question; Input the screened facts, questions and tables into the language model.
5. The structured data insight generation method of claim 4, wherein, The step of type analysis on each column of the table, and dividing all columns in the table into three types: numerical value, date and string, comprises: Determine whether the type of each column of the table is numerical value type; If yes, determine that the type of each column of the table is numerical value; If not, determine whether the type of each column of the table is date type; If yes, determine that the type of each column of the table is date; If not, determine that the type of each column of the table is string.
6. The structured data insight generation method of claim 4, wherein, In the step of generating a series of facts according to the predefined reasoning template and the table, five templates are defined, and each template generates at least three facts.
7. The structured data insights generation method of claim 4, wherein, The step of vectorizing the original question and the generated fact comprises: Vectorize the natural language form of the fact, and screen out several facts.
8. The structured data insights generation method of claim 4, wherein, The step of screening out the facts related to the question comprises: After obtaining the vectorized representation of the question and the fact, calculate the cosine similarity value of each fact and the question, and select k facts with the highest cosine similarity value to the question, wherein, rows refers to the number of columns of the table, cols refers to the number of rows of the table, and [x] represents the maximum integer not greater than x, i.e., the floor of x.
9. A structured data insight generation system, characterized by, The system comprises a memory, a processor, and a structured data insight generation program stored on the processor, which, when executed by the processor, performs the steps of the method of any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a structured data insight generation program, which, when executed by a processor, performs the steps of the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Table question and answer method based on large language model and natural language processing
CN117743526A
Large model table-oriented question and answer method
CN117972070A
Data processing method and device, equipment, storage medium and product
CN118014086A
Table data processing large language model training method and device, medium and equipment
CN118132969A
Producing Insight Information from Tables Using Natural Language Processing
US20150309990A1