Conversational financial analysis method and device, equipment and medium

By combining a conversational financial analysis approach with financial semantic graphs and large language models, accurate SQL query statements are generated, solving the flexibility and accuracy problems of existing financial data analysis methods and achieving efficient and interpretable financial data analysis.

CN121901378APending Publication Date: 2026-04-21BEIJING HESI HUIZHI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING HESI HUIZHI INFORMATION TECHNOLOGY CO LTD
Filing Date
2026-01-23
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing financial data analysis methods rely on pre-configured data models and dashboards, lacking flexibility and freedom, and are unable to understand complex business logic, time series analysis, and data aggregation needs, resulting in inaccurate analysis results and poor interactivity.

Method used

We employ a conversational financial analysis approach, using financial semantic graphs and large language models for semantic parsing to generate SQL query statements. Combined with a statement validation and optimization model, we ensure the accuracy and security of the queries, achieving end-to-end parsing from natural language to structured financial analysis results.

Benefits of technology

It significantly improves the accuracy and interactivity of financial analysis, lowers the barrier for non-technical personnel to use complex financial systems, ensures that analysis results conform to corporate financial standards and logical norms, and enhances the robustness and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901378A_ABST
    Figure CN121901378A_ABST
Patent Text Reader

Abstract

The invention provides a dialogue type financial analysis method and device, equipment and a medium, and relates to the technical field of financial data analysis, and the method comprises the steps: obtaining a financial analysis demand and a dialogue context inputted by a user in a current dialogue with a dialogue type financial analysis system; performing semantic analysis on the financial analysis demand to obtain a semantic analysis result; extracting a data subset associated with the semantic analysis result from a configured database according to the configured financial semantic map; inputting the financial analysis demand, the dialogue context and the data subset into a pre-trained financial field big language model to obtain an initial SQL query statement corresponding to the financial analysis demand; inputting the initial SQL query statement into a pre-trained SQL statement verification optimization model to obtain a target SQL query statement; and in the database, executing the target SQL query statement to obtain a financial analysis result. According to the method, the accuracy, the interpretability and the interaction naturalness of financial analysis can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial data analysis technology, and more specifically, to a conversational financial analysis method, apparatus, device, and medium. Background Technology

[0002] In modern enterprise operations, rapid and accurate financial decision-making is crucial for maintaining a competitive edge. Senior executives and business unit leaders need to stay informed about the company's financial health, profit drivers, cost structure, and liquidity. These analyses often involve real-time cross-referencing, aggregation, and in-depth analysis of massive amounts of heterogeneous data from multiple complex systems such as Enterprise Resource Planning (ERP), General Ledger (GL), Customer Relationship Management (CRM), and Supply Chain Management (SCM).

[0003] However, current financial data analysis methods rely on pre-configured data models and dashboards, obtaining results based on keyword matching and template filling; users can only operate within a preset visualization framework, lacking flexibility and freedom; at the same time, they cannot understand complex business logic, time series analysis, and data aggregation needs. Summary of the Invention

[0004] The purpose of this application is to provide a conversational financial analysis method, apparatus, device, and medium to solve the above-mentioned problems existing in the prior art, and to significantly improve the accuracy, interpretability, and naturalness of interaction of financial analysis.

[0005] Firstly, a conversational financial analysis method is provided, which may include: Obtain the financial analysis needs and conversation context entered by the user in the current conversation with the conversational financial analysis system; The financial analysis requirements are semantically parsed to obtain the semantic parsing results; Based on the configured financial semantic graph, extract a subset of data associated with the semantic parsing results from the configured database; The financial analysis requirement, the dialogue context, and the data subset are input into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirement. The initial SQL query statement is input into a pre-trained SQL statement validation and optimization model to obtain the target SQL query statement; The target SQL query is executed in the database to obtain financial analysis results.

[0006] In an optional implementation, the semantic parsing result includes multiple business entities; the financial semantic graph includes multiple graph nodes and the attribute data of the corresponding graph nodes.

