Financial question and answer retrieval enhancement generation method and system based on hypergraph

Through the enhanced generation method of financial question-and-answer search based on hypergraphs, the knowledge graph is constructed and sub-graph search is carried out, and the problem of text association and topological structure being ignored in the existing technology is solved, and the accuracy and reliability of answers to complex financial problems are improved.

CN119294526APending Publication Date: 2025-01-10ZHEJIANG UNIV +1
View PDF 0 Cites 15 Cited by

Patent Information

Application Number
CN202411515271.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The prior art ignores the association between texts and topological structures within text when dealing with complex financial problems, resulting in low retrieval accuracy and inability to effectively represent text overviews at different levels.

Method used

Using the financial question-and-answer search and enhance generation method based on hypergraphs, the documents pre-stored in the corpus are processed in blocks, entity relationship extraction, community cluster detection, and constructed hypergraphs and knowledge graphs, and the abstract is generated using a large language model. By searching nodes and hyperedges on the knowledge graph, a subgraph that is most suitable for generating answers is constructed, and the subgraph is finally converted into text form and combined with the user's query to input a large language model to generate the answer.

Benefits of technology

Improve the reliability of the answer, retain the topological structure of the source text content, provide multi-dimensional context selection, reduce the hallucination phenomenon of large language models, and enhance the accuracy of retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294526A_ABST
    Figure CN119294526A_ABST
Patent Text Reader

Abstract

The invention discloses a hypergraph-based financial question and answer retrieval enhancement generation method and system, and the generation method comprises the steps: carrying out the blocking processing of a document stored in a corpus in advance, and obtaining text blocks; performing entity relationship extraction on the text blocks to obtain nodes and edges, and obtaining a node set and an edge set according to the nodes and the edges; constructing a hypergraph through a community clustering detection algorithm based on the node set and the edge set, and generating a corresponding abstract by using a large language model; constructing a knowledge graph according to the text block, the node set, the edge set, the hypergraph and the abstract; and performing node and hyperedge retrieval on the constructed knowledge graph to generate a final answer. According to the method, a retrieval enhancement generation method is used for answering complex financial questions, the illusion phenomenon of a large language model is reduced, and the answering reliability is improved; retaining a topological structure of the source text content; the hyperedge has abstract representation on the knowledge graph at different levels, and provides multi-dimensional selection for the context of the large language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent question answering technology, and more specifically to a hypergraph-based financial question answering retrieval enhancement generation method and system. Background Art

[0002] Complex financial problems often require multi-hop reasoning to get accurate answers. Most existing search enhancement generation technologies directly splice the retrieved text blocks into a large language model, ignoring the associations between texts and the topological structure within the text. Some existing knowledge graph-based search enhancement generation technologies use standard isomorphic graphs to construct, which have a relatively simple structure and cannot represent text overviews at different levels. At the same time, the existing subgraph retrieval method cannot accurately find relevant text, and there are cases where relevant text is filtered or irrelevant text is included. Summary of the invention

[0003] In this embodiment, a hypergraph-based financial question-answer retrieval enhancement generation method, system, electronic device and storage medium are provided to solve the problem that the related technology ignores the association between texts and the topological structure within the text, and the retrieval accuracy is not high.

[0004] In a first aspect, an embodiment of the present invention provides a hypergraph-based financial question-answer retrieval enhancement generation method, the generation method comprising: The documents pre-stored in the corpus are processed into blocks to obtain text blocks; Extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Based on the node set and the edge set, a hypergraph is constructed by using a community clustering detection algorithm, and a corresponding summary is generated by using a large language model; Build a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; By retrieving nodes and hyperedges on the constructed knowledge graph, a subgraph that is most suitable for generating answers is constructed; The retrieved subgraph is converted into text form and combined with the user's query into a large language model to generate the final answer.

[0005] In an optional embodiment, the document pre-stored in the corpus is processed into blocks to obtain text blocks including: Using a variable granularity strategy to process the documents in the corpus into blocks to obtain text blocks; Overlap is set between adjacent text blocks.

