Dynamic knowledge graph construction and application method, device and equipment for financial service analysis and medium

By employing a dynamic knowledge graph construction method, the problems of highly dynamic knowledge, high accuracy requirements, and tight processing time in the financial field are solved, enabling efficient and reliable knowledge graph generation and application, which is suitable for financial risk early warning, intelligent investment research, and regulatory compliance inspection.

CN121638411BActive Publication Date: 2026-07-24INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR GENERSOFT CO LTD
Filing Date
2025-12-03
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

When existing technologies are applied to the financial field, where knowledge is highly dynamic, accuracy is critical, and processing time is tight, problems arise such as missed identification of entities and relationships, error accumulation, knowledge illusion, and difficulty in balancing efficiency and effectiveness.

Method used

A dynamic knowledge graph construction method is adopted. By acquiring sample texts in the financial field, structured pattern definitions are generated. The DSPy optimizer and ReAct verification module are used for end-to-end extraction and automated verification. Combined with a semantic deduplication strategy that integrates large and small models, a highly reliable knowledge graph is generated.

Benefits of technology

It enables dynamic adaptation of financial knowledge, improves the accuracy and processing efficiency of extraction results, and ensures the high reliability of financial data and seamless integration with financial business systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121638411B_ABST
    Figure CN121638411B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data processing, in particular to a dynamic knowledge graph construction and application method, device and equipment for financial business analysis and a medium, which aims to automatically construct a high-quality knowledge graph. The method dynamically generates a structured mode definition based on a financial sample text; cleans, segments and generates a unique data source index for a text to be processed; drives an end-to-end extraction of a large language model by using an instruction sequence generated by a DSPy optimizer, and outputs an indexed preliminary triple; performs fact checking and automatic verification by using a ReAct verification module, and filters error triples; and cleans redundancy by using a semantic deduplication strategy of a large model in cooperation with a small model. After entity ID standardization and relationship mapping, the data is converted into a graph database format and imported, and a knowledge graph applicable to financial business is generated. By using the semantic deduplication strategy of the large model in cooperation with the small model, the processing efficiency is improved under the premise of guaranteeing the semantic-level deduplication effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, specifically to a method, apparatus, equipment, and medium for constructing and applying dynamic knowledge graphs for financial business analysis. Background Technology

[0002] With the deep penetration of artificial intelligence in the financial field, knowledge graphs have become a core technology for connecting unstructured text with structured decision-making, and are widely used in scenarios such as intelligent investment research, risk warning, and regulatory compliance. Currently, the technology for automatically constructing knowledge graphs from unstructured financial texts (such as research reports and announcements) has mainly evolved into three categories: methods based on traditional natural language processing, methods based on pre-trained models, and methods based on large language models.

[0003] However, these existing technologies have significant shortcomings when dealing with the dynamic nature of knowledge, high accuracy requirements, and tight processing timelines in the financial field. First, they generally rely on predefined static knowledge models, making them unsuitable for handling frequently emerging concepts in finance, leading to missed entity and relationship identification. Second, traditional phased processing workflows cause error accumulation, while direct application of large language models suffers from knowledge illusion and unstable output, both failing to meet the near-zero error tolerance accuracy requirements of financial data. Finally, existing solutions struggle to balance effectiveness and efficiency: processing massive amounts of financial text using a single large model is too time-consuming, failing to meet the daily update requirements; while simple deduplication rules cannot effectively handle the complex semantic redundancy in financial terminology.

[0004] The essence of these shortcomings lies in the mismatch between general technical solutions and the specific technical needs of the financial sector. Therefore, there is an urgent need for an automated knowledge graph construction solution that can dynamically adapt to the evolution of financial knowledge, ensure high reliability of extraction results, and take into account processing efficiency. Summary of the Invention

[0005] To address the aforementioned problems, this invention provides a method, apparatus, device, and medium for constructing and applying dynamic knowledge graphs for financial business analysis.

[0006] In a first aspect, the technical solution of the present invention provides a method for constructing and applying dynamic knowledge graphs for financial business analysis, comprising the following steps: S1. Obtain sample texts from the financial field and dynamically generate structured pattern definitions for financial knowledge graphs; S2. Obtain the financial text to be processed, perform preprocessing, including cleaning and text segmentation, and generate a unique data source index for each text segment; S3. Input the structured pattern definition and the preprocessed financial text to be processed into the large language model. Drive the large language model through the instruction sequence generated by the DSPy optimizer according to the structured pattern definition to extract the initial set of triples end-to-end, where each triple is associated with the data source index. S4. For the initial set of triples, the ReAct verification module is used to generate fact-checking questions and automatically verify the original text based on the data source index to filter out erroneous triples and form a set of verified triples. S5. Clean the set of triples after verification using a semantic deduplication strategy that combines large and small models to obtain the final set of triples. S6. Standardize the final set of triples by entity ID and map the relation types, convert it into a data format that the graph database can recognize, and import it to generate the knowledge graph.

[0007] S7. Deploy the knowledge graph in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research or regulatory compliance inspection.

[0008] As a preferred embodiment of the technical solution of the present invention, step S1 includes: S11. Define a signature template, which has predefined fields for describing financial entities; the fields included in the signature template are: entity type, relationship type, descriptive constraints, and data format specifications. S12. Input the sample text from the financial field into the large language model for parsing, identify entities and relationships, and fill the parsing results into the signature template to generate the initial pattern definition; S13. Using the DSPy optimizer, the matching degree of the initial pattern definition is calculated and iteratively optimized based on the sample text in the financial field to generate the structured pattern definition.