[0007] The semantic parsing results include multiple business entities; the financial semantic graph includes multiple graph nodes and the attribute data of the corresponding graph nodes.

[0008] In an optional implementation, the financial analysis requirement is semantically parsed to obtain the semantic parsing result, including: The financial analysis requirements are standardized to obtain standardized financial analysis requirements. The standardized financial analysis requirements are segmented, part-of-speech tagging is performed, and dependency parsing is used to obtain sentence structure representations. A pre-trained Transformer-based sequence labeling model is used to perform business entity recognition, condition constraint recognition, and intent recognition on sentence structure representation, resulting in semantic parsing.

[0009] In an optional implementation, based on the configured financial semantic graph, a subset of data associated with the semantic parsing results is extracted from the configured database, including: For any business entity, semantic normalization is performed on the business entity according to the configured financial semantic graph to obtain the normalized business entity. By performing path search and mapping based on financial domain knowledge on the financial semantic graph, the target graph node corresponding to the normalized business entity is extracted from the financial semantic graph. The attribute data of the target graph nodes of each business entity are used as the data subset associated with the semantic parsing results.

[0010] In an optional implementation, the financial analysis requirement, the dialogue context, and the data subset are input into a pre-trained financial domain large language model to obtain an initial SQL query statement corresponding to the financial analysis requirement, including: The financial analysis requirements, the dialogue context, and the data subset are processed in a structured manner to obtain structured data; Based on the configured domain constraints and security rules, the structured data is converted into Prompt format data; The Prompt format data is input into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirements.

[0011] In an optional implementation, the initial SQL query statement is input into a pre-trained SQL statement validation and optimization model to obtain the target SQL query statement, including: The initial SQL query statement is converted into an abstract syntax tree using a pre-trained SQL statement validation and optimization model. Using a pre-trained SQL statement validation optimization model, the abstract syntax tree and the initial SQL query statement are validated to ensure they meet the configured validation rules and the database syntax specifications. If the abstract syntax tree and the initial SQL query statement satisfy the configured validation rules and the database syntax specifications, then the initial SQL query statement is optimized to obtain the target SQL query statement.

[0012] In an optional implementation, the initial SQL query is optimized to obtain the target SQL query, including: Based on the configured SQL optimization rules, the standardized initial SQL query statement is optimized to obtain the target SQL query statement.

[0013] The aforementioned financial analysis requirements are semantically parsed to obtain the semantic parsing results, including: The financial analysis requirements are standardized to obtain standardized financial analysis requirements. The standardized financial analysis requirements are segmented, part-of-speech tagging is performed, and dependency parsing is used to obtain sentence structure representations. A pre-trained Transformer-based sequence labeling model is used to perform business entity recognition, condition constraint recognition, and intent recognition on sentence structure representation, resulting in semantic parsing.

[0014] Secondly, a conversational financial analysis device is provided, which may include: The acquisition unit is used to acquire the financial analysis needs and dialogue context entered by the user in the current dialogue with the conversational financial analysis system. The parsing unit is used to perform semantic parsing on the financial analysis requirements and obtain semantic parsing results. The extraction unit is used to extract a subset of data associated with the semantic parsing results from a configured database based on the configured financial semantic graph. The conversion unit is used to input the financial analysis requirement, the dialogue context and the data subset into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirement. The optimization unit is used to input the initial SQL query statement into a pre-trained SQL statement validation and optimization model to obtain the target SQL query statement; An execution unit is used to execute the target SQL query statement in the database to obtain financial analysis results.

[0015] Thirdly, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements any of the steps described in the first aspect above.

[0016] Fourthly, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when executed by a processor, the computer program implements the steps of any of the methods described in the first aspect above.

[0017] This application integrates financial semantic graphs, context-aware mechanisms, and large language models in the financial domain to achieve end-to-end intelligent parsing and execution of financial analysis needs in natural language form and structured financial analysis results. It can accurately understand the financial professional semantics in the user's intent and dynamically adjust the data retrieval scope in combination with the dialogue context, significantly improving the accuracy, interpretability, and naturalness of interaction of financial analysis, and effectively reducing the threshold for non-technical personnel to use complex financial systems.

