Regulation association question-answering method and system based on retrieval enhancement, electronic equipment and storage medium

By segmenting, entity extraction and triple generation of source text of financial regulations, building a search tree and using clustering and summary technology, the problem of low answer accuracy in the existing technology is solved, and the performance and user experience of the question-and-answer system are improved.

CN119646147APending Publication Date: 2025-03-18ZHEJIANG BANGSUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411690841.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In the prior art, the ability to express questions and utilize large-scale discourse structures is limited, resulting in a low accuracy of the answers obtained, resulting in a poor user experience.

Method used

By obtaining the source text of the financial regulations, dividing it into multiple financial regulations text blocks, identifying and extracting entities and their information, generating triples, building a search tree, using clustering and summary techniques to enhance search capabilities, and generating more accurate answers.

Benefits of technology

It improves the efficiency of building an associated knowledge base, enhances the parameterized knowledge of large language models, and improves the performance of long text Q&A, thereby improving the accuracy and user experience of question answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646147A_ABST
    Figure CN119646147A_ABST
Patent Text Reader

Abstract

The invention provides a retrieval enhancement-based regulation association question-answering method and system, electronic equipment and a storage medium. The method comprises the following steps of: segmenting a financial regulation source text into a plurality of financial regulation text blocks; identifying and extracting a plurality of entities and entity information thereof from the financial regulation text block, and generating a plurality of triads according to each entity and the entity information thereof; generating financial regulation abstracts of the financial regulation text blocks according to the triples of the financial regulation text blocks; clustering each financial regulation text block to obtain a plurality of continuous clusters and summary information thereof, and constructing a search tree by utilizing the summary information of each cluster and the financial regulation abstract of each financial regulation text block; carrying out embedded coding on the retrieval problem to obtain a retrieval problem vector; traversing the search tree according to the retrieval problem vector, and querying global context information corresponding to the retrieval problem; and combining the retrieval questions and the global context information thereof to obtain a retrieval question combination, and generating question answers according to the retrieval question combination by utilizing a large language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of related questions and answers, and more specifically, to a method, system, electronic device and storage medium for related questions and answers of regulations based on retrieval enhancement. Background Art

[0002] With the advancement of computer science and artificial intelligence technology, intelligent response systems have gradually evolved from simple question-answering systems to intelligent systems capable of conducting complex conversations; through these intelligent systems, corresponding answers are output based on the input questions.

[0003] In the prior art, a question statement and an operation knowledge base can be obtained, wherein the operation knowledge base contains several question-answer knowledge pairs; the question statement is compared with the question-answer knowledge pairs in the operation knowledge base; if the comparison between the question statement and the question-answer knowledge pairs in the operation knowledge base is successful, the large language model is input according to the corresponding question-answer knowledge pairs in the operation knowledge base to obtain the output answer. However, this method only retrieves some answers with high similarity, which limits the ability to represent questions and utilize large-scale discourse structures, resulting in a low correlation between the answers obtained and the questions, that is, the accuracy of the answers obtained is low, resulting in a poor user experience. Summary of the invention

[0004] In view of this, the present application provides a regulation-related question and answer system, electronic device and storage medium based on retrieval enhancement to solve the problem in the prior art that the accuracy of the answers obtained is low due to the limitation of question representation and the ability to utilize large-scale discourse structures, thus leading to a poor user experience.

[0005] The first aspect of the present application provides a regulation-related question-answering method based on retrieval enhancement, the method comprising:

[0006] Acquire a financial regulation source text, and divide the financial regulation source text into a plurality of financial regulation text blocks;

[0007] For each of the financial regulations text blocks, multiple entities and entity information thereof are identified and extracted from the financial regulations text block, and multiple triples are generated according to each of the entities and entity information thereof;

[0008] Generating a financial regulation summary of each financial regulation text block according to each triple corresponding to each financial regulation text block;

[0009] Clustering each of the financial regulation text blocks to obtain a plurality of continuous clusters and their related summary information, and constructing a corresponding search tree using the summary information of each cluster and the financial regulation summary of each of the financial regulation text blocks;

[0010] When a retrieval question is detected, embedding and encoding the retrieval question to obtain a corresponding retrieval question vector;

[0011] Traversing the search tree according to the search question vector to query global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary;

[0012] The retrieval question and its global context information are combined to obtain a retrieval question combination, and a large language model is used to generate a corresponding question answer based on the retrieval question combination.

[0013] Optionally, for each of the financial regulations text blocks, identifying and extracting multiple entities and entity information thereof from the financial regulations text block, and generating multiple triples according to each of the entities and entity information thereof, including:

[0014] For each of the financial regulations text blocks, identifying and extracting a plurality of entities and entity information thereof from the financial regulations text block;

[0015] Combining each of the entities in pairs to obtain a plurality of entity combinations;

[0016] For each entity combination, a source entity and a target entity are determined from two entities in the entity combination according to entity information of each entity in the entity combination, and an entity relationship between the source entity and the target entity is determined; wherein the entity relationship between the source entity and the target entity is an entity relationship between the two entities in the entity combination;

[0017] Corresponding triples are generated according to the source entity, the target entity, and the entity relationship between the source entity and the target entity.

[0018] Optionally, for each of the financial regulations text blocks, identifying and extracting a plurality of entities and entity information thereof from the financial regulations text block includes:

[0019] Acquire a preset entity type list, wherein the entity type list includes multiple entity types;

[0020] For each of the financial regulations text blocks, a plurality of entities and their entity information are identified and extracted from the financial regulations text block according to each of the entity type lists by using a preset entity recognition model; wherein the entity type of the entity is an entity type in the entity type list.