[0009] As a preferred embodiment of the technical solution of the present invention, the steps of matching degree calculation and iterative optimization in S13 include: S131. Calculate the matching degree between the initial pattern definition and the financial sample text, wherein the matching degree is the ratio of the number of entity relations that conform to the initial pattern definition to the total number of entity relations in the financial sample text; S132. If the matching degree is lower than the preset threshold, adjust the constraints in the signature template and repeat steps S11-S12 and S131 until the matching degree reaches or exceeds the preset threshold.

[0010] The signature template provides a structured knowledge representation framework, ensuring the standardization of the generated patterns. Through the quantitative feedback mechanism of matching degree calculation and iterative optimization, the generated patterns are automatically evaluated and calibrated, ensuring a high degree of fit between the dynamically generated pattern definition and the financial sample data, thereby guaranteeing the comprehensiveness and accuracy of subsequent knowledge extraction from the source.

[0011] As a preferred embodiment of the technical solution of the present invention, in S3, the step of generating the instruction sequence by the DSPy optimizer according to the structured pattern definition includes: The DSPy optimizer extracts the entity type and relation type from the structured schema definition, generates financial semantic decomposition instructions, and determines the execution order and output format instructions of the instructions; the output format instructions specify that the initial triple set is output in JSON format.

[0012] The DSPy optimizer automatically generates financial semantic decomposition instructions and output format instructions, achieving intelligent binding between the extraction process and dynamic patterns. This not only reduces the reliance on manual prompting engineering, but more importantly, it constrains the output behavior of large models through standardized instructions, ensuring the consistency and standardization of the initial triple set in terms of format and content.

[0013] As a preferred embodiment of the technical solution of the present invention, in S4, the specific working process of the ReAct verification module includes: Based on the entity type and relation type of the triple, fact-checking questions are generated according to predefined rules; for entities containing attributes, interrogative sentences containing attribute definitions are generated; for financial professional relations, terminology explanations are added to the interrogative sentences. Based on the paragraph number information contained in the data source index associated in the triple, locate and extract the corresponding text segment from the original text; The fact-checking question and the anchored original text fragment are input into the judgment model for matching degree assessment. Based on the judgment result, the triples are marked into one of the following three categories: Verification passed: Core information is completely consistent; To be confirmed: There are differences in the wording of the core information, but the meaning is consistent; Verification failed: Core information conflict.

[0014] By generating precise verification questions through predefined rules and combining them with data source indexes to achieve rapid original text location, a highly efficient automated fact-checking closed loop is constructed. This mechanism transforms the abstract problem of knowledge illusion into a concrete text matching task, reducing the proportion of erroneous triples and enhancing the credibility and reliability of the financial knowledge graph.

[0015] As a preferred embodiment of the technical solution of the present invention, in S5, the execution steps of the semantic deduplication strategy of large and small model collaboration include: S51. Based on the large language model, perform semantic screening on the set of verified triples, delete identical triples, and mark triples that are semantically identical but have different expressions. S52. For the set of triples after initial screening, use a semantic vectorization model finely tuned for the financial field to generate text vectors, calculate the cosine similarity between vectors, and perform clustering and deduplication based on the preset financial field similarity threshold. S53. For the triples retained after deduplication, a lightweight contextual verification model is used to perform semantic consistency verification in conjunction with the original text fragments corresponding to the data source index, and triples that are inconsistent with the context are deleted.

[0016] Rapid deduplication is achieved through initial screening using a large model; fine-tuned vectorized models enable refined clustering based on financial semantics; and finally, contextual verification using a lightweight small model ensures that the deduplication results are consistent with the semantics of the original text. This collaborative strategy strikes a balance between deduplication effectiveness and processing efficiency, eliminating redundant information while preserving effective knowledge to the maximum extent, thus guaranteeing the overall response speed of the system.

[0017] As a preferred embodiment of the technical solution of the present invention, step S6 includes: S61. Assign a structured unique identifier to each entity in the final set of triples to standardize the entity ID. The format of the unique identifier is domain identifier-entity type-serial number. S62. Align and unify the relation types in the final set of triples with the relation types contained in the structured schema definition to complete the relation type mapping; S63. Based on the descriptive constraints in the structured schema definition, supplement the corresponding attribute information for the entity; S64. Convert the standardized and mapped triple data into RDF triple format to generate Cypher statements for Neo4j graph database. These statements are used to create nodes and relationships to generate a knowledge graph.

[0018] Structured unique identifiers ensure the uniqueness and manageability of entities globally; relational type mapping maintains consistency with dynamic schemas; and attribute supplementation enriches the information dimensions of entities. Finally, conversion to standard formats such as RDF and Cypher ensures seamless integration with mainstream graph databases and financial application systems.

[0019] As a preferred embodiment of the technical solution of the present invention, financial risk early warning is implemented in S7, specifically including: Based on the knowledge graph, the target entity and its associated subsidiaries and suppliers are queried to construct a risk transmission chain; When any entity in the risk transmission chain experiences a preset risk event, a risk warning notification is generated and triggered for the upstream entity.

[0020] As a preferred embodiment of the technical solution of this invention, intelligent investment research is implemented in S7, specifically including: Receive investment research query requests containing financial indicators and thresholds; Perform a graph traversal query in the knowledge graph to locate all entities that simultaneously satisfy the indicators and thresholds; Returns a detailed list of entities that meet the criteria, including at least the entity name, associated metric values, and data source.

[0021] As a preferred embodiment of the technical solution of this invention, S7 implements regulatory compliance checks, specifically including: Obtain a list of mandatory information disclosure attributes for the target entity type from the structured schema definition; In the knowledge graph, check whether the target entity fully possesses all the attributes in the attribute list; Automatically generate and output a list of missing attributes or a compliance report.