[0018] In the process of generating executable queries, this invention introduces an SQL statement validation and optimization model based on pre-trained financial business rules. This model performs semantic consistency checks, field validity verification, and performance optimization on the initial SQL output by the large language model, avoiding invalid or erroneous queries caused by model illusions or semantic ambiguity. This not only ensures the security and efficiency of database execution but also ensures that the final returned financial analysis results strictly conform to the enterprise's financial standards and logical norms, thereby improving the robustness and credibility of the entire conversational financial analysis system. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 An architecture diagram of a conversational financial analysis system provided in this application embodiment; Figure 2 A flowchart illustrating a conversational financial analysis method provided in this application embodiment; Figure 3 A schematic diagram of the structure of a conversational financial analysis device provided in this application embodiment; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise defined, the technical or scientific terms used in this application should have the ordinary meaning understood by those skilled in the art. The words "first," "second," and similar terms used in this application do not indicate any order, quantity, or importance, but are only used to distinguish different components. The words "comprising" or "including," etc., mean that the element or object preceding the word covers the element or object listed after the word and its equivalents, but do not exclude other elements or objects. The words "connected," "coupled," or "connected," etc., are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up," "down," "left," "right," etc., are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0022] The conversational financial analysis method provided in this application embodiment can be applied to... Figure 1 In the system architecture shown, such as Figure 1 As shown, the system may include: a server for the enterprise's backend and terminals for the enterprise's employees; The terminal is used to allow users to input their financial analysis needs in the current conversation with the conversational financial analysis system and to display the conversation context and financial analysis results. The server is used to execute the conversational financial analysis method provided in the embodiments of this application. The server can be a physical server, a server cluster composed of multiple physical servers, or a distributed system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal can be a user equipment (UE) such as a mobile phone, smartphone, laptop, digital broadcast receiver, personal digital assistant (PDA), tablet computer (PAD), handheld device, in-vehicle device, wearable device, computing device, or other processing device connected to a wireless modem, mobile station (MS), mobile terminal, etc. The terminal and server can be directly or indirectly connected via wired or wireless communication methods, which is not limited herein.

[0023] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.

[0024] Figure 2 This is a flowchart illustrating a conversational financial analysis method provided in an embodiment of this application. Figure 2 As shown, the method may include: Step S210: Obtain the financial analysis needs and dialogue context entered by the user in the current dialogue with the conversational financial analysis system.

[0025] In practice, the system obtains the dialogue context from previous rounds of the user's conversation with the conversational financial analysis system, as well as the financial analysis needs expressed in natural language during the current round of the conversation; for example, "Please analyze the growth of R&D expenses in the last quarter and explain the reasons."

[0026] Step S220: Perform semantic parsing on the financial analysis requirements to obtain the semantic parsing results.

[0027] In practice, the financial analysis requirements input by users in natural language are standardized to obtain standardized financial analysis requirements. The standardization process may include: text cleaning, financial terminology standardization, and time expression normalization. Financial terminology standardization can be performed based on a configured financial terminology dictionary. The standardized financial analysis requirements are segmented, part-of-speech tagging is performed, and dependency parsing is performed to obtain a sentence structure representation with part-of-speech tagging and dependency relations; A pre-trained Transformer-based sequence labeling model is used to perform business entity recognition, condition constraint recognition, and intent recognition on sentence structure representations. The result is a semantic parsing analysis that includes the identified business entities, the relationships between different business entities, condition constraints, and intent categories. Business entity recognition is used to identify specific financial objects and dimensions in the sentence structure representation. Condition constraint recognition is used to identify the filtering conditions and time constraints in the sentence structure representation. Intent recognition is used to identify the type of analysis operation that the user expects to perform in the sentence structure representation.

[0028] In another embodiment of this application, performing semantic parsing on financial analysis requirements to obtain semantic parsing results may further include: Obtain the context state vector obtained by semantic tracking of the dialogue context; based on the identified business entities, condition constraints and intent categories, and the context state vector, obtain the semantic parsing results of the financial analysis requirements.