[0021] Optionally, clustering each of the financial regulation text blocks to obtain a plurality of continuous clusters and their related summary information, and constructing a corresponding search tree using the summary information of each cluster and the financial regulation summary of each of the financial regulation text blocks, includes:

[0022] Generate a corresponding financial regulation embedding matrix according to each of the financial regulation text blocks; wherein the financial regulation embedding matrix includes a financial regulation text block vector corresponding to each of the financial regulation text blocks;

[0023] Determine the optimal cluster number, and determine the Gaussian distribution probability corresponding to each financial regulation text block vector according to the optimal cluster number;

[0024] The Gaussian mixture model is fitted using the expectation maximization algorithm to obtain a clustering model;

[0025] Using the clustering model to cluster each of the financial regulations text blocks according to the optimal cluster number and the Gaussian distribution probability of each of the financial regulations text block vectors, a plurality of cluster sets are obtained; wherein each of the cluster sets includes at least one cluster;

[0026] Determine summary information corresponding to each of the clusters according to each financial regulation text block in each of the clusters;

[0027] A corresponding search tree is constructed using the financial regulation summaries of each of the financial regulation text blocks and each of the clusters and their summary information.

[0028] Optionally, the clustering model is used to cluster each of the financial regulations text blocks according to the optimal cluster number and the Gaussian distribution probability of each of the financial regulations text block vectors to obtain a plurality of cluster sets, including:

[0029] Using the clustering model to perform initial clustering on each of the financial regulations text blocks according to the optimal cluster number and the Gaussian distribution probability of each of the financial regulations text block vectors to obtain a plurality of clusters;

[0030] For each of the clusters, determining whether the total length of the text of the cluster is greater than a text length threshold;

[0031] If the total text length of the cluster is not greater than the text length threshold, generating a corresponding cluster set according to the cluster;

[0032] If the total length of the text in the cluster is greater than the text length threshold, the cluster is recursively clustered using the clustering model according to the Gaussian distribution probability of each financial regulations text block until multiple clusters related to the cluster are obtained, and a corresponding cluster set is generated based on the cluster and its multiple related clusters.

[0033] Optionally, traversing the search tree according to the search question vector to query global context information corresponding to the search question includes:

[0034] Traversing from the root node of the search tree, calculating the cosine similarity between the search question vector and each child node connected to the root node; wherein the child node is the cluster;

[0035] Among the child nodes connected to the root node, the child node with the largest cosine similarity is used as the target child node;

[0036] Determine whether there is a corresponding child node connected to the target child node;

[0037] If the target subnode is not connected to a corresponding subnode, the summary text corresponding to the subnode with the largest cosine similarity is added to a preset search list, and the financial regulations summaries corresponding to each financial regulations text block in the cluster corresponding to the target subnode are added to the search list; wherein the total node text corresponding to the target subnode is the summary text of the corresponding cluster;

[0038] The global context information of the search question is generated according to the summary text and the financial regulations summary in the search list.

[0039] Optionally, the method further includes:

[0040] If the target subnode is connected to a corresponding subnode, calculate the cosine similarity between each subnode under the target subnode and the search question;

[0041] The target subnode is updated using the subnode with the largest cosine similarity among the subnodes under the target subnode, and the step of returning to determine whether the target subnode is connected to a corresponding subnode is executed.

[0042] The second aspect of the present application provides a regulation-related question-answering system based on retrieval enhancement, the system comprising:

[0043] A segmentation unit, used for acquiring a financial regulation source text and segmenting the financial regulation source text into a plurality of financial regulation text blocks;

[0044] A first generating unit is used for identifying and extracting a plurality of entities and entity information thereof from each of the financial regulation text blocks, and generating a plurality of triples according to each of the entities and entity information thereof;

[0045] A second generating unit is used to generate a financial regulation summary of each financial regulation text block according to each triple corresponding to each financial regulation text block;

[0046] A search tree construction unit, used for clustering each of the financial regulation text blocks to obtain a plurality of continuous clusters and their related summary information, and constructing a corresponding search tree using the summary information of each cluster and the financial regulation summary of each of the financial regulation text blocks;

[0047] An embedding coding unit, used for embedding and coding the retrieval question when a retrieval question is detected, so as to obtain a corresponding retrieval question vector;

[0048] A query unit, configured to traverse the search tree according to the search question vector, and query the global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary;

[0049] The third generating unit is used to combine the retrieval question and its global context information to obtain a retrieval question combination, and use a large language model to generate a corresponding question answer according to the retrieval question combination.

[0050] The third aspect of the present application provides an electronic device, comprising: a processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; and the memory is used to store a program, wherein the program is used to implement the retrieval-enhanced regulation-related question and answer method provided in the first aspect of the present application.

[0051] The fourth aspect of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are used to execute the retrieval-enhanced regulation-related question and answer method provided in the first aspect of the present application.