[0022] Secondly, the present invention also provides a dynamic knowledge graph construction and application device for financial business analysis, comprising: The dynamic pattern generation module is configured to acquire sample texts from the financial field and dynamically generate structured pattern definitions for financial knowledge graphs. The data preprocessing module is configured to acquire the financial text to be processed, perform cleaning and text segmentation, and generate a unique data source index for each text segment; An end-to-end extraction module is configured to input the structured pattern definition and the preprocessed financial text to be processed into a large language model, and drive the large language model through an instruction sequence generated by the DSPy optimizer according to the structured pattern definition to extract an initial set of triples end-to-end, wherein each triple is associated with the data source index. The result verification module is configured to generate fact-checking questions using the ReAct verification module for the initial triple set and perform automated verification based on the original text anchored by the data source index to filter out erroneous triples and form a verified triple set. The redundancy cleanup module is configured to clean up the verified triplet set using a semantic deduplication strategy that combines large and small models to obtain the final triplet set. The knowledge graph construction module is configured to perform entity ID standardization and relation type mapping on the final triple set, convert it into a data format that can be recognized by the graph database and import it to generate the knowledge graph. The application deployment module is used to deploy the knowledge graph in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research or regulatory compliance inspection.

[0023] Thirdly, the present invention also provides an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory storing computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to execute the dynamic knowledge graph construction and application method for financial business analysis as described in the first aspect.

[0024] Fourthly, the present invention also provides a non-transitory computer-readable storage medium that stores computer instructions that cause the computer to execute the dynamic knowledge graph construction and application method for financial business analysis as described in the first aspect.

[0025] As can be seen from the above technical solutions, this application has the following advantages: it solves the static schema adaptability problem caused by the rapid iteration of knowledge in the financial field by dynamically generating structured schema definitions; by combining end-to-end extraction and ReAct verification, it effectively suppresses the knowledge illusion of large models and improves the accuracy of financial data extraction while avoiding the accumulation of staged errors; and by using a semantic deduplication strategy that coordinates large and small models, it improves processing efficiency by leveraging the lightweight characteristics of small models while ensuring semantic-level deduplication effect. Attached Figure Description

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

[0027] Figure 1 This is a flowchart illustrating the method provided in an embodiment of the present invention.

[0028] Figure 2 A block diagram of the apparatus provided in an embodiment of the present invention. Detailed Implementation

[0029] To make the purpose, features, and advantages of this application more apparent and understandable, specific embodiments and accompanying drawings will be used to clearly and completely describe the technical solution protected by this application. Obviously, the embodiments described below are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0030] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used in this application and in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.

[0031] like Figure 1 As shown, this embodiment of the invention provides a method for constructing and applying a dynamic knowledge graph for financial business analysis, including the following steps: S1. Obtain sample texts from the financial field and dynamically generate structured pattern definitions for financial knowledge graphs; The selected sample text is input into a large language model (such as GPT-3.5 Financial Optimized Version) that has been fine-tuned for the financial domain. Combined with the Signature mechanism of the DSPy framework, the entity and the relationship between entities in the sample text are automatically identified, and a structured schema definition containing entity type, relationship type and attribute constraints is generated.

[0032] S2. Obtain the financial text to be processed, perform preprocessing, including cleaning and text segmentation, and generate a unique data source index for each text segment; High-quality data is obtained through two channels: ① APIs of authoritative financial data service providers to obtain research report texts with structured fields; ② Public databases of financial regulatory agencies to obtain regulatory strategy texts and listed company announcements with strong compliance. The data format is uniformly TXT text with UTF-8 encoding, and the size of a single file is controlled within 10MB.

[0033] Using regular expressions and keyword matching technology, irrelevant content such as disclaimers, analyst contact information, and headers and footers of report summary pages are removed from the text; character encoding verification is used to identify and remove garbled characters and meaningless placeholders.

[0034] Based on the context window length of the target large language model, the cleaned text is segmented into segments of no more than 3200 tokens each to ensure that each segment contains complete semantics.

[0035] A unique data source index is generated for each text segment, in the format of data source-report number-segment number-publication date. The publication date is used to distinguish information from different periods of the same subject, which facilitates subsequent error backtracking and data traceability.

[0036] S3. Input the structured pattern definition and the preprocessed financial text to be processed into the large language model. Drive the large language model through the instruction sequence generated by the DSPy optimizer according to the structured pattern definition to extract the initial set of triples end-to-end, where each triple is associated with the data source index. The DSPy optimizer extracts entity and relation types from the structured schema definition, generates a financial semantic decomposition instruction library, clarifies the instruction execution order, and generates output format instructions. It specifies that the initial triples are output in JSON format, including the fields "Entity 1 Name", "Entity 1 Type", "Relationship", "Entity 2 Name", "Entity 2 Type", "Data Source Index", and "Extract Confidence Score".

[0037] The preprocessed text segments, along with the structured schema definition and financial semantic decomposition instructions, are input into the large language model. Entity recognition and relation extraction are performed end-to-end, generating a preliminary set of triples. The preliminary set of triples is then validated according to the data format specifications in the structured schema definition, filtering out entries that do not conform to the specifications.