[0029] In this embodiment, the unstructured natural language is transformed into a structured semantic frame by semantic parsing of financial analysis requirements. Simultaneously, the system maintains a context state vector through multi-turn dialogue history to ensure that subsequent processing accurately inherits the analysis dimensions, filters, and aggregation conditions from the previous round, thereby supporting complex continuous questioning and data exploration.

[0030] Step S230: Based on the configured financial semantic graph, extract the data subset associated with the semantic parsing results from the configured database.

[0031] The financial semantic graph includes multiple graph nodes, their attribute data, and factual relationships between different graph nodes. The attribute data of each graph node may include: the physical address of each graph node in the database, as well as the data table, fields, and aggregate functions related to the graph node.

[0032] In practice, for any business entity, semantic normalization is performed on the business entity according to the configured financial semantic graph to obtain the normalized business entity; among them, semantic normalization is performed on each business entity according to the thesaurus and terminology standardization rules built into the financial semantic graph to generate the standard business name corresponding to each business entity. By performing path search and mapping based on financial domain knowledge on the financial semantic graph, the target graph nodes corresponding to the normalized business entities are extracted from the financial semantic graph. Specifically, synonyms and near-synonyms of the standard business name are retrieved in the financial semantic graph to obtain a synonym mapping table for the standard business name. If no synonyms or near-synonyms of the standard business name are found in the business entity, synonyms and near-synonyms that have a hierarchical relationship with the standard business name are retrieved, or the standard business name is split and retrieved again to obtain a synonym mapping table for the standard business name. Direct mapping retrieval is employed to search the financial semantic graph for the target graph nodes corresponding to the standard business name and its synonyms in the synonym mapping table. A breadth-first search is then performed in the financial semantic graph to find indirect mapping paths related through business logic, thus performing a path search based on financial domain knowledge to obtain graph nodes semantically or logically related to the standard business name. Finally, the confidence levels of the graph nodes obtained from the mapping or path search are evaluated, and graph nodes with confidence levels greater than the configured confidence threshold are selected as target graph nodes. The attribute data of the target graph nodes of each business entity are used as the data subset associated with the semantic parsing results. Specifically, the data tables of the target graph nodes of each business entity are used as the first data table. From the configured database metadata, the dimension tables and fact tables directly associated with the first data table through primary and foreign key relationships are retrieved to obtain the second data table. The data tables indirectly associated with the first data table and the join tables used to indirectly associate the first data table are retrieved to obtain the third data table. Based on the conditional constraints in the semantic parsing results, the first, second, and third data tables are filtered to obtain the data subset associated with the semantic parsing results. Specifically, at the table level, only tables directly related to the query are retained, and tables corresponding to irrelevant nodes are removed. At the field level, each retained table retains only fields related to the query intent, such as core indicator fields and constraint association fields, and deletes irrelevant fields such as notes and data entry personnel. At the same time, duplicate association information is merged, the specific purpose of each field is clarified, and the overall structure is simplified.

[0033] In another embodiment of this application, the method may further include: Based on the query intent in the semantic parsing results, the associated data subset is optimized and improved. When the query intent is for trend analysis, time series-related fields and corresponding year-on-year and month-on-month calculation rules are added. When the query intent is for detailed analysis, corresponding detailed dimension fields and dimension table association information are added. In addition, indexed fields are marked to provide a basis for performance optimization in subsequent SQL generation. Finally, redundant fields are checked and removed to ensure that the subset structure is concise and adaptable to user needs. The data subset is transformed into a structured text format that can be directly understood by a large language model in the financial domain, clearly presenting the hierarchy of tables, fields, and relationships between tables. Simultaneously, supplementary meta-information such as field comments, data type descriptions, and aggregate function suggestions are added to reduce the model's understanding cost, ultimately forming a standardized subset of related data that provides core contextual constraints for subsequent input prompts in building a large language model.

