Question and answer method, device and equipment based on large language model and storage medium
By constructing a graph-structured knowledge graph and a large language model, combined with information retrieval technology, the time-consuming and labor-intensive problems of traditional anti-money laundering methods are solved, and efficient and accurate money laundering risk identification and automated processing are achieved.
Patent Information
- Application Number
- CN202510713545.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-09-23
AI Technical Summary
Traditional anti-money laundering methods rely on manual processing of anti-money laundering public opinion information or review of suspicious transaction reports, which is time-consuming and labor-intensive, and makes it difficult to effectively identify complex money laundering patterns and predict and detect potential money laundering activities.
A question-answering system based on a large language model is used. By constructing a graph-structured knowledge graph, combining information retrieval and model generation, and using the large language model to calculate the relevance of text blocks and analyze semantic similarity, accurate answers for money laundering risk identification are generated.
It improves the degree of automation and recognition efficiency in anti-money laundering work, enhances the ability to identify complex money laundering patterns and the accuracy of response, reduces manual intervention, and improves the system's adaptability and response speed.
Smart Images

Figure CN120687561A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present application relate to the field of artificial intelligence technology, and in particular, to a question-answering method, apparatus, device, and storage medium based on a large language model. Background Art
[0002] In the field of anti-money laundering (AML), traditional monitoring and analysis methods are increasingly insufficient in the face of ever-changing tools and complex money laundering techniques. Current money laundering risk identification relies primarily on manually processing AML public opinion information or reviewing recent suspicious transaction reports. This approach is not only time-consuming and labor-intensive, but also inefficient, making it difficult to automatically identify complex money laundering patterns and effectively predict and detect potential money laundering activities. Therefore, there is a general desire for intelligent and efficient solutions to improve the effectiveness of money laundering risk identification in AML efforts. Summary of the Invention
[0003] One or more embodiments of the present application provide the following technical solutions:
[0004] This application provides a question-answering method based on a large language model, the method comprising:
[0005] Calculating the relevance between the query text and each text block segmented from the document, and determining a related text block from the text blocks based on the relevance;
[0006] A target text block is determined from the associated text blocks, and based on a graph, each associated text block is sequentially obtained from the graph in descending order of semantic similarity between the corresponding concepts and the concept corresponding to the target text block; wherein each node in the graph represents a text block; each edge in the graph represents semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge, and the weight of each edge represents the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge;
[0007] When each associated text block is obtained, the context used to generate the answer text corresponding to the query text is updated based on the associated text block, and the query text and the updated context are input into the large language model, and the large language model performs inference based on the query text and the updated context to generate the answer text corresponding to the query text.
[0008] The present application also provides a question-answering device based on a large language model, the device comprising:
[0009] a text block determination module that calculates the relevance between the query text and the text blocks into which the document is segmented, and determines a related text block from the text blocks based on the relevance;
[0010] a text block acquisition module that determines a target text block from the associated text blocks and, based on a graph, sequentially acquires the associated text blocks from the graph in descending order of semantic similarity between the corresponding concepts and the concept corresponding to the target text block; wherein each node in the graph represents a text block; each edge in the graph represents semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge, and the weight of each edge represents the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge;
[0011] The answer generation module, when obtaining each associated text block, updates the context used to generate the answer text corresponding to the query text based on the associated text block, and inputs the query text and the updated context into the large language model. The large language model performs inference based on the query text and the updated context to generate the answer text corresponding to the query text.
[0012] The present application also provides an electronic device, comprising:
[0013] processor;
[0014] a memory for storing processor-executable instructions;
[0015] The processor implements the steps of any of the above methods by running the executable instructions.
[0016] The present application also provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of any of the methods described above.
[0017] In the above technical solution, a graph can be constructed in advance, in which each node in the graph can represent each text block, each edge can represent that the concepts corresponding to the text blocks represented by the nodes connected by the edges are semantically similar, and the weight of each edge can represent the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edges; subsequently, the correlation between the query text and the text blocks divided by the document can be calculated first, and based on the calculated correlation, the associated text blocks can be determined from these text blocks, and then the target text blocks can be determined from these associated text blocks, and based on the graph, the associated text blocks can be obtained from the graph in descending order of the semantic similarity between the corresponding concepts and the concepts corresponding to the target text blocks, and when each associated text block is obtained, the context used to generate the answer text corresponding to the query text can be updated based on the obtained associated text block, and the query text and the updated context can be input into the large language model, and the large language model performs reasoning based on the query text and the updated context to generate the answer text corresponding to the query text.
[0018] By adopting the above method, it is possible to use large language model technology to improve the automation and effectiveness of money laundering risk identification in anti-money laundering work; in addition, for the money laundering risk identification system based on the large language model and using RAG, the efficiency, adaptability and response accuracy of the money laundering risk identification system can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The following is a description of the accompanying drawings required for describing the exemplary embodiments, in which:
[0020] Figure 1 It is a schematic diagram of a system shown in an exemplary embodiment of the present application.
[0021] Figure 2 It is a schematic diagram of a graph structure shown in an exemplary embodiment of the present application.
[0022] Figure 3 This is a flowchart of a question-answering method based on a large language model, shown as an exemplary embodiment of the present application.
[0023] Figure 4 It is a schematic diagram of another graph structure shown in an exemplary embodiment of the present application.
[0024] Figure 5 It is a schematic diagram of another graph structure shown in an exemplary embodiment of the present application.
[0025] Figure 6 It is a structural diagram of a device shown in an exemplary embodiment of the present application.
[0026] Figure 7This is a block diagram of a question-answering device based on a large language model, shown as an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0027] The exemplary embodiments will be described in detail herein, with examples thereof being illustrated in the accompanying drawings. When the following description refers to the drawings, identical numbers in different drawings represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of the present application. Instead, they are merely examples consistent with some aspects of one or more embodiments of the present application.
[0028] It should be noted that, in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this application. In some other embodiments, the method may include more or fewer steps than those described in this application. In addition, a single step described in this application may be broken down into multiple steps for description in other embodiments; and multiple steps described in this application may be combined into a single step for description in other embodiments.
[0029] With the development of financial technology, money laundering activities have become increasingly covert and complex, involving faster and more diverse flows of funds. In the field of anti-money laundering, faced with ever-changing tools and complex money laundering methods, traditional rule-based monitoring methods and simple data analysis technologies have significant limitations in addressing these emerging threats. For example, they are unable to effectively process unstructured data, such as key information from sources such as news reports and social media posts; at the same time, they often perform poorly for complex money laundering patterns that require a deep understanding of the context to identify. Therefore, current money laundering risk identification mainly relies on manual processing of anti-money laundering public opinion information or reviewing recent suspicious transaction reports. This method is not only time-consuming and labor-intensive, but also inefficient, making it difficult to automatically identify complex money laundering patterns and effectively predict and detect potential money laundering activities.
[0030] Given these challenges, there's a general desire for intelligent, efficient solutions to improve money laundering risk identification in anti-money laundering efforts. Large Language Models (LLMs) have garnered widespread attention for their exceptional natural language understanding and generation capabilities. Trained on large-scale text datasets, these models are capable of understanding and processing the nuances of human language, offering new insights into addressing these challenges.
[0031] Specifically, large language models can be used to automatically parse and classify massive amounts of unstructured data from various channels, quickly extracting characteristic information related to money laundering behavior; by learning complex patterns from historical cases, the accuracy of identifying new money laundering techniques can be improved; and they can be combined with real-time data for dynamic risk assessments, providing early warnings of potential money laundering activities. Furthermore, leveraging the power of deep learning algorithms, large language models can continuously optimize their performance without extensive human intervention, adapting to the ever-changing money laundering risk environment. Therefore, using large language models to improve the intelligence level of existing money laundering risk identification systems will not only help reduce manual workloads and improve work efficiency, but will also significantly enhance financial institutions' ability to prevent financial crime and ensure the safe and stable operation of the economic system.
[0032] In this application, the money laundering risk identification system can be implemented using an intelligent dialogue system (or intelligent question-and-answer system). Taking the intelligent dialogue system as an example, it simulates human communication methods to provide users with medical-related dialogue, question-and-answer, and query services. The intelligent dialogue system is a specific user-facing application of the large language model. It is designed to understand and answer questions posed by users in natural language and generate concise and clear answers. Specifically, the intelligent dialogue system is based on the large language model, which understands and answers user questions and generates corresponding answers.
[0033] In actual applications, using an intelligent dialogue system, users can include text materials such as anti-money laundering public opinion information or recent suspicious transaction reports in questions related to money laundering risk identification and provide them to the large language model. The large language model will understand and answer the questions raised by the users, that is, identify money laundering risks based on these text materials and generate corresponding answers, which describe whether money laundering risks are identified from these text materials.
[0034] Large language models are deep learning models trained using large amounts of text data. They can be used to generate natural language text or understand its meaning. Large language models can handle a variety of natural language tasks, such as text classification, named entity recognition (NER), question answering, and conversation, and are a key path to artificial intelligence.
[0035] In the field of natural language processing (NLP), large-scale text datasets are often referred to as corpuses. Corpuses can contain a variety of text data, such as literary works, academic papers, legal documents, news reports, everyday conversations, emails, and online forum posts. By learning from the text data in a corpus, large language models can acquire and understand the patterns and regularities of natural language, enabling effective processing and generation of human language.
[0036] Large language models typically use the Transformer architecture, meaning they are deep learning models based on the Transformer architecture. Transformer-based deep learning models are a type of neural network model that excels in fields like natural language processing.
[0037] Transformer is a neural network model used for sequence-to-sequence modeling. Transformer does not rely on recursive structures and can parallelize training and inference, speeding up model processing. In deep learning models based on the Transformer architecture, a multi-layer Transformer encoder is typically used to extract features from the input sequence, and a Transformer decoder is used to convert the extracted features into an output sequence. At the same time, such models typically also use a self-attention mechanism to capture long-distance dependencies in the input sequence, as well as residual connections and regularization methods to accelerate training and improve model performance.
[0038] A pretrained model is a large language model pretrained on large amounts of unlabeled text data. Pretrained models are general-purpose models; they are not designed or optimized for specific tasks. To adapt pretrained models to specific application scenarios and task requirements, they require fine-tuning to improve their performance on specific tasks. The large language model that is ultimately put into use is typically a pretrained model that has been further fine-tuned, performing supervised learning on labeled text data. Pretraining and fine-tuning are complementary processes: pretraining enables the model to acquire broad language understanding capabilities, while fine-tuning makes the model more specialized and accurate for specific tasks.
[0039] In other words, the training process of a large language model can be divided into two stages: pre-training and fine-tuning. During the pre-training stage, unsupervised learning (e.g., self-supervised learning) can be used on large-scale, unlabeled text datasets (e.g., online encyclopedias, online articles, books, etc.). Specifically, the model can predict missing parts or the next word based on the context, learn statistical laws such as semantics and syntax, and language structure. Backpropagation and optimization algorithms (e.g., gradient descent) are used to minimize prediction losses, iteratively update model parameters, and gradually improve the model's understanding of language. During the fine-tuning phase, you can select corresponding supervised learning tasks (for example, text classification, named entity recognition, question-answering systems, dialogue systems, etc.) based on the specific application scenarios and task requirements, and prepare task-specific text datasets. You can then use the pre-trained model as the starting point for fine-tuning, and use supervised learning to fine-tune on the task-specific text dataset. Specifically, you can perform the task based on the text dataset, and minimize the loss used to measure the performance of the model in processing specific tasks through backpropagation and optimization algorithms (for example, gradient descent). The model parameters are iteratively updated to gradually improve the model's performance on specific tasks. In practical applications, fine-tuning can flexibly choose supervised learning, unsupervised learning, or semi-supervised learning methods based on the specific application scenarios and the type of available data.
[0040] The language comprehension ability learned by the large language model during the pre-training and fine-tuning stages enables the large language model to perform logical inference, knowledge reasoning, or problem-solving by understanding, analyzing, and integrating text information when faced with complex problems or tasks. This ability is usually referred to as the reasoning ability of the large language model.
[0041] In practical applications, the pre-trained large language model is usually called the base model of the large language model, and the fine-tuned large language model is called the serving model of the large language.
[0042] Large language models are typically guided or stimulated by prompts (also known as prompts) to perform specific tasks. A prompt can be an initial text or text fragment provided to the large language model, such as a sentence, a question, or a conversation, intended to guide or stimulate the model to produce the corresponding output. Prompts are a key tool for guiding model output and can be very simple or quite complex, including instructions, examples, and descriptions of the desired output format. Prompts explicitly tell the large language model what task it is expected to perform, such as answering a question, simulating a conversation, writing an article, or translating text. Prompts also provide the large language model with necessary background information and context, enabling it to understand the logic, style, theme, or stance it should follow when generating content. Prompts can also inspire the large language model to demonstrate its inherent knowledge or specific language abilities, such as explaining complex concepts, citing regulations, or imitating the writing style of a specific author.
[0043] Since large language models are primarily used to understand and generate human language based on text processing, prompts usually appear in the form of text. However, in practical applications, large language models can also accept other forms of input as prompts, such as images, audio, and even video, provided that the large language model is designed or trained to process multimodal data.
[0044] Intelligent dialogue systems typically rely primarily on the knowledge acquired by their large language models during training by studying static corpora. Due to the limitations of this knowledge, the system may experience hallucinations when answering complex or specific questions. Hallucinations occur when the content generated by the large language model appears plausible and coherent, sometimes even mimicking human emotions and thought patterns, creating the illusion of "understanding" the input, even though in reality, the content is inaccurate or misleading. This reliance on static corpora limits the system's adaptability and response accuracy.
[0045] To improve the adaptability and response accuracy of money laundering risk identification systems, a Retrieval-Augmented Generation (RAG) approach can be employed, combining information retrieval and model generation. This allows the system to answer user questions without relying solely on the knowledge acquired by the large language model during training, which is acquired through learning static corpora. Instead, the system can first retrieve information from a large document collection based on the question, then use the retrieved relevant documents to understand and address the question and generate the corresponding answer. In other words, the document collection can be combined with the large language model, and relevant information can be retrieved from the document collection in real time during the model generation process to assist the model in making more accurate and comprehensive responses or decisions. Because the retrieved information and the context of the question are taken into account during the model generation process, the generated content can be guaranteed to meet practical needs while being accurate, reliable, coherent, and natural.
[0046] In the field of anti-money laundering, high accuracy is required for money laundering risk identification to minimize unnecessary losses to users caused by misjudgments of money laundering activities. While RAGs can improve the accuracy of money laundering risk identification to a certain extent, typical RAGs fail to consider the hierarchy and connections between different documents and instead directly perform information retrieval within a document collection consisting of documents at the same level. Furthermore, traditional information retrieval systems primarily rely on keyword matching and text similarity-based algorithms to provide information retrieval results. This approach exhibits significant shortcomings in complex queries and queries involving multiple entities and their interactions. Therefore, if the retrieval requirements are stringent (e.g., requiring high text similarity), the number of documents retrieved that are relevant to the user's question will be small, potentially leading to information omissions and compromising the completeness and comprehensiveness of the resulting answer. If the retrieval requirements are looser, the number of documents retrieved that are relevant to the user's question will be large, requiring large language models to reference a large number of documents to generate an answer, thus affecting their efficiency.
[0047] In order to control the data volume of the information retrieval results within an appropriate range while reducing information omissions in the information retrieval, thereby improving the completeness and comprehensiveness of the final generated answer, in the RAG provided in one or more embodiments of the present application, information retrieval can be implemented in combination with a graph.
[0048] Graphs are data stored and managed in a graphical structure. In a graph, data is stored using nodes, edges, and properties. This storage method is well-suited for expressing complex relationships between entities. In a graph, nodes represent entities, such as people, places, events, and so on. Each node can have multiple attributes to describe specific information about the entity. Edges are used to represent relationships between nodes, such as "know," "belong to," "located in," and so on. Edges can also contain attributes to describe the characteristics of the relationship, such as the strength of the relationship and when it was established. Attributes are data fields attached to nodes or edges that are used to store specific information, such as a person's name, age, or the start date of a relationship.
[0049] By integrating graphs into information retrieval, graphs can be used to capture entities and their relationships. This provides more accurate, complete, and contextually relevant information retrieval results for complex queries or those involving multiple entities and their interactions. Furthermore, the data size of the information retrieval results can be controlled to a certain extent. This can improve the efficiency, adaptability, and response accuracy of money laundering risk identification systems using RAGs.
[0050] One or more embodiments of the present application provide a technical solution for implementing question answering based on a large language model. In this technical solution, a graph can be pre-constructed, in which each node in the graph can represent each text block, each edge can represent that the concept corresponding to the text block represented by the node connected by the edge is semantically similar, and the weight of each edge can represent the semantic similarity between the concepts corresponding to the text block represented by the node connected by the edge; subsequently, the association between the query text and the text blocks divided by the document can be first calculated, and based on the calculated association, associated text blocks can be determined from these text blocks, and then a target text block can be determined from these associated text blocks, and based on the graph, each associated text block can be obtained from the graph in descending order of the semantic similarity between the corresponding concept and the concept corresponding to the target text block. When each associated text block is obtained, the context used to generate the answer text corresponding to the query text can be updated based on the obtained associated text block, and the query text and the updated context can be input into the large language model, and the large language model performs reasoning based on the query text and the updated context to generate the answer text corresponding to the query text.
[0051] By adopting the above method, it is possible to use large language model technology to improve the automation and effectiveness of money laundering risk identification in anti-money laundering work; in addition, for the money laundering risk identification system based on the large language model and using RAG, the efficiency, adaptability and response accuracy of the money laundering risk identification system can be improved.
[0052] Please refer to Figure 1 , Figure 1 This is a schematic diagram of a money laundering risk identification system shown in an exemplary embodiment of the present application.
[0053] like Figure 1 As shown, the money laundering risk identification system may include a server and at least one client connected to the server via any type of wired or wireless network.
[0054] Among them, the above-mentioned server can correspond to a server including an independent physical host, or a server cluster composed of multiple independent physical hosts; or, it can correspond to a virtual server, cloud server, etc. carried by a host cluster.
[0055] The above-mentioned client can correspond to terminal devices such as smart phones, tablet computers, laptops, desktop computers, PCs (Personal Computers), PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), smart car devices or game consoles.
[0056] Users can use the money laundering risk identification service provided by the money laundering risk identification system through the client. The client and server can implement user-oriented money laundering risk identification services through data exchange between each other. The money laundering risk identification service can be an intelligent question-and-answer service for money laundering risk identification.
[0057] Specifically, the server can be equipped with a large language model, and the money laundering risk identification system can be based on the large language model, which can understand and answer the query text and generate an answer text corresponding to the query text.
[0058] For example, the client can output a corresponding user interface to the user, allowing the user to perform operations such as inputting query text (which may be called a query or question) and uploading documents or images to assist in asking questions in the user interface, thereby asking questions to the money laundering risk identification system and using the money laundering risk identification service provided by the money laundering risk identification system. The client can send the query text input by the user to the server, which will generate a corresponding answer text (which may be called an answer) for the query text and output the answer text to the user, that is, return the answer text to the client. The client will then display the answer text to the user through the user interface, allowing the user to review the corresponding answer generated by the money laundering risk identification system and confirm whether there is a money laundering risk, thereby realizing a user-oriented money laundering risk identification service.
[0059] The server can also be equipped with a knowledge graph and information retrieval components. The knowledge graph is an external knowledge base relative to the large language model installed on the server. That is, the data in the knowledge graph is not the knowledge acquired by the large language model through learning during the training process, but serves as auxiliary data in the reasoning process of the large language model, assisting the large language model in generating answer text corresponding to the query text. During the reasoning process of the large language model, the information retrieval component can perform information retrieval in the knowledge graph based on the query text, so as to assist the large language model in generating answer text corresponding to the query text through the retrieved relevant information.
[0060] It should be noted that the server can also be equipped with other functional components or subsystems such as a prompt generation component. These components or subsystems can work in conjunction with the large language model installed on the server to jointly generate answer text corresponding to the query text.
[0061] In addition, there can be only one large language model in the above-mentioned money laundering risk identification system, and the large language model can be used to perform dialogue tasks or question-answering tasks, and can also be used to perform other tasks such as concept extraction tasks, embedding processing tasks, answer completeness judgment tasks, etc.
[0062] Alternatively, there may be multiple large language models in the money laundering risk identification system. In addition to the large language models for performing dialogue tasks or question-answering tasks, these large language models may also include large language models for performing concept extraction tasks, large language models for performing embedding processing tasks, and / or large language models for performing answer integrity determination tasks.
[0063] The following describes in detail the question-answering method based on a large language model in this application from two aspects: graph construction and intelligent question-answering combined with graphs.
[0064] 1. Graph Construction
[0065] First, it should be noted that in the constructed graph, a node can represent a text block divided from one or more documents. For example, the text block can be used as an attribute of the node. An edge can connect two nodes. This edge is used to indicate that the text blocks corresponding to the two nodes connected to it are associated with each other. This edge can also be assigned a weight based on the degree of association between the text blocks corresponding to the two nodes. The weight can be considered an attribute of the edge. For example, suppose an edge in the graph connects node A and node B. Node A represents text block A, and node B represents text block B. Then this edge is used to indicate that text block A is associated with text block B, and the weight of this edge can represent the degree of association between text block A and text block B.
[0066] In practical applications, the text blocks segmented from a document can be a chapter, a paragraph, or several sentences that convey a complete meaning. In the field of anti-money laundering, the documents segmented into text blocks can include anti-money laundering laws and regulations, anti-money laundering public opinion information, and money laundering risk warnings. In other words, documents related to anti-money laundering can be segmented into multiple text blocks, and the above-mentioned graph can be constructed based on these text blocks.
[0067] In some embodiments, the individual text blocks divided from the document can be input into a large language model, and the large language model extracts concepts from the individual text blocks. In the field of natural language processing, the concepts extracted from the text blocks can refer to the core ideas, themes, or specific information units identified by analyzing the text content. These concepts can be specific entities (for example: names of people, places, names of organizations, dates, etc.), abstract themes (for example: equality, freedom, etc.), or more complex semantic structures (for example: event descriptions, positive, negative or neutral emotional tendencies, etc.). Concept extraction is usually a multi-level process, involving both understanding of the surface information of the text and deep semantic analysis, which helps to achieve more advanced tasks such as information retrieval and automatic summarization.
[0068] The aforementioned large language model can refer to the serving model of the large language model. In practical applications, the constructed large language model can be pre-trained on a large-scale, unlabeled text dataset using unsupervised learning to obtain the base model of the large language model. Furthermore, the concept extraction task can be used as a supervised learning task during fine-tuning, and a text dataset specific to the concept extraction task can be prepared. The base model of the large language model can then be used as the starting point for fine-tuning, using supervised learning to fine-tune the data on the text dataset specific to the concept extraction task to obtain the serving model of the large language model.
[0069] In some embodiments, after extracting the concepts corresponding to each text block from the text block, nodes in a graph can be constructed based on the text blocks and the concepts corresponding to each text block. In this case, a node in the graph can represent a text block and the concept corresponding to the text block. For example, assuming that concepts A1 and A2 are extracted from text block A, a node A can be added when constructing the graph. Node A can represent (text block A, concept A1, concept A2), that is, the combination of text block A, concept A1, and concept A2.
[0070] By using text blocks and concepts extracted from the text blocks together to construct nodes in the graph, information retrieval can be achieved by matching questions with concepts in the constructed graph, thereby reducing the complexity of information retrieval and improving the efficiency of information retrieval.
[0071] In some embodiments, after extracting the concepts corresponding to each text block from each text block, the semantic similarity between the concepts corresponding to each text block can be further calculated, and based on the calculated semantic similarity, the edges in the above-mentioned graph can be constructed. At this time, an edge in the graph can indicate that the concepts corresponding to the two nodes connected to this edge are semantically similar, and the weight of this edge can indicate the semantic similarity between the concepts corresponding to the two nodes connected to this edge. Semantic similarity refers to a measure of the degree of similarity in meaning between two text fragments (such as words, phrases, sentences or paragraphs). If there are multiple concepts corresponding to two nodes, the maximum value or average value of the semantic similarities between these multiple concepts can be used as the semantic similarity between the concepts corresponding to the two nodes.
[0072] For example, assuming that the concepts corresponding to node A include concept A1 and concept A2, and the concepts corresponding to node B include concept B1 and concept B2, then the semantic similarity 1 between concept A1 and concept B1, the semantic similarity 2 between concept A2 and concept B1, the semantic similarity 3 between concept A1 and concept B2, and the semantic similarity 4 between concept A2 and concept B2 can be calculated, and the maximum value of the four semantic similarities, semantic similarity 1, semantic similarity 2, semantic similarity 3, and semantic similarity 4, can be used as the semantic similarity between the concepts corresponding to node A and node B respectively, or the average value of the four semantic similarities, semantic similarity 1, semantic similarity 2, semantic similarity 3, and semantic similarity 4, can be used as the semantic similarity between the concepts corresponding to node A and node B respectively.
[0073] In practical applications, the semantic similarity between words can be calculated by looking for synonyms, hypernyms, and other relationships; alternatively, a word vector model (such as Word2Vec, GloVe, etc.) can be used to map words into a continuous vector space, and then the distance between these vectors (such as cosine similarity) can be calculated as their semantic similarity; alternatively, deep learning can be used to calculate the semantic similarity between words using a deep learning model.
[0074] It should be noted that when constructing the edges in the above graph, a threshold value (e.g., 0 or 10%) can be set for semantic similarity. If the semantic similarity between the concepts corresponding to two nodes is greater than or equal to the threshold value, the two nodes can be connected by an edge, and the weight of the edge is set to the semantic similarity between the concepts corresponding to the two nodes. If the semantic similarity between the concepts corresponding to the two nodes is less than the threshold value, the two nodes can be left unconnected.
[0075] By connecting the nodes in the constructed graph according to the semantic similarity between the concepts they represent, and the edges connecting the nodes represent the semantic similarity between the concepts, it is possible to use the graph to capture the relationship between text blocks when combining the constructed graph to implement information retrieval, thereby providing more accurate, complete and context-relevant information retrieval results.
[0076] In some embodiments, in order to improve the effect of concept matching and thus improve the accuracy of information retrieval, after extracting the corresponding concepts from each text block, the concepts corresponding to each text block can be lemmatized, and the restored concepts can be used as the concepts corresponding to each text block.
[0077] Lemmatization involves reducing the different morphological variants of a word to its base form, or lemma. Lemmatization considers the word's part of speech (e.g., verb, noun, adjective, etc.) and performs conversions based on grammatical rules and lexical knowledge, ensuring that the lemma results in a valid, actual word. The primary purpose of lemmatization is to standardize text. By normalizing different forms or usages of a word to its base or standard form, it can reduce lexical diversity and improve the effectiveness of tasks such as information retrieval. For example, in English, the plural form of a noun can be reduced to its base form (e.g., "children" is reduced to "child"); or the third-person singular, present participle, past tense, and past participle of a verb can be reduced to their base form (e.g., "walks" is reduced to "walk," "talking" is reduced to "talk," and "gone" is reduced to "go"). Furthermore, the comparative and superlative forms of adjectives and adverbs can be reduced to their base form (e.g., "better" is reduced to "good"). Taking Chinese as an example, traditional Chinese characters can be converted into simplified Chinese, or vice versa, to standardize the text; or different writing forms can be unified into a standard writing method; or, for words with multiple meanings or multiple parts of speech, they can be classified into the most appropriate meaning or part of speech according to the context; or, proper nouns such as names of people and places can be standardized (for example, "Beiping" can be restored to "Beijing").
[0078] Accordingly, when constructing the above-mentioned graph, the nodes in the graph can be constructed based on each text block and the restored concepts corresponding to each text block, and the edges in the graph can be constructed based on the semantic similarity between the restored concepts corresponding to each text block.
[0079] For example, assuming that the text blocks divided from documents in the anti-money laundering field include text block A, text block B, and text block C, concepts A1 and A2 are extracted from text block A, concepts B1 and B2 are extracted from text block B, and concept C is extracted from text block C, then the constructed graph may include node A, node B, and node C, where node A represents (text block A, concept A1, concept A2), node B represents (text block B, concept B1, concept B2), and node C represents (text block C, concept C). Continuing to assume that the semantic similarity between concepts A1 and B1 is 90%, the semantic similarity between concepts A2 and B1 is 0, the semantic similarity between concepts A1 and B2 is 5%, the semantic similarity between concepts A2 and B2 is 80%, the semantic similarity between concepts A1 and C is 0, the semantic similarity between concepts A2 and C is 8%, the semantic similarity between concepts B1 and C is 0, and the semantic similarity between concepts B2 and C is 95%. Then, the semantic similarity between the concepts corresponding to nodes A and B can be determined to be 90%, the semantic similarity between the concepts corresponding to nodes A and C can be determined to be 8%, and the semantic similarity between the concepts corresponding to nodes B and C can be determined to be 95%. Continuing to assume that the threshold for semantic similarity is set to 10%, then in the constructed graph, nodes A and B can be connected by an edge with a weight of 0.9, nodes B and C can be connected by another edge with a weight of 0.95, and nodes A and C are not connected. At this point, the constructed graph can be Figure 2 shown.
[0080] It should be noted that Figure 2 The "A", "B", and "C" in the figure are simplified representations of the node content. The actual content of each node includes text blocks and concepts.
[0081] 2. Intelligent Question Answering with Graphs
[0082] Please refer to Figure 3 , Figure 3 This is a flowchart of a question-answering method based on a large language model, shown as an exemplary embodiment of the present application.
[0083] like Figure 3 As shown, the above-mentioned question answering method based on the large language model may include the following steps:
[0084] Step 302: Calculate the relevance between the query text and each text block segmented from the document, and determine the relevant text blocks from the text blocks based on the relevance.
[0085] In this embodiment, a query text can be used to raise questions. For a query text used to raise questions related to money laundering risk identification, if information retrieval is performed directly based on the query text within the aforementioned graph constructed from text blocks segmented from relevant anti-money laundering documents, a large number of text blocks need to be accessed, resulting in low information retrieval efficiency. To improve information retrieval efficiency, a portion of text blocks relevant to the query text can be first filtered out from all text blocks used to construct the graph, and then information retrieval can be performed within this filtered portion of text blocks.
[0086] Specifically, once the query text is obtained, the association degree with each text block used to construct the graph can be calculated. Based on the calculated association degree, text blocks related to the query text can be identified from these text blocks. The identified text blocks related to the query text can be used as associated text blocks for subsequent information retrieval.
[0087] In some embodiments, to reduce the complexity of calculating the association between texts and improve efficiency, the association between texts can be converted into calculating the similarity between embedding vectors corresponding to the texts. Embedding is used to map high-dimensional sparse data into a low-dimensional dense vector space. For example, words can be converted into vector representations, thereby measuring the similarity between words in a mathematical space.
[0088] Specifically, on the one hand, for each text block used to construct the above-mentioned graph, each text block can be embedded in advance to generate an embedding vector corresponding to each text block (which can be called a second embedding vector), and an index can be constructed based on the second embedding vector corresponding to each text block; on the other hand, when the above-mentioned query text is obtained, the query text can first be embedded to generate an embedding vector corresponding to the query text (which can be called a first embedding vector), and then the constructed index can be used to calculate the similarity between the first embedding vector and each second embedding vector, and based on the calculated similarity, the text block related to the query text can be determined from these text blocks.
[0089] In one example, when determining text blocks related to the query text from the text blocks used to construct the above-mentioned graph based on the calculated similarity, it is possible to first determine a second embedding vector whose similarity with the first embedding vector corresponding to the query text is greater than a preset threshold, and then obtain a text block corresponding to the determined second embedding vector from these text blocks as a text block related to the query text.
[0090] In another example, when determining the text blocks related to the query text from the text blocks used to construct the above-mentioned graph based on the calculated similarity, it is possible to first determine a preset number (i.e., Top K, K is the preset number) of second embedding vectors with the largest similarity to the first embedding vector corresponding to the query text, and then obtain the text blocks corresponding to the determined second embedding vectors from these text blocks as the text blocks related to the query text.
[0091] In some embodiments, a large language model that can perform embedding processing tasks can also be used to perform convenient and accurate embedding processing, that is, the large language model can generate a second embedding vector corresponding to each text block used to construct the above-mentioned graph, and a first embedding vector corresponding to the above-mentioned query text. Specifically, each text block used to construct the graph can be input into the large language model in advance, and the large language model generates a second embedding vector corresponding to each text block; subsequently, when the query text is obtained, the query text can be input into the large language model, and the large language model generates a first embedding vector corresponding to the query text. Using the same large language model to generate embedding vectors corresponding to the text blocks and the query text respectively can ensure the uniformity of the generated embedding vectors, avoid differences in embedding vectors due to different embedding processing methods adopted, and improve the accuracy of similarity calculations.
[0092] The aforementioned large language model can refer to the serving model of the large language model. In practical applications, the constructed large language model can be pre-trained on a large-scale, unlabeled text dataset using unsupervised learning to obtain the base model of the large language model. Furthermore, the embedding processing task can be used as a supervised learning task during fine-tuning, and a text dataset specific to the embedding processing task can be prepared. The base model of the large language model can then be used as the starting point for fine-tuning, and fine-tuned on the text dataset specific to the embedding processing task using supervised learning to obtain the serving model of the large language model.
[0093] Step 304: Determine a target text block from the associated text blocks, and based on the graph, obtain each associated text block from the graph in descending order of semantic similarity between the corresponding concept and the concept corresponding to the target text block; wherein each node in the graph represents each text block; each edge in the graph represents that the concept corresponding to the text block represented by the node connected to the edge is semantically similar, and the weight of each edge represents the semantic similarity between the concepts corresponding to the text block represented by the node connected to the edge.
[0094] In this embodiment, since each node in the above-constructed graph can represent each text block, each edge can represent that the concepts corresponding to the text blocks represented by the two nodes connected to it are semantically similar, and the weight of each edge can represent the semantic similarity between the concepts corresponding to the text blocks represented by the two nodes connected to it, when the above-mentioned associated text blocks are determined, an associated text block can be further determined from these associated text blocks as the target text block, and based on the graph, each associated text block can be obtained from the graph in descending order of the semantic similarity between the corresponding concept and the concept corresponding to the target text block.
[0095] Specifically, for any associated text block, the semantic similarity between the concept corresponding to the associated text block and the concept corresponding to the target text block is the sum of the semantic similarities represented by the weights of the series of edges connecting the node corresponding to the target text block with the node corresponding to the associated text block in the graph. This series of edges, and the nodes connected by each edge, together constitute the path from the node corresponding to the target text block to the node corresponding to the associated text block. Therefore, based on this graph, the nodes corresponding to each associated text block can be accessed in sequence in the graph in descending order of the sum of the semantic similarities represented by the weights of the series of edges connecting the node corresponding to the target text block with the nodes corresponding to each associated text block, thereby sequentially obtaining each associated text block from the graph.
[0096] It should be noted that, taking any associated text block as an example, in the above figure, if there are multiple paths from the node corresponding to the above target text block to the node corresponding to the associated text block, the minimum value of the sum of the semantic similarities represented by the weights of the series of edges contained in these paths can be used as the semantic similarity between the concept corresponding to the associated text block and the concept corresponding to the target text block; or, the sum of the semantic similarities represented by the weights of the series of edges contained in each path can be calculated separately, and the average value of the sum of the semantic similarities corresponding to these paths can be used as the semantic similarity between the concept corresponding to the associated text block and the concept corresponding to the target text block. Based on this figure, the method for calculating the semantic similarity between the concepts corresponding to each associated text block and the concept corresponding to the target text block can be set according to actual conditions and needs, and this application does not impose any special restrictions on this.
[0097] For example, assuming that the node corresponding to the target text block is node A, and the node corresponding to a certain associated text block is node X, and assuming that in the above graph, the paths from node A to node X include two paths: A→B→X and A→C→X, then the sum of the semantic similarities represented by the weights of the two edges included in the path A→B→X (the edge connecting nodes A and B, and the edge connecting nodes B and X) can be calculated (represented by R1), and the sum of the semantic similarities represented by the weights of the two edges included in the path A→C→X (the edge connecting nodes A and C, and the edge connecting nodes C and X) can be calculated (represented by R2). If R1>R2, then R2 can be determined as the semantic similarity between the concept corresponding to the associated text block and the concept corresponding to the target text block. Alternatively, the average of R1 and R2 can be determined as the semantic similarity between the concept corresponding to the associated text block and the concept corresponding to the target text block.
[0098] In some embodiments, determining the target text block from the associated text blocks may specifically include determining the associated text block having the greatest degree of association with the query text as the target text block.
[0099] In practical applications, the associated text block with the highest degree of relevance to the query text is typically most likely to answer the question posed by the query text. In the constructed graph, other associated text blocks with even greater relevance to the associated text block are also more likely to answer the question. Therefore, by selecting the associated text block with the highest degree of relevance to the query text as the target text block, the number of associated text blocks required to be retrieved from the graph can be minimized, improving the efficiency of information retrieval and, ultimately, the effectiveness of money laundering risk identification systems using RAGs.
[0100] In some embodiments, the weight of each edge in the constructed graph may represent the semantic similarity between the concepts corresponding to the text blocks represented by the two nodes connected to it. However, the specific value of the weight of each edge may be inversely proportional to the semantic similarity between the concepts corresponding to the text blocks represented by the two nodes connected to it. Taking any edge in the graph as an example, assuming that the semantic similarity between the concepts corresponding to the text blocks represented by the two nodes connected to this edge is 0.8, the weight of this edge may be set to 1 / 0.8 = 1.25.
[0101] Furthermore, based on the above graph, each associated text block is obtained from the graph in sequence according to the order of semantic similarity between the corresponding concept and the concept corresponding to the above target text block from large to small. Specifically, this may include calculating the shortest path from the node corresponding to the target text block to the node corresponding to each associated text block based on the graph, so as to obtain each associated text block from the graph in sequence according to the order in which these shortest paths are calculated.
[0102] For example, assuming that the node corresponding to the target text block is node A, and the nodes corresponding to the associated text blocks include node B, node C, and node D, then based on the graph, the shortest paths from node A to node B, node C, and node D can be calculated respectively. If the shortest path from node A to node B is calculated first, then the shortest path from node A to node D is calculated, and finally the shortest path from node A to node C is calculated, then the associated text block corresponding to node B can be obtained from the graph first, then the associated text block corresponding to node D can be obtained from the graph, and finally the associated text block corresponding to node C can be obtained from the graph.
[0103] To facilitate the calculation of the shortest path, based on a Dijkstra-like algorithm and the graph, the associated text blocks can be obtained from the graph in descending order of their association with the target text block.
[0104] Assume that the above graph is constructed as Figure 4 As shown in the figure, the node corresponding to the target text block is node A, and the nodes corresponding to the associated text blocks include node B, node C, and node D.
[0105] It should be noted that Figure 4 The "A", "B", "C", "D", and "E" in the figure are simplified representations of the node content. The actual content of each node includes text blocks and concepts.
[0106] According to the Dijkstra-like algorithm, an initial setup can be performed. In the initial setup, node A is selected as the starting node, and nodes A, B, C, and D are added to a priority queue (mainly used to efficiently select the node with the shortest current distance and that has not been processed). They are sorted in the priority queue based on their current shortest distance. Furthermore, the distance of node A in the distance table is initialized to 0, the distances of all other nodes are initialized to infinity, and the predecessor nodes of all nodes in the predecessor table are initialized to empty, as shown in Table 1 below:
[0107] Table 1
[0108]
[0109]
[0110] In the first iteration, node A with the smallest distance can be taken from the priority queue and its neighbor nodes B and C can be processed. Specifically, the distance of node B can be updated to 2, with node A as its predecessor, and the distance of node C can be updated to 6, with node A as its predecessor. That is, the distance table and the predecessor table can be updated as shown in Table 2 below:
[0111] Table 2
[0112] A 0 null B 2 A C 6 A D ∞ null
[0113] In the first iteration, the shortest path from node A to node A itself is determined, so the text block corresponding to node A can be obtained from the above graph, that is, the above target text block.
[0114] In the second iteration, the node B with the smallest distance can be taken out from the priority queue and its neighbor nodes C and D can be processed. Specifically, the distance of node C can be updated to 1+2=3, and the predecessor is A→E. The distance of node D can be updated to 2+4=6, and the predecessor is A→B. That is, the distance table and the predecessor table can be updated as shown in Table 3 below:
[0115] Table 3
[0116] A 0 null B 2 A C 3 A→E D 6 A→B
[0117] In the second iteration, the shortest path from node A to node B is determined, so the associated text block corresponding to node B can be obtained from the above graph.
[0118] In the third iteration, the node C with the smallest distance can be taken out from the priority queue and its neighbor node D can be processed. At this time, the distance of node D is already the smallest, so the distance of node D does not need to be updated, that is, the distance table and the predecessor table can be maintained as shown in Table 3 above.
[0119] In the third iteration, the shortest path from node A to node C is determined, so the associated text block corresponding to node C can be obtained from the above graph.
[0120] In the fourth iteration, the node D with the smallest distance can be taken out from the priority queue. Node D has no unprocessed neighbor nodes, so no distance needs to be updated.
[0121] In the fourth iteration, the shortest path from node A to node D is determined, so the associated text block corresponding to node D can be obtained from the above graph.
[0122] In summary, the order of obtaining the four associated text blocks corresponding to node A, node B, node C, and node D is: the associated text block corresponding to node A → the associated text block corresponding to node B → the associated text block corresponding to node C → the associated text block corresponding to node D.
[0123] Step 306: When each associated text block is obtained, the context used to generate the answer text corresponding to the query text is updated based on the associated text block, and the query text and the updated context are input into the large language model, and the large language model performs inference based on the query text and the updated context to generate the answer text corresponding to the query text.
[0124] In this embodiment, each associated text block can be sequentially obtained from the constructed graph, and each time an associated text block is obtained, the context (Context) used to generate the answer text corresponding to the query text can be updated based on the obtained associated text block. Subsequently, the query text and the updated context can be input into a large language model, which responds to the input and outputs the response content, that is, reasoning is performed based on the query text and the updated context to generate the answer text corresponding to the query text with the assistance of the updated context. For example, a prompt text can be further constructed based on the query text and the updated context, and the constructed prompt text can be input into the large language model, which generates the answer text corresponding to the query text under the guidance of the prompt text and with the assistance of the updated context.
[0125] It should be noted that when updating the context based on the acquired associated text blocks, the associated text blocks can be sorted within the updated context according to the order in which they were acquired. Specifically, associated text blocks acquired first can be arranged first, while associated text blocks acquired later can be arranged last. When generating an answer text corresponding to the query text based on the query text and the updated context, the large language model can rely more heavily on the associated text blocks ranked first within the updated context. In other words, it can refer more closely to the associated text blocks ranked first within the updated context when generating an answer text corresponding to the query text. Since the associated text blocks ranked first within the updated context correspond to concepts with a higher semantic similarity to the concept corresponding to the target text block, this means that when generating an answer text corresponding to the query text, not only the correlation between the query text itself and these associated text blocks is considered, but also the correlation between these associated text blocks. This can further improve the response accuracy of a money laundering risk identification system based on the large language model and using RAG.
[0126] In some embodiments, after the above context is updated, it may be further determined whether the updated context contains a complete answer corresponding to the query text.
[0127] If it is determined that the updated context for generating the answer text corresponding to the query text contains a complete answer to the query text, the query text and the updated context can be input into the large language model, which then responds to the input and outputs a response. In other words, the large language model performs reasoning based on the query text and the updated context to generate the answer text corresponding to the query text with the assistance of the updated context. For example, a prompt text can be further constructed based on the query text and the updated context, and the constructed prompt text can be input into the large language model. The large language model, guided by the prompt text and assisted by the updated context, generates the answer text corresponding to the query text.
[0128] It should be noted that if the updated context for generating the answer text corresponding to the above-mentioned query text is determined, then even if all associated text blocks have not yet been obtained from the above-mentioned graph, the acquisition of associated text blocks from the graph can be stopped, thereby reducing the number of associated text blocks that need to be obtained from the graph, improving the efficiency of information retrieval, and improving the efficiency of the money laundering risk identification system using RAG.
[0129] In some embodiments, a large language model can be used to conveniently and accurately determine the completeness of an answer. Specifically, after updating the context, the updated context can be input into the large language model, which then determines whether the updated context contains a complete answer corresponding to the query text.
[0130] The aforementioned large language model can refer to the serving model of the large language model. In practical applications, the constructed large language model can be pre-trained on a large-scale, unlabeled text dataset using unsupervised learning to obtain the base model of the large language model. Furthermore, the answer completeness determination task can be used as a supervised learning task during fine-tuning, and a text dataset specific to the answer completeness determination task can be prepared. The base model of the large language model can then be used as the starting point for fine-tuning, using supervised learning to perform fine-tuning on the text dataset specific to the answer completeness determination task to obtain the serving model of the large language model.
[0131] In some embodiments, when the last associated text block is acquired, the context used to generate the answer text corresponding to the query text may also be updated based on the associated text block. After the context is updated, if it is determined that the updated context still does not contain a complete answer corresponding to the query text, then since it can be detected that the acquisition of associated text blocks has been completed, i.e., all associated text blocks have been acquired, the query text and the updated context can be input into the large language model. The large language model then performs inference based on the query text and the updated context to generate the answer text corresponding to the query text with the assistance of the updated context.
[0132] That is, even if all the associated text blocks related to the above-mentioned query text are merged together, it is still impossible to form a complete answer corresponding to the query text. It is also possible to directly generate an answer text corresponding to the query text based on the query text and all the associated text blocks, thereby ensuring that the answer text corresponding to the input query text can always be output.
[0133] In some embodiments, the constructed graph can be visualized to facilitate user review of the basis for money laundering risk identification. Furthermore, once the answer text is generated and output, the graph can further visually annotate the associated text blocks included in the context used to generate the answer text, as well as the order in which the associated text blocks within the context were obtained. Visual annotation can include bolding, italicizing, underlining, displaying in a different color, or displaying in a different font, among other options.
[0134] In such Figure 4 Based on the above diagram constructed as shown, assuming that the associated text blocks included in the context used to generate the above answer text are underlined and displayed, and the order in which the associated text blocks included in the context are obtained is displayed in the form of dotted lines, the diagram can be updated as follows Figure 5 shown.
[0135] like Figure 5 As shown, the node contents (including text blocks and concepts) represented by "A", "B", "C", and "D" are displayed after being underlined; the order of obtaining associated text blocks is the associated text block corresponding to node A → the associated text block corresponding to node B → the associated text block corresponding to node C → the associated text block corresponding to node D, so the path of node A → node B → node C → node D can be displayed in the form of a dotted line.
[0136] In some embodiments, to facilitate user review of the basis for money laundering risk identification, after the answer text is generated and output, the answer text and the context used to generate the answer text may also be output to the user. Because the associated text blocks are essentially text blocks segmented from the document, the user can be guaranteed to view the original text that serves as the basis for money laundering risk identification.
[0137] It should be noted that the large language model used to perform dialogue tasks or question-answering tasks, the large language model used to perform concept extraction tasks, the large language model used to perform embedding processing tasks, and the large language model used to perform answer completeness judgment tasks in this application can be multiple different large language models or the same large language model, that is, these large language models can also refer to different services provided by the same large language model, which can be specifically set according to actual needs, and this application does not impose any special restrictions on this.
[0138] In the technical solution provided by one or more embodiments of the present application, a graph can be pre-constructed, in which each node in the graph can represent each text block, each edge can represent that the concepts corresponding to the text blocks represented by the nodes connected by the edges are semantically similar, and the weight of each edge can represent the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edges; subsequently, the correlation between the query text and the text blocks divided by the document can be first calculated, and based on the calculated correlation, the associated text blocks can be determined from these text blocks, and then the target text blocks can be determined from these associated text blocks, and based on the graph, the associated text blocks can be obtained from the graph in descending order of the semantic similarity between the corresponding concepts and the concepts corresponding to the target text blocks, and when each associated text block is obtained, the context used to generate the answer text corresponding to the query text can be updated based on the obtained associated text block, and the query text and the updated context can be input into the large language model, and the large language model performs reasoning based on the query text and the updated context to generate the answer text corresponding to the query text.
[0139] By adopting the above method, it is possible to use large language model technology to improve the automation and effectiveness of money laundering risk identification in anti-money laundering work; in addition, for the money laundering risk identification system based on the large language model and using RAG, the efficiency, adaptability and response accuracy of the money laundering risk identification system can be improved.
[0140] Corresponding to the aforementioned method embodiments, the present application also provides device embodiments.
[0141] Please refer to Figure 6 , Figure 66 is a structural diagram of a device shown in an exemplary embodiment of the present application. At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608 and a non-volatile memory 610, and of course may also include other required hardware. One or more embodiments of the present application can be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to software implementation, one or more embodiments of the present application do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic module, but can also be hardware or logic devices.
[0142] Please refer to Figure 7 , Figure 7 This is a block diagram of a question-answering device based on a large language model, shown as an exemplary embodiment of the present application.
[0143] The above-mentioned question-answering device based on the large language model can be applied to Figure 6 The device shown in the figure is used to implement the technical solution of this application. The device includes:
[0144] The text block determination module 702 calculates the relevance between the query text and each text block segmented from the document, and determines a related text block from the text blocks based on the relevance;
[0145] The text block acquisition module 704 determines a target text block from the associated text blocks and, based on the graph, sequentially acquires the associated text blocks from the graph in descending order of semantic similarity between the corresponding concepts and the concept corresponding to the target text block; wherein each node in the graph represents a text block; each edge in the graph represents semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge; and the weight of each edge represents the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge;
[0146] A context updating module 706 updates the context used to generate the answer text corresponding to the query text based on the associated text blocks when each associated text block is obtained, and determines whether the updated context contains a complete answer corresponding to the query text;
[0147] The answer generation module 706, when obtaining each associated text block, updates the context used to generate the answer text corresponding to the query text based on the associated text block, and inputs the query text and the updated context into the large language model. The large language model performs inference based on the query text and the updated context to generate the answer text corresponding to the query text.
[0148] In some embodiments, when each associated text block is obtained, a context for generating an answer text corresponding to the query text is updated based on the associated text block, and the query text and the updated context are input into a large language model, and the large language model performs reasoning based on the query text and the updated context to generate an answer text corresponding to the query text, including:
[0149] When each associated text block is obtained, updating the context used to generate the answer text corresponding to the query text based on the associated text block, and determining whether the updated context contains a complete answer corresponding to the query text;
[0150] If the updated context contains the complete answer, the query text and the updated context are input into a large language model, and the large language model performs reasoning based on the query text and the updated context to generate an answer text corresponding to the query text.
[0151] In some embodiments, the apparatus further comprises:
[0152] A concept extraction module inputs each text block into a large language model, extracts concepts from each text block by the large language model, and determines the concepts extracted from the text block as concepts corresponding to the text block;
[0153] A calculation module calculates the semantic similarity between the concepts corresponding to each text block;
[0154] The graph construction module constructs nodes in the graph based on each text block and its corresponding concept, and constructs edges in the graph based on the semantic similarity between the concepts corresponding to each text block; wherein each node in the graph represents each text block and its corresponding concept.
[0155] In some embodiments, inputting each text block into a large language model, extracting concepts from each text block by the large language model, and determining the concepts extracted from the text block as concepts corresponding to the text block includes:
[0156] Inputting each text block into a large language model, and extracting concepts from each text block by the large language model;
[0157] Lemma restoration is performed on the concepts extracted from each text block to obtain restored concepts, and the restored concepts are determined as concepts corresponding to the text block.
[0158] In some embodiments, calculating the relevance between the query text and each text block segmented from the document, and determining the relevant text block from the text blocks based on the relevance, includes:
[0159] Embedding the query text to generate a first embedding vector corresponding to the query text, and obtaining second embedding vectors corresponding to the respective text blocks segmented from the document;
[0160] The similarity between the first embedding vector and each second embedding vector is calculated, and based on the similarity, associated text blocks are determined from the text blocks.
[0161] In some embodiments, the second embedding vector is an embedding vector corresponding to each text block generated by a large language model by embedding each text block into which the document is segmented;
[0162] The embedding process of the query text to generate a first embedding vector corresponding to the query text includes:
[0163] The query text is input into the large language model, and the large language model performs embedding processing on the query text to generate a first embedding vector corresponding to the query text.
[0164] In some embodiments, determining whether the updated context contains a complete answer corresponding to the query text includes:
[0165] The updated context is input into a large language model, so that the large language model determines whether the updated context contains a complete answer corresponding to the query text.
[0166] In some embodiments, the answer generation module 708 is further configured to:
[0167] If the updated context does not contain the complete answer and the acquisition of the associated text block is completed, the query text and the updated context are input into the large language model, and the large language model performs reasoning based on the query text and the updated context to generate an answer text corresponding to the query text.
[0168] In some embodiments, determining the target text block from the associated text blocks includes:
[0169] The associated text block with the greatest degree of association with the query text is determined as the target text block.
[0170] In some embodiments, the weight of each edge in the graph is inversely proportional to the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge;
[0171] The step of obtaining the associated text blocks from the graph in descending order of their relevance to the target text block based on the graph includes:
[0172] Based on the graph, the shortest paths from the node representing the target text block to the nodes representing the associated text blocks are calculated, so as to sequentially obtain the associated text blocks from the graph in the order in which the shortest paths are calculated.
[0173] In some embodiments, the apparatus further comprises:
[0174] A visualization module performs visualization processing on the graph and, after generating the answer text, visually annotates in the graph the associated text blocks included in the context used to generate the answer text and the order in which they are obtained.
[0175] In some embodiments, the answer generation module 708 is further configured to:
[0176] After the answer text is generated, the answer text and the context used to generate the answer text are output to the user.
[0177] For the device embodiments, they basically correspond to the method embodiments, so for relevant details, please refer to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the technical solution of this application.
[0178] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or physical devices, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.
[0179] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0180] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0181] Computer-readable media include permanent and non-permanent, removable and non-removable media that can implement information storage by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0182] It should be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0183] The above description is of specific embodiments of the present application. Other embodiments are within the scope of this application. In some cases, the actions or steps described in this application can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0184] The terms used in one or more embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present application. The singular forms "a," "the," and "the" are also intended to include the plural forms unless the context clearly indicates otherwise. The term "and / or" refers to and includes any or all possible combinations of one or more of the associated listed items.
[0185] The terms "one embodiment," "some embodiments," "example," "specific example," or "one implementation" used in one or more embodiments of the present application mean that the specific features or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present application. The schematic descriptions of these terms do not necessarily refer to the same embodiment. Moreover, the specific features or characteristics described can be combined in an appropriate manner in one or more embodiments of the present application. In addition, different embodiments and specific features or characteristics in different embodiments can be combined without conflict.
[0186] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0187] The above description is merely a preferred embodiment of one or more embodiments of the present application and is not intended to limit one or more embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application shall be included in the scope of protection of one or more embodiments of the present application.
[0188] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
Claims
1. A question-answering method based on a large language model, the method comprising: Calculating the relevance between the query text and each text block segmented from the document, and determining a related text block from the text blocks based on the relevance; A target text block is determined from the associated text blocks, and based on a graph, each associated text block is sequentially obtained from the graph in descending order of semantic similarity between the corresponding concepts and the concept corresponding to the target text block; wherein each node in the graph represents a text block; each edge in the graph represents semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge, and the weight of each edge represents the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge; When each associated text block is obtained, the context used to generate the answer text corresponding to the query text is updated based on the associated text block, and the query text and the updated context are input into the large language model, and the large language model performs inference based on the query text and the updated context to generate the answer text corresponding to the query text.
2. The method according to claim 1, wherein upon obtaining each associated text block, a context for generating an answer text corresponding to the query text is updated based on the associated text block, and the query text and the updated context are input into a large language model, whereby the large language model performs inference based on the query text and the updated context to generate an answer text corresponding to the query text, comprising: When each associated text block is obtained, updating the context used to generate the answer text corresponding to the query text based on the associated text block, and determining whether the updated context contains a complete answer corresponding to the query text; If the updated context contains the complete answer, the query text and the updated context are input into a large language model, and the large language model performs reasoning based on the query text and the updated context to generate an answer text corresponding to the query text.
3. The method according to claim 1, further comprising: Inputting each text block into a large language model, extracting concepts from each text block by the large language model, and determining the concepts extracted from the text blocks as concepts corresponding to the text blocks; Calculate the semantic similarity between the concepts corresponding to each text block; Based on each text block and its corresponding concept, the nodes in the graph are constructed, and based on the semantic similarity between the concepts corresponding to each text block, the edges in the graph are constructed; wherein each node in the graph represents each text block and its corresponding concept.
4. The method according to claim 3, wherein inputting each text block into a large language model, extracting concepts from each text block by the large language model, and determining the concepts extracted from the text block as concepts corresponding to the text block comprises: Inputting each text block into a large language model, and extracting concepts from each text block by the large language model; Lemma restoration is performed on the concepts extracted from each text block to obtain restored concepts, and the restored concepts are determined as concepts corresponding to the text block.
5. The method according to claim 1, wherein calculating the relevance between the query text and each text block segmented from the document, and determining the relevant text blocks from the text blocks based on the relevance, comprises: Embedding the query text to generate a first embedding vector corresponding to the query text, and obtaining second embedding vectors corresponding to the respective text blocks segmented from the document; The similarity between the first embedding vector and each second embedding vector is calculated, and based on the similarity, associated text blocks are determined from the text blocks.
6. The method according to claim 5, wherein the second embedding vector is an embedding vector corresponding to each text block generated by embedding each text block segmented from the document using a large language model; The embedding process of the query text to generate a first embedding vector corresponding to the query text includes: The query text is input into the large language model, and the large language model performs embedding processing on the query text to generate a first embedding vector corresponding to the query text.
7. The method according to claim 2, wherein determining whether the updated context contains a complete answer corresponding to the query text comprises: The updated context is input into a large language model, so that the large language model determines whether the updated context contains a complete answer corresponding to the query text.
8. The method according to claim 2, further comprising: If the updated context does not contain the complete answer and the acquisition of the associated text block is completed, the query text and the updated context are input into the large language model, and the large language model performs reasoning based on the query text and the updated context to generate an answer text corresponding to the query text.
9. The method according to claim 1, wherein determining the target text block from the associated text blocks comprises: The associated text block with the greatest degree of association with the query text is determined as the target text block.
10. The method according to claim 1, wherein the weight of each edge in the graph is inversely proportional to the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge; The step of obtaining the associated text blocks from the graph in descending order of their relevance to the target text block based on the graph includes: Based on the graph, the shortest paths from the node representing the target text block to the nodes representing the associated text blocks are calculated, so as to sequentially obtain the associated text blocks from the graph in the order in which the shortest paths are calculated.
11. The method according to claim 1 , further comprising: The graph is visualized, and after the answer text is generated, the associated text blocks included in the context used to generate the answer text and the order in which they are obtained are visually annotated in the graph.
12. The method according to claim 1, further comprising: After the answer text is generated, the answer text and the context used to generate the answer text are output to the user.
13. A question-answering device based on a large language model, comprising: a text block determination module that calculates the relevance between the query text and the text blocks into which the document is segmented, and determines a related text block from the text blocks based on the relevance; a text block acquisition module that determines a target text block from the associated text blocks and, based on a graph, sequentially acquires the associated text blocks from the graph in descending order of semantic similarity between the corresponding concepts and the concept corresponding to the target text block; wherein each node in the graph represents a text block; each edge in the graph represents semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge, and the weight of each edge represents the semantic similarity between the concepts corresponding to the text blocks represented by the nodes connected by the edge; The answer generation module, when obtaining each associated text block, updates the context used to generate the answer text corresponding to the query text based on the associated text block, and inputs the query text and the updated context into the large language model. The large language model performs inference based on the query text and the updated context to generate the answer text corresponding to the query text.
14. An electronic device comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 12 by running the executable instructions.
15. A computer-readable storage medium having computer instructions stored thereon, wherein when the instructions are executed by a processor, the method according to any one of claims 1 to 12 is implemented.