[0038] S4. For the initial set of triples, the ReAct verification module is used to generate fact-checking questions and automatically verify the original text based on the data source index to filter out erroneous triples and form a set of verified triples. The ReAct validation module generates precise verification questions based on the entity type and relation type of the triples, according to predefined rules: For the basic triple "Entity 1-Relationship-Entity 2" (such as "a liquor company-stock code-600XXX"), generate the question "Is the stock code of a liquor company 600XXX?"; For entities with attributes (such as the "revenue growth rate" of a "certain liquor company"), generate interrogative sentences with attribute definitions, such as "Is the revenue growth rate of a certain listed liquor company in the first half of 2024 15%?" Based on the paragraph number in the "source" field of the triple, the corresponding text segment is located and extracted from the original file of the financial text to be processed. The fact-checking question and the extracted text segment are input together into the judgment model (using a BERT model fine-tuned for the financial field). The model makes judgments according to the following logic: If the core information (entities, relations, values) is consistent with the original text, such as the question "Is the stock code 600XXX?" matching the original text "Stock code 600XXX", mark it as "Verification passed"; The core information is expressed differently but the meaning is the same, such as the original text "Securities Code 600XXX" and the question "Stock Code 600XXX", marked "Pending Confirmation"; If there is a core information conflict, such as the original text "stock code 600XXX" and the question "stock code 600YYY", mark it as "verification failed".

[0039] Retain valid triples; discard invalid triples; for valid triples, record their data source index and have them manually reviewed by financial professionals to confirm semantic consistency before deciding whether to retain them.

[0040] S5. Clean the set of triples after verification using a semantic deduplication strategy that combines large and small models to obtain the final set of triples. The lightweight large language model is invoked to perform the initial deduplication of the validated triplet set: Delete triples with identical "entity1, entity1_type, relation, entity2, entity2_type" and keep only the entry with the highest confidence (e.g., for two triples "a liquor company-stock code-600XXX", keep the entry with confidence=0.97). Triples with different entity names or relational descriptions but completely identical semantics are marked as "to be clustered" and proceed to the subsequent vectorization stage.

[0041] Using a Sentence-BERT model finely tuned for the financial field, the entity and relation text in the triples to be clustered are input into the model. After financial-specific word segmentation (e.g. splitting "a certain liquor enterprise company" into "a certain liquor enterprise" and "company", excluding interference from common suffixes) and mean pooling, a 768-dimensional dense vector is generated. The cosine similarity between vectors is calculated using a threshold determined by validation set tests in the financial field (default 0.85, adjusted to 0.83 for the banking industry due to significant differences in entity names, and adjusted to 0.87 for the securities industry due to strong terminology standardization). Vectors with similarity ≥ the threshold are grouped into one class. The frequency and confidence of triples in each class are counted, and the entries with "highest frequency + confidence ≥ 0.9" are retained (e.g., "a certain liquor company" appears 6 times with a confidence of 0.97, "a certain liquor company joint-stock company" appears 3 times with a confidence of 0.92, and the triple corresponding to "a certain liquor company" is retained).

[0042] Using a DistilBERT model fine-tuned for the financial field, the triples retained after clustering and deduplication are input into the model along with the corresponding original text fragments. The model outputs "consistent" or "inconsistent" results. "Inconsistent" entries are deleted (e.g., the triple "a liquor company - main products - new energy batteries" conflicts with the original text "a liquor company mainly produces and sells liquor," so it is judged as "inconsistent" and deleted), while "consistent" entries are retained to form the final set of triples.

[0043] S6. Standardize the final set of triples by entity ID and map the relation types, convert it into a data format that the graph database can recognize, and import it to generate the knowledge graph.

[0044] Assign a unique identifier to each entity in the final set of triples, in the format of "Domain Identifier-Entity Type-Sequence Number".

[0045] Align the relation types in the final triples with the structured schema definition generated by S1 (e.g., "industry affiliation" is mapped to "industry affiliation" in the schema definition, and "revenue year-on-year growth rate" is mapped to "revenue year-on-year growth rate"); supplement attribute information for entities based on the descriptive constraints in the schema definition (e.g., supplement "registered location: XX province XX city", "establishment time: XXXX year", "ESG rating: A", "data source: Wind", "publication date: 20240930" for "a liquor company").

[0046] The standardized triples are converted into the RDF format commonly used in the financial field. The Neo4j graph database is selected, and nodes and relationships are created using Cypher statements. Finally, a knowledge graph that conforms to the standards of the financial field is generated, which can be directly connected to business systems such as financial risk warning, intelligent investment research, and regulatory compliance inspection.

[0047] S7. Deploy the knowledge graph in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research or regulatory compliance inspection.

[0048] In some embodiments, step S1 includes: S11. Define a signature template, which has predefined fields for describing financial entities; the fields included in the signature template are: entity type, relationship type, descriptive constraints, and data format specifications. Entity type: Limited to core categories in the financial sector, including "listed companies", "financial institutions", "financial indicators", "industry classification", "ESG rating", "financial products", etc., and each category must be associated with a specific business scenario; Relationship type: Corresponds to the logical relationship between entities in the financial field, such as "listed company-stock code-securities code", "financial institution-regulatory agency-regulatory body", "enterprise-ESG rating-rating result", etc. The relationship definition must conform to the financial business logic; Descriptive constraints: Clearly define the key attribute requirements for each entity / relationship, such as "Entity type: Listed company, Descriptive constraints: Must include stock code, place of registration, main business, and establishment time" and "Relationship type: ESG rating, Descriptive constraints: Must be associated with an assessment agency and the validity period of the rating"; Data format specifications: Specify the field value format, such as entity name and relation name as string type with a length not exceeding 50 characters; securities code as 6-digit numeric string; date type attributes as “YYYYMMDD” format; numerical financial indicators must include units.

[0049] Template storage: The designed signature templates are stored in the template library of the data processing system in XML format for easy subsequent calling and modification.