[0034] This application uses graph-driven path search and mapping to intelligently identify which tables (e.g., ERP_Cost and Sales_Order) and columns (e.g., Gross_Margin) in the data warehouse a term actually corresponds to. This graph-driven mapping not only solves the synonym problem, but more importantly, it can dynamically prune the most relevant subset of database schemas. Inputting the pruned, highly relevant subset of data into the financial domain large language model significantly reduces the input length (ContextWindow) of the financial domain large language model, improving the accuracy and response speed of Text-to-SQL generation.

[0035] Step S240: Input the financial analysis requirements, dialogue context, and data subset into the pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirements.

[0036] In practice, the financial analysis needs, dialogue context, and data subsets are structured to obtain structured data. Based on the configured domain constraints and security rules, the structured data is converted into Prompt format data; the domain constraints and security rules may include: a user privacy data table that cannot be queried, and restrictions on full table scans of large data volumes; Prompt-formatted data is input into a pre-trained financial domain language model to obtain initial SQL query statements corresponding to financial analysis needs. The financial domain language model is an LLM fine-tuned for Text-to-SQL tasks. The task of the financial domain language model is to generate SQL statements that satisfy user intent and are oriented towards the target database dialect (such as PostgreSQL or HiveQL) under these constraints. Specifically, the financial domain language model first clarifies the core objective of the user's financial analysis needs, using it as the core instruction of the Prompt. Next, it embeds dialogue context information, clarifying the constraints and analysis dimensions in historical queries to ensure the model can inherit contextual logic. Then, it fully imports key metadata from a subset of data, limiting the database tables, fields, and association rules that the model can call, avoiding the generation of SQL that exceeds the data scope. Simultaneously, it supplements pre-set financial domain basic rules, such as common aggregate function usage specifications and data filtering logic requirements, providing domain constraints for the model to generate SQL. In one embodiment of this application, the initial SQL query statement is format-validated to check whether the SQL statement's syntax is complete, whether the keywords are used correctly, and whether it contains tables or fields not covered in the data subset, ensuring that the statement has basic executability. If the format validation fails, for example, if obvious format errors or mismatches with the data subset are found, the statement is returned to the financial domain large language model for quick correction. If the format validation passes, the statement is output as the initial SQL query statement and enters the subsequent semantic validation and optimization stage.

[0037] Step S250: Input the initial SQL query statement into the pre-trained SQL statement validation and optimization model to obtain the target SQL query statement.

[0038] The verification rules may include: financial security rules, data access permissions, financial business logic, and security policies.