[0006] In an optional embodiment, constructing a hypergraph based on the node set and the edge set by using a community clustering detection algorithm includes: An initial graph is formed by the node set and the edge set; Use the Leiden algorithm to detect communities, obtain community information in the graph, and divide larger communities into several small communities; All nodes in the same community are connected through a hyperedge, so that communities at different levels are connected through hyperedges to form a hypergraph structure; Use the incidence matrix to store the hypergraph.

[0007] In an optional embodiment, generating a summary using a large language model includes: Use a specific prompt word template to guide the large language model to generate summaries; Store the generated summaries in the summaries collection.

[0008] In an optional embodiment, by searching nodes and hyperedges on the constructed knowledge graph, constructing a subgraph that is most suitable for generating answers includes: Use the pre-trained text embedding model to generate embedding representations of all nodes and edges for the hypergraph, and store the embedding representations in the collection and collection middle; Generate an embedding representation of a given query question through a text embedding model; Calculate the cosine similarity between the embedding representation of the given query question and the embedding representation of the nodes and edges to obtain the similarity value; According to the similarity value The node and edge embedding representation forms a set and collection ; From the set using the PCST algorithm and collection Construct an optimal subgraph in .

[0009] In an optional embodiment, the PCST algorithm is used to extract the and collection Construct an optimal subgraph in, including: A hyperedge is represented by a virtual node, and the common nodes between hyperedges are used as the edges between virtual nodes; A connected subgraph is obtained through an optimization algorithm, and an optimal subgraph is obtained through retrieval, and the optimal subgraph is used to generate a final answer.

[0010] In an optional embodiment, the retrieved subgraph is converted into text form and combined with the user's query and input into a large language model to generate a final answer, including: Convert the optimal subgraph into text form and concatenate it with the user query, encode the concatenation result through the text encoder, and generate a vector representation of the hard prompt; The hypergraph representation is converted into static and dynamic embedding vectors through a hypergraph neural network, and the Euclidean distance between the static and dynamic embedding vectors is calculated to generate the final embedding; The final embedding is projected to the same dimension as the hidden layer of the large language model through average pooling and an MLP to generate soft hints; The hard prompt and the soft prompt are concatenated and input into the self-attention layer of the large language model to generate the final answer.

[0011] Compared with the prior art, the hypergraph-based financial question-answer retrieval enhancement generation method of the present invention has the following beneficial effects: The present invention uses a retrieval enhancement generation method to answer complex financial questions, reduces the hallucination phenomenon of the large language model, and improves the reliability of the answer; the retrieval enhancement generation method of the present invention is based on the knowledge graph and retains the topological structure of the source text content; the present invention adopts a hypergraph structural representation, and the hyperedges have summary representations of the knowledge graph at different levels, providing multi-dimensional selection for the context of the large language model.

[0012] In a second aspect, an embodiment of the present invention proposes a hypergraph-based financial question-answer retrieval enhancement generation system, comprising: The knowledge graph construction module is used to process the documents pre-stored in the corpus into blocks to obtain text blocks; Extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Based on the node set and the edge set, a hypergraph is constructed by using a community clustering detection algorithm, and a corresponding summary is generated by using a large language model; Build a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; The subgraph retrieval module is used to construct the most suitable subgraph for generating answers by searching nodes and hyperedges on the constructed knowledge graph; The answer generation module is used to convert the retrieved subgraph into text form and combine it with the user's query and input it into the large language model to generate the final answer.

[0013] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a communication interface, a memory and a bus, wherein the processor, the communication interface and the memory communicate with each other through the bus, and the processor can call logic instructions in the memory to execute the steps of the method provided in the first aspect.

[0014] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the hypergraph-based financial question and answer retrieval enhancement generation method as described in the first aspect.