[0050] S12. Input the sample text from the financial field into the large language model for parsing, identify entities and relationships, and fill the parsing results into the signature template to generate the initial pattern definition; Select 3-5 typical sample texts from the financial data resource library, covering different financial knowledge scenarios. Example Sample 1: "An electronics technology company was established in 2005, registered in xx city, and its main business is the research and development and manufacturing of consumer electronics. In the first quarter of 2024, its net profit was 250 million yuan, belonging to the electronics manufacturing industry." Example Sample 2: "An automobile company's ESG rating in 2024 was AA, issued by a third-party assessment agency. The rating is valid until March 2025, with an environmental dimension score of 85 points and a social dimension score of 82 points."

[0051] Input the sample text into a large language model fine-tuned for the financial domain, and the model performs the following operations: By matching financial terminology dictionaries and analyzing contextual semantics, entities and types in the samples are identified. For example, from sample 1, the following can be identified: “a certain electronics technology company” (a listed company), “002XXX” (stock code), “2005” (establishment year), “xx city” (registered location), “250 million yuan” (financial indicator - net profit), and “electronics manufacturing industry” (industry classification). Based on the financial relationship rule base and grammatical structure analysis, relationships between entities are extracted, such as "a certain electronic technology company - stock code - 002XXX", "a certain electronic technology company - establishment time - 2005", "a certain electronic technology company - net profit - 250 million yuan", "a certain automobile company - ESG rating - AA", "a certain automobile company - ESG assessment agency - a certain third-party assessment agency". The "Entity Type - Relationship Type - Attribute Constraint" information obtained from model parsing is automatically filled into the signature template defined in S11 according to the field correspondence to generate the initial schema definition. For example, under the "Entity Type - Listed Company" field, "Relationship: Stock Code, Establishment Time, Registered Location, Main Business, Net Profit, Industry" is added; under the "Relationship Type - ESG Rating" field, "Descriptive Constraint: Related Assessment Agency, Rating Validity Period, Dimension Score" is added.

[0052] S13. Using the DSPy optimizer, perform matching degree calculation and iterative optimization on the initial pattern definition based on the sample text in the financial field to generate the structured pattern definition. The matching degree calculation and iterative optimization steps in this step include: S131. Calculate the matching degree between the initial pattern definition and the financial sample text, wherein the matching degree is the ratio of the number of entity relations that conform to the initial pattern definition to the total number of entity relations in the financial sample text; S132. If the matching degree is lower than the preset threshold, adjust the constraints in the signature template and repeat steps S11-S12 and S131 until the matching degree reaches or exceeds the preset threshold.

[0053] Load the DSPy framework into the data processing system and configure the optimizer parameters, including "sample matching degree calculation threshold", "maximum number of iterations", and "constraint adjustment step size". In view of the high accuracy requirements in the financial field, the initial matching degree threshold is set to 90% and the maximum number of iterations is 5.

[0054] The DSPy optimizer compares the initial pattern definition with the input financial domain sample text, counting the "number of entity relationships matching the initial pattern definition" and the "total number of entity relationships in the sample text," and calculates the matching degree (matching degree = number of entity relationships matching the constraints / total number of entity relationships × 100%). Taking sample 1 as an example, if the sample contains 8 entity relationships, and all of them match the initial pattern definition constraints, then the matching degree = 8 / 8 × 100% = 100%; if relationships are missed and only 7 entity relationships are matched, then the matching degree = 7 / 8 × 100% = 87.5%.

[0055] If the matching degree is ≥90%, the initial pattern definition is determined to meet the knowledge coverage requirements of the financial field, and it is directly output as a structured pattern definition; If the matching degree is less than 90%, the constraint adjustment mechanism is triggered: the optimizer automatically analyzes the unmatched entity relationships, locates the missing constraints in the signature template, supplements the corresponding field constraints, returns to S12, and calls the large language model again to parse the sample text, fill in the template, and generate a new initial pattern definition. The process of repeating pattern evaluation and constraint adjustment continues until the matching degree reaches 90% or higher, or the maximum number of iterations is reached. If the threshold is not met even after reaching the maximum number of iterations, the system automatically prompts manual review of the template field design and sample selection for rationality. After adjustment, further optimization continues, ultimately generating a structured pattern definition adapted for the financial field.

[0056] In some embodiments, step S3, which involves generating the instruction sequence by the DSPy optimizer according to the structured pattern definition, includes: The DSPy optimizer extracts the entity type and relation type from the structured schema definition, generates financial semantic decomposition instructions, and determines the execution order and output format instructions. The output format instructions specify that the initial triple set is output in JSON format, which includes the following fields: entity 1 name, entity 1 type, relation, entity 2 name, entity 2 type, data source index, and extraction confidence.

[0057] Before extracting the initial set of triples end-to-end, the following steps are also included: A financial terminology dictionary and a financial relationship rule base are loaded into the large language model to improve its accuracy in semantic understanding of financial texts.

[0058] After extracting the initial set of triples end-to-end, the following steps are also included: The initial set of triples is format-validated, and entries that do not conform to the predefined data format specifications are filtered out.

[0059] In some embodiments, the specific working process of the ReAct verification module in S4 includes: Based on the entity type and relation type of the triple, fact-checking questions are generated according to predefined rules; for entities containing attributes, interrogative sentences containing attribute definitions are generated; for financial professional relations, terminology explanations are added to the interrogative sentences. Based on the paragraph number information contained in the data source index associated in the triple, locate and extract the corresponding text segment from the original text; The fact-checking question and the anchored original text fragment are input into the judgment model for matching degree assessment. Based on the judgment result, the triples are marked into one of the following three categories: Verification passed: Core information is completely consistent; To be confirmed: There are differences in the wording of the core information, but the meaning is consistent; Verification failed: Core information conflict.

[0060] For triples marked as pending verification, their data source index is recorded for manual review; triples marked as verification failed are discarded.