[0039] In practice, based on the preset financial security rules, data access permission configurations, and database syntax specifications, the initial SQL query statement is formatted, redundant spaces are removed, and keyword case is standardized to obtain a standardized initial SQL query statement. Using a pre-trained SQL statement validation and optimization model, the standardized initial SQL query statement is converted into an abstract syntax tree. Specifically, the standardized initial SQL query statement is decomposed in a structured manner using abstract syntax tree (AST) technology to restore the syntax logic level of the statement, clarify the core components such as table relationships, field references, filtering conditions, aggregate functions, and query logic, and form a structured syntax tree representation that can be recognized by validation rules. The abstract syntax tree (AST) is validated to ensure it meets the configured financial security rules and data access permissions, yielding a syntax validation result. Specifically, the AST is checked for SQL injection risks, such as unauthorized dangerous statements or special characters. The queried tables and fields are verified to be within the user's data access permissions and to ensure they do not involve private data tables. Simultaneously, the SQL statements are validated to ensure they comply with financial data query standards, such as preventing unauthorized queries of sensitive financial indicators, thus ensuring the SQL statements are compliant and secure. Verify that the abstract syntax tree (AST) meets the configured financial domain business logic and database syntax specifications, obtaining semantic and logical correctness verification results; specifically, check whether the data subset contains table names and column names from the AST; verify whether the association between tables and fields in the AST is reasonable, and whether there are any non-existent tables or incorrect field references; check whether the use of aggregate functions matches the financial indicator calculation logic, and whether the filtering conditions meet the business analysis requirements; verify whether the SQL syntax is fully adapted to the target database dialect, avoiding syntax incompatibility issues, and ensuring that the SQL statements are accurate in both business logic and syntax. Verify whether the standardized initial SQL query statement meets the configured security policy and obtain the security verification result; specifically, verify whether the standardized initial SQL query statement has field queries that do not use indexes, whether there are unnecessary full table scans, whether there are inefficient Cartesian product joins, whether there are non-constant string concatenations or suspicious comment characters, whether it may return an excessively large result set, and whether it attempts to access tables or sensitive columns that are not in the current user's permission list. When the syntax check, semantic and logical correctness check, and security check all pass, the standardized initial SQL query statement is optimized. Specifically, the standardized initial SQL query statement is optimized according to the configured SQL optimization rules. These optimization rules may include: moving filter conditions before subqueries or JOINs; adjusting the JOIN order based on table statistics (such as size), prioritizing the joining of tables with strong filtering capabilities; converting related subqueries into more efficient JOIN operations where possible; and removing duplicate expressions or conditions. When the syntax check, semantic and logical correctness check, or security check fails, the initial SQL query that does not conform to the corresponding rules or syntax specifications is converted into specific hints at the abstract syntax tree level and fed back to the pre-trained financial domain big language model. Based on the error hints and preset correction rules, the financial domain big language model performs targeted corrections on the initial SQL, generating a corrected SQL statement. The corrected statement is then re-entered into the validation process for repeated validation until the statement fully complies with all requirements.

[0040] Step S260: Execute the target SQL query statement in the database to obtain the financial analysis results.

[0041] In practice, the target SQL query is sent to the enterprise's high-performance distributed database or OLAP engine for execution. After data retrieval, not only is the raw result set returned, but pre-defined in-depth business analysis modules are also automatically launched. For example, if the query involves time, year-on-year (YoY) and month-on-month (MoM) percentage changes are automatically calculated; if the query involves ranking, Top-N analysis and Pareto analysis are automatically performed; if the query results are significantly inconsistent with historical trends, an anomaly detection algorithm is automatically activated for labeling. All these analyses are performed in parallel in the background, transforming raw data into analytical insights with business value, which are then included as financial analysis results.

[0042] In another embodiment of this application, after obtaining the financial analysis results, the method may further include: The financial analysis results are input into a pre-trained financial analysis report language model, which transforms the financial analysis results into a concise, professional, and corporate-style natural language report. Structural analysis is performed on the financial analysis results to obtain structural analysis results; From the comparison table of different structural analysis results and different chart types, match the target chart type corresponding to the structural analysis result; for example, automatically select a line chart for data containing the time dimension, and select a bar chart or pie chart for data containing category ranking. Based on the financial analysis results and the target chart type, generate financial charts corresponding to the financial analysis results; A financial analysis report is generated based on the converted financial analysis results and financial charts.

[0043] In yet another embodiment of this application, the method may further include: The identified business entities, relationships between different business entities, and conditional constraints are extracted from the semantic parsing results to obtain a list of entities to be verified. For any element in the list of entities to be verified, the corresponding graph node is matched based on the financial semantic graph, and the factual relationship associated with the graph node is obtained. Based on the graph nodes matched to different elements and the associated factual relationships, an initial fact network is constructed. The verification process involves verifying whether the list to be verified and the initial fact network satisfy the financial semantic graph, and obtaining the verification results. Specifically, the verification includes: element validity verification: checking whether each element in the list to be verified is consistent with the initial fact network; entity validity verification: checking whether each business entity in the list to be verified exists in the financial semantic graph, and if not, marking it as a confirmed entity; relationship rationality verification: verifying whether the relationship between different business entities conforms to the preset business logic in the financial semantic graph; and constraint compliance verification: verifying whether the condition constraints meet the attribute requirements of the graph nodes. Based on the verification results, correct the semantic parsing results.

