Multi-data-source intelligent question answering method and device based on large model and storage medium

By using a multi-data source intelligent question-answering method based on a large model, combining metadata with user questions to generate query and data analysis code, the problem of existing tools struggling to understand structured and unstructured data is solved, enabling accurate data analysis and visualization.

CN121031776APending Publication Date: 2025-11-28CHINA MERCHANTS BANK
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202511117933.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-11
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

Existing intelligent question-answering tools struggle to deeply understand the correlation patterns between structured and unstructured data, and are unable to effectively analyze user-uploaded data.

Method used

By using a multi-data source intelligent question-answering method based on a large model, combining metadata with user questions, query and data analysis code is generated to achieve accurate location and analysis of multiple data sources.

Benefits of technology

It enables accurate understanding and analysis of structured and unstructured data, avoids the problem of insufficient adaptation of heterogeneous data formats and metadata rules, and generates accurate data analysis results and visualization charts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121031776A_ABST
    Figure CN121031776A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-data-source intelligent question and answer method and device based on a large model and a storage medium, and relates to the technical field of data processing.The method comprises the steps that metadata corresponding to an initial data set uploaded by a user and questions asked by the user are input into a pre-trained reasoning large model, and query codes are generated; performing screening query on the metadata according to the query code to obtain a target data set; inputting the target data set and the user questions into the large reasoning model to generate data analysis codes; and executing the data analysis code to obtain a code execution result. The unified symbolic structure of the metadata provides reference constraint basis for the model to generate query codes, so that the model can accurately understand the format specification and internal association of data, a natural language question is mapped into query grammar conforming to a data storage format based on a large reasoning model, and the query grammar and the query grammar conforming to the data storage format are obtained through metadata prompt and code generation. And the problem of insufficient adaptation of a large model to heterogeneous data formats and metadata rules is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a multi-data-source intelligent question-answering method based on a large model, equipment and a storage medium. BACKGROUND

[0002] At present, the core architecture of general intelligent question-answering tools and document question-answering systems is oriented to natural language processing, and the model training data and algorithm optimization thereof are focused on text semantic understanding, and lack of deep adaptation to specific formats and metadata rules of structured data and unstructured data. For example, for unstructured data, the core is a relationship network composed of nodes and edges, and the meanings carried by the attributes of the nodes, the weights and types of the edges are often deeply bound to specific business scenarios. The metadata rules based on the topological structure are essentially different from the linear semantics of the text, and the existing intelligent question-answering tools are difficult to capture the correlation patterns therein, resulting in difficulty in deeply understanding the data connotation and being unable to directly perform data analysis tasks on the structured data or unstructured data uploaded by the user.

[0003] The above content is only used to assist in understanding the technical solutions of the present application and does not represent the acknowledgement of the above content as prior art. SUMMARY

[0004] The main purpose of the present application is to provide a multi-data-source intelligent question-answering method based on a large model, equipment and a storage medium, aiming to solve the technical problem of how to perform data question-answering on multiple structured and unstructured data sources through a large model.

[0005] In order to solve the above problems, the present application provides a multi-data-source intelligent question-answering method based on a large model, which comprises:

[0006] inputting metadata corresponding to an initial data set uploaded by a user and a user question into a pre-trained inference large model to generate a query code;

[0007] performing screening and querying on the metadata according to the query code to obtain a target data set;

[0008] inputting the target data set and the user question into the inference large model to generate a data analysis code;

[0009] executing the data analysis code to obtain a code execution result.

[0010] In an embodiment, before the step of inputting the metadata corresponding to the initial data set uploaded by the user and the user question into the pre-trained inference large model to generate the query code, the method further comprises:

[0011] determining a data type of the initial data set, determining a parsing tool according to the data type;

[0012] parsing the initial data set based on the parsing tool to obtain the metadata corresponding to the initial data set.

[0013] In an embodiment, the step of inputting the metadata corresponding to the initial data set uploaded by the user and the user's query input into the pre-trained inference large model to generate a query code comprises:

[0014] performing semantic parsing and intent recognition on the user's query based on the inference large model to obtain an operation object;

[0015] performing semantic comparison between the operation object and the field name, field description and data type in the target data set to determine a storage field corresponding to the operation object;

[0016] generating the query code according to the storage field and the operation object based on the syntax knowledge of the inference large model.

[0017] In an embodiment, the step of generating the query code according to the storage field and the operation object based on the syntax knowledge of the inference large model comprises:

[0018] determining a data source type of the metadata, calling a syntax mapping rule built-in the inference large model based on the data source type to generate a basic structural framework of a corresponding query language;

[0019] filling the storage field into a placeholder in a corresponding position of the basic structural framework to obtain the query code.

[0020] In an embodiment, the step of inputting the target data set and the user's query into the inference large model to generate a data analysis code comprises:

[0021] performing semantic parsing and intent recognition on the user's query based on the inference large model to obtain a processing mode corresponding to the target data set;

[0022] mapping the processing mode into a standard data processing operation;

[0023] inputting the target data set and the standard data processing operation into the inference large model to obtain the data analysis code.

[0024] In an embodiment, the step of executing the data analysis code to obtain a code execution result further comprises:

[0025] Based on the reasoning large model, the user question is semantically analyzed, a target word containing a visualization intention is identified, and a chart type with a mapping relationship is determined according to the target word;

[0026] Based on the reasoning large model, the mapping relationship between the data and the chart in the code execution result is determined.

[0027] A chart rendering engine is called to generate a visualization chart according to the chart type, the mapping relationship between the data and the chart, and the data in the code execution result.

[0028] In an embodiment, the big model-based multi-data source intelligent question answering method further comprises:

[0029] The user question is obtained as a seed question, and the seed question is input into a preset big model to perform question diffusion to obtain an extended question;

[0030] The extended question is input into the big model to generate a question answer;

[0031] The question answer and the extended question that are correctly labeled are input into the big model to generate a reasoning process and obtain reasoning training data;

[0032] The big model is trained according to the reasoning training data to obtain a fine-tuning model.

[0033] In an embodiment, after the step of training the big model according to the reasoning training data to obtain the reasoning large model, the method further comprises:

[0034] A reward function is constructed according to a predicted answer, a standard answer, and a preset thinking length output by the fine-tuning model;