[0061] In some embodiments, in S5, the execution steps of the semantic deduplication strategy based on the collaboration between large and small models include: S51. Based on the large language model, perform semantic screening on the set of verified triples, delete identical triples, and mark triples that are semantically identical but have different expressions. S52. For the set of triples after initial screening, use a semantic vectorization model finely tuned for the financial field to generate text vectors, calculate the cosine similarity between vectors, and perform clustering and deduplication based on the preset financial field similarity threshold. S53. For the triples retained after deduplication, a lightweight contextual verification model is used to perform semantic consistency verification in conjunction with the original text fragments corresponding to the data source index, and triples that are inconsistent with the context are deleted.

[0062] The semantic vectorization model in S52 is a Sentence-BERT model fine-tuned with financial domain corpus. The financial domain similarity threshold is determined through testing on a financial domain validation set and dynamically adjusted according to the domain characteristics of the banking or securities industry.

[0063] The contextual validation model in S53 is a DistilBERT model fine-tuned for the financial domain.

[0064] In some embodiments, step S6 includes: S61. Assign a structured unique identifier to each entity in the final set of triples to standardize the entity ID. The format of the unique identifier is domain identifier-entity type-serial number. S62. Align and unify the relation types in the final set of triples with the relation types contained in the structured schema definition to complete the relation type mapping; S63. Based on the descriptive constraints in the structured schema definition, supplement the corresponding attribute information for the entity; S64. Convert the standardized and mapped triple data into RDF triple format to generate Cypher statements for the Neo4j graph database. These statements are used to create nodes and relationships, generating a knowledge graph. The Cypher statements include: The CREATE statement is used to create entity nodes, in which the node's labels and attributes are defined; and the MATCH and CREATE statements are used to create relationships between nodes.

[0065] In some embodiments, financial risk warning is implemented in S7, specifically including: Based on the knowledge graph, the target entity and its associated subsidiaries and suppliers are queried to construct a risk transmission chain; specifically, constructing the risk transmission chain includes the following steps: Starting with the target entity as the starting node, a one-way or two-way graph traversal is performed in the knowledge graph along the relationship edges of holding subsidiaries, wholly-owned subsidiaries, or suppliers. During the traversal, the visited entities are treated as nodes, and the relationships between them are treated as edges, dynamically constructing a subgraph representing the risk transmission path. When the traversal depth reaches a preset threshold or there are no new reachable entities, the traversal stops, and the finally constructed subgraph is output as the risk transmission chain.

[0066] When any entity in the risk transmission chain experiences a preset risk event, a risk warning notification is generated and triggered for the upstream entity. The generation and triggering of risk warning notifications for upstream entities specifically includes: Monitor external data sources, and when a preset risk event is detected in any entity in the risk transmission chain, mark that entity as a risk source; In the risk transmission chain, the risk source is traced upstream in reverse order to locate all potentially affected parent companies or core customers as upstream entities. A structured early warning message is automatically generated for each upstream entity, and the message contains at least information on the risk source, transmission path, and risk level. The warning message is automatically pushed to the designated financial business terminal or user by calling the message interface API.

[0067] In some embodiments, intelligent investment research is implemented in S7, specifically including: Receive investment research query requests containing financial indicators and thresholds; Perform a graph traversal query in the knowledge graph to locate all entities that simultaneously satisfy the indicators and thresholds; Returns a detailed list of entities that meet the criteria, including at least the entity name, associated metric values, and data source.

[0068] In some embodiments, regulatory compliance checks are implemented in S7, specifically including: Obtain a list of mandatory information disclosure attributes for the target entity type from the structured schema definition; In the knowledge graph, check whether the target entity fully possesses all the attributes in the attribute list; Automatically generate and output a list of missing attributes or a compliance report.

[0069] like Figure 2 As shown, this embodiment of the invention also provides a dynamic knowledge graph construction and application device for financial business analysis, the device comprising: The dynamic pattern generation module is configured to acquire sample texts from the financial field and dynamically generate structured pattern definitions for financial knowledge graphs. The data preprocessing module is configured to acquire the financial text to be processed, perform cleaning and text segmentation, and generate a unique data source index for each text segment; An end-to-end extraction module is configured to input the structured pattern definition and the preprocessed financial text to be processed into a large language model, and drive the large language model through an instruction sequence generated by the DSPy optimizer according to the structured pattern definition to extract an initial set of triples end-to-end, wherein each triple is associated with the data source index. The result verification module is configured to generate fact-checking questions using the ReAct verification module for the initial triple set and perform automated verification based on the original text anchored by the data source index to filter out erroneous triples and form a verified triple set. The redundancy cleanup module is configured to clean up the verified triplet set using a semantic deduplication strategy that combines large and small models to obtain the final triplet set. The knowledge graph construction module is configured to perform entity ID standardization and relation type mapping on the final triple set, convert it into a data format that can be recognized by the graph database and import it to generate the knowledge graph. The application deployment module is used to deploy the knowledge graph in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research or regulatory compliance inspection.

[0070] In some embodiments, the dynamic pattern generation module includes: The template definition unit is configured to define a signature template, which has predefined fields for describing financial entities. The fields included in the signature template are: entity type, relationship type, descriptive constraints, and data format specifications. The parsing and filling unit is configured to input sample text from the financial field into a large language model for parsing, identify entities and relationships, and fill the parsing results into the signature template to generate an initial pattern definition; The optimization verification unit is configured to use the DSPy optimizer to perform matching degree calculation and iterative optimization on the initial pattern definition based on the sample text in the financial field, and generate the structured pattern definition.

