A method, device and medium for processing tabular data using a large model
By converting natural language into SQL queries and optimizing the calculation graph, it solves the problem of low efficiency of large models in processing tabular data, achieves more efficient tabular data processing and user-friendly interface, and is suitable for tabular data tasks in different fields.
Patent Information
- Application Number
- CN202410645067.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-05-23
AI Technical Summary
Existing large models perform poorly when processing tabular data, have low efficiency, are difficult to understand and operate two-dimensional tabular data, and require professional SQL query statements for users, which increases the threshold for use.
By converting users' natural language into SQL queries, parsing them into operators, using operators to decompose, combine, and rearrange, and combining with cost function optimization to generate fine-grained calculation graphs, compile them into code for execution, provide user responses, lower user thresholds and Improve data operation efficiency.
It improves the understanding and processing efficiency of tabular data in large models, lowers the user threshold, enhances the reliability and generalization ability of data operations, and is suitable for tabular data tasks in different fields.
Smart Images

Figure CN118245485B
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer database, large model, natural language processing and compilation, and in particular to a method, device and medium for processing tabular data with a large model. Background Art
[0002] Tabular data can be found everywhere in daily work and life, and is widely used in various applications and web pages. Whether it is used for personal task management, data analysis, or team collaboration, people tend to use tables to organize and process data. As a clear and intuitive way to convey information, tables are widely used to display and analyze data. In enterprises, relational databases are ubiquitous. These databases organize data in the form of tables and perform data operations through query languages such as SQL. Because tabular data has a clear structure, is easy to maintain, and is friendly to both human and machine understanding, tables and relational databases have become the most commonly used structured knowledge storage form in all walks of life. They are widely used to store and manage large amounts of structured data, such as customer information, sales data, inventory information, etc., providing indispensable support for the daily operations and decision-making of enterprises.
[0003] However, there are certain thresholds in query interactions for tabular knowledge: dialogue systems or search engines cannot very well query tabular knowledge as answers. In addition, queries to relational databases require professional technicians to write query statements (such as SQL statements) to complete, which is a high threshold for most users. Considering that large language models represented by GPT-3 and ChatGPT have demonstrated outstanding capabilities in following human instructions and performing various tasks, especially in the field of natural language processing, using these large models for tabular data processing can help make up for the lack of ability of ordinary users to write professional query statements. By using large language models, users can ask queries in natural language without having to understand complex query languages in advance, which helps improve the efficiency and ease of use of tabular data processing.
[0004] Large models are usually trained on large amounts of natural language corpus data, so they perform poorly on tabular data understanding tasks. The main reason is that tabular data is a two-dimensional object, while natural language is a one-dimensional object, so more complex information processing capabilities are required to understand and manipulate tabular data. In addition, neural networks also have certain limitations in processing heterogeneous data and numerical representation, which further leads to the poor performance of large models when processing tabular data. Therefore, more in-depth research on large model processing techniques for tabular data is needed to overcome these challenges and improve the performance of large models on tabular data understanding tasks. Summary of the invention
[0005] The purpose of the present invention is to propose a method, device and medium for processing tabular data with a large model to address the problems of poor performance and low efficiency when processing tabular data with existing large models, thereby simplifying the way users process tabular data, improving the reliability of data operation execution, and better handling data variability and generalization to different fields.
[0006] The object of the present invention is achieved through the following technical solution: A method for processing tabular data using a large model, comprising:
[0007] (1) Convert the user’s natural language into SQL queries to perform table data query requests;
[0008] (2) Parse the table tasks in the SQL query into corresponding operators to generate a coarse-grained computational graph;
[0009] (3) Use operator decomposition, operator combination, operator rearrangement, and cost function to optimize the coarse-grained computational graph and generate a fine-grained computational graph;
[0010] (4) Compile into code based on the fine-grained computational graph;
[0011] (5) Execute the code and get a response from the user.
[0012] Furthermore, the converting of the user's natural language into SQL query includes:
[0013] The user's natural language is converted into SQL queries through a large model.
[0014] Furthermore, the operators include table understanding operators, table question-answering operators, table conversion operators, table cleaning operators, table matching operators, and table enhancement operators.
[0015] Furthermore, the operator is encapsulated by the corresponding model.
[0016] Furthermore, the use of operator decomposition, operator combination, operator rearrangement, and combining a cost function to optimize the coarse-grained computational graph to generate a fine-grained computational graph includes:
[0017] Operator decomposition is used to decompose operators in a coarse-grained computational graph into finer-grained operators. Then, redundant operators are removed and combined based on the commutativity and composability of operators. The optimal execution order is calculated in combination with the cost function to rearrange the operators and obtain a fine-grained computational graph.
[0018] Furthermore, the processing order between the two operators changes, but the processing results are the same, that is, the two operators are interchangeable;
[0019] The two operators decompose into the same finer-grained operators, that is, the two operators are composable.
[0020] Furthermore, the cost of an operator is obtained by multiplying the execution time of the operator processing a piece of data by the amount of data processed by the operator; the cost of different computational graphs is obtained by the sum of the costs of the operators in the computational graphs.
[0021] The present invention also provides a device for processing tabular data using a large model, comprising:
[0022] A user interaction module, used to convert the user's natural language into SQL queries to perform table data query requests;
[0023] The computation graph generation module is used to parse the table tasks in the SQL query into corresponding operators to generate a coarse-grained computation graph;
[0024] The computational graph optimization module is used to optimize the coarse-grained computational graph by using operator decomposition, operator combination, operator rearrangement, and cost function to generate a fine-grained computational graph;
[0025] The code generation module is used to compile into code based on the fine-grained computational graph;
[0026] The code execution module is used to execute the code and obtain a user response.
[0027] The present invention also provides a device for processing tabular data using a large model, comprising one or more processors for implementing the above-mentioned method for processing tabular data using a large model.
[0028] The present invention also provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, it is used to implement the above-mentioned method of processing tabular data with a large model.
[0029] The beneficial effects of the present invention are that the present invention provides a method, device and medium for processing tabular data with a large model. The domain large model customized for the tabular task can better understand the tabular data; convert the natural language queries proposed by the user into SQL queries, thereby lowering the threshold for user use; the optimization and compilation layer can better optimize, enhance and compile the SQL query plan into target code, thereby further improving the execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0031] Figure 1 It is a flowchart of a method for processing tabular data using a large model provided by an embodiment of the present invention;
[0032] Figure 2 This is a model architecture diagram for natural language to SQL query conversion based on a large model;
[0033] Figure 3 Schematic diagram of model fine-tuning of six operators in the present invention, wherein (a) is a table understanding data fine-tuning large model to obtain a table understanding model, (b) is a table question answering data fine-tuning large model to obtain a table question answering model, (c) is a table conversion data fine-tuning large model to obtain a table conversion model, (d) is a table cleaning data fine-tuning large model to obtain a table cleaning model, (e) is a table matching data fine-tuning large model to obtain a table matching model, and (f) is a table enhancement data fine-tuning large model to obtain a table enhancement model;
[0034] Figure 4 is an example diagram of operator exchangeability and combinability provided by an embodiment of the present invention, wherein diagram (a) is one processing order of two operators, diagram (b) is another processing order of the two operators, diagram (c) is the processing order before the two operators are combined, and diagram (d) is the processing order after the two operators are combined without duplication;
[0035] Figure 5 It is a hardware structure diagram provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present invention is described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the features of the following embodiments and implementations can be combined with each other.
[0037] A method for processing tabular data using a large model of the present invention comprises:
[0038] (1) Convert the user's natural language into SQL (Structured Query Language) queries to perform table data query requests;
[0039] Specifically, the user's natural language is converted into SQL queries using a large model;
[0040] Furthermore, the large model is trained as follows: the tabular data and the metadata of the table are embedded into a vector, and the set transformer is used as the backbone of the table encoder, which is enhanced by the attention mechanism; for specific industries, a domain data processing pipeline is adopted. The domain data processing pipeline uses active learning to carefully select fine-tuning examples in the domain data to achieve excellent fine-tuning results with fewer examples and accelerate model learning; pre-packaged function commands are used to enhance the multi-hop reasoning ability of the large model in table operations. These command sequences are easier to be checked and errors are located by the backend parsing system.
[0041] Table encoding representation: For tabular data, the present invention proposes a table encoding representation that embeds the entire table into a vector for extracting a global representation from the table so that LLM can achieve comprehensive table understanding. The table encoding representation combines the ability to extract knowledge from metadata and the entire digital entry, and divides the information of the table data into two main parts: one part learns the metadata representation of the table, and the other part learns the digital information representation of the table. A modified set transformer is used as the backbone of the table encoder and is enhanced by an attention mechanism. This encoder is pre-trained on a large tabular dataset, and the learned table representation can not only be used for table understanding, but also enhance the prediction performance of downstream classifiers.
[0042] Chain of Command: We enhance the multi-hop reasoning capabilities of Large Language Models (LLMs) in table operations through pre-packaged function commands. These command sequences are easier to be checked and errors are located by the backend parsing system. In addition, we introduce Chain of Command (CoC) to enhance the chain of thought approach by providing step-by-step instructions related to intermediate steps. The purpose of Chain of Command is to enhance the reasoning ability and robustness of LLM when operating table data. It involves converting user input into a series of intermediate command operations, enabling LLM to manipulate table data more accurately and efficiently. To improve performance and stability, we constructed a dataset with a large number of command chain instructions, fine-tuned LLM to adapt to these commands, and adopted contextual learning to provide hints for multiple steps in the command chain sequence.
[0043] Domain Data Processing Pipeline: The present invention includes an efficient domain data processing pipeline, which aims to address the shortcomings of large language models in processing the subtle language style and logic of specific industries. The pipeline uses active learning methods to achieve excellent fine-tuning results with a smaller number of examples by carefully selecting fine-tuning examples in domain data, thereby accelerating the learning process of the model. In addition, we further enhance the file retrieval function of LLM, using technologies such as vector database and LangChain, which can retrieve relevant information from a large number of proprietary files, providing LLM with a richer learning context. These innovative methods and technologies help to improve the performance and applicability of LLM in specific industry fields.
[0044] (2) Parse the table tasks in the SQL query into corresponding operators to generate a coarse-grained computational graph; the operators include table understanding operators, table question-answering operators, table conversion operators, table cleaning operators, table matching operators, and table enhancement operators;
[0045] Based on the large model, a professional model for the target task is customized, and the customized model is encapsulated into an operation operator; specifically, the table understanding operator is obtained by encapsulating the table understanding model, and the table understanding model is obtained by using Figure 3 The table comprehension data shown in (a) is fine-tuned to obtain the large model; the table question answering operator is obtained by encapsulating the table question answering model, and the table question answering model is obtained by using Figure 3 The table conversion operator is obtained by encapsulating the table conversion model, and the table conversion model is obtained by using the table conversion operator. Figure 3 The table conversion data shown in (c) is fine-tuned to obtain the large model; the table cleaning operator is obtained by encapsulating the table cleaning model, and the table cleaning model is obtained by using Figure 3 The table shown in (d) is obtained by fine-tuning the large model by cleaning the data; the table matching operator is obtained by encapsulating the table matching model, and the table matching model is obtained by using Figure 3 The table matching data shown in (e) is used to fine-tune the large model; the table enhancement operator is obtained by encapsulating the table enhancement model, and the table enhancement model is obtained by using Figure 3 The table shown in (f) is obtained by fine-tuning the large model with enhanced data.
[0046] (3) Use operator decomposition, operator combination, and operator rearrangement to optimize the coarse-grained computational graph and generate a fine-grained computational graph;
[0047] Specifically, the operators in the coarse-grained computational graph are decomposed into finer-grained operators using operator decomposition, and then the redundant operators are removed. Operators are combined and rearranged based on the commutativity and composability of the operators, and the optimal execution order is calculated based on the cost function to obtain a fine-grained computational graph.
[0048] If operator a and operator b are commutative, when the input data is the same, the result after the data is processed by operator a and then by operator b is the same as the result after the data is processed by operator b and then by operator a, such as Figure 4 (a) and Figure 4 As shown in (b) in . The composability of operators is that, Figure 4 As shown in (c), operator M includes two processes M1+M2, and operator M' includes two processes M1+M3. Operators M and M' can be decomposed, the redundant M1 is removed, and M2+M3 are combined into one operator, as shown in Figure 4 As shown in (d) in .
[0049] The cost of an operator is obtained by multiplying the execution time of the operator to process a piece of data by the amount of data processed by the operator; the cost of different computational graphs is obtained by the sum of the costs of the operators in the computational graphs.
[0050] (4) Compile into executable code based on the fine-grained computational graph;
[0051] (5) Execute the code and get the user's response.
[0052] Specifically, load the code and the dependent libraries during code execution; execute the loaded code.
[0053] The present invention also provides a device for processing tabular data using a large model, comprising:
[0054] A user interaction module, used to convert the user's natural language into SQL queries to perform table data query requests;
[0055] The computation graph generation module is used to parse the table tasks in the SQL query into corresponding operators to generate a coarse-grained computation graph;
[0056] The computational graph optimization module is used to optimize the coarse-grained computational graph by using operator decomposition, operator combination, operator rearrangement, and cost function to generate a fine-grained computational graph;
[0057] Specifically, the computational graph optimization module includes:
[0058] Operator decomposition module, used to decompose operators in a coarse-grained computational graph into finer-grained operators;
[0059] Operator combination module, used to deduplicate and merge finer-grained operators;
[0060] The operator rearrangement module is used to calculate the optimal execution order according to the cost function to rearrange the operators after the operators are deduplicated and merged.
[0061] The code generation module is used to compile into code based on the fine-grained computational graph;
[0062] The code execution module is used to execute the code and obtain a user response.
[0063] It should be noted that the device embodiment shown in this embodiment matches the content of the above method embodiment, and the content of the above method embodiment can be referred to, which will not be repeated here.
[0064] Corresponding to the aforementioned embodiment of a method for processing tabular data using a large model, the present invention also provides an embodiment of an apparatus for processing tabular data using a large model.
[0065] See also Figure 5 An embodiment of the present invention provides a device for processing tabular data with a large model, including one or more processors, for implementing a method for processing tabular data with a large model in the above embodiment.
[0066] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0067] An embodiment of a large-scale model apparatus for processing tabular data of the present invention can be applied to any device with data processing capability, and the device with data processing capability can be a device or apparatus such as a computer. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, the processor of any device with data processing capability reads the corresponding computer program instructions in the non-volatile memory into the memory and runs them. From the hardware level, if Figure 5 As shown, it is a hardware structure diagram of any device with data processing capability where a large model of the present invention processes table data, except Figure 5 In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the apparatus in the embodiments is located may also include other hardware, generally based on the actual functions of the device with data processing capabilities, which will not be described in detail.
[0068] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0069] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.
[0070] An embodiment of the present invention further provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a method for processing tabular data with a large model in the above embodiment is implemented.
[0071] The computer-readable storage medium may be an internal storage unit of any device with data processing capability described in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be any device with data processing capability, such as a plug-in hard disk, a smart media card (SMC), an SD card, a flash card, etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of any device with data processing capability and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.
[0072] The above embodiments are only used to illustrate the design ideas and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.
Claims
1. A method for processing tabular data with a large model, It is characterized in that include: (1) Convert the user’s natural language into SQL queries to perform table data query requests; (2) Parse the table tasks in the SQL query into corresponding operators to generate a coarse-grained computational graph; (3) Use operator decomposition, operator combination, operator rearrangement, and cost function to optimize the coarse-grained computational graph to generate a fine-grained computational graph, including: Operator decomposition is used to decompose operators in a coarse-grained computational graph into finer-grained operators. Then, redundant operators are removed and combined based on the commutativity and composability of operators. The optimal execution order is calculated in combination with the cost function to rearrange the operators and obtain a fine-grained computational graph. The operators include table understanding operators, table question-answering operators, table conversion operators, table cleaning operators, table matching operators, and table enhancement operators; the operators are encapsulated by corresponding fine-tuning large models; (4) Compile into code based on the fine-grained computational graph; (5) Execute the code and get a response from the user.
2. The method according to claim 1, It is characterized in that The converting the user's natural language into SQL query includes: The user's natural language is converted into SQL queries through a large model.
3. The method according to claim 1, It is characterized in that The processing order between the two operators changes, but the processing results are the same, that is, the two operators are interchangeable; The two operators decompose into the same finer-grained operators, that is, the two operators are composable.
4. The method according to claim 1, It is characterized in that The cost of an operator is obtained by multiplying the execution time of the operator to process a piece of data by the amount of data processed by the operator; the cost of different computational graphs is obtained by the sum of the costs of the operators in the computational graphs.
5. A device for processing tabular data in a large model, It is characterized in that include: A user interaction module, used to convert the user's natural language into SQL queries to perform table data query requests; The computation graph generation module is used to parse the table tasks in the SQL query into corresponding operators to generate a coarse-grained computation graph; The computational graph optimization module is used to optimize the coarse-grained computational graph by using operator decomposition, operator combination, operator rearrangement, and cost functions to generate a fine-grained computational graph, including: Operator decomposition is used to decompose operators in a coarse-grained computational graph into finer-grained operators, and then redundant operators are removed, and operators are combined based on the interchangeability and composability of operators, and then the optimal execution order is calculated in combination with the cost function to rearrange the operators to obtain a fine-grained computational graph; the operators include table understanding operators, table question-answering operators, table conversion operators, table cleaning operators, table matching operators, and table enhancement operators; the operators are encapsulated by the corresponding fine-tuned large model; The code generation module is used to compile into code based on the fine-grained computational graph; The code execution module is used to execute the code and obtain a user response.
6. A device for processing tabular data in a large model, It is characterized in that The method comprises one or more processors for implementing a method for processing tabular data with a large model according to any one of claims 1 to 4.
7. A computer-readable storage medium having a program stored thereon, It is characterized in that When the program is executed by a processor, it is used to implement a method for processing tabular data with a large model as described in any one of claims 1-4.