[0052] The present application provides a method, system, electronic device and storage medium for querying regulations based on retrieval enhancement, which obtains a source text of financial regulations and divides the source text of financial regulations into multiple financial regulation text blocks; for each financial regulation text block, identifies and extracts multiple entities and their entity information from the financial regulation text block, and generates multiple triples based on each entity and its entity information; generates a financial regulation summary for each financial regulation text block based on each triple corresponding to each financial regulation text block; clusters each financial regulation text block to obtain multiple continuous clusters and their related summary information, and uses the summary information of each cluster and the financial regulations of each financial regulation text block to obtain a summary of the financial regulations. Abstract: Construct a corresponding search tree; when a search question is detected, embed the search question and encode it to obtain a corresponding search question vector; traverse the search tree according to the search question vector to query the global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary; combine the search question and its global context information to obtain a search question combination, and use a large language model to generate a corresponding question answer according to the search question combination; the technical solution provided by the present application, by adopting clustering and summarizing technology, constructs a search tree that can associate knowledge between various financial regulation text blocks, thereby improving the efficiency of building an associated knowledge base. Moreover, in the query stage, the search tree is searched by using depth-first traversal to obtain the global structural information of the long text related to the search question (global context information), which enhances the parameterized knowledge of the large language model and improves the performance of long text question answering, thereby improving the accuracy of the obtained question answer, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0054] Figure 1 A flowchart of a regulation-related question-answering method based on retrieval enhancement provided in an embodiment of the present application;

[0055] Figure 2 An example diagram of a regulation-related question-answering method based on retrieval enhancement provided in an embodiment of the present application;

[0056] Figure 3 A schematic diagram of the structure of a regulation-related question-answering system based on retrieval enhancement provided in an embodiment of the present application;

[0057] Figure 4A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0059] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0060] See also Figure 1 , shows a flow chart of a method for question-answering regulations associated with retrieval enhancement provided in an embodiment of the present application, and the method for question-answering regulations associated with retrieval enhancement specifically includes the following steps:

[0061] S101: Acquire a financial regulation source text, and divide the financial regulation source text into a plurality of financial regulation text blocks.

[0062] In the specific process of executing step S101, a corresponding specific length may be preset so that after obtaining the financial regulation source text, the financial regulation source text is segmented into multiple continuous financial regulation text blocks based on the preset specific length, wherein each financial regulation text block includes multiple continuous sentences.

[0063] It should be noted that the preset specific length is the length of a text block, and the text block length is greater than the sentence length of any sentence in the source text of the financial regulations.

[0064] In the actual application process, assuming that the preset specific length is chunksize, the financial regulation source text Text can be traversed, and multiple continuous financial regulation text blocks Text with a length equal to or less than the text block length can be sequentially segmented from the financial regulation source text. n-1, t n}; Specifically, the financial regulations source text is segmented from the beginning of the financial regulations source text according to a preset specific length. In the process of segmenting the financial regulations source text, if the sentence at the segmentation critical point cannot be completely segmented into the current financial regulations text block, that is, if the sentence at the segmentation critical point is completely segmented into the current financial regulations text block, then the length of the segmented current financial regulations text block will exceed the preset text block length; therefore, in order to avoid this situation, the sentence at the segmentation critical point can be moved to the next financial regulations text block, which not only ensures that the length of the segmented financial regulations text block does not exceed the preset text block length, but also ensures the integrity of each sentence in the financial regulations text block, as well as the context and semantic coherence within each financial regulations text block.

[0065] S102: for each financial regulation text block, identify and extract multiple entities and their entity information from the financial regulation text block, and generate multiple triples according to each entity and its entity information; wherein a triple consists of two entities and an entity relationship between the two entities;

[0066] In the specific process of executing step S102, after obtaining multiple financial regulations text blocks, for each financial regulations text block, all entities and their entity information in the financial regulations text block can be identified; each entity is combined in pairs to obtain multiple entity combinations; for each entity combination, a triple corresponding to the entity combination is generated according to each entity in the entity combination and its entity information.

[0067] Optionally, for each financial regulation text block, identifying and extracting multiple entities and their entity information from the financial regulation text block, and generating multiple triples based on each entity and its entity information can be specifically as follows: for each financial regulation text block, identifying and extracting multiple entities and their entity information from the financial regulation text block; combining each entity in pairs to obtain multiple entity combinations; for each entity combination, determining a source entity and a target entity from two entities in the entity combination based on the entity information of each entity in the entity combination, and determining the entity relationship between the source entity and the target entity; wherein the entity relationship between the source entity and the target entity is the entity relationship between the two entities in the entity combination; and generating corresponding triples based on the source entity, the target entity, and the entity relationship between the source entity and the target entity.

[0068] It should be noted that the entity information of an entity may include the entity name, entity category and entity description of the entity; the entity relationship between two entities may be an "expand" relationship, an "implied" relationship, and so on.

[0069] In some embodiments, a corresponding preset entity recognition model can be pre-set, wherein the preset entity recognition model can be a large language model (Large Language Model, LLM), which is not limited in the embodiments of the present application; accordingly, after obtaining multiple financial regulations text blocks, for each financial regulations text block, a large language model can be used to identify and extract multiple entities and their entity information from the financial regulations text block, and each entity is combined in pairs to obtain multiple entity combinations, so as to determine the source entity and the target entity from the two entities in the entity combination according to the entity information of each entity in each entity combination, and determine the entity relationship between the source entity and the target entity.

[0070] As a preferred method of an embodiment of the present application, for each financial regulations text block, the process of identifying and extracting multiple entities and their entity information from the financial regulations text block can specifically be: obtaining a preset entity type list, wherein the entity type list includes multiple entity types; for each financial regulations text block, identifying and extracting multiple entities and their entity information from the financial regulations text block according to each entity type list through a preset entity recognition model; wherein the entity type of the entity is the entity type in the entity type list.