[0071] In some embodiments, the optimized verification unit is specifically configured to: Calculate the matching degree between the initial pattern definition and the financial domain sample text, where the matching degree is the ratio of the number of entity relationships that conform to the initial pattern definition to the total number of entity relationships in the financial domain sample text; If the matching degree is lower than the preset threshold, the constraints in the signature template are adjusted, and the parsing and filling unit is re-triggered to perform parsing and filling and its own matching degree calculation until the matching degree reaches or exceeds the preset threshold.

[0072] In some embodiments, the DSPy optimizer in the end-to-end extraction module is specifically configured to: Extract the entity type and relation type from the structured schema definition, generate financial semantic decomposition instructions, and determine the execution order and output format instructions of the instructions; the output format instructions specify that the preliminary triple set is output in JSON format.

[0073] In some embodiments, the ReAct verification module in the result verification module is specifically configured to: Based on the entity type and relation type of the triple, fact-checking questions are generated according to predefined rules; for entities containing attributes, interrogative sentences containing attribute definitions are generated; for financial professional relations, terminology explanations are added to the interrogative sentences. Based on the paragraph number information contained in the data source index associated in the triple, locate and extract the corresponding text segment from the original text; The fact-checking question and the anchored original text fragment are input into the judgment model for matching degree judgment. Based on the judgment result, the triple is marked as verified, pending confirmation, or verified as failed.

[0074] In some embodiments, the redundancy cleanup module is specifically configured to perform: The semantic screening unit performs semantic screening on the set of verified triples based on the large language model, deletes identical triples, and marks triples that are semantically identical but have different expressions. The vectorization deduplication unit generates text vectors from the initial set of triples using a semantic vectorization model finely tuned for the financial domain, calculates the cosine similarity between vectors, and performs clustering deduplication based on a preset financial domain similarity threshold. The contextual verification unit uses a lightweight contextual verification model to perform semantic consistency verification on the triples retained after deduplication, combined with the original text fragments corresponding to the data source index, and deletes triples that are inconsistent with the context.

[0075] In some embodiments, the knowledge graph construction module includes: A standardization unit is configured to assign a structured unique identifier to each entity in the final set of triples, thereby standardizing entity IDs. The format of the unique identifier is domain identifier-entity type-serial number. The mapping unit is configured to align and unify the relation types in the final set of triples with the relation types contained in the structured schema definition, thereby completing the relation type mapping. An attribute supplementation unit is configured to supplement corresponding attribute information for entities based on the descriptive constraints in the structured pattern definition. The format conversion and import unit is configured to convert standardized and mapped triple data into RDF triple format, and / or generate Cypher statements for the Neo4j graph database to create nodes and relationships, thereby generating the knowledge graph.

[0076] This invention also provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other via the communication bus. The communication bus can be used for information transmission between the electronic device and sensors. The processor can call logical instructions in the memory to execute the following methods: S1, acquiring sample text in the financial field and dynamically generating a structured pattern definition for a financial knowledge graph; S2, acquiring the financial text to be processed, performing preprocessing, including cleaning and text segmentation, and generating a unique data source index for each text segment; S3, inputting the structured pattern definition and the preprocessed financial text to be processed into a large language model, driving the large language model through an instruction sequence generated by the DSPy optimizer according to the structured pattern definition, and extracting a preliminary set of triples end-to-end, wherein each triple is associated with the data source index; S4, for the preliminary set of triples... S5. Using the ReAct verification module, fact-checking questions are generated and automatically verified based on the original text indexed by the data source to filter out erroneous triples, forming a set of verified triples; S6. The set of verified triples is cleaned using a semantic deduplication strategy that combines large and small models to obtain the final set of triples; S7. The final set of triples is standardized by entity ID and mapped to relation types, transformed into a data format recognizable by the graph database, and imported to generate the knowledge graph; S8. The knowledge graph is deployed in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research, or regulatory compliance inspection.

[0077] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0078] This invention provides a non-transitory computer-readable storage medium storing computer instructions that cause a computer to execute the methods provided in the above-described method embodiments. These instructions include, for example,: S1, acquiring sample text from the financial field and dynamically generating a structured schema definition for a financial knowledge graph; S2, acquiring the financial text to be processed, performing preprocessing including cleaning and text segmentation, and generating a unique data source index for each text segment; S3, inputting the structured schema definition and the preprocessed financial text to be processed into a large language model, driving the large language model through an instruction sequence generated by the DSPy optimizer based on the structured schema definition, and extracting an initial set of triples end-to-end, wherein each... S4. For the initial set of triples, the ReAct verification module generates fact-checking questions and performs automated verification based on the original text anchored by the data source index to filter out erroneous triples, forming a set of verified triples; S5. The set of verified triples is cleaned using a semantic deduplication strategy that combines large and small models to obtain the final set of triples; S6. The final set of triples is standardized by entity ID and mapped to relation types, converted into a data format recognizable by the graph database, and imported to generate the knowledge graph; S7. The knowledge graph is deployed in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research, or regulatory compliance inspection.

[0079] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for constructing and applying dynamic knowledge graphs for financial business analysis, characterized in that, Includes the following steps: S1. Obtain sample texts from the financial field and dynamically generate structured pattern definitions for financial knowledge graphs; S2. Obtain the financial text to be processed, perform preprocessing, including cleaning and text segmentation, and generate a unique data source index for each text segment; S3. Input the structured pattern definition and the preprocessed financial text to be processed into the large language model. Drive the large language model through the instruction sequence generated by the DSPy optimizer according to the structured pattern definition to extract the initial set of triples end-to-end, where each triple is associated with the data source index. S4. For the initial set of triples, the ReAct verification module is used to generate fact-checking questions and automatically verify the original text based on the data source index to filter out erroneous triples and form a set of verified triples. S5. Clean the set of triples after verification using a semantic deduplication strategy that combines large and small models to obtain the final set of triples. S6. Standardize the final set of triples by entity ID and map the relation type, convert it into a data format that the graph database can recognize and import it to generate the knowledge graph. S7. Deploy the knowledge graph in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research or regulatory compliance inspection; The steps in S1 include: S11. Define a signature template, wherein the signature template is predefined with multiple fields for describing financial entities; The signature template includes the following fields: entity type, relationship type, descriptive constraints, and data format specifications; S12. Input the sample text from the financial field into the large language model for parsing, identify entities and relationships, and fill the parsing results into the signature template to generate the initial pattern definition; S13. Using the DSPy optimizer, the matching degree of the initial pattern definition is calculated and iteratively optimized based on the sample text in the financial field to generate a structured pattern definition.