[0015] Compared with the prior art, the beneficial effects of the hypergraph-based financial question and answer retrieval enhancement generation system, electronic device and storage medium of the present invention are the same as the hypergraph-based financial question and answer retrieval enhancement generation method described in the first aspect, so they will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 It is a flowchart of a hypergraph-based financial question-answer retrieval enhancement generation method in an embodiment of the present invention; Figure 2 It is a principle diagram of a hypergraph-based financial question-answer retrieval enhancement generation method in an embodiment of the present invention; Figure 3 It is a structural block diagram of a hypergraph-based financial question-answer retrieval enhancement generation system in an embodiment of the present invention; Figure 4 1 is a structural block diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0019] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with general skills in the technical field to which this application belongs. The words "one", "a", "the", "these" and the like in this application do not indicate a quantitative limitation, and they may be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone. Generally, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0020] In an embodiment of the present invention, a hypergraph-based financial question-answer retrieval enhancement generation method is provided. Figure 1 is a flowchart of the hypergraph-based financial question-answer retrieval enhancement generation method of the present invention, such as Figure 1 As shown, the process includes the following steps: S11, dividing the documents pre-stored in the corpus into blocks to obtain text blocks; It should be noted that the documents pre-stored in the corpus are processed into blocks, and the resulting text blocks include: A variable granularity strategy is adopted to process the documents in the corpus in blocks to obtain text blocks; specifically, due to the limited processing capability of the large language model (LLM) for long texts, in the general framework of retrieval enhancement generation, the long documents in the corpus are cut into independent blocks. Furthermore, the present invention adopts a variable granularity strategy, using segmentation granularities of different block sizes, and the number of entities recognized and extracted is different. The number of extracted entities under segmentation of different block sizes is compared, and the block size that can extract the largest number of entities is adopted as the segmentation granularity. In general, 600 tokens (to topken) is a suitable block size.

[0021] Overlap is set between adjacent text blocks. In order to ensure that the semantic context is not lost between blocks and the integrity of the relationship between entities, some overlap is maintained between blocks. In the present invention, this overlap is set to one tenth of the block size.

[0022] S12, extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Specifically, the large language model (LLM) is used to extract nodes and edges from the segmented text blocks. First, entities are extracted as node sets according to entity types (entity_types). . Relations are then extracted from the interactions of these entities as a set of edges The entity list and relationship list formatted by LLM are parsed into nodes and edges for the next step of hypergraph construction.

[0023] For example, the prompt word template is as follows: Given a text document and a set of entity types, your task is to identify all entities of these types from the text and all relations between the identified entities. Follow these steps to complete the task: 1. Identify all entities. For each identified entity, extract the entity in the format of "(entity name, entity type, entity description)". The entity type is selected in {{ entity_types}}, and the entity description is a comprehensive description of the entity's attributes and activities.

[0024] 2. Identify all relationships between entities. From the entities identified in the first step, find all pairs of entities that are clearly related to each other, denoted as (source entity, target entity). The format for extracting relationships is "(source entity, target entity, relationship description, relationship strength)". The relationship description is an explanation of the relationship between the two entities; the relationship strength is an integer between 1 and 10 (inclusive), representing the degree of correlation between the two entities.

[0025] 3. Output all entities and relationships using line breaks as separators.

[0026] S13, constructing a hypergraph based on the node set and the edge set by using a community clustering detection algorithm, and generating a corresponding summary by using a large language model; Constructing a hypergraph based on the node set and the edge set by using a community clustering detection algorithm, including: An initial graph is formed by the node set and the edge set; Use the Leiden algorithm to detect communities, obtain community information in the graph, and divide larger communities into several small communities; All nodes in the same community are connected through a hyperedge, so that communities at different levels are connected through hyperedges to form a hypergraph structure; The hypergraph is stored using an incidence matrix, where each entry represents the connection between a hyperedge and a node.

[0027] Specifically, the present invention uses a hypergraph structure to store knowledge graphs. A hyperedge connects two or more nodes and can represent multivariate relationships between multiple nodes. and edge set , forming the initial graph In this embodiment, the Leiden algorithm is used as the clustering algorithm for community detection. All nodes in the community detected in the algorithm are connected by a hyperedge. Furthermore, the Leiden algorithm has a refinement step in the process of detecting communities, which further divides the large community into smaller subcommunities. The present invention connects all communities of different levels with hyperedges to ensure the diversity of hyperedge scales. Suppose the number of nodes extracted is , the number of hyperedges is , so we get a hypergraph .in, ; ; The present invention uses the correlation matrix Store a hypergraph where ; First, construct an all-zero matrix To store the hypergraph. The communities of all levels divided by the Leiden algorithm are expressed as the set of nodes in the community. For example, let communities, then the generated communities It can be expressed as ,in Next, use right Assignment: .

[0028] Furthermore, when the graph is large, the hyperedges formed by higher-level communities contain a large number of nodes. In this embodiment, the hyperedge information is expressed by using LLM to generate summaries. Using a summary set To save the summary information of each hyperedge.