[0071] For example, the pre-set entity type table includes institutional entity type, organizational entity type, and activity entity type, etc.; the segmented financial regulations text block is "Local financial organizations shall conduct financial activities in accordance with the principles of legal operation, honesty and trustworthiness, and risk control, and shall not harm national interests, social public interests, and the legitimate rights and interests of others"; the entities identified and extracted from the financial regulations text block by the large language model LLM according to the pre-set entity types can be "local financial organization" entity and "financial activity" entity, and the "local financial organization" entity and the "financial activity" entity constitute an entity combination; the entity information of the "local financial organization" entity and the "financial activity" entity is identified from the financial regulations text block, so as to determine the source entity and the target entity from the two entities in the entity combination according to the entity information of each entity in the entity combination, and determine the entity relationship between the source entity and the target entity as a "carry out" relationship.

[0072] In actual application, a corresponding entity type list can be set in advance, wherein the entity type list can include multiple entity types, for example: the instance type can be an institutional entity type, an organizational entity type, an activity entity type, etc.; so that after obtaining the financial regulations text block, the large language model LLM can be used to identify and extract multiple entities from the financial regulations text block according to each entity type, and the entity information corresponding to each entity can be identified from the financial regulations text block, wherein the entity information can include the entity name (the name of the entity, in uppercase), the entity type (the entity type is the entity type in the entity type class table) and the entity description (a comprehensive description of the entity attributes and activities). For example, the entity information can be in the form of ("entity"{{meta placeholder}}<entity name>{{meta placeholder}}<entity type>{ {{meta placeholder}}<entity description>); combine each entity in pairs to obtain multiple entity combinations; for each entity combination, determine the source entity and the target entity from the two entities of the entity combination according to the entity name in the entity information of each entity in the entity combination, so as to determine the relationship strength between the source entity and the target entity according to the entity description in the entity information of the source entity and the entity description in the entity information of the target entity; finally, generate the entity relationship between the source entity and the target entity according to the source entity, target entity, relationship description and relationship strength corresponding to the entity combination, wherein the entity relationship can be represented by ("entity relationship"{{meta placeholder}}<source entity>{{meta placeholder}}<target entity>{{meta placeholder}}<relationship description>{{meta placeholder}}<relationship strength>).

[0073] S103: Generate a financial regulation summary for each financial regulation text block according to the entity relationships in each triplet corresponding to each financial regulation text block.

[0074] In the specific process of executing step S103, after obtaining multiple triples corresponding to each financial regulations text block, for each financial regulations text block, the entity relationships between the source entities and the target entities in each triple corresponding to the financial regulations text block can be combined into an entity relationship set, and the entity relationship set corresponding to the financial regulations text block is used as the financial regulations summary corresponding to the financial regulations text block.

[0075] S104: Clustering each financial regulation text block to obtain a plurality of continuous clusters and their related summary information, and constructing a corresponding search tree using the summary information of each cluster and the financial regulation summary of each financial regulation text block.

[0076] In the specific process of executing step S104, after obtaining the financial regulation summary corresponding to each financial regulation text block, the text embedding method can be used to embed each financial regulation text block to obtain the corresponding financial regulation embedding matrix Wherein, M is the financial regulation embedding matrix, n is the number of each financial regulation text block, the financial regulation embedding matrix includes the financial regulation text block vector x corresponding to each financial regulation text block, and the financial regulation text block vector is a d-dimensional dense vector x; the financial regulation text block vectors of each financial regulation text block are used to cluster each financial regulation text block to organize each financial regulation text block into multiple coherent clusters, and finally the summary information of each cluster and the financial regulation summary of each financial regulation text block are used to construct a corresponding search tree. The search tree includes a root node and multiple child nodes under the root node.

[0077] Optionally, clustering each financial regulation text block to obtain multiple continuous clusters and their related summary information, and using the summary information of each cluster and the financial regulation summary of each financial regulation text block to construct a corresponding search tree. The specific process can be: generating a corresponding financial regulation embedding matrix according to each financial regulation text block; wherein the financial regulation embedding matrix includes a financial regulation text block vector corresponding to each financial regulation text block; determining the optimal number of clusters, and determining the Gaussian distribution probability corresponding to each financial regulation text block vector according to the optimal number of clusters; fitting the Gaussian mixture model using the expectation maximization algorithm to obtain a clustering model; using the clustering model to cluster each financial regulation text block according to the optimal number of clusters and the Gaussian distribution probability of each financial regulation text block vector to obtain multiple cluster sets; wherein each cluster set includes at least one cluster; determining the summary information corresponding to each cluster according to each financial regulation text block in each cluster; and constructing a corresponding search tree using the financial regulation summary of each financial regulation text block and each cluster and its summary information.

[0078] As a preferred method of an embodiment of the present application, a clustering model is used to perform initial clustering on each financial regulation text block according to the optimal cluster number and the Gaussian distribution probability of each financial regulation text block vector to obtain multiple clusters; for each cluster, it is determined whether the total text length of the cluster is greater than the text length threshold; if the total text length of the cluster is not greater than the text length threshold, a corresponding cluster set is generated based on the cluster; if the total text length in the cluster is greater than the text length threshold, the clustering model is used to continue to recursively cluster the clusters according to the Gaussian distribution probability of each financial regulation text block until multiple clusters related to the cluster are obtained, and a corresponding cluster set is generated based on the cluster and its multiple related clusters.

[0079] In actual application, due to the different characteristics of each clustering, the optimal number of clusters k for each clustering is also different. Therefore, the optimal number of clusters can be automatically calculated by using the partitioning around the center point algorithm (Partitioning Around Medoids, PAM) to reduce the sensitivity to outliers and allow the use of any distance for calculation; after obtaining the optimal number of clusters k, for each financial regulations block, it can be assumed that the probability that the financial regulations text block vector x belongs to the kth Gaussian distribution is expressed as p(x|k)=N(x; μ k ,Σ k ), and then determine the Gaussian distribution probability corresponding to each financial regulation text block, where the entire probability distribution is a weighted sum π k represents the mixture weight of the kth Gaussian distribution; the expectation maximization (EM) algorithm is used to estimate the parameters (mean, covariance and mixture weight) of the Gaussian mixture model GMM, complete the model fitting, and obtain the clustering model.

[0080] The fitted clustering model is used to perform initial clustering on each financial regulation text block according to the optimal cluster number and the Gaussian distribution probability of each financial regulation text block vector, and multiple clusters are obtained. The clusters obtained at this time can be the various sub-nodes connected to the root node of the search tree constructed subsequently; for each cluster, that is, for each sub-node connected under the root node, it can be further determined whether the total text length of the cluster is greater than the text length threshold. If the total text length of the cluster is not greater than the text length threshold, the cluster can be generated as a cluster set separately, that is, the sub-node corresponding to this cluster has no other sub-nodes connected below.

[0081] If the total text length of the cluster is greater than the text length threshold, the clustering model can be used to continue to recursively cluster the cluster according to the Gaussian distribution probability of each financial regulations text block in the cluster to obtain multiple clusters corresponding to the cluster, that is, multiple child nodes connected to the child node corresponding to the cluster; for each cluster corresponding to the cluster, if there is a cluster with a total text length greater than the text length threshold, continue to recursively cluster until a cluster with a total text length not greater than the text length threshold is obtained; the cluster with the initial total text length greater than the text length threshold and the clusters obtained by recursively clustering the cluster are combined to generate a cluster set, wherein the cluster set obtained at this time includes multiple clusters, and there are corresponding parent-child relationships between the multiple clusters.

[0082] Finally, each financial regulation text block in each cluster in each cluster set is input into the large language model LLM for text summary to obtain the summary text corresponding to each cluster, and the parent-child relationship between each cluster is used to construct the corresponding search tree, wherein the search tree includes a root node and n child node layers, each child node in the first child node layer is connected to the root node, and each child node in the nth child node layer is connected to the child node in the n-1th child node layer that has a parent-child relationship; the summary text corresponding to each cluster is embedded in the child node corresponding to the cluster in the search tree, and the financial regulation summary corresponding to each financial regulation text block in the cluster is embedded in the corresponding financial regulation text block in the child node corresponding to the cluster, finally forming a structured, multi-layered search tree with the financial regulation summary as the leaf node.

[0083] For example, after clustering, a cluster obtained includes financial regulation text blocks [t1, t3, t5, t9]. Each financial regulation text block is represented by a corresponding string, and the string corresponding to each financial regulation text block is input into the large language model LLM. The large language model summarizes the input financial regulation text blocks and obtains and outputs the summary text s corresponding to the cluster.

[0084] S105: When a retrieval question is detected, embedding encoding is performed on the retrieval question to obtain a corresponding retrieval question vector.

[0085] In the specific process of executing step S105, after obtaining the corresponding search tree, it is possible to detect in real time whether there is a search question raised by the user. When a search question raised by the user is detected, the detected search question can be embedded and encoded using a text embedding method to obtain a search question vector corresponding to the search text.

[0086] S106: Traverse the search tree according to the search question vector to query the global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary.

[0087] In the specific process of executing step S106, after obtaining the corresponding search question vector, the search tree is traversed according to the obtained search question vector using a depth-first traversal method to query the global context information corresponding to the search question, so that the large language model LLM can be used to generate the answer to the search question according to the search question and its corresponding global context information. Figure 2 shown.

[0088] Optionally, traverse from the root node of the search tree to calculate the cosine similarity between the retrieval question vector and each child node connected to the root node; wherein the child nodes are clusters; the child node with the largest cosine similarity among the child nodes connected to the root node is used as the target child node; determine whether there is a corresponding child node connected to the target child node; if there is a corresponding child node connected to the target child node, calculate the cosine similarity between each child node under the target child node and the retrieval question; update the target child node using the child node with the largest cosine similarity among the child nodes under the target child node, and return to execute the step of determining whether there is a corresponding child node connected to the target child node; if there is no corresponding child node connected to the target child node, add the summary text corresponding to the child node with the largest cosine similarity to a pre-set retrieval list, and add the financial regulation summaries corresponding to each financial regulation text block in the cluster corresponding to the target child node to the retrieval list; wherein the total node text corresponding to the target child node is the summary text of the corresponding cluster; generate global context information of the retrieval question based on the summary text and financial regulation summary in the retrieval list.

[0089] For example, after detecting the corresponding retrieval question q, embed the retrieval question to obtain the corresponding retrieval question vector Q, start traversing from the root node of the search tree, and calculate the cosine similarity between the retrieval question vector and each child node connected to the root node; among the child nodes connected to the root node, the child node with the largest cosine similarity is taken as the target child node. At this time, the summary text s1 of the cluster corresponding to the target child node can be added to the pre-set retrieval class table; determine whether the target child node is connected to a corresponding child node; if the target child node is connected to a corresponding child node, calculate the cosine similarity between each child node under the target child node and the retrieval question; use the child nodes under the target child node to find the corresponding child node. The target child node is updated by the child node with the largest cosine similarity. At this time, the total section text s2 of the cluster corresponding to the updated target child node can be added to the search list, and the step of determining whether the updated target child node is connected to the corresponding child node is continued. If it is determined that the updated target child node is not connected to the corresponding child node, the financial regulation summaries g corresponding to each financial regulation text block in the cluster corresponding to the updated target child node are added to the search list, and the global context information corresponding to the search question is [s1, s2, g1, g2, ..., gn], where n is the number of financial regulation text blocks in the cluster corresponding to the updated target child node.

[0090] S107: Combine the search question and its global context information to obtain a search question combination, and use the large language model to generate a corresponding question answer based on the search question combination.

[0091] In the specific process of executing step S107, after obtaining the global context information of the retrieval question, the retrieval question and its global question context information can be merged to obtain a retrieval question combination, and the obtained retrieval question combination can be input into the language model LLM, so that the large language model LLM uses the input retrieval question combination to generate the corresponding question answer.

[0092] The present application provides a method for querying and answering regulations-related questions based on retrieval enhancement, which obtains a source text of financial regulations and divides the source text of financial regulations into multiple financial regulation text blocks; for each financial regulation text block, identifies and extracts multiple entities and their entity information from the financial regulation text block, and generates multiple triples based on each entity and its entity information; generates a financial regulation summary for each financial regulation text block based on each triple corresponding to each financial regulation text block; clusters each financial regulation text block to obtain multiple continuous clusters and their related summary information, and constructs a corresponding query and answer method using the summary information of each cluster and the financial regulation summary of each financial regulation text block. search tree; when a search question is detected, embed the search question and encode it to obtain a corresponding search question vector; traverse the search tree according to the search question vector to query the global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary; combine the search question and its global context information to obtain a search question combination, and use the large language model to generate a corresponding question answer according to the search question combination; the technical solution provided by the present application, by adopting clustering and summarizing technology, constructs a search tree that can associate knowledge between various financial regulation text blocks, thereby improving the efficiency of constructing an associated knowledge base. Moreover, in the query stage, the search tree is searched by using depth-first traversal to obtain the global structural information of the long text related to the search question (global context information), which enhances the parameterized knowledge of the large language model and improves the performance of long text question answering, thereby improving the accuracy of the obtained question answer, thereby improving the user experience.

[0093] Based on the above-mentioned regulation-related question-answering method based on retrieval enhancement provided in the embodiment of the present application, correspondingly, the embodiment of the present application also provides a regulation-related question-answering system based on retrieval enhancement, such as Figure 3 As shown, the regulation-related question-answering system based on retrieval enhancement includes:

[0094] The segmentation unit 31 is used to obtain a financial regulation source text and segment the financial regulation source text into a plurality of financial regulation text blocks;

[0095] A first generating unit 32 is used for identifying and extracting a plurality of entities and entity information thereof from each financial regulation text block, and generating a plurality of triples according to each entity and entity information thereof;

[0096] The second generating unit 33 is used to generate a financial regulation summary of each financial regulation text block according to each triple corresponding to each financial regulation text block;

[0097] A search tree construction unit 34 is used to cluster each financial regulation text block to obtain a plurality of continuous clusters and their related summary information, and to construct a corresponding search tree using the summary information of each cluster and the financial regulation summary of each financial regulation text block;

[0098] The embedding coding unit 35 is used to embed the retrieval question and obtain a corresponding retrieval question vector when a retrieval question is detected;

[0099] A query unit 36, configured to traverse the search tree according to the search question vector, and query the global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary;

[0100] The third generating unit 37 is used to combine the search question and its global context information to obtain a search question combination, and generate a corresponding question answer based on the search question combination using a large language model.

[0101] The specific principles and execution processes of each unit in the retrieval-enhanced regulations-associated question and answer system disclosed in the above-mentioned embodiment of the present application are the same as the retrieval-enhanced regulations-associated question and answer method disclosed in the above-mentioned embodiment of the present application. Please refer to the corresponding parts of the retrieval-enhanced regulations-associated question and answer method disclosed in the above-mentioned embodiment of the present application, and will not be repeated here.

[0102] The present application provides a method, system, electronic device and storage medium for querying regulations based on retrieval enhancement, which obtains a source text of financial regulations and divides the source text of financial regulations into multiple financial regulation text blocks; for each financial regulation text block, identifies and extracts multiple entities and their entity information from the financial regulation text block, and generates multiple triples based on each entity and its entity information; generates a financial regulation summary for each financial regulation text block based on each triple corresponding to each financial regulation text block; clusters each financial regulation text block to obtain multiple continuous clusters and their related summary information, and uses the summary information of each cluster and the financial regulations of each financial regulation text block to obtain a summary of the financial regulations. Abstract: Construct a corresponding search tree; when a search question is detected, embed the search question and encode it to obtain a corresponding search question vector; traverse the search tree according to the search question vector to query the global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary; combine the search question and its global context information to obtain a search question combination, and use a large language model to generate a corresponding question answer according to the search question combination; the technical solution provided by the present application, by adopting clustering and summarizing technology, constructs a search tree that can associate knowledge between various financial regulation text blocks, thereby improving the efficiency of building an associated knowledge base. Moreover, in the query stage, the search tree is searched by using depth-first traversal to obtain the global structural information of the long text related to the search question (global context information), which enhances the parameterized knowledge of the large language model and improves the performance of long text question answering, thereby improving the accuracy of the obtained question answer, thereby improving the user experience.

[0103] Optionally, the first generation unit includes:

[0104] An extraction unit, for identifying and extracting a plurality of entities and entity information thereof from the financial regulation text block for each financial regulation text block;

[0105] A combination unit, used to combine entities in pairs to obtain multiple entity combinations;

[0106] A first determining unit is used to determine, for each entity combination, a source entity and a target entity from two entities in the entity combination according to entity information of each entity in the entity combination, and determine an entity relationship between the source entity and the target entity; wherein the entity relationship between the source entity and the target entity is an entity relationship between two entities in the entity combination;

[0107] The first generating unit is used to generate corresponding triples according to a source entity, a target entity and an entity relationship between the source entity and the target entity.

[0108] Optionally, an extraction unit comprising:

[0109] An entity type list acquiring unit, used to acquire a preset entity type list, wherein the entity type list includes a plurality of entity types;

[0110] The extraction subunit is used to identify and extract multiple entities and their entity information from each financial regulation text block according to each entity type list through a preset entity recognition model; wherein the entity type of the entity is the entity type in the entity type list.

[0111] Optional, search tree building unit, including:

[0112] An embedding unit, used to generate a corresponding financial regulation embedding matrix according to each financial regulation text block; wherein the financial regulation embedding matrix includes a financial regulation text block vector corresponding to each financial regulation text block;

[0113] A second determination unit is used to determine an optimal clustering number, and determine a Gaussian distribution probability corresponding to each financial regulation text block vector according to the optimal clustering number;

[0114] A fitting unit, used to fit the Gaussian mixture model using an expectation maximization algorithm to obtain a clustering model;

[0115] A clustering unit, used for clustering each financial regulation text block according to the optimal cluster number and the Gaussian distribution probability of each financial regulation text block vector using a clustering model to obtain a plurality of cluster sets; wherein each cluster set includes at least one cluster;

[0116] A third determining unit is used to determine summary information corresponding to each cluster according to each financial regulation text block in each cluster;

[0117] The search tree construction subunit is used to construct a corresponding search tree using the financial regulation summaries of each financial regulation text block and each cluster and its summary information.

[0118] Optional, clustering unit, including:

[0119] An initial clustering unit, used to perform initial clustering on each financial regulation text block according to the optimal clustering number and the Gaussian distribution probability of each financial regulation text block vector using a clustering model to obtain multiple clusters;

[0120] A first judging unit is used to judge, for each cluster, whether the total text length of the cluster is greater than a text length threshold;

[0121] A fourth generating unit, configured to generate a corresponding cluster set according to the cluster if the total text length of the cluster is not greater than the text length threshold;

[0122] The recursive clustering unit is used to continue to recursively cluster the clusters according to the Gaussian distribution probability of each financial regulation text block using the clustering model if the total length of the text in the cluster is greater than the text length threshold, until multiple clusters related to the cluster are obtained, and a corresponding cluster set is generated according to the cluster and its multiple related clusters.

[0123] Optionally, a query unit includes:

[0124] A traversal unit is used to start traversal from the root node of the search tree and calculate the cosine similarity between the retrieval question vector and each child node connected to the root node; wherein the child node is a cluster;

[0125] A fourth determining unit is used to select, among the child nodes connected to the root node, the child node with the largest cosine similarity as the target child node;

[0126] A second judgment unit is used to judge whether a corresponding sub-node is connected to the target sub-node;

[0127] An adding unit is used for adding the summary text corresponding to the subnode with the largest cosine similarity to a preset search list if there is no corresponding subnode connected to the target subnode, and adding the financial regulation summaries corresponding to each financial regulation text block in the cluster corresponding to the target subnode to the search list; wherein the total node text corresponding to the target subnode is the summary text of the corresponding cluster;

[0128] The fifth generating unit is used to generate global context information of the search question according to the summary text and the financial regulations summary in the search list.

[0129] The regulation-related question-answering system based on retrieval enhancement provided in the embodiment of the present application further includes:

[0130] A calculation unit, used for calculating the cosine similarity between each subnode under the target subnode and the search question if the target subnode is connected to a corresponding subnode;

[0131] The updating unit is used to update the target sub-node using the sub-node with the largest cosine similarity among the sub-nodes under the target sub-node, and return to the second judgment unit for execution.

[0132] The present application embodiment provides an electronic device, such as Figure 4 As shown, the electronic device includes a processor 401 and a memory 402, the memory 402 is used to store program code and data for retrieval-enhanced regulation-associated question and answer, and the processor 401 is used to call the program instructions in the memory to execute the steps shown in the retrieval-enhanced regulation-associated question and answer method in the above embodiment.

[0133] An embodiment of the present application provides a storage medium, which includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute the retrieval-enhanced regulation-associated question-and-answer method shown in the above embodiment.

[0134] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0135] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

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