[0035] A reward and punishment score of the predicted answer is determined based on the reward function;

[0036] The fine-tuning model is iterated according to the reward and punishment score to obtain the reasoning large model.

[0037] In addition, to achieve the above object, the present application also proposes a big model-based multi-data source intelligent question answering device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the big model-based multi-data source intelligent question answering method as described above.

[0038] In addition, to achieve the above-mentioned purpose, the application further provides a storage medium, which is a computer readable storage medium, and a computer program is stored on the storage medium, and the computer program is executed by a processor to implement the steps of the large model-based multi-data source intelligent question answering method.

[0039] The application provides a large model-based multi-data source intelligent question answering method. The structured metadata eliminates the format difference of the original data, and the metadata and the natural language demand of the user's question jointly constitute the input of the model. The model is used to associate the data meta information by using the understanding ability of the natural language, and generate a query code capable of accurately positioning the data. The target data set is obtained by screening and querying the metadata through the query code and stripping irrelevant information; and the target data set is input into the model together with the user's question to generate data analysis code adapted to statistical and association tasks, and the answer to the user's question is obtained through the execution result of the data analysis code.

[0040] The unified symbolic structure of the metadata provides a direct reference constraint basis for the model to generate the query code, so that the model can accurately understand the format specification and internal correlation of the data. The natural language question is mapped to a query syntax conforming to the data storage format based on the reasoning large model, and the problem of insufficient adaptation of the large model to heterogeneous data formats and metadata rules is avoided through metadata prompting and code generation. BRIEF DESCRIPTION OF DRAWINGS

[0041] The accompanying drawings, which are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the application and, together with the specification, serve to explain the principles of the application.

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0043] Figure 1 The first flowchart of the large model-based multi-data source intelligent question answering method provided by the application is shown in the following figure:

[0044] Figure 2 The data screening flowchart of the large model-based multi-data source intelligent question answering method provided by the application is shown in the following figure:

[0045] Figure 3 The metadata analysis flowchart of the large model-based multi-data source intelligent question answering method provided by the application is shown in the following figure:

[0046] Figure 4 The second flowchart of the large model-based multi-data source intelligent question answering method provided by the application is shown in the following figure:

[0047] Figure 5 A third process schematic diagram provided by the large model-based multi-data source intelligent question answering method of the present application;

[0048] Figure 6 A structural schematic diagram of a hardware running environment involved in the large model-based multi-data source intelligent question answering method in the embodiments of the present application.

[0049] The object implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and do not limit the present application.

[0051] In order to better understand the technical solutions of the present application, the following will be described in detail in combination with the drawings and specific embodiments of the specification.

[0052] To achieve the above object, the present application provides a large model-based multi-data source intelligent question answering method, the metadata corresponding to the initial data set uploaded by the user and the user question input are input to the pre-trained inference large model to generate query code; the metadata is filtered and queried according to the query code to obtain a target data set; the target data set and the user question are input into the inference large model to generate data analysis code; and the data analysis code is executed to obtain a code execution result.

[0053] At present, the core architecture of general intelligent question answering tools and document question answering systems is oriented to natural language processing, and the model training data and algorithm optimization thereof are focused on text semantic understanding, lacking deep adaptation to the specific format and metadata rules of structured data and unstructured data. For example, for unstructured data, its core is a relationship network composed of nodes and edges, and the attributes of nodes, the weights and types of edges, and the meanings carried by them are often deeply bound with specific business scenarios. The metadata rules based on topological structure and the linear semantics of text have essential differences, and the existing intelligent question answering tools are difficult to capture the correlation patterns therein, resulting in difficulty in deeply understanding the data connotation and inability to directly perform data analysis tasks on the structured data or unstructured data uploaded by the user.

[0054] The application provides a large model-based multi-data source intelligent question answering method. Structured metadata eliminates format differences of original data, and the metadata and natural language requirements of user questions jointly constitute the input of the model. The model uses the understanding ability of natural language to associate data metadata, and generates query code that can accurately locate data. The query code is used to filter and query the metadata to obtain a target data set. The target data set is input into the model with the user question to generate data analysis code for adaptive statistics and association tasks. The execution result of the data analysis code is used to obtain an answer to the user question.

[0055] The unified symbolic structure of the metadata provides a direct reference constraint basis for the model to generate query code, so that the model can accurately understand the format specification and internal correlation of the data. The natural language question is mapped to a query syntax that conforms to the data storage format based on the reasoning large model. Through metadata prompting and code generation, the problem of insufficient adaptation of the large model to heterogeneous data formats and metadata rules is avoided.

[0056] It should be noted that the execution subject of the embodiment can be a computing service device with network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, or an electronic device or apparatus capable of realizing the above functions. The following describes the embodiment and each of the following embodiments based on a large model-based multi-data source intelligent question answering device.

[0057] Based on this, the application provides a large model-based multi-data source intelligent question answering method, which is described below with reference to Figure 1 , Figure 1 The following is a flowchart of a first embodiment of the large model-based multi-data source intelligent question answering method of the application.

[0058] In this embodiment, the large model-based multi-data source intelligent question answering method is applied to a large model-based multi-data source intelligent question answering device. The method includes steps S10-S40.

[0059] Step S10: inputting metadata corresponding to an initial data set uploaded by a user and a user question into a pre-trained reasoning large model to generate query code.

[0060] Step S20: filtering and querying the metadata according to the query code to obtain a target data set.

[0061] In this embodiment, different metadata parsing is performed on different initial data sets uploaded by users to obtain corresponding metadata. After obtaining the parsed metadata, preliminary screening and filtering are performed on the metadata. Specifically, for data files such as Excel, CSV, and Markdown, fine-tuned reasoning large models are used to generate Python code files for data screening; for relational or non-relational databases such as MySQL and Neo4j, fine-tuned reasoning large models are used to generate database query codes such as SQL and Cypher, and database clients are used to execute the codes to obtain data. Through data filtering, the amount of data that needs to be analyzed is reduced.

[0062] For example, referring to Figure 2 , the data source of the initial data set input by the user is a MySQL relational database, and the user asks, "I want to view the proportion of insurance sales in each branch." The database contains detailed insurance sales data for each first-level branch. The data filtering part generates a corresponding SQL query statement through the user's question and the parsed metadata of the data table by using a large model, and obtains the summary information of insurance sales in each branch dimension through the execution of the database client.