[0029] Specifically, using a large language model to generate summaries includes: Use a specific prompt word template to guide the large language model to generate summaries; Store the generated summaries in the summaries collection.

[0030] For example, traverse the hyperedge set For all the hyperedges in , use the following template to generate text information for them: Your task is to generate a comprehensive summary of the given data. Given a set of entities, and a set of their descriptions and descriptions of their associations. Connect all the descriptions into a single concise description, making sure to include information gleaned from all the descriptions. If the descriptions provided are contradictory, resolve the contradictions and provide a single, coherent summary. Make sure it is written in the third person and includes the entity names. Enrich it with as much relevant information from nearby text as possible. If there is no answer, or the description is empty, convey only the information provided in the text.

[0031] S14, constructing a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; The steps of knowledge graph construction include source text segmentation, entity and relationship extraction, hypergraph construction, and summary generation. The knowledge graph is constructed based on text blocks, node sets, edge sets, hypergraphs, and summaries. Through this process, a knowledge graph is finally formed that not only retains the topological structure of the source text content, but also can efficiently retrieve and use relevant information. This hypergraph-based knowledge graph provides a solid foundation for retrieval enhancement generation methods, which helps to improve the accuracy and reliability of answering complex financial questions.

[0032] S15. By searching nodes and hyperedges on the constructed knowledge graph, a subgraph most suitable for generating answers is constructed; By retrieving nodes and hyperedges on the constructed knowledge graph, the subgraph that is most suitable for generating answers is constructed, including: Use the pre-trained text embedding model to generate embedding representations of all nodes and edges for the hypergraph, and store the embedding representations in the collection and collection middle; Generate an embedding representation of a given query question through a text embedding model; Calculate the cosine similarity between the embedding representation of the given query question and the embedding representation of the nodes and edges to obtain the similarity value; According to the similarity value The node and edge embedding representation forms a set and collection ; From the set using the PCST algorithm and collection Construct an optimal subgraph in .

[0033] From the set using the PCST algorithm and collection Construct an optimal subgraph in, including: A hyperedge is represented by a virtual node, and the common nodes between hyperedges are used as the edges between virtual nodes; A connected subgraph is obtained through an optimization algorithm, and an optimal subgraph is obtained through retrieval, and the optimal subgraph is used to generate a final answer.

[0034] Specifically, node and hyperedge retrieval is performed on the hypergraph to construct the subgraph that is most suitable for generating answers.

[0035] First, we use a pre-trained text embedding language model on the hypergraph Generate embeddings for all nodes and edges and store them in sets and collection In this example, the bge-large-zh-v1.5 model, which has a leading performance in Chinese search tasks, is used as . Let the total set of hyperedges of all levels be , ; ; Next, for a given query ,use generate and calculate its embedding with and Embedded dependencies and , find the front The set of most relevant nodes and edges and their similarities and .

[0036] Furthermore, the present invention uses cosine similarity to measure the correlation between embeddings; ; ; ; ; Use the improved Prize-Collecting Steiner Tree (PCST) algorithm to extract rewards from the collection and collection The nodes and hyperedges in the graph construct a subgraph with the maximum reward value minus the total cost. In this embodiment, a hyperedge is represented by a virtual node, and the common nodes between the hyperedges are refined and summarized as the edges between the virtual nodes. The reward value of the improved PCST in this embodiment is determined by the correlation coefficient between the node and the hyperedge, and the total cost is determined by the number of hyperedges and the corresponding pre-set edge cost. Multiply them together to get. The set of all connected subgraphs of is , the optimal subgraph retrieved is , subgraph The reward value is , the total cost is ; ; in, and They are functions for calculating node and hyperedge reward values, respectively. This function ensures that when the correlation is 0, the reward value is 0 and the correlation reaches the threshold When the reward value reaches .

[0037] ; ; in, , .

[0038] In this embodiment, Set to 5, and can be adjusted according to the scale of the graph and the answer requirements; The default value is set to 3; The default value is set to 0.8; The default value of is set to 0.5. It should be noted that it can be changed appropriately according to the scale of the graph to control the size of the constructed subgraph.