[0044] In yet another embodiment of this application, after obtaining the target SQL query statement, the method may further include: The target SQL query statement is parsed into a first abstract syntax tree using an SQL parser; features are extracted from the first abstract syntax tree to obtain the target features of the first abstract syntax tree; the target features may include structural features, functional features, and syntactic features. Based on the target features and the configured scenario blame library, scenario tags are added to the first abstract syntax tree to obtain the second abstract syntax tree; Extract the database type from the configured database configuration information; the metadata information may include the database version and supported features. Extract the conversion rule set corresponding to the database type and the scene label of the second abstract syntax tree from the configured dialect conversion rule library; wherein, the dialect conversion rule library may include: scene labels of various database dialects, database types and corresponding syntax mapping rules, function correspondence table and keyword replacement table; Based on the transformation rule set, the second abstract syntax tree is reconstructed to obtain the third abstract syntax tree; The third abstract syntax tree is de-parsed to obtain the executable target SQL statement; in the database, the target SQL statement is executed to obtain the financial analysis results.

[0045] This application achieves millisecond-level response times from posing complex business questions to obtaining precise data insights, reducing the analysis cycle from hours to days to seconds, significantly accelerating the enterprise decision-making process. By introducing a financial semantic graph (Knowledge Graph), it can accurately and dynamically map natural language business terms used by executives (such as "tight cash flow" and "declining profit margins") to complex and diverse database table and column names in the backend, ensuring that the generated SQL has business accuracy; it can accurately inherit the query conditions and result sets from the previous round, perform incremental analysis, and achieve true data exploration. This application not only returns data, but also automatically selects the best visualization chart based on the type of query results (time series, ranking, distribution), and automatically generates a summary and interpretable natural language analysis report by LLM. Corresponding to the above method, embodiments of this application also provide a conversational financial analysis device, such as... Figure 3 As shown, the device includes: The acquisition unit 310 is used to acquire the financial analysis needs and dialogue context entered by the user in the current dialogue with the conversational financial analysis system. Parsing unit 320 is used to perform semantic parsing on financial analysis requirements and obtain semantic parsing results; Extraction unit 330 is used to extract a subset of data associated with the semantic parsing results from a configured database based on the configured financial semantic graph; The conversion unit 340 is used to input the financial analysis requirements, dialogue context and data subset into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirements. The optimization unit 350 is used to input the initial SQL query statement into the pre-trained SQL statement validation and optimization model to obtain the target SQL query statement; Execution unit 360 is used to execute target SQL query statements in the database to obtain financial analysis results.

[0046] The functions of each functional unit of the conversational financial analysis device provided in the above embodiments of this application can be implemented through the above methods and steps. Therefore, the specific working process and beneficial effects of each unit in the conversational financial analysis device provided in the embodiments of this application will not be repeated here.

[0047] This application also provides an electronic device, such as... Figure 4 As shown, it includes a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440.

[0048] Memory 430 is used to store computer programs; When the processor 410 executes the program stored in the memory 430, it performs the following steps: Obtain the financial analysis needs and conversation context entered by the user in the current conversation with the conversational financial analysis system; Semantic parsing is performed on the financial analysis requirements to obtain the semantic parsing results; Based on the configured financial semantic graph, extract a subset of data associated with the semantic parsing results from the configured database; The financial analysis requirements, dialogue context, and data subset are input into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirements. The initial SQL query statement is input into a pre-trained SQL statement validation and optimization model to obtain the target SQL query statement; In the database, execute the target SQL query to obtain the financial analysis results.

[0049] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0050] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0051] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0052] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0053] The implementation methods and beneficial effects of the various components of the electronic device in the above embodiments for solving the problem can be found in [reference needed]. Figure 2 The steps in the illustrated embodiments are used to implement the electronic device. Therefore, the specific working process and beneficial effects of the electronic device provided in this application will not be repeated here.

[0054] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the conversational financial analysis methods described in the above embodiments.

[0055] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the conversational financial analysis methods described in the above embodiments.

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

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

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

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

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