[0137] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A regulation-related question-answering method based on retrieval enhancement, characterized in that: The method comprises: Acquire a financial regulation source text, and divide the financial regulation source text into a plurality of financial regulation text blocks; For each of the financial regulations text blocks, multiple entities and entity information thereof are identified and extracted from the financial regulations text block, and multiple triples are generated according to each of the entities and entity information thereof; Generating a financial regulation summary of each financial regulation text block according to each triple corresponding to each financial regulation text block; Clustering each of the financial regulation text blocks to obtain a plurality of continuous clusters and their related summary information, and constructing a corresponding search tree using the summary information of each cluster and the financial regulation summary of each of the financial regulation text blocks; When a retrieval question is detected, embedding and encoding the retrieval question to obtain a corresponding retrieval question vector; Traversing the search tree according to the search question vector to query global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary; The retrieval question and its global context information are combined to obtain a retrieval question combination, and a large language model is used to generate a corresponding question answer based on the retrieval question combination.

2. The method according to claim 1, characterized in that For each of the financial regulations text blocks, multiple entities and entity information thereof are identified and extracted from the financial regulations text block, and multiple triples are generated according to each of the entities and entity information thereof, including: For each of the financial regulations text blocks, identifying and extracting a plurality of entities and entity information thereof from the financial regulations text block; Combining each of the entities in pairs to obtain a plurality of entity combinations; For each entity combination, a source entity and a target entity are determined from two entities in the entity combination according to entity information of each entity in the entity combination, and an entity relationship between the source entity and the target entity is determined; wherein the entity relationship between the source entity and the target entity is an entity relationship between the two entities in the entity combination; Corresponding triples are generated according to the source entity, the target entity, and the entity relationship between the source entity and the target entity.