[0063] In step S30, the target data set and the user question are input into the reasoning large model to generate data analysis code.

[0064] In step S40, the data analysis code is executed to obtain the code execution result.

[0065] In this embodiment, the user's question and the limited data set after preliminary screening are input into the reasoning large model. The natural language understanding module decomposes the user's question into an analysis intent, and combines the metadata and the analysis intent into a task description body. The semantics are converted into symbol sequences recognizable by the computing unit through symbolic coding. The reasoning large model generates data analysis code to solve the current user's question based on the pre-trained business logic mapping knowledge. For example, the user's input question is "I want to view the proportion of insurance sales in each branch," and the output code execution result is the proportion of insurance sales in each branch relative to the total sales of the branch.

[0066] The generated code is reprocessed, and the result output code is filled and corrected. Through the preset rule engine and the verification module, the initial code generated by the model is corrected and supplemented, and the uncertainty and execution obstacles in the code are eliminated. Through a syntax parser, such as an abstract syntax tree (AST) analysis module, the generated data analysis code is read, structural defects are identified and repaired, and if the model-generated code has a start without an end structure, such as a loop statement lacking a closing symbol, the parser will complete the missing end marker based on the syntax rules. For data analysis scenarios, if the code contains calculation proportion logic but does not contain data loading steps, the rule engine will insert the basic code to read the target data file. According to the target execution environment, such as sandbox memory limitations, computing resource quotas, etc., resource-related parameters in the code are adjusted. If the original calculation result is a decimal number, and the business rule requires the output to be a percentage, format conversion code is inserted.

[0067] After obtaining the data analysis code, the code is executed in a sandbox environment, dangerous instructions that may be included in the data analysis code, such as system command calls and file deletion statements, are filtered, and the code is converted into an intermediate format recognizable by the sandbox, such as bytecode or abstract syntax. A read-only copy of the dataset is created, and the original data is stored in a secure area. The sandbox can only access the copy to prevent data tampering. The copy is mounted to a preset path in the sandbox, and the data location is notified to the code through an environment variable. The lightweight executor in the sandbox loads the code and data, calls the basic computing library in the sandbox according to the code logic, and performs the entire process of data reading, processing, and calculation, such as grouping, summation, and proportion calculation according to the code instructions. The structured number output by the code is read, the result format is converted, and the result is transmitted back to the host system's result buffer through a secure channel. After execution, the sandbox is destroyed, the allocated memory, CPU, and other resources are released, the temporary data and code copy in the sandbox are deleted, and no residual information is leaked; and the sandbox environment parameters are reset for the next execution.

[0068] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as the above-mentioned first embodiment can refer to the above introduction, and the following will not be repeated. On this basis, before step S10, steps S01-S02 can also be included.

[0069] Step S01, determine the data type of the initial dataset, and determine the parsing tool according to the data type.

[0070] In this embodiment, different metadata analysis is performed on different data sets uploaded by users and external knowledge, including Excel files, relational databases, graph databases, and other three main types. Taking a MySQL relational database as an example, metadata analysis needs to generate table names, table descriptions, field names, field descriptions, data types, sample values, and user-defined knowledge through data table DDL (Data Definition Language). The original information of different data sources is converted into comprehensive metadata including table name, field information, data type, sample value, and user-defined knowledge, and is presented in a unified format for easy understanding by the large model and subsequent processing.

[0071] The original data set uploaded by the user and the external knowledge text are subjected to data source type identification. After obtaining the original data set uploaded by the user, if the original data set is a local file, the complete path of the file is read, and the extension part in the file name is extracted; if the original data set is a database that needs to be connected remotely, the connection configuration input by the user is read to obtain the file extension or the database connection string. Excel files are identified by file extensions such as.xlsx or.xls; relational databases are identified by connection protocols such as jdbc:mysql: / / for MySQL; and graph databases are identified by interfaces specific to graph databases such as the Bolt protocol for Neo4j. For Excel files, the obtained file extension is matched with a preset list, and if the matching is successful, it is confirmed that the data set is of the Excel type. For MySQL relational databases, the prefix of the database connection string is extracted, and the part before “: / / ” is compared with the MySQL protocol prefix “jdbc:mysql” in the preset relational database protocol prefix list. If the prefix is completely consistent, it is confirmed as a MySQL database; if other relational protocols are matched, the corresponding type is marked, such as jdbc:postgresql. For graph databases, the protocol prefix of the connection string is parsed, and the port number in the connection string is obtained and compared with the default port of the graph database. If the port number is consistent and the protocol prefix contains the corresponding prefix information, the corresponding graph database type is determined.

[0072] In step S02, the initial data set is parsed based on the parsing tool to obtain the metadata corresponding to the initial data set.

[0073] In this embodiment, for different types of data sources, corresponding parsing tools are called, such as Excel parsing library, MySQL metadata query interface, and graph database Schema query tool. When performing MySQL relational database metadata parsing, table-level metadata is extracted, SHOW TABLES is executed to obtain all table names, and the COMMENT in the DDL is extracted as the table description through SHOW CREATE TABLE table name. The table name list and the corresponding table description are output. The field definition in the DDL is parsed, such as user_id INT(11) NOT NULL AUTO_INCREMENT COMMENT 'user unique identifier', and the field name (user_id), data type (INT(11)), and field description (COMMENT content) are extracted. A number of records are randomly extracted from the data table to extract sample values of each field. The user-provided text annotations are read and associated with the corresponding field metadata. The structured metadata containing the table name, table description, field name, field description, data type, sample value, and user-defined knowledge are output.