2. The method for constructing and applying dynamic knowledge graphs for financial business analysis according to claim 1, characterized in that, The steps for matching degree calculation and iterative optimization in S13 include: S131. Calculate the matching degree between the initial pattern definition and the financial sample text, wherein the matching degree is the ratio of the number of entity relations that conform to the initial pattern definition to the total number of entity relations in the financial sample text; S132. If the matching degree is lower than the preset threshold, adjust the constraints in the signature template and repeat steps S11-S12 and S131 until the matching degree reaches or exceeds the preset threshold.

3. The method for constructing and applying dynamic knowledge graphs for financial business analysis according to claim 2, characterized in that, In S3, the steps involved in generating the instruction sequence by the DSPy optimizer based on the structured pattern definition include: The DSPy optimizer extracts the entity type and relation type from the structured schema definition, generates financial semantic decomposition instructions, and determines the execution order and output format instructions of the instructions; the output format instructions specify that the initial triple set is output in JSON format.

4. The method for constructing and applying dynamic knowledge graphs for financial business analysis according to claim 3, characterized in that, In S4, the specific working process of the ReAct verification module includes: Based on the entity type and relation type of the triple, fact-checking questions are generated according to predefined rules; for entities containing attributes, interrogative sentences containing attribute definitions are generated; for financial professional relations, terminology explanations are added to the interrogative sentences. Based on the paragraph number information contained in the data source index associated in the triple, locate and extract the corresponding text segment from the original text; The fact-checking question and the anchored original text fragment are input into the judgment model for matching degree assessment. Based on the judgment result, the triples are marked into one of the following three categories: Verification passed: Core information is completely consistent; To be confirmed: There are differences in the wording of the core information, but the meaning is consistent; Verification failed: Core information conflict.

5. The method for constructing and applying dynamic knowledge graphs for financial business analysis according to claim 4, characterized in that, In S5, the execution steps of the semantic deduplication strategy for collaboration between large and small models include: S51. Based on the large language model, perform semantic screening on the set of verified triples, delete identical triples, and mark triples that are semantically identical but have different expressions. S52. For the set of triples after initial screening, use a semantic vectorization model finely tuned for the financial field to generate text vectors, calculate the cosine similarity between vectors, and perform clustering and deduplication based on the preset financial field similarity threshold. S53. For the triples retained after deduplication, a lightweight contextual verification model is used to perform semantic consistency verification in conjunction with the original text fragments corresponding to the data source index, and triples that are inconsistent with the context are deleted.

6. The method for constructing and applying dynamic knowledge graphs for financial business analysis according to claim 5, characterized in that, Financial risk early warning is implemented in S7, specifically including: Based on the knowledge graph, the target entity and its associated subsidiaries and suppliers are queried to construct a risk transmission chain; When any entity in the risk transmission chain experiences a preset risk event, a risk warning notification is generated and triggered for the upstream entity.

7. A device for constructing and applying dynamic knowledge graphs for financial business analysis, characterized in that, include: The dynamic pattern generation module is configured to acquire sample texts from the financial field and dynamically generate structured pattern definitions for financial knowledge graphs. The data preprocessing module is configured to acquire the financial text to be processed, perform cleaning and text segmentation, and generate a unique data source index for each text segment; An end-to-end extraction module is configured to input structured pattern definitions and preprocessed financial text to be processed into a large language model. The large language model is driven by a sequence of instructions generated by the DSPy optimizer according to the structured pattern definitions to extract an initial set of triples end-to-end, wherein each triple is associated with the data source index. The result verification module is configured to generate fact-checking questions using the ReAct verification module for the initial triple set and perform automated verification based on the original text anchored by the data source index to filter out erroneous triples and form a verified triple set. The redundancy cleanup module is configured to clean up the set of triples after verification using a semantic deduplication strategy that combines large and small models to obtain the final set of triples. The knowledge graph construction module is configured to standardize the final set of triples by entity ID and map the relation types, convert it into a data format that the graph database can recognize and import it to generate a knowledge graph. The application deployment module is used to deploy the knowledge graph in the financial business system to realize at least one application function in financial risk early warning, intelligent investment research or regulatory compliance inspection; The dynamic pattern generation module includes: The template definition unit is configured to define a signature template, which has predefined fields for describing financial entities. The fields included in the signature template are: entity type, relationship type, descriptive constraints, and data format specifications. The parsing and filling unit is configured to input sample text from the financial field into a large language model for parsing, identify entities and relationships, and fill the parsing results into the signature template to generate an initial pattern definition; The optimized verification unit is configured to utilize the DSPy optimizer to perform matching degree calculation and iterative optimization on the initial pattern definition based on the sample text in the financial field, thereby generating a structured pattern definition.

8. An electronic device, characterized in that, The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; the memory stores computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to execute the dynamic knowledge graph construction and application method for financial business analysis as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that cause the computer to execute the dynamic knowledge graph construction and application method for financial business analysis as described in any one of claims 1 to 6.