3. The method according to claim 2, characterized in that For each of the financial regulations text blocks, multiple entities and entity information thereof are identified and extracted from the financial regulations text block, including: Acquire a preset entity type list, wherein the entity type list includes multiple entity types; For each of the financial regulations text blocks, a plurality of entities and their entity information are identified and extracted from the financial regulations text block according to each of the entity type lists by using a preset entity recognition model; wherein the entity type of the entity is an entity type in the entity type list.

4. The method according to claim 1, characterized in that: The clustering of each of the financial regulation text blocks to obtain a plurality of continuous clusters and their related summary information, and constructing a corresponding search tree using the summary information of each cluster and the financial regulation summary of each of the financial regulation text blocks, includes: Generate a corresponding financial regulation embedding matrix according to each of the financial regulation text blocks; wherein the financial regulation embedding matrix includes a financial regulation text block vector corresponding to each of the financial regulation text blocks; Determine the optimal cluster number, and determine the Gaussian distribution probability corresponding to each financial regulation text block vector according to the optimal cluster number; The Gaussian mixture model is fitted using the expectation maximization algorithm to obtain a clustering model; Using the clustering model to cluster each of the financial regulations text blocks according to the optimal cluster number and the Gaussian distribution probability of each of the financial regulations text block vectors, a plurality of cluster sets are obtained; wherein each of the cluster sets includes at least one cluster; Determine summary information corresponding to each of the clusters according to each financial regulation text block in each of the clusters; A corresponding search tree is constructed using the financial regulation summaries of each of the financial regulation text blocks and each of the clusters and their summary information.