[0074] Exemplarily, please refer to Figure 3 The metadata obtained by performing metadata parsing on the XX insurance sales table includes the table name: each branch insurance sales table; the table description: the table mainly statistics the sales of different insurance at the granularity of the first-level branch; the field information: (insurance name: String; full name of the insurance; sample value: xx insurance), (category code: String; code value of the insurance category, and the specific code value mapping relationship is (001: critical illness insurance, …, sample value: 001); business knowledge: (special line: special line usually refers to A branch, B branch, and C branch, three first-level branches, …).

[0075] When performing metadata parsing on the Excel file, the Excel file worksheet label name is read as the table name, the cell content above the header row is read as the table description, the header row is identified, the column name is extracted as the field name, and the field description is obtained through the adjacent annotation column. The data type is determined through the value format, such as 2023-10-01 for date type; the preset number of non-header rows is extracted as sample values; the explanation document attached to the Excel file is read and associated with the corresponding field, such as 1 in the payment status column representing payment, and 0 representing non-payment,

[0076] When performing graph database metadata parsing, the node label is obtained as the table name through graph database Schema query; and the descriptive attribute of the node or relationship is obtained as the table description. The attribute definition of the node or relationship is parsed, the attribute name and data type are extracted; the attribute description is obtained through field annotation. The node or relationship instance is randomly extracted, and the attribute sample value is extracted. The graph structure explanation provided by the user is associated and supplemented to the metadata of the relationship type, and the metadata adapted to the graph structure is output.

[0077] For user-provided external knowledge texts such as business glossary, data dictionary, rule description, etc., the entities in the knowledge are extracted through natural language processing, such as the user_level field: 1-common user, 2-member, associated with the field metadata of the corresponding data source, and the general knowledge that cannot be directly associated is supplemented as global metadata. The enhanced metadata set containing external knowledge is obtained, the business logic and rules not contained in the data source itself are supplemented, the semantic richness of the metadata is improved, and the large model can understand the business meaning behind the data.

[0078] For the generated MySQL, Excel, graph database and external knowledge metadata, check the field integrity of all metadata, such as whether the sample value is missing, the data type, mark the missing items as known and prompt the user to supplement. The metadata of different data sources are converted into JSON or table format. The output format is unified, the information of the standardized metadata set is complete, and the format difference of different data sources is eliminated to provide consistent input for the large model. The unified metadata format can improve the efficiency and accuracy of subsequent processing such as data association and query generation, and avoid understanding deviation caused by format confusion of the large model.

[0079] In this embodiment, by analyzing the metadata, the implicit rules originally scattered in different data formats are converted into text sequence format adapted for model training, becoming context knowledge that can be directly referenced by the model, providing data structure basis for subsequent mapping to query syntax.

[0080] Based on the first embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as the above embodiment one can refer to the above introduction, and the subsequent will not be repeated. On this basis, step S10 can include steps S11-S13:

[0081] Step S11, based on the reasoning large model, the user question is semantically analyzed and intention recognized, and the operation object is obtained.

[0082] In this embodiment, the user's question is analyzed based on the reasoning large model to generate structured data requirements that can be processed by the machine. First, the user's question is segmented and tagged with parts of speech, the sentence is split into the smallest semantic units, and the grammatical properties of each word are marked to obtain the segmented sentence and part-of-speech tags. For example, the user's question is: "I want to check the proportion of insurance sales of each branch", which is split into view / each branch / insurance sales / and / proportion, and the attributes of each word are marked as view=verb, each branch=noun phrase, insurance sales=noun phrase, and proportion=noun. The segmented sentence and part-of-speech tags are [view, verb], [each branch, noun phrase], [insurance sales, noun phrase], [of, auxiliary word], and [proportion, noun]. By breaking down continuous natural language into analyzable semantic units, the ambiguity of sentence structure is eliminated.

[0083] Secondly, the candidate words in the semantic unit are compared with the preset classification rules to determine the operation object and processing method in the user's question. The operation object is quantifiable business data such as sales, amount, and quantity, and the processing method is the processing logic for the operation object such as proportion, total, and average.

[0084] Step S12, the operation object is compared with the field name, field description, and data type in the target data set to determine the storage field corresponding to the operation object.

[0085] In this embodiment, the metadata of the target data set is read, including the field name list (such as ["branch_id", "branch_name", "insurance_sales", "sale_date"]), field description (such as "insurance_sales":"records the insurance sales of each branch, unit: single"), and data type (such as "insurance_sales":"int", "branch_name":"string"). The meta information is converted into a vector representation, and a text encoder is used to generate semantic vectors for the field name and description. The vector similarity between the operation object and the field meta information is calculated, a threshold is set, and the field with the highest similarity and exceeding the threshold is selected as the matching result. For example, branch_name is matched with branch_name, and insurance_sales is matched with insurance_sales. Optionally, the matching rationality can be verified by a rule engine to check whether the operation type and the data type of the matched field are compatible, such as whether the insurance_sales is a numerical type and supports proportion division operation. If there are multiple field matches, such as sales and amount matching insurance_sales, the unique field can be determined by combining the accuracy of the field description.

[0086] Step S13, based on the syntax knowledge of the reasoning large model, generating the query code according to the storage field and the operation object.

[0087] In this embodiment, the storage field and the operation object are converted into executable code, the syntax knowledge base of the reasoning large model is called, the mapping rules of operation types and code templates are stored in the syntax knowledge base, for example, the proportion calculation associated template: first, group and aggregate field A, then calculate the total amount field B, and get the field A / total amount; replace the template variable, field A=branch_name, field B=insurance_sales. Based on the syntax rules of the target language, the basic code framework is generated.

[0088] In a feasible implementation, step S13 can include steps S131-S132:

[0089] Step S131, determining the data source type of the metadata, calling the syntax mapping rules built-in the reasoning large model based on the data source type, and generating the basic structure framework of the corresponding query language.

[0090] In this embodiment, the data source identification recorded in the metadata is read, for example, the data source type "source_type: MySQL" in the metadata is used to determine the data source type. The built-in syntax mapping rule library of the reasoning large model is called, which stores the association relationship between different data source types and the corresponding query language basic structure, for example, the basic structure of the SQL language corresponding to MySQL, the Pandas library query structure corresponding to Excel, and the query language basic structure framework matched with the current data source is generated, which contains multiple placeholders corresponding to the positions of the fields to be queried, data sources, filtering conditions, and grouping bases. The basic structure framework contains the logic order of reading tables, specifying columns, condition filtering, and aggregate calculation.

[0091] Step S132, filling the placeholders in the corresponding positions of the basic structure framework to obtain the query code.

[0092] In this embodiment, according to the established field mapping relationship, the specific field name, table name and other information in the mapping relationship are filled into the corresponding placeholders of the basic structure framework, for example, branch_name and policy_count are filled into the selection field placeholders of the SQL framework, and the table name insurance_sales storing these fields is filled into the data source table placeholder. The calculation logic is converted into functions or operators in the syntax, such as SUM(insurance_sales) in SQL to summarize the sales of a certain branch.

[0093] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as the above embodiment one can be referred to the above introduction, and the subsequent will not be described. On this basis, step S30 can further include steps S31-S33:

[0094] Step S31, based on the reasoning large model, the user question is semantically parsed and intention is recognized, and the processing mode corresponding to the target data set is obtained.

[0095] Step S32, the processing mode is mapped to a standard data processing operation.

[0096] In this embodiment, the context awareness ability of the pre-trained language model is used to convert the natural language text of the user question into a high-dimensional semantic vector. Through a structured prediction model, such as a sequence labeling based on Transformer, discrete operation symbols are decoded from the semantic vector: entity symbols of operation objects are extracted, and behavior symbols of processing modes are extracted, such as calculation, filtering, and aggregation; Abstract semantic networks are formed between symbols through logical relationships, such as: operation acting on object. Through vector similarity calculation (matching abstract symbols with standard operations, operation object symbols matching field symbols in data sets, processing mode symbols), matching standard operation symbols such as proportion matching division, aggregation, etc., combined with production rules such as proportion = part aggregation / whole aggregation, discrete symbols are combined into an ordered operation chain.

[0097] Step S33, inputting the target data set and the standard data processing operation into the reasoning large model, the data analysis code is obtained.

[0098] In this embodiment, the standard operation chain is mapped to a code template according to the syntax rules, and the initial code is generated after filling the specific field symbols. The standard operation chain is converted into a sequence of atomic operation symbols, each atomic operation containing: operation type symbol, input parameter symbol and output variable symbol. Through the operation template mapping engine, the corresponding code template is matched for each atomic operation. The mapping table of operation type symbol and code segment template is pre-stored in the syntax rule library, and the most matching template version is selected according to the number and type of operation input parameters, to ensure that the template structure is consistent with the operation logic. Through the symbol replacement module, the placeholders in the template are replaced by specific symbols, and the filled code segments are sequentially spliced according to the operation chain order to form a continuous code stream.

[0099] Based on the first embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as the above embodiment one can be referred to the above introduction, and the subsequent will not be described. On this basis, step S40 can further include steps S50-S70:

[0100] Step S50, based on the reasoning large model, the semantic analysis of the user question is carried out, the target word containing the visualization intention is identified, and the chart type with a mapping relationship is determined according to the target word.

[0101] In this embodiment, Jieba or the built-in word segmentation tool of the large model is used to segment the text and split the lexical units. The large model has a built-in visualization intention word table containing keywords corresponding to various analysis targets and their semantic weights, for example, the target words containing visualization intention corresponding to the trend analysis type are trend, change, fluctuation, etc., the target words containing visualization intention corresponding to the proportion analysis type are proportion, ratio, percentage, etc., the target words containing visualization intention corresponding to the comparison analysis type are comparison, difference, comparison, etc., and the target words containing visualization intention corresponding to the ranking analysis type are ranking, high and low, order, etc. Based on the large model, the semantic analysis of the lexical units is carried out, the similarity between the target words and the intention word table is calculated, and the target words containing visualization intention are extracted.

[0102] The built-in intention and chart type mapping rule table of the large model is called to match the extracted target words containing visualization intention with chart types, for example, the target word trend matches the line chart, and the target word proportion matches the pie chart.

[0103] Step S60, based on the reasoning large model, the mapping relationship between the data and the chart in the code execution result is determined.

[0104] In this embodiment, based on the code execution result, the data dimension mapping relationship of the chart is determined, that is, it is clear which fields in the data correspond to the category dimension, numerical dimension or grouping dimension of the chart, providing a bottom layer data basis for the structure design of the chart.

[0105] All values of the field are traversed, if they are all integers, floating point numbers or strings that can be converted into numerical values, and arithmetic operations are supported, they are marked as numerical type fields; if the field value is a non-numerical string, and the number of values after deduplication is ≤ the total number of records (that is, there are repeated discrete values), it is marked as a category type field. Secondly, the fields related to the analysis target are screened and analyzed through the vector matching algorithm, the field name is converted into a feature vector, the cosine similarity between the field vector and the user question feature vector is calculated, and the fields with a similarity greater than or equal to a threshold value are retained. The retained category type fields are bound to the category dimension of the chart, and the numerical type fields are bound to the numerical dimension of the chart.

[0106] Step S70, calling the chart rendering engine, generating a visualization chart according to the chart type, the mapping relationship between the data and the chart, and the data in the code execution result.

[0107] In this embodiment, the chart rendering engine reads the chart type, loads the corresponding chart's basic rendering template, which includes default styles such as the initial radius of the pie chart, color scheme, etc. The mapping relationship instruction is parsed to extract the field names of the category dimension and the numerical dimension and the chart parameters, and an index table of data fields and chart parameters is established. Each piece of data in the code execution result is traversed, the corresponding field values are extracted according to the index table, and are bound to the visual parameters of the chart, for example, the values of A branch and B branch are extracted from the branch_name field and are bound to the parameter of the text label stored as a sector; for numerical fields, the specific numerical values are converted into sector angles of the pie chart through mathematical calculation, and are bound to the corresponding parameters of the visual chart. Finally, the underlying drawing API, such as the arc() function of Canvas, is used to draw the pie chart, the visual elements are generated according to the bound parameters, and the visual chart is obtained.

[0108] In this embodiment, the chart dimension mapping instruction is used as an intermediate data structure, which is a structured description file between user demand and analysis result data and the final visual chart. The large model only needs to output descriptive rules, such as using a pie chart, the category field is branch_name, and the numerical field is ratio, without needing to pay attention to the syntax details of specific libraries. The technical details are handled by the rendering engine built into the system, and the engine has pre-stored syntax specifications of all libraries, which avoids code syntax errors from the root and greatly improves the accuracy.

[0109] Please refer to Figure 4 , Figure 4 A data flowchart of this embodiment is provided, which inputs user questions, data sets and external knowledge into a reasoning large model, wherein the user question is a data analysis demand initiated by the user; the data set is structured data to be analyzed, and / or unstructured data, such as CSV, Excel, database table; the external knowledge is domain-specific rules, which are used to supplement the model's understanding of business logic. First, different metadata of different data sets uploaded by the user and external knowledge are parsed, and the metadata parsing generates table name, table description, field name, field description, data type, sample value, user-defined knowledge and other metadata contents, which processes different data sources into a form that is more easily understood by the large model. After obtaining the parsed metadata, the data needs to be preliminarily screened and filtered, and all data information required for generating a data analysis result is generated through the input user question and the limited data set after preliminary screening. The general large model generates a data analysis report in combination with the user question and the data analysis result; generates relevant interactive data charts through the data analysis result and the user question; generates an intermediate data structure between the visual chart and the data through the general large model; and finally outputs the visual chart meeting the expected requirements.

[0110] Based on the first embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as the above embodiment one can be referred to the above introduction, and the following will not be repeated. On this basis, please refer to Figure 5 The above-mentioned multi-data source intelligent question answering method based on a large model can further include steps A10-A40:

[0111] Step A10, acquire the user question as a seed question, input the seed question into a pre-set large model for question diffusion, and obtain an expanded question.

[0112] It should be noted that the seed question refers to a representative question extracted from past business analysis requirements.

[0113] In this embodiment, the seed question is diffused to generate more user questions using a large model. After inputting the seed question into the large model, the large model performs semantic analysis on the seed question, decomposes the syntax structure and semantic components of the question through pre-trained language understanding ability, identifies operation actions, business entities, and logical relationships; for example, the operation action can be calculation, statistics, etc.; the business entity can be branch, insurance sales, XX year each quarter, car insurance, etc.; the logical relationship can be the proportion relationship between the part and the whole, and the statistical representation of the quantitative summary of a specific entity. The natural language question is converted into a structured semantic element set, and it is clear that the question is composed of which key parts.

[0114] The large model calls the built-in domain knowledge graph and language rule library to match replaceable variants for each component. For operation actions, call the synonym library, such as: calculation corresponds to statistics, accounting, estimation, etc.; for business entities, call the domain term table, such as: insurance sales is associated with premium income, number of policies, car insurance is associated with health insurance, life insurance, and other types of insurance, branch is associated with branch, region, and other levels; for logical relationships, call the calculation logic template, such as: the proportion can keep the core logic, and only adjust the expression method.

[0115] Based on the semantic consistency constraint, the replaced elements are re-spliced according to the logical structure of the original question to ensure that the new question is grammatically correct and semantically coherent. For example, after replacing calculation with statistics and replacing insurance sales with premium income, the structure of operation action + business entity + logical relationship is kept unchanged to generate statistics of each branch premium income proportion, avoiding logical breakage caused by element replacement. The model will filter out combinations with semantic conflicts, such as statistics of each branch car insurance proportion, if car insurance and branch have no business association, it will be judged as invalid.

[0116] Multiple rounds of replacement are performed on the same core elements, and through the sentence conversion rules, declarative sentences and interrogative sentences are converted, active sentences and passive sentences are converted, further increasing the variant forms. After generation, the model removes duplicates through a semantic similarity algorithm, eliminates problems with a repetition rate exceeding a threshold, and finally outputs an expanded problem set covering multiple dimensions and multiple scenarios, retaining the core business logic of the seed problem, and achieving problem diversity through element replacement and structure adjustment, solving the problem of limited reasoning training data set.

[0117] Step A20, input the expanded question into the large model, generate question and answer.

[0118] In this embodiment, the output expanded question and data set are input into the large model to output the corresponding question answer for the expanded question. Specifically, the large model disassembles the expanded question into calculation dimensions, target indicators, and calculation rules, for example, for the first quarter of 2024 A region branch health insurance sales proportion, the calculation dimensions are: time (first quarter of 2024), region (A region), institution (branch), and insurance (health insurance); the target indicator is: sales; the calculation rule is: proportion (certain dimension sales ÷ total sales). According to the field description, match the indicators in the question, according to the table description, confirm the data range, ensure that the correct table and field are called, generate a query statement for query. And combined with business rules and real data, verify the accuracy of the answer, mark the correct or incorrect label, correct the wrong answer. The finally generated data set includes question text and corresponding correct answer.

[0119] Step A30, input the correctness annotated question answer and the expanded question into the large model, generate the reasoning process, and obtain the reasoning training data.

[0120] In this embodiment, the extended question and the correct answer pair are input into the large model, and the large model is guided by the preset prompt template to decompose the question-answer pair into step-by-step logical reasoning. The prompt template can be: You are a logical reasoning assistant, please generate a detailed thinking process based on the following question and answer. After the model receives the question and answer pair and the prompt template, it decomposes the mapping relationship from the question to the answer into a number of continuous sub-steps based on the pre-trained logical reasoning ability, maps each sub-step to the smallest operation unit, assigns a unique identifier to each sub-step, calculates the correlation weight between sub-steps through a self-attention mechanism, and forms a dependency matrix. The value of an element in the matrix represents the degree of dependence of a sub-step on another sub-step. For example, the dependence weight of the calculation proportion on the partial value and the total value is close to 1. Based on the dependency matrix, a topological sorting algorithm is used to linearly sort all sub-steps. First, the sub-steps with no pre-dependence are retained, and then the subsequent steps that rely on the sorted sub-steps are inserted in turn. After sorting, it is checked whether the input and output of adjacent steps form a closed loop. The output variable of the previous step needs to be used as the input variable of the subsequent step. If it is found that the output of the previous step is irrelevant to the input of the subsequent step, the attention weight is adjusted for reordering, and finally the reasoning text is obtained.

[0121] Step A40, training the large model according to the reasoning training data to obtain a fine-tuned model.

[0122] In this embodiment, the encoded question is received as input, and the reasoning process and the answer are received as target output. The mapping relationship between the two is learned through the attention mechanism of multiple layers of Transformer, and the correlation weight between the keywords in the question and the corresponding operations in the reasoning steps is identified. For each training sample, the model generates a predicted reasoning and answer through forward propagation, calculates the loss with the true label, and transmits the loss signal to all parameters through back propagation to adjust the value of each element in the weight matrix, so that the prediction result is closer to the true label. Through feedback from the validation set, the model dynamically adjusts the parameters to balance the fitting of the training data and the generalization ability to new problems. If there is a logical deviation in the reasoning of a new problem, it is corrected by adjusting the attention weight, such as reducing the correlation between the average value and the proportion. For code generation scenarios, the model associates the natural language logic in the reasoning steps with the syntax rules of the corresponding programming language at the parameter level, so that the reasoning process can be directly mapped to code segments that conform to the syntax, improving the accuracy of generated code. Through parameter iterative learning, the reasoning and generation capabilities suitable for business scenarios are formed.

[0123] After step A40, steps A50-A70 can also be included:

[0124] Step A50, constructing a reward function according to the predicted answer output by the fine-tuned model, the standard answer, and the preset thinking length.

[0125] In this embodiment, the reinforcement learning method is used to control the output length of the reasoning large model, thereby improving the output efficiency of the reasoning large model. Specifically, the following reward function is designed using GRPO reinforcement learning, which covers three parts: output keeping the thinking process, code generation effect and length of the thinking process, and the formula of the reward function is:

[0126]

[0127] where ypred is the predicted answer output by the model, ygold is the standard answer, ntarget is the expected length of the thinking, npred is the length of the thinking generated by the model, the length of the thinking is in token, σ(·) is the scoring module of the code generation effect, outputting a score between 0 and 1.

[0128] Step A60, determining the reward and punishment score of the predicted answer based on the reward function.

[0129] Step A70, performing parameter iteration on the fine-tuning model according to the reward and punishment score, to obtain the reasoning large model.

[0130] In this embodiment, the reinforcement learning training data is a triple (question, y glod , n pred ), the question is encoded into a model input sequence using tokenizer, the reasoning format features in the standard answer y glod are extracted as the basis for thinking format verification, and n pred is recorded as the length constraint target. Under the condition of the question, the complete result containing the reasoning process and the question and answer is output through the text generation interface, the token is generated through autoregressive decoding, and the token probability of each step is recorded and the number of generated tokens is accumulated.

[0131] Extract the reasoning process of all correct answers, parse the semantic roles using NLP tools, extract the core logic step templates, for example, for the standard answer of calculating the sales volume proportion of each branch, parse the template ["group (branch)", "sum (sales)", "calculate total", "division (proportion)"]. Encode the template into a vector as a legal logic library. When the model generates a predicted answer, separate the reasoning process text, parse the semantic roles of the predicted answer using the same NLP tool, extract the logic steps, calculate the semantic similarity between the step sequence and the templates in the legal logic library, and if the similarity is less than a preset similarity threshold, it is determined that the core step is missing, and it is determined that the thinking format is not satisfied.

[0132] When the satisfaction of the thinking format is met, the reward and punishment scores are determined by weighted summation of the generation effect score and the thinking length score of the generated code according to the model. A code evaluation model is pre-trained, such as a CodeBERT-based regression model, the input of which is (predicted answer, standard answer), and the output of which is a matching score. From the predicted answer and the standard answer, the code segment is extracted by using a regular expression (such as def.*|SELECT.*FROM); the code format is unified, such as removing comments, aligning indentation, and avoiding the influence of layout differences on scoring; the code is executed through a sandbox environment, and the consistency of the running result with the standard answer is compared to obtain the code generation effect score. When calculating the length penalty, the reasoning process text of the predicted answer output by the fine-tuned large model is segmented based on the token, the token number npred is counted, the absolute value of the expected generated thinking length and the thinking length output by the model is calculated to obtain the length absolute difference, and the length absolute difference is multiplied by the corresponding weight to obtain the thinking length score.

[0133] In the embodiment, by designing the reinforcement learning reward function covering whether the thinking process is included, the effect of code generation and the length of the thinking process, the total length of the reasoning model thinking process is controlled, thereby improving the output efficiency of the model.

[0134] The application provides a large model-based multi-data source intelligent question answering device, comprising: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the large model-based multi-data source intelligent question answering method in the above embodiment one.

[0135] Reference will now be made to the following description Figure 6 , which shows a structural schematic diagram of the large model-based multi-data source intelligent question answering device suitable for realizing the embodiments of the application. The large model-based multi-data source intelligent question answering device in the embodiments of the application can include but is not limited to mobile terminals such as mobile phones, notebook computers, personal digital assistants (PDA, Personal Digital Assistant), tablet computers (PAD, portable android device), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Figure 6 The large model-based multi-data source intelligent question answering device shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the application.

[0136] As Figure 6As shown, the large model based multi-data source intelligent question answering device can include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 1002 or loaded from a storage device 1003 into a random access memory (RAM) 1004. In the random access memory 1004, various programs and data required for operation of the large model based multi-data source intelligent question answering device are also stored. The processing device 1001, the read only memory 1002, and the random access memory 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; the storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the large model based multi-data source intelligent question answering device to communicate with other devices wirelessly or by wire to exchange data. Although the large model based multi-data source intelligent question answering device with various systems is shown in the figure, it should be understood that all the shown systems are not required to be implemented or possessed. More or fewer systems can be alternatively implemented or possessed.

[0137] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carrying computer program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication device, or installed from the storage device 1003, or installed from the read only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.

[0138] The multi-data-source intelligent question answering device based on a large model provided in the application adopts the multi-data-source intelligent question answering method based on a large model in the above embodiment, and can solve the technical problem of how to perform data question answering on multiple structured and unstructured data sources through a large model. Compared with the prior art, the multi-data-source intelligent question answering device based on a large model provided in the application has the same beneficial effects as the multi-data-source intelligent question answering method based on a large model provided in the above embodiment, and other technical features in the multi-data-source intelligent question answering device based on a large model are the same as the features disclosed in the above embodiment method, and will not be repeated here.

[0139] It should be understood that parts of the present application can be realized by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0140] The above is merely specific implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