[0039] S16: Convert the retrieved subgraph into text form and combine it with the user's query and input it into the large language model to generate the final answer.

[0040] Specifically, the retrieved subgraph is converted into text form and combined with the user's query to input into the large language model to generate the final answer including: Convert the optimal subgraph into text form and concatenate it with the user query, encode the concatenation result through the text encoder, and generate a vector representation of the hard prompt; The hypergraph representation is converted into static and dynamic embedding vectors through a hypergraph neural network, and the Euclidean distance between the static and dynamic embedding vectors is calculated to generate the final embedding; The final embedding is projected to the same dimension as the hidden layer of the LLM through average pooling and an MLP to generate soft hints; The hard prompt and the soft prompt are concatenated and input into the self-attention layer of LLM to generate the final answer.

[0041] In the answer generation stage, the present invention uses a prompt word fine-tuning method, and a hard prompt is combined with a soft prompt to input the LLM to obtain a response, and the parameters of the LLM are frozen.

[0042] First, the retrieved hypergraph subgraph Express it in text form and compare it with the query Concatenation. Then use the text encoder to encode the concatenated result and generate a vector representation of the hard prompt .

[0043] ; In this embodiment, a layer of hypergraph neural network is used , the hypergraph representation is converted into static and dynamic embedding vectors, and the final embedding is generated by calculating the pseudo-Euclidean distance between the two. Then, average pooling and a multi-layer perceptron (MLP) are used to project the embedding dimension to the same dimension as the hidden layer of the LLM to generate soft hints .

[0044] ; Finally, the generated hard prompts and soft prompts are concatenated and input into the self-attention layer of LLM. , Optimize the parameters to generate the answer ,Answer as follows: .

[0045] The embodiment of the present invention also provides a hypergraph-based financial question-answer retrieval enhancement generation system, which is used to implement the above method embodiment, which has been described and will not be repeated. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware or a combination of software and hardware is also possible and conceivable.

[0046] like Figure 3 As shown, Figure 3 It is a structural block diagram of the hypergraph-based financial question-answer retrieval enhancement generation system of the present invention, which includes: The knowledge graph construction module 101 is used to process the documents pre-stored in the corpus into blocks to obtain text blocks; Extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Based on the node set and the edge set, a hypergraph is constructed by using a community clustering detection algorithm, and a corresponding summary is generated by using a large language model; Build a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; A subgraph retrieval module 102 is used to construct a subgraph that is most suitable for generating an answer by searching nodes and hyperedges on the constructed knowledge graph; The answer generation module 103 is used to convert the retrieved subgraph into text form and combine it with the user's query and input it into the large language model to generate the final answer.

[0047] Figure 4 A structural block diagram of an electronic device provided by an embodiment of the present invention, such as Figure 4 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the following method: The documents pre-stored in the corpus are processed into blocks to obtain text blocks; Extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Based on the node set and the edge set, a hypergraph is constructed by using a community clustering detection algorithm, and a corresponding summary is generated by using a large language model; Build a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; By retrieving nodes and hyperedges on the constructed knowledge graph, a subgraph that is most suitable for generating answers is constructed; The retrieved subgraph is converted into text form and combined with the user's query into a large language model to generate the final answer.

[0048] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0049] An embodiment of the present invention further provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method provided in each of the above embodiments is implemented, for example, including: The documents pre-stored in the corpus are processed into blocks to obtain text blocks; Extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Based on the node set and the edge set, a hypergraph is constructed by using a community clustering detection algorithm, and a corresponding summary is generated by using a large language model; Build a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; By retrieving nodes and hyperedges on the constructed knowledge graph, a subgraph that is most suitable for generating answers is constructed; The retrieved subgraph is converted into text form and combined with the user's query into a large language model to generate the final answer.

[0050] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0051] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A hypergraph-based financial question-answer retrieval enhancement generation method, characterized in that: The generation method comprises: The documents pre-stored in the corpus are processed into blocks to obtain text blocks; Extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Based on the node set and the edge set, a hypergraph is constructed by using a community clustering detection algorithm, and a corresponding summary is generated by using a large language model; Build a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; By retrieving nodes and hyperedges on the constructed knowledge graph, a subgraph that is most suitable for generating answers is constructed; The retrieved subgraph is converted into text form and combined with the user's query into a large language model to generate the final answer.