5. The method according to claim 4, characterized in that The clustering model is used to cluster each of the financial regulations text blocks according to the optimal cluster number and the Gaussian distribution probability of each of the financial regulations text block vectors to obtain a plurality of cluster sets, including: Using the clustering model to perform initial clustering on each of the financial regulations text blocks according to the optimal cluster number and the Gaussian distribution probability of each of the financial regulations text block vectors to obtain a plurality of clusters; For each of the clusters, determining whether the total length of the text of the cluster is greater than a text length threshold; If the total text length of the cluster is not greater than the text length threshold, generating a corresponding cluster set according to the cluster; If the total length of the text in the cluster is greater than the text length threshold, the cluster is recursively clustered using the clustering model according to the Gaussian distribution probability of each financial regulations text block until multiple clusters related to the cluster are obtained, and a corresponding cluster set is generated based on the cluster and its multiple related clusters.

6. The method according to claim 5, characterized in that The traversing the search tree according to the search question vector to query the global context information corresponding to the search question includes: Traversing from the root node of the search tree, calculating the cosine similarity between the search question vector and each child node connected to the root node; wherein the child node is the cluster; Among the child nodes connected to the root node, the child node with the largest cosine similarity is used as the target child node; Determine whether there is a corresponding child node connected to the target child node; If the target subnode is not connected to a corresponding subnode, the summary text corresponding to the subnode with the largest cosine similarity is added to a preset search list, and the financial regulations summaries corresponding to each financial regulations text block in the cluster corresponding to the target subnode are added to the search list; wherein the total node text corresponding to the target subnode is the summary text of the corresponding cluster; The global context information of the search question is generated according to the summary text and the financial regulations summary in the search list.