[0141] The present application provides a computer readable storage medium having computer readable program instructions (i.e. computer programs) stored thereon, the computer readable program instructions being used to perform the multi-data-source intelligent question answering method based on a large model in the above embodiment.

[0142] The computer readable storage medium provided in the application may, for example, be a U disk, but is not limited to an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system or device, or any combination of the above. More specific examples of the computer readable storage medium may include, but are not limited to, an electric connection with one or more conductive wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiment, the computer readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to an electric wire, an optical cable, a radio frequency (RF), and the like, or any suitable combination of the above.

[0143] The computer readable storage medium described above can be contained in the large model-based multi-data source intelligent question and answer device, or can exist independently without being assembled into the large model-based multi-data source intelligent question and answer device. The computer readable storage medium carries one or more programs, which, when executed by the large model-based multi-data source intelligent question and answer device, cause the large model-based multi-data source intelligent question and answer device to: input metadata corresponding to an initial data set uploaded by a user and a user question into a pre-trained inference large model to generate a query code; perform a screening query on the metadata according to the query code to obtain a target data set; input the target data set and the user question into the inference large model to generate a data analysis code; and execute the data analysis code to obtain a code execution result.

[0144] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0145] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may

[0146] The modules involved in the embodiments of the present application can be implemented in the form of software or in the form of hardware. In some cases, the name of the module does not constitute a limitation on the module itself.