2. The hypergraph-based financial question-answer retrieval enhancement generation method according to claim 1, characterized in that: The documents pre-stored in the corpus are processed into blocks, and the resulting text blocks include: Using a variable granularity strategy to process the documents in the corpus into blocks to obtain text blocks; Overlap is set between adjacent text blocks.

3. The hypergraph-based financial question-answer retrieval enhancement generation method according to claim 1, characterized in that: Constructing a hypergraph based on the node set and the edge set by using a community clustering detection algorithm, including: An initial graph is formed by the node set and the edge set; Use the Leiden algorithm to detect communities, obtain community information in the graph, and divide larger communities into several small communities; All nodes in the same community are connected through a hyperedge, so that communities at different levels are connected through hyperedges to form a hypergraph structure; Use the incidence matrix to store the hypergraph.

4. The hypergraph-based financial question-answer retrieval enhancement generation method according to claim 1, characterized in that: Summarization using large language models includes: Use a specific prompt word template to guide the large language model to generate summaries; Store the generated summaries in the summaries collection.

5. The hypergraph-based financial question-answer retrieval enhancement generation method according to claim 1, characterized in that: By retrieving nodes and hyperedges on the constructed knowledge graph, the subgraph that is most suitable for generating answers is constructed, including: Use the pre-trained text embedding model to generate embedding representations of all nodes and edges for the hypergraph, and store the embedding representations in the collection and collection middle; Generate an embedding representation of a given query question through a text embedding model; Calculate the cosine similarity between the embedding representation of the given query question and the embedding representation of the nodes and edges to obtain the similarity value; According to the similarity value The node and edge embedding representation forms a set and collection ; From the set using the PCST algorithm and collection Construct an optimal subgraph in .

6. The hypergraph-based financial question-answer retrieval enhancement generation method according to claim 5, characterized in that: From the set using the PCST algorithm and collection Construct an optimal subgraph in, including: A hyperedge is represented by a virtual node, and the common nodes between hyperedges are used as the edges between virtual nodes; A connected subgraph is obtained through an optimization algorithm, and an optimal subgraph is obtained through retrieval, and the optimal subgraph is used to generate a final answer.

7. The hypergraph-based financial question-answer retrieval enhancement generation method according to claim 6, characterized in that: The retrieved subgraph is converted into text form and combined with the user's query to input into the large language model to generate the final answer including: Convert the optimal subgraph into text form and concatenate it with the user query, encode the concatenation result through the text encoder, and generate a vector representation of the hard prompt; The hypergraph representation is converted into static and dynamic embedding vectors through a hypergraph neural network, and the Euclidean distance between the static and dynamic embedding vectors is calculated to generate the final embedding; The final embedding is projected to the same dimension as the hidden layer of the large language model through average pooling and an MLP to generate soft hints; The hard prompt and the soft prompt are concatenated and input into the self-attention layer of the large language model to generate the final answer.

8. A hypergraph-based financial question-answering retrieval enhancement generation system, characterized in that: include: The knowledge graph construction module is used to process the documents pre-stored in the corpus into blocks to obtain text blocks; Extracting entity relationships from the text block to obtain nodes and edges, and obtaining a node set and an edge set based on the nodes and the edges; Based on the node set and the edge set, a hypergraph is constructed by using a community clustering detection algorithm, and a corresponding summary is generated by using a large language model; Build a knowledge graph based on text blocks, node sets, edge sets, hypergraphs, and summaries; The subgraph retrieval module is used to construct the most suitable subgraph for generating answers by searching nodes and hyperedges on the constructed knowledge graph; The answer generation module is used to convert the retrieved subgraph into text form and combine it with the user's query and input it into the large language model to generate the final answer.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the hypergraph-based financial question and answer retrieval enhancement generation method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the hypergraph-based financial question-answer retrieval enhancement generation method as described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Stereo garage fault analysis system and method based on large language model

    CN120011425A

  • A stereo garage fault analysis system and method based on a large language model

    CN120011425B

  • Document question and answer method and device based on hypergraph

    CN120030103A

  • A hypergraph-based document question answering method and device

    CN120030103B

  • Retrieval enhancement generation method and system based on structured document

    CN120067340A