7. The method according to claim 6, characterized in that The method further comprises: If the target subnode is connected to a corresponding subnode, calculate the cosine similarity between each subnode under the target subnode and the search question; The target subnode is updated using the subnode with the largest cosine similarity among the subnodes under the target subnode, and the step of returning to determine whether the target subnode is connected to a corresponding subnode is executed.

8. A regulation-related question-answering system based on retrieval enhancement, characterized in that: The system comprises: A segmentation unit, used for acquiring a financial regulation source text and segmenting the financial regulation source text into a plurality of financial regulation text blocks; A first generating unit is used for identifying and extracting a plurality of entities and entity information thereof from each of the financial regulation text blocks, and generating a plurality of triples according to each of the entities and entity information thereof; A second generating unit is used to generate a financial regulation summary of each financial regulation text block according to each triple corresponding to each financial regulation text block; A search tree construction unit, used for clustering each of the financial regulation text blocks to obtain a plurality of continuous clusters and their related summary information, and constructing a corresponding search tree using the summary information of each cluster and the financial regulation summary of each of the financial regulation text blocks; An embedding coding unit, used for embedding and coding the retrieval question when a retrieval question is detected, so as to obtain a corresponding retrieval question vector; A query unit, configured to traverse the search tree according to the search question vector, and query the global context information corresponding to the search question; wherein the global context information includes at least one summary information and at least one financial regulation summary; The third generating unit is used to combine the retrieval question and its global context information to obtain a retrieval question combination, and use a large language model to generate a corresponding question answer according to the retrieval question combination.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the processor and the memory are connected via a communication bus; wherein the processor is used to call and execute a program stored in the memory; The memory is used to store a program, and the program is used to implement the retrieval-enhanced regulation-associated question-and-answer method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the retrieval-enhanced regulation-related question-and-answer method as described in any one of claims 1-7.