[0147] The readable storage medium provided by the present application is a computer readable storage medium, which stores computer readable program instructions (i.e., computer programs) for executing the above-mentioned large model-based multi-data source intelligent question answering method, and can solve the technical problem of how to use a large model to perform data question answering on multiple structured and unstructured data sources. Compared with the prior art, the computer readable storage medium provided by the present application has the same beneficial effects as the large model-based multi-data source intelligent question answering method provided by the above-mentioned embodiments, and will not be described here.

[0148] The above merely provides part of embodiments of the present application, and does not limit the patent scope of the present application. Any equivalent structure transformation, direct / indirect application in other related technical fields, or the like, which is made based on the technical concept of the present application, and based on the content of the present application specification and drawings, is included in the patent protection scope of the present application.

Claims

1. A multi-data source intelligent question answering method based on a large model, characterized in that, The intelligent question answering method based on a large model and multiple data sources includes: The metadata corresponding to the initial dataset uploaded by the user, as well as the user's question, are input into the pre-trained inference model to generate query code; The target dataset is obtained by filtering and querying the metadata according to the query code. Input the target dataset and the user's question into the reasoning model to generate data analysis code; Execute the data analysis code to obtain the code execution result.

2. The intelligent question-answering method based on a large model and multiple data sources as described in claim 1, characterized in that, Before the step of inputting the metadata corresponding to the initial dataset uploaded by the user, and the user's query into the pre-trained inference model to generate query code, the following steps are also included: Determine the data type of the initial dataset, and determine the parsing tool based on the data type; The initial dataset is parsed using the parsing tool to obtain the metadata corresponding to the initial dataset.