[0061] Obviously, those skilled in the art can make various modifications and variations to the embodiments of this application without departing from the spirit and scope of the embodiments of this application. Therefore, if these modifications and variations to the embodiments of this application fall within the scope of this application and its equivalents, then these modifications and variations are also intended to be included in the embodiments of this application.

Claims

1. A dialogic financial analysis method, characterized in that, The method includes: Obtain the financial analysis needs and conversation context entered by the user in the current conversation with the conversational financial analysis system; The financial analysis requirements are semantically parsed to obtain the semantic parsing results; Based on the configured financial semantic graph, extract a subset of data associated with the semantic parsing results from the configured database; The financial analysis requirement, the dialogue context, and the data subset are input into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirement. The initial SQL query statement is input into a pre-trained SQL statement validation and optimization model to obtain the target SQL query statement; The target SQL query is executed in the database to obtain financial analysis results.

2. The method as described in claim 1, characterized in that, The semantic parsing results include multiple business entities; the financial semantic graph includes multiple graph nodes and the attribute data of the corresponding graph nodes.

3. The method as described in claim 2, characterized in that, The aforementioned financial analysis requirements are semantically parsed to obtain the semantic parsing results, including: The financial analysis requirements are standardized to obtain standardized financial analysis requirements. The standardized financial analysis requirements are segmented, part-of-speech tagging is performed, and dependency parsing is used to obtain sentence structure representations. A pre-trained Transformer-based sequence labeling model is used to perform business entity recognition, condition constraint recognition, and intent recognition on the sentence structure representation to obtain semantic parsing results.

4. The method as described in claim 2, characterized in that, Based on the configured financial semantic graph, extract a subset of data associated with the semantic parsing results from the configured database, including: For any business entity, semantic normalization is performed on the business entity according to the configured financial semantic graph to obtain the normalized business entity. By performing path search and mapping based on financial domain knowledge on the financial semantic graph, the target graph node corresponding to the normalized business entity is extracted from the financial semantic graph. The attribute data of the target graph nodes of each business entity are used as the data subset associated with the semantic parsing results.

5. The method as described in claim 1, characterized in that, The financial analysis requirement, the dialogue context, and the data subset are input into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirement, including: The financial analysis requirements, the dialogue context, and the data subset are processed in a structured manner to obtain structured data; Based on the configured domain constraints and security rules, the structured data is converted into Prompt format data; The Prompt format data is input into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirements.

6. The method as described in claim 1, characterized in that, The initial SQL query statement is input into a pre-trained SQL statement validation and optimization model to obtain the target SQL query statement, including: The initial SQL query statement is converted into an abstract syntax tree using a pre-trained SQL statement validation and optimization model. Using a pre-trained SQL statement validation optimization model, the abstract syntax tree and the initial SQL query statement are validated to ensure they meet the configured validation rules and the database syntax specifications. If the abstract syntax tree and the initial SQL query statement satisfy the configured validation rules and the database syntax specifications, then the initial SQL query statement is optimized to obtain the target SQL query statement.

7. The method as described in claim 6, characterized in that, The initial SQL query is optimized to obtain the target SQL query, which includes: Based on the configured SQL optimization rules, the standardized initial SQL query statement is optimized to obtain the target SQL query statement.

8. A conversational financial analysis device, characterized in that, The device includes: The acquisition unit is used to acquire the financial analysis needs and dialogue context entered by the user in the current dialogue with the conversational financial analysis system. The parsing unit is used to perform semantic parsing on the financial analysis requirements and obtain semantic parsing results. The extraction unit is used to extract a subset of data associated with the semantic parsing results from a configured database based on the configured financial semantic graph. The conversion unit is used to input the financial analysis requirement, the dialogue context and the data subset into a pre-trained financial domain large language model to obtain the initial SQL query statement corresponding to the financial analysis requirement. The optimization unit is used to input the initial SQL query statement into a pre-trained SQL statement validation and optimization model to obtain the target SQL query statement; An execution unit is used to execute the target SQL query statement in the database to obtain financial analysis results.

9. An electronic device, characterized in that, The electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.