Financial problem analysis method and device based on large language model, equipment and medium
By obtaining structural representation vectors through topological analysis, determining the graph structure type, dynamically reorganizing the logical flow, and filling in prompt word templates, the problem of contextual organization confusion and logical breakage in the answers generated by large language models is solved, thereby improving the accuracy and logical coherence of financial problem analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR ENTERPRISE CLOUD TECHNOLOGY (SHANDONG) CO LTD
- Filing Date
- 2025-12-02
- Publication Date
- 2026-04-17
AI Technical Summary
When the external knowledge base is organized into a graph with a rich relational structure, the existing traditional RAG technology can lead to problems such as chaotic contextual organization and logical breaks in the answers generated by the large language model.
The structural representation vector is obtained through topological analysis to determine the graph structure type. Node priorities are determined based on semantic relevance, temporal relevance, and PageRank scores. The logical flow is dynamically reorganized and filled with prompt word templates to generate target prompt words, which are then input into a large language model for analysis.
It improves the reasoning ability of large language models for complex financial knowledge, solves the problems of chaotic context organization and logical breaks, and enhances the logical coherence and accuracy of the answers.
Smart Images

Figure CN121233980B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to methods, apparatus, devices and media for financial problem analysis based on large language models. Background Technology
[0002] Retrieval-Augmented Generation (RAG) technology effectively improves the accuracy and factuality of the generated content by retrieving relevant information fragments from external knowledge bases and inputting them as context along with user queries into a large language model, thus alleviating the "illusion" problem.
[0003] Existing traditional RAG techniques typically rely on vector similarity for retrieval (e.g., calculating the cosine similarity between the query and text blocks using an embedding model). The top-K most relevant text fragments are then simply concatenated and directly input into an LLM (Large Language Model). When the external knowledge base is organized into a graph with a rich relational structure (e.g., knowledge graph, document link graph, entity relationship graph), this approach leads to problems such as disorganized context and logical breaks in the answers generated by the LLM. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for financial problem analysis based on a large language model, which can obtain structural representation vectors through topological analysis and solve the problem of chaotic context organization in the generated results. The specific solution is as follows:
[0005] Firstly, this application provides a method for analyzing financial problems based on a large language model, including:
[0006] The system obtains a financial question to be analyzed input by a target user, retrieves the target subgraph corresponding to the financial question from a preset knowledge graph, and performs topological analysis on the target subgraph to obtain the corresponding structural representation vector; wherein the structural representation vector represents the topological features of the target subgraph.
[0007] The graph structure type of the target subgraph is determined using the structural representation vector, and the target prompt word template corresponding to the financial problem to be analyzed is determined based on the graph structure type.
[0008] Based on the semantic and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node, the priority of each node is determined. The nodes are sorted and reorganized according to their priorities to obtain the corresponding target logic flow. The target logic flow is then used to fill the target prompt word template to obtain the corresponding target prompt words.
[0009] The target prompt words are input into a preset large language model so that the preset large language model can generate analysis results corresponding to the financial problem to be analyzed.
[0010] Optionally, performing topological analysis on the target subgraph to obtain the corresponding structural representation vector includes:
[0011] The global structural features of the target subgraph are extracted, the semantic clusters in the target subgraph are identified using a target clustering algorithm, and the connection strength between each semantic cluster is calculated; wherein, the global structural features include path length distribution, clustering coefficient, centrality index, and ring structure detection results;
[0012] A preset graph neural network is used to generate node vectors corresponding to each node in the target subgraph, and the structural representation vector is obtained based on the global structural features, each node vector, and the connection strength between each semantic cluster; wherein, the node vector is a feature vector representing the connection relationship and topological position of the corresponding node in the target subgraph.
[0013] Optionally, determining the graph structure type of the target subgraph using the structural representation vector includes:
[0014] Determine the cosine similarity between the structural representation vector and the graph structure templates corresponding to each preset graph structure type. If the cosine similarity between any graph structure template and the structural representation vector is greater than the preset cosine similarity threshold, then the graph structure type of the target subgraph is determined as the graph structure type corresponding to any graph structure template.
[0015] Optionally, determining the priority of each node based on the semantic and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node, includes:
[0016] The semantic relevance is determined based on the cosine similarity between each node and the target question vector corresponding to the financial problem to be analyzed, and the temporal relevance is determined based on the timestamps of the associated events corresponding to each node.
[0017] The centrality weight of each node is determined based on the PageRank score, the query relevance weight of each node is determined based on the semantic relevance, and the time decay weight of each node is determined based on the temporal relevance.
[0018] The priority of each node is determined based on the centrality weight, the query relevance weight, and the time decay weight.
[0019] Optionally, the step of filling the target prompt word template with the target logic flow includes:
[0020] The node descriptions corresponding to each node in the target logic flow are filled into the target prompt word template. Semantic completion processing is performed on each node description in the target prompt word template, and logical transition words are inserted between adjacent node descriptions.
[0021] Optionally, after filling the target prompt word template with the target logic flow, the method further includes:
[0022] Based on the graph structure type, a corresponding relation guidance instruction is generated, and the relation guidance instruction is added to the target position of the target prompt word; wherein, the relation guidance instruction is used to guide the reasoning process of the preset large language model.
[0023] Optionally, after filling the target prompt word template with the target logic flow, the method further includes:
[0024] The target prompt word is compressed based on the context window of the preset large language model to obtain the corresponding compressed prompt word, and constraints are added to the compressed prompt word to obtain the target prompt word.
[0025] Secondly, this application provides a financial problem analysis device based on a large language model, comprising:
[0026] The structural representation vector acquisition module is used to acquire the financial problem to be analyzed input by the target user, retrieve the target subgraph corresponding to the financial problem to be analyzed from the preset knowledge graph, and perform topological analysis on the target subgraph to obtain the corresponding structural representation vector; wherein, the structural representation vector represents the topological features of the target subgraph;
[0027] The prompt word template determination module is used to determine the graph structure type of the target subgraph using the structural representation vector, and to determine the target prompt word template corresponding to the financial problem to be analyzed based on the graph structure type;
[0028] The target prompt word acquisition module is used to determine the priority of each node based on the semantic relevance and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node; sort and reorganize each node according to the priority to obtain the corresponding target logic flow; and use the target logic flow to fill the target prompt word template to obtain the corresponding target prompt words.
[0029] The prompt word input module is used to input the target prompt word into a preset large language model so that the preset large language model can generate the analysis result corresponding to the financial problem to be analyzed.
[0030] Thirdly, this application provides an electronic device, comprising:
[0031] Memory, used to store computer programs;
[0032] A processor for executing the computer program to implement the aforementioned financial problem analysis method based on a large language model.
[0033] Fourthly, this application provides a computer-readable storage medium for storing a computer program that, when executed by a processor, implements the aforementioned financial problem analysis method based on a large language model.
[0034] This application first obtains the financial question to be analyzed input by the target user, retrieves the target subgraph corresponding to the financial question from a preset knowledge graph, and performs topological analysis on the target subgraph to obtain the corresponding structural representation vector. The structural representation vector represents the topological features of the target subgraph. Then, the structural representation vector is used to determine the graph structure type of the target subgraph, and based on the graph structure type, a target prompt word template corresponding to the financial question to be analyzed is determined. Next, based on the semantic relevance and temporal relevance between each node in the target subgraph and the financial question to be analyzed, as well as the PageRank score of each node, the priority of each node is determined. The nodes are then sorted and reorganized according to their priorities to obtain the corresponding target logic flow. The target logic flow is then used to fill the target prompt word template to obtain the corresponding target prompt words. Finally, the target prompt words are input into a preset large language model so that the preset large language model can generate the analysis results corresponding to the financial question to be analyzed. Therefore, this application obtains structural representation vectors through topological analysis, realizing the perception of subgraph topological features and solving the problem of contextual organization disorder caused by neglecting node relationships in traditional methods; through structural classifiers and template matching, it realizes dynamic selection of prompt word templates according to graph structure type, avoiding logical breaks caused by fixed templates; by integrating the priority ranking and reorganization of semantic relevance, temporal relevance and PageRank scores, it generates target logical flow, realizes optimized arrangement of node content, reduces information redundancy and conflict, and enhances the logical coherence of the context, thereby improving the reasoning ability of large language models for complex financial knowledge. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0036] Figure 1 This application discloses a flowchart of a financial problem analysis method based on a large language model.
[0037] Figure 2 This is a schematic diagram of a financial problem analysis process based on a large language model disclosed in this application;
[0038] Figure 3 This is a schematic diagram of the structure of a financial problem analysis device based on a large language model disclosed in this application;
[0039] Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0040] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0041] Traditional RAG (Relational Analysis) techniques suffer from the problem that when the external knowledge base is organized into a graph with rich relational structures, the LLM (Large Language Model) generated answers may exhibit disorganized context and logical breaks. To address this, this application provides a financial problem analysis method based on a large language model. By obtaining structural representation vectors through topological analysis, it resolves the issue of disorganized context in the generated results.
[0042] See Figure 1 As shown in the figure, this invention discloses a financial problem analysis method based on a large language model, including:
[0043] Step S11: Obtain the financial problem to be analyzed input by the target user, retrieve the target subgraph corresponding to the financial problem to be analyzed from the preset knowledge graph, and perform topological analysis on the target subgraph to obtain the corresponding structural representation vector; wherein, the structural representation vector represents the topological features of the target subgraph.
[0044] The financial problem analysis process in this embodiment is as follows: Figure 2As shown, the process includes: receiving natural language queries from users, retrieving relevant subgraphs from the knowledge graph, calculating the topological vectors of subgraph nodes and calculating global structural features; identifying semantic clusters and calculating the inter-cluster connection strength, generating structural representation vectors, matching corresponding templates to generate target prompt words, and finally generating answers using a large language model.
[0045] In this embodiment, after receiving a user query (i.e., a financial problem to be analyzed), the system first performs a deep subgraph retrieval through a graph database engine. The retrieval strategy adopts a dynamic weight adjustment mechanism: an initial candidate node set is calculated based on the cosine similarity between the query semantic vector and the graph node embedding, and then expanded to the k-hop neighborhood through a multi-hop traversal algorithm (such as a PageRank-based random walk).
[0046] The process of performing topological analysis on the target subgraph can specifically include: extracting global structural features of the target subgraph, identifying semantic clusters in the target subgraph using a target clustering algorithm, and calculating the connection strength between each semantic cluster; wherein, the global structural features include path length distribution, clustering coefficient, centrality index, and ring structure detection results; generating node vectors corresponding to each node in the target subgraph using a pre-set graph neural network, and obtaining structural representation vectors based on global structural features, node vectors, and connection strength between semantic clusters; wherein, the node vector is a feature vector representing the connection relationship and topological position of the corresponding node in the target subgraph.
[0047] Specifically, this embodiment introduces a structural feature extraction module, which performs topological analysis on the retrieved subgraphs to generate structural representation vectors. The specific implementation includes:
[0048] (1) Use graph neural networks (GNNs) such as GraphSAGE to encode features of the subgraph and output the topological embedding vector (i.e., node vector) of each node.
[0049] (2) Extract global structural features, including path length distribution, clustering coefficient, centrality index (such as degree centrality, betweenness centrality, eigenvector centrality) and ring structure detection results.
[0050] (3) Identify semantic clusters in the subgraph and calculate the inter-cluster connection strength by using clustering algorithms such as DBSCAN (Density-Based Spatial Clustering of Applications with Noise).
[0051] For example, if a subgraph contains a linear path of "central bank interest rate hike → increased borrowing costs → decreased corporate profits → stock market decline", then the structural characteristics of the subgraph can be represented as follows: path length is 4, clustering coefficient is N, and the centrality peak is located at a certain node.
[0052] By analyzing the subgraph, the system can intuitively understand the topological characteristics of the subgraph, thereby generating answers more accurately and coherently based on the subgraph's topological structure.
[0053] Step S12: Determine the graph structure type of the target subgraph using the structural representation vector, and determine the target prompt word template corresponding to the financial problem to be analyzed based on the graph structure type.
[0054] In this embodiment, the process of determining the graph structure type of the target subgraph using the structural representation vector may specifically include: determining the cosine similarity between the structural representation vector and the graph structure templates corresponding to each preset graph structure type; if the cosine similarity between any graph structure template and the structural representation vector is greater than the preset cosine similarity threshold, then the graph structure type of the target subgraph is determined to be the graph structure type corresponding to any graph structure template.
[0055] In other words, based on the structural representation vector generated in the preceding steps, the system activates a structural classifier to determine the type. The classifier is trained using a lightweight neural network (such as a multilayer perceptron), with the input being the structural feature vector and the output being five predefined structural labels: linear path structure, star structure, tree structure, ring structure, and dense cluster structure. The classification logic is designed with a dynamic threshold mechanism: when the cosine similarity between the feature vector and a certain type of template exceeds a certain threshold, it is determined to be of that structural type; if all similarities are below the threshold, the default template is returned. After classification, the system automatically matches the corresponding structured prompt template library. The template library adopts a hierarchical design: basic templates (such as "Please explain in the following order: {node 1} → {node 2} → … → {node N}") cover 90% of common scenarios, while the dynamic template generator (based on LLM fine-tuning) handles long-tail structures. For example, for a star schema (where the central node "Transformer" is associated with multiple components), the system matches the template "The core components of the central node include: ① {Node A}: {Description}; ② {Node B}: {Description}; ...". For a circular schema (such as "Policy A → Implementation B → Feedback C → Policy A"), it generates "Please analyze the following circular dependency chain: {Node A} → {Node B} → {Node C} → {Node A}".
[0056] By determining the graph structure of the target subgraph and matching the corresponding template according to the graph structure, the applicability of the template is ensured, thereby ensuring the reliability of the generated target prompts.
[0057] Step S13: Based on the semantic and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node, determine the priority of each node. Sort and reorganize each node according to the priority to obtain the corresponding target logic flow. Then, use the target logic flow to fill the target prompt word template to obtain the corresponding target prompt words.
[0058] In this embodiment, the process of determining the priority of each node based on the semantic relevance and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node, may specifically include: determining the semantic relevance based on the cosine similarity between each node and the target question vector corresponding to the financial problem to be analyzed, and determining the temporal relevance based on the timestamps of the associated events corresponding to each node; determining the centrality weight of each node based on the PageRank score, determining the query relevance weight of each node based on the semantic relevance, and determining the time decay weight of each node based on the temporal relevance; and determining the priority of each node based on the centrality weight, query relevance weight, and time decay weight.
[0059] Specifically, to optimize the input logic of LLM, the system executes a node sorting algorithm. This algorithm calculates node priority based on a weighted average of three dimensions:
[0060] (1) Centrality weight ( Based on PageRank scores, nodes with high centrality (such as "central bank interest rate hike" in the financial subgraph) have higher priority.
[0061] (2) Query relevance weight ( ): The cosine similarity between node embedding and query vector ensures that core information is presented first.
[0062] (3) Time decay weight ( ): The timestamp of the event associated with the node, with recent events (such as policies of the current year or month) having increased weight.
[0063] The sorting formula is: Priority = ×Centerality + × Similarity + × (1 / (1 + )),in The difference between the event and the current time (in days), and + + =1. For example, when searching for "the effect of a certain vaccine" in a medical subgraph, the "vaccine effectiveness data" node with the highest centrality is prioritized, followed by the "side effect report" node with high relevance, and the recent event "new data for the current month" has its weight further increased. After sorting, the system reorganizes the node content according to priority to form a logical flow. This step avoids the problem of random splicing of fragments in traditional RAGs, making the context present a natural reasoning path.
[0064] In addition, in this embodiment, the process of filling the target prompt word template with the target logic flow specifically includes: filling the node descriptions corresponding to each node in the target logic flow into the target prompt word template, performing semantic completion processing on each node description in the target prompt word template, and inserting logical transition words between adjacent node descriptions. Specifically:
[0065] (1) Template filling: Fill the sorted node content according to the template structure, such as replacing {node1} with "interest rate increase" and {node2} with "borrowing cost increase" in the linear path structure.
[0066] (2) Semantic completion: Lightweight expansion of node descriptions, using LLM fine-tuning models (such as LoRA-adapted BERT) to generate concise explanations (such as "increased borrowing costs" expanded to "increased borrowing costs lead to increased difficulty in corporate financing").
[0067] (3) Enhanced logical coherence: Inserting transition words (such as "therefore", "further") makes the path smoother.
[0068] Rewrite Example: The input subgraph path is "Policy A → Implementation B → Effect C", and the output prompt is "Please analyze according to the following logical chain: After Policy A is implemented, it leads to the execution of Implementation B, which in turn produces Effect C. Specifically, how does Policy A (such as interest rate adjustment) trigger Implementation B (such as tightening corporate loans), and how does Implementation B lead to Effect C (such as a slowdown in economic growth)?" This step ensures that the prompt not only contains facts but also explicitly constructs the reasoning chain.
[0069] In addition, in this embodiment, after filling the target prompt word template with the target logic flow, the method further includes: generating corresponding relation guidance instructions based on the graph structure type, and adding the relation guidance instructions to the target position of the target prompt word; wherein, the relation guidance instructions are used to guide the reasoning process of the preset large language model.
[0070] Specifically, to enhance the structure awareness capability of LLM, the system injects dynamically generated relational guidance instructions at the end of the prompt (i.e., the target position). Instruction generation is based on structure type and node sorting results:
[0071] (1) Linear path structure injection: "Please strictly follow the order of reasoning and do not skip intermediate links."
[0072] (2) Star structure injection: “Please introduce the associated components of the central node in order of importance from high to low”.
[0073] (3) Tree structure injection: "Please expand level by level to avoid confusing branches."
[0074] (4) Circular structure injection: “Please analyze the impact of circular dependencies on system stability.”
[0075] The instruction generator operates in a dual-mode architecture, combining a rule base and an LLM (Local Management Model). Simple structures invoke preset rules, while complex structures (such as hybrid structures) call a fine-tuned LLM to generate natural language instructions. For example, in a financial subgraph, if a circular structure of "Policy A → Market Response B → Policy A" is detected, the instruction would be: "Note: Policy A and Market Response B have a two-way feedback loop. Please analyze the impact of this loop mechanism on the long-term economy." This instruction guides the LLM to focus on the critical path and reduces irrelevant reasoning.
[0076] Furthermore, after populating the target prompt template using the target logic flow, it also includes:
[0077] The target prompt word is compressed using a context window based on a pre-defined large language model to obtain the corresponding compressed prompt word. Constraints are then added to the compressed prompt word to obtain the target prompt word.
[0078] In other words, the reconstructed prompts (containing structured content and relational guidance instructions) are input into the LLM. The system optimizes the generation quality through the following mechanisms:
[0079] (1) Prompt word length compression: Reduce redundancy through structured expression (such as compressing 5 independent sentences into 1 logical chain) to ensure that the input length is controlled within the LLM context window.
[0080] (2) Generate constraint injection: Add constraints such as "avoid using subjective expressions" and "answer only based on the provided chain of evidence" to the prompt words.
[0081] By adding constraints and relational guidance instructions to prompts, large language models can better understand user needs, thereby ensuring the reliability of the generated answers.
[0082] Step S14: Input the target prompt words into a preset large language model so that the preset large language model can generate the analysis results corresponding to the financial problem to be analyzed.
[0083] In this embodiment, after the large language model generates the answer, the system backtracks through the graph structure to verify whether the key nodes are referenced. If no high-weight nodes are referenced, regeneration is triggered.
[0084] In summary, this embodiment constructs an optimized end-to-end path from knowledge graph to LLM output by deeply integrating graph structure analysis, dynamic prompt word reconstruction, and relationship guidance mechanisms. It transforms the "implicit relationships" of the graph structure into "explicit guidance," enabling LLM to understand the logical connections between information rather than mechanically piecing together text.
[0085] Therefore, this application obtains structural representation vectors through topological analysis, realizing the perception of subgraph topological features and solving the problem of contextual organization disorder caused by neglecting node relationships in traditional methods; through structural classifiers and template matching, it realizes dynamic selection of prompt word templates according to graph structure type, avoiding logical breaks caused by fixed templates; by integrating the priority ranking and reorganization of semantic relevance, temporal relevance and PageRank scores, it generates target logical flow, realizes optimized arrangement of node content, reduces information redundancy and conflict, and enhances the logical coherence of the context, thereby improving the reasoning ability of large language models for complex financial knowledge.
[0086] See Figure 3 As shown in the figure, an embodiment of the present invention discloses a financial problem analysis device based on a large language model, comprising:
[0087] The structural representation vector acquisition module 11 is used to acquire the financial problem to be analyzed input by the target user, retrieve the target subgraph corresponding to the financial problem to be analyzed from the preset knowledge graph, and perform topological analysis on the target subgraph to obtain the corresponding structural representation vector; wherein, the structural representation vector represents the topological features of the target subgraph;
[0088] The prompt word template determination module 12 is used to determine the graph structure type of the target subgraph using the structural representation vector, and to determine the target prompt word template corresponding to the financial problem to be analyzed based on the graph structure type;
[0089] The target prompt word acquisition module 13 is used to determine the priority of each node based on the semantic relevance and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node, sort and reorganize each node according to the priority to obtain the corresponding target logic flow, and use the target logic flow to fill the target prompt word template to obtain the corresponding target prompt words.
[0090] The prompt word input module 14 is used to input the target prompt word into a preset large language model so that the preset large language model can generate the analysis result corresponding to the financial problem to be analyzed.
[0091] In some specific embodiments, the structural representation vector acquisition module 11 may specifically include:
[0092] The structural feature extraction unit is used to extract the global structural features of the target subgraph, identify semantic clusters in the target subgraph using a target clustering algorithm, and calculate the connection strength between each semantic cluster; wherein, the global structural features include path length distribution, clustering coefficient, centrality index, and ring structure detection results;
[0093] The structural representation vector acquisition unit is used to generate node vectors corresponding to each node in the target subgraph using a preset graph neural network, and to acquire the structural representation vector based on the global structural features, each node vector, and the connection strength between each semantic cluster; wherein, the node vector is a feature vector representing the connection relationship and topological position of the corresponding node in the target subgraph.
[0094] In some specific embodiments, the prompt word template determination module 12 may specifically include:
[0095] The graph structure type determination unit is used to determine the cosine similarity between the structure representation vector and the graph structure templates corresponding to each preset graph structure type. If the cosine similarity between any graph structure template and the structure representation vector is greater than the preset cosine similarity threshold, then the graph structure type of the target subgraph is determined to be the graph structure type corresponding to any graph structure template.
[0096] In some specific embodiments, the target prompt word acquisition module 13 may specifically include:
[0097] The time relevance determination unit is used to determine the semantic relevance based on the cosine similarity between each node and the target question vector corresponding to the financial problem to be analyzed, and to determine the time relevance based on the timestamp of the associated event corresponding to each node.
[0098] The time decay weight determination unit is used to determine the centrality weight corresponding to each node based on the PageRank score, determine the query relevance weight corresponding to each node based on the semantic relevance, and determine the time decay weight corresponding to each node based on the time relevance.
[0099] The priority determination unit is used to determine the priority of each node according to the centrality weight, the query relevance weight and the time decay weight.
[0100] In some specific embodiments, the target prompt word acquisition module 13 may specifically include:
[0101] The transition word insertion unit is used to fill the node descriptions corresponding to each node in the target logic flow into the target prompt word template, perform semantic completion processing on each node description in the target prompt word template, and insert logical transition words between adjacent node descriptions.
[0102] In some specific embodiments, the target prompt word acquisition module 13 further includes:
[0103] The guidance instruction adding unit is used to generate corresponding relationship guidance instructions based on the graph structure type, and add the relationship guidance instructions to the target position of the target prompt word; wherein, the relationship guidance instructions are used to guide the reasoning process of the preset large language model.
[0104] In some specific embodiments, the target prompt word acquisition module 13 further includes:
[0105] The constraint addition unit is used to compress the target prompt word based on the context window of the preset large language model to obtain the corresponding compressed prompt word, and add constraint conditions to the compressed prompt word to obtain the target prompt word.
[0106] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0107] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the financial problem analysis method based on a large language model disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0108] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0109] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0110] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the financial problem analysis method based on a large language model executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0111] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed method for analyzing financial problems based on a large language model. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0112] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0113] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0114] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0115] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0116] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A financial problem analysis method based on a large language model, characterized in that, include: The system obtains a financial question to be analyzed input by a target user, retrieves the target subgraph corresponding to the financial question from a preset knowledge graph, and performs topological analysis on the target subgraph to obtain the corresponding structural representation vector; wherein the structural representation vector represents the topological features of the target subgraph. The graph structure type of the target subgraph is determined using the structural representation vector, and the target prompt word template corresponding to the financial problem to be analyzed is determined based on the graph structure type. Based on the semantic and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node, the priority of each node is determined. The nodes are sorted and reorganized according to their priorities to obtain the corresponding target logic flow. The target logic flow is then used to fill the target prompt word template to obtain the corresponding target prompt words. The target prompt words are input into a preset large language model so that the preset large language model can generate the analysis results corresponding to the financial problem to be analyzed. The topological analysis of the target subgraph to obtain the corresponding structural representation vector includes: The global structural features of the target subgraph are extracted, the semantic clusters in the target subgraph are identified using a target clustering algorithm, and the connection strength between each semantic cluster is calculated; wherein, the global structural features include path length distribution, clustering coefficient, centrality index, and ring structure detection results; A preset graph neural network is used to generate node vectors corresponding to each node in the target subgraph, and the structural representation vector is obtained based on the global structural features, each node vector, and the connection strength between each semantic cluster; wherein, the node vector is a feature vector representing the connection relationship and topological position of the corresponding node in the target subgraph; The step of retrieving the target subgraph corresponding to the financial problem to be analyzed from the preset knowledge graph includes: An initial candidate node set is determined based on the cosine similarity between the query semantic vector of the financial problem to be analyzed and the graph node embeddings in the preset knowledge graph. The initial candidate node set is then expanded to the k-hop neighborhood using a multi-hop traversal algorithm to obtain the target subgraph corresponding to the financial problem to be analyzed.
2. The financial problem analysis method based on a large language model according to claim 1, characterized in that, The step of determining the graph structure type of the target subgraph using the structural representation vector includes: Determine the cosine similarity between the structural representation vector and the graph structure templates corresponding to each preset graph structure type. If the cosine similarity between any graph structure template and the structural representation vector is greater than the preset cosine similarity threshold, then the graph structure type of the target subgraph is determined as the graph structure type corresponding to any graph structure template.
3. The financial problem analysis method based on a large language model according to claim 1, characterized in that, The process of determining the priority of each node based on the semantic and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node, includes: The semantic relevance is determined based on the cosine similarity between each node and the target question vector corresponding to the financial problem to be analyzed, and the temporal relevance is determined based on the timestamps of the associated events corresponding to each node. The centrality weight of each node is determined based on the PageRank score, the query relevance weight of each node is determined based on the semantic relevance, and the time decay weight of each node is determined based on the temporal relevance. The priority of each node is determined based on the centrality weight, the query relevance weight, and the time decay weight.
4. The financial problem analysis method based on a large language model according to claim 1, characterized in that, The step of filling the target prompt word template with the target logic flow includes: The node descriptions corresponding to each node in the target logic flow are filled into the target prompt word template. Semantic completion processing is performed on each node description in the target prompt word template, and logical transition words are inserted between adjacent node descriptions.
5. The financial problem analysis method based on a large language model according to claim 1, characterized in that, After filling the target prompt word template with the target logic flow, the method further includes: Based on the graph structure type, a corresponding relation guidance instruction is generated, and the relation guidance instruction is added to the target position of the target prompt word; wherein, the relation guidance instruction is used to guide the reasoning process of the preset large language model.
6. The financial problem analysis method based on a large language model according to claim 1, characterized in that, After filling the target prompt word template with the target logic flow, the method further includes: The target prompt word is compressed based on the context window of the preset large language model to obtain the corresponding compressed prompt word, and constraints are added to the compressed prompt word to obtain the target prompt word.
7. A financial problem analysis device based on a large language model, characterized in that, include: The structural representation vector acquisition module is used to acquire the financial problem to be analyzed input by the target user, retrieve the target subgraph corresponding to the financial problem to be analyzed from the preset knowledge graph, and perform topological analysis on the target subgraph to obtain the corresponding structural representation vector; wherein, the structural representation vector represents the topological features of the target subgraph; The prompt word template determination module is used to determine the graph structure type of the target subgraph using the structural representation vector, and to determine the target prompt word template corresponding to the financial problem to be analyzed based on the graph structure type; The target prompt word acquisition module is used to determine the priority of each node based on the semantic relevance and temporal relevance between each node in the target subgraph and the financial problem to be analyzed, as well as the PageRank score of each node; sort and reorganize each node according to the priority to obtain the corresponding target logic flow; and use the target logic flow to fill the target prompt word template to obtain the corresponding target prompt words. The prompt word input module is used to input the target prompt word into a preset large language model so that the preset large language model can generate the analysis result corresponding to the financial problem to be analyzed. The structural representation vector acquisition module includes: The structural feature extraction unit is used to extract the global structural features of the target subgraph, identify semantic clusters in the target subgraph using a target clustering algorithm, and calculate the connection strength between each semantic cluster; wherein, the global structural features include path length distribution, clustering coefficient, centrality index, and ring structure detection results; The structural representation vector acquisition unit is used to generate node vectors corresponding to each node in the target subgraph using a preset graph neural network, and to acquire the structural representation vector based on the global structural features, each node vector, and the connection strength between each semantic cluster; wherein, the node vector is a feature vector representing the connection relationship and topological position of the corresponding node in the target subgraph; The structural representation vector acquisition module is specifically used for: An initial candidate node set is determined based on the cosine similarity between the query semantic vector of the financial problem to be analyzed and the graph node embeddings in the preset knowledge graph. The initial candidate node set is then expanded to the k-hop neighborhood using a multi-hop traversal algorithm to obtain the target subgraph corresponding to the financial problem to be analyzed.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the financial problem analysis method based on a large language model as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Used to store computer programs, which, when executed by a processor, implement the financial problem analysis method based on a large language model as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Social network friend recommendation method based on heterogeneous graph neural network clustering
CN118939884A
Knowledge graph construction and product recommendation method and system based on user data
CN120338924A
Question and answer method based on large language model, electronic equipment, medium and product
CN120873122A