3. The intelligent question-answering method based on a large model and multiple data sources as described in claim 1, characterized in that, The step of inputting the metadata corresponding to the initial dataset uploaded by the user, as well as the user's query, into the pre-trained inference model to generate query code includes: Based on the aforementioned reasoning model, the user's question is semantically parsed and intent is identified to obtain the operation object; The operation object is semantically compared with the field names, field descriptions and data types in the target dataset to determine the storage field corresponding to the operation object; Based on the grammatical knowledge of the aforementioned reasoning model, the query code is generated according to the stored fields and the operation object.

4. The intelligent question-answering method based on a large model and multiple data sources as described in claim 3, characterized in that, The step of generating the query code based on the grammatical knowledge of the inference model, according to the stored fields and the operation object, includes: Determine the data source type of the metadata, and based on the data source type, call the built-in syntax mapping rules of the inference big model to generate the basic structural framework of the corresponding query language; The storage field is filled into the placeholders in the corresponding positions of the infrastructure framework to obtain the query code.

5. The intelligent question-answering method based on a large model and multiple data sources as described in claim 1, characterized in that, The step of inputting the target dataset and the user question into the reasoning model to generate data analysis code includes: Based on the aforementioned reasoning model, the user's question is semantically parsed and intent is identified to obtain the processing method corresponding to the target dataset. Map the aforementioned processing method to standard data processing operations; The target dataset and the standard data processing operations are input into the inference model to obtain the data analysis code.

6. The intelligent question-answering method based on a large model and multiple data sources as described in claim 1, characterized in that, After the step of executing the data analysis code and obtaining the code execution result, the method further includes: Based on the aforementioned reasoning model, the user's question is semantically parsed to identify target words containing visual intent, and the chart types with mapping relationships are determined based on the target words. Based on the aforementioned reasoning model, the mapping relationship between the data and charts in the code execution results is determined; The chart rendering engine is invoked to generate a visual chart based on the chart type, the mapping relationship between the data and the chart, and the data in the code execution result.

7. The intelligent question-answering method based on a large model and multiple data sources as described in claim 1, characterized in that, The intelligent question answering method based on large models and multiple data sources also includes: The user's question is obtained as a seed question, and the seed question is input into a preset large model to expand the question and obtain extended questions. Input the extended question into the large model to generate a question answer; The correctness-labeled answers to the questions and the extended questions are input into the large model to generate the reasoning process and obtain reasoning training data. The large model is trained using the inference training data to obtain a fine-tuned model.

8. The intelligent question-answering method based on a large model and multiple data sources as described in claim 7, characterized in that, After the step of training the large model based on the inference training data to obtain the large inference model, the method further includes: A reward function is constructed based on the predicted answer, the standard answer, and the preset thinking length output by the fine-tuning model. The reward or penalty score for the predicted answer is determined based on the reward function. The fine-tuned model is iterated based on the reward and punishment scores to obtain the large inference model.

9. A multi-data source intelligent question-answering device based on a large model, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the multi-data source intelligent question answering method based on a large model as described in any one of claims 1 to 8.

10. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the intelligent question-answering method based on a large model and multiple data sources as described in any one of claims 1 to 8.

Citation Information

Cited By

  • Intelligent data question and answer method and system based on index semantic enhancement

    CN121543748A

  • Question and answer interaction method based on multi-source data and storage medium

    CN121579660A

  • Visual report display method and system and electronic equipment

    CN121681635A

  • Knowledge base question answering method and system based on edge type partition and code generation

    CN122673314A