Information matching method and device, equipment and storage medium
By constructing a directory tree and using feature extraction and scoring networks to calculate node and path scores, and pruning the directory tree, the problem of high computational complexity in intelligent question answering systems is solved, and matching efficiency and accuracy are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2021-07-08
- Publication Date
- 2026-05-29
AI Technical Summary
In intelligent question-answering systems, existing technologies calculate the matching score between user questions and each answer in the answer database one by one, which results in high computational complexity when the answer database is large.
The candidate information is constructed into a directory tree. The feature extraction network and the node and path scoring network are used to calculate the node and path scores. The directory tree is pruned, and only branches with high matching degree are calculated to reduce the computational complexity.
By using directory tree pruning techniques, the computational complexity of the information matching process is reduced, and the efficiency and accuracy of the matching results are improved.
Smart Images

Figure CN113821610B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to an information matching method, apparatus, device, and storage medium. Background Technology
[0002] In an intelligent question-answering system, the system needs to retrieve a matching answer from the answer database based on the question provided by the user and provide the answer to the user.
[0003] In related technologies, the user-provided question is matched one by one with all the answers in the answer database, and the highest-scoring answer is selected and fed back to the user. This method requires calculating the matching score between the question and each answer in the answer database separately, which is computationally complex when there are a large number of candidate answers in the answer database. Summary of the Invention
[0004] This application provides an information matching method, apparatus, device, and storage medium, which can reduce the computational complexity of information matching. The technical solution is as follows:
[0005] According to one aspect of the embodiments of this application, an information matching method is provided, the method comprising:
[0006] Obtain query information and directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node.
[0007] The root node of the directory tree is used as the first node for initialization, and the child nodes of the root node are used as the second nodes for initialization. Based on the query information and the candidate information corresponding to the second node, the node score and path score corresponding to each second node are calculated respectively. The node score is used to indicate the correctness of the node selection, and the path score is used to indicate the correctness of the path selection.
[0008] For a target second node whose path score does not meet the first condition, remove the target second node and its descendant nodes from the directory tree;
[0009] If there are still remaining second nodes in the directory tree, then the remaining second nodes are taken as new first nodes, and the child nodes of the remaining second nodes are taken as new second nodes. Then, the process starts again from the step of calculating the node score and path score of each second node based on the query information and the candidate information corresponding to the second node.
[0010] If there are no remaining second nodes in the directory tree, then candidate information corresponding to the target node that meets the second condition is selected from the nodes that have not been removed from the directory tree, and used as the matching result corresponding to the query information.
[0011] According to one aspect of the embodiments of this application, a training method for an information matching model is provided, the information matching model including a feature extraction network, a node scoring network, and a path scoring network; the method includes:
[0012] Multiple training samples are constructed based on a directory tree. Each training sample includes information to be matched and candidate information corresponding to a sample node selected from the directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node.
[0013] The feature extraction network is used to obtain the matching representation vector of the information to be matched and the candidate information corresponding to the sample node;
[0014] The node scoring network outputs the predicted node score corresponding to the sample node based on the matching representation vector, and the node score is used to indicate the correctness of the node selection.
[0015] The path scoring network outputs the predicted path score of the sample node based on the matching representation vector, and the path score is used to indicate the correctness of the path selection.
[0016] The model training loss is calculated based on the predicted values of the node scores and the predicted values of the path scores.
[0017] The network parameters of the information matching model are adjusted according to the model training loss to obtain a fully trained information matching model; wherein, the fully trained information matching model is used to provide matching results corresponding to the query information based on the directory tree.
[0018] According to one aspect of the embodiments of this application, an information matching apparatus is provided, the apparatus comprising:
[0019] The information acquisition module is used to acquire query information and a directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node.
[0020] The score calculation module is used to initialize the root node of the directory tree as the first node and the child nodes of the root node as the second nodes. Based on the query information and the candidate information corresponding to the second node, it calculates the node score and path score corresponding to each second node respectively. The node score is used to indicate the correctness of the node selection, and the path score is used to indicate the correctness of the path selection.
[0021] The node removal module is used to remove the target second node and its descendant nodes from the directory tree for target second nodes whose path scores do not meet the first condition.
[0022] The score calculation module is also used to, when there are still remaining second nodes in the directory tree, take the remaining second nodes as new first nodes, take the child nodes of the remaining second nodes as new second nodes, and execute the step of calculating the node score and path score corresponding to each second node based on the query information and the candidate information corresponding to the second node again.
[0023] The result determination module is used to select candidate information corresponding to the target node that meets the second condition from the nodes that have not been removed in the directory tree when there is no remaining second node in the directory tree, and use it as the matching result corresponding to the query information.
[0024] According to one aspect of the embodiments of this application, a training apparatus for an information matching model is provided, the information matching model including a feature extraction network, a node scoring network, and a path scoring network; the apparatus includes:
[0025] The sample construction module is used to construct multiple training samples based on the directory tree. Each training sample includes information to be matched and candidate information corresponding to the sample nodes selected from the directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents that the candidate information corresponding to the parent node and the candidate information corresponding to the child node have a hierarchical relationship.
[0026] The feature extraction module is used to obtain a matching representation vector of the information to be matched and the candidate information corresponding to the sample node through the feature extraction network;
[0027] The node scoring module is used to output the predicted value of the node score corresponding to the sample node based on the matching representation vector through the node scoring network. The node score is used to indicate the correctness of the node selection.
[0028] The path scoring module is used to output the predicted value of the path score corresponding to the sample node through the path scoring network based on the matching representation vector. The path score is used to indicate the correctness of the path selection.
[0029] The loss calculation module is used to calculate the model training loss based on the predicted values of the node scores and the predicted values of the path scores;
[0030] The parameter adjustment module is used to adjust the network parameters of the information matching model according to the model training loss to obtain a trained information matching model; wherein, the trained information matching model is used to provide matching results corresponding to the query information based on the directory tree.
[0031] According to one aspect of the embodiments of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the above-described information matching method, or to implement the above-described information matching model training method.
[0032] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored in the storage medium, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the above-described information matching method, or to implement the above-described information matching model training method.
[0033] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned information matching method or the aforementioned information matching model training method.
[0034] The technical solutions provided in this application have at least the following beneficial effects:
[0035] By constructing candidate information into a directory tree, and then calculating the matching degree between candidate information and query information corresponding to some nodes in batches based on the directory tree, the calculation results include node scores and path scores. Based on the path scores, the directory tree can be pruned, removing some branches with low matching degree with query information. This eliminates the need to calculate the matching degree between candidate information and query information corresponding to every node in the directory tree, reducing the computational complexity of the entire information matching process and helping to improve the efficiency of obtaining matching results. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1 This is a schematic diagram of the implementation environment of a solution provided in one embodiment of this application;
[0038] Figure 2 This is a schematic diagram of the answer library directory tree provided in one embodiment of this application;
[0039] Figure 3 This is a schematic diagram of the interface of a question-and-answer system provided in one embodiment of this application;
[0040] Figure 4 This is a schematic diagram of a directed acyclic graph of a tree structure provided in one embodiment of this application;
[0041] Figure 5 This is a flowchart of an information matching method provided in one embodiment of this application;
[0042] Figure 6 This is a flowchart of a training method for an information matching model provided in one embodiment of this application;
[0043] Figure 7 This is a flowchart illustrating the model usage process provided in one embodiment of this application;
[0044] Figure 8 This is a schematic diagram of the score calculation process provided in one embodiment of this application;
[0045] Figure 9 This is a flowchart of a model training process provided in one embodiment of this application;
[0046] Figure 10 This is a block diagram of an information matching device provided in one embodiment of this application;
[0047] Figure 11This is a block diagram of a training apparatus for an information matching model provided in one embodiment of this application;
[0048] Figure 12 This is a schematic diagram of the structure of a computer device provided in one embodiment of this application. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0050] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0051] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0052] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close relationship with linguistic research. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0053] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learn-by-doing.
[0054] The technical solutions provided in this application involve technologies such as machine learning and natural language processing in artificial intelligence, which are specifically described and illustrated through the following embodiments.
[0055] Please refer to Figure 1 The diagram illustrates an implementation environment for a solution provided in one embodiment of this application. This implementation environment may include a model training device 10 and a model usage device 20.
[0056] The model training device 10 can be an electronic device such as a computer, server, or intelligent robot, or other electronic devices with strong computing power. The model training device 10 is used to train the information matching model 30. In this embodiment, the information matching model 30 is a neural network model used to calculate the matching degree between two pieces of information. The model training device 10 can use machine learning to train the information matching model 30 to achieve better performance.
[0057] The trained information matching model 30 can be deployed on the model-using device 20 to provide matching results corresponding to the query information. The model-using device 20 can be a terminal device such as a mobile phone, computer, smart TV, multimedia playback device, wearable device, medical device, or a server; this application does not limit this.
[0058] In this embodiment, the information matching model 30 provides matching results corresponding to the query information based on a directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. The directed edges from the parent node to the child node represent that the candidate information corresponding to the parent node and the candidate information corresponding to the child node have a hierarchical relationship.
[0059] In an exemplary embodiment, such as Figure 1As shown, the information matching model 30 includes a feature extraction network 31, a node scoring network 32, and a path scoring network 33. The feature extraction network 31 extracts a matching representation vector between the query information and candidate information corresponding to any node in the directory tree. The node scoring network 32 outputs a node score based on the matching representation vector, indicating the correctness of the node selection. The path scoring network 33 outputs a path score based on the matching representation vector, indicating the correctness of the path selection. The model uses device 20 to prune the directory tree based on the path scores, removing nodes that do not need to be matched with the query information, thereby reducing computational complexity. Finally, the model uses device 20 to select candidate information corresponding to target nodes that meet certain conditions from the remaining nodes in the directory tree, as the matching result for the query information.
[0060] The following method embodiments will detail the usage and training process of the information matching model 30. Furthermore, the information matching model 30 can be applied to matching calculations between texts, images, and other types of information such as audio and video; this application does not limit its application to these applications.
[0061] Taking information matching model 30 for text-to-text matching calculation as an example, a typical application scenario is an intelligent question-answering system. The answer database of an intelligent question-answering system is modeled using a directory tree structure, which is a Directed Acyclic Graph (DAG). The answer database τ 0 =(N 0 E 0 In ), N 0 Let n be a set of nodes. Each node n in the answer set... i =(q i ,a i )∈N 0 This represents a sample in the answer set, containing the sample question q. i And the standard answer a to this example question i , where q i and a i All data is text. Each edge e in the answer database... i = <n p ,n c >∈E 0 This represents a hierarchical relationship between answers in the answer database, where n p For n c The higher-order question and answer, i.e., n p The sample problem can contain n c The example problem. The answer set contains exactly one root node r = (q r ,ar )∈N 0 As the top-level node in the entire answer database, q r an empty string, a r This serves as the default answer for the question-and-answer system, and is the output when the entire answer database fails to match the user's question. An example of an answer database directory tree used in a COVID-19 question-and-answer system is shown below. Figure 2 As shown.
[0062] based on Figure 2 The answer database directory tree shown indicates that the client of the intelligent question-answering system can provide users with question-and-answer services related to the COVID-19 pandemic. For example... Figure 3 As shown, when a user clicks the "COVID-19 Vaccine" button 32 on the main interface 31 of the client, the client displays an introduction interface 33 related to the COVID-19 vaccine. When the user clicks the "Consultation Assistant" button 34 on the introduction interface 33, the client displays a Q&A interface 35. In this Q&A interface 35, the user can select or enter the question they want to ask, and the system will automatically return the answer that best matches the question from the answer database. The client then displays that answer.
[0063] Of course, in addition to being applied to intelligent question-answering systems, the technical solution of this application can also be applied to any application scenario involving the calculation of the matching degree between two pieces of information, such as search systems (providing search results corresponding to search information) and translation systems (providing translation results corresponding to information to be translated). This application does not limit this application.
[0064] In addition, for ease of understanding, let's first combine... Figure 4 This section introduces and explains directed acyclic graphs (DAGs) with tree-like structures. For example... Figure 4 As shown, a directed acyclic graph (DAG) consists of multiple nodes and directed edges connecting them. Each directed edge connects two nodes in a parent-child relationship. Figure 4 In the given equation, there exists a directed edge from node A to node B, where node A is the parent node of node B and node B is the child node of node A. Similarly, there exists a directed edge from node G to node L, where node G is the parent node of node L and node L is the child node of node G.
[0065] The child nodes of a given node are the nodes directly pointed to by a directed edge emanating from that node. For example, the child nodes of node A include nodes B and C, the child nodes of node B include nodes D, E, and F, and the child nodes of node C include nodes G and H.
[0066] The parent node of a given node is the node connected by a directed edge pointing to that node. For example, node B's parent node is node A, node K's parent node is node F, and node E's parent node is node B.
[0067] The descendant nodes of a given node include the node's child nodes, the child nodes' next-level child nodes, the next-level child nodes' next-level child nodes, and so on, until there are no more child nodes. In other words, the descendant nodes of a given node include all lower-level nodes that can be connected to from that node. For example, the descendant nodes of node B include nodes D, E, F, I, J, and K, and the descendant nodes of node C include nodes G, H, L, M, and N.
[0068] An ancestor node of a given node includes its parent node, the parent's next-level parent node, the next-level parent's next-level parent node, and so on, until there are no more parent nodes. In other words, the ancestor nodes of a given node include all the nodes that can be connected to from that node. For example, the ancestor nodes of node J include nodes D, B, and A, and the ancestor nodes of node E include nodes B and A.
[0069] The technical solution of this application will be described below through several embodiments.
[0070] Please refer to Figure 5 The diagram illustrates a flowchart of an information matching method provided in one embodiment of this application. The entity executing each step of this method may be the one described above. Figure 1 The model in the implementation environment of the illustrated scheme uses device 20. The method may include the following steps (510-570):
[0071] Step 510: Obtain query information and directory tree.
[0072] The query information can be user-provided information, and matching results corresponding to the query information are provided based on a directory tree. For example, the query information can be in text form. In an intelligent question-answering system, for instance, the query information could be a question selected or entered by the user.
[0073] The directory tree is a directed acyclic graph (DAG) constructed from multiple nodes, and this DAG has a tree-like structure. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node. Specifically, the candidate information corresponding to the parent node is the higher-level representation of the candidate information corresponding to the child node, and the candidate information corresponding to the child node is the lower-level representation of the candidate information corresponding to the parent node. Optionally, the candidate information corresponding to the root node of the directory tree is the default candidate information. If no candidate information matching the query information exists in any other node of the directory tree besides the root node, this default candidate information is used as the matching result for the query information.
[0074] by Figure 2Taking the answer database directory tree shown as an example, sample question A is "Can you introduce the COVID-19 vaccine?", and sample question B is "How protective is the COVID-19 vaccine?". The node corresponding to sample question A is the parent node of the node corresponding to sample question B; that is, sample question A is the higher-level expression of sample question B, and sample question B is the lower-level expression of sample question A. Furthermore, Figure 2 The root node in the example question corresponds to an empty string, and the corresponding standard answer is "I don't understand what you're saying.", which is the output when the entire answer database cannot match the user's question.
[0075] Step 520: Use the root node of the directory tree as the first node for initialization, and use the child nodes of the root node as the second node for initialization.
[0076] The child nodes of the root node are nodes that are directly connected to the root node through a directed edge, which points from the root node to its child node. The root node can have one or more child nodes.
[0077] Step 530: Based on the query information and the candidate information corresponding to the second node, calculate the node score and path score corresponding to each second node.
[0078] Node scores indicate the correctness of node selection. Node selection correctness refers to the accuracy with which the candidate information corresponding to that node matches the query information. In this example, a higher node score indicates a higher degree of correctness in node selection.
[0079] The path score indicates the correctness of path selection. Path selection correctness refers to the accuracy with which the matching result corresponding to the query information is selected from the candidate information corresponding to the node or its descendant nodes. In this example, a higher path score indicates a higher level of path selection correctness.
[0080] Optionally, step 530 may include the following sub-steps (1-3):
[0081] 1. Obtain the matching representation vector of the query information and the candidate information corresponding to the second node;
[0082] The matching representation vector is a numerical representation of the query information and the candidate information corresponding to the second node. It represents these two pieces of information in vector form, thereby enabling subsequent score calculation.
[0083] Optionally, a feature extraction network is used to process the query information and the candidate information corresponding to the second node, and output a matching representation vector.
[0084] In one example, taking the query information and the candidate information corresponding to the second node as both being text, this step includes the following sub-steps (1-1 to 1-4):
[0085] 1-1. Perform word segmentation on the query information and the candidate information corresponding to the second node to obtain the first word sequence and the second word sequence;
[0086] The first word sequence is the word sequence obtained by segmenting the query information, and the second word sequence is the word sequence obtained by segmenting the candidate information corresponding to the second node. For example, if the query information is q, the candidate information corresponding to the second node is q. i Using the jieba word segmentation tool to segment q and q i Perform word segmentation to obtain the corresponding word sequence t q and t qi Of course, this application does not limit the tools or methods used for word segmentation.
[0087] 1-2. Concatenate the classification embedding, the embedding sequence corresponding to the first word sequence, the delimiter embedding, and the embedding sequence corresponding to the second word sequence to obtain the concatenated embedding sequence;
[0088] After word segmentation, the word sequence t is obtained. q and t qi After that, t q and t qi The concatenation is used as the input format for the feature extraction network. Optionally, for t... q and t qi For each word segment, obtain its corresponding word embedding. A word embedding is a numerical representation of a word segment, also known as a word vector. The first word sequence t... q After each word segment in the sequence is converted into a word embedding, the first word sequence t is obtained. q The corresponding embedding sequence. The second word sequence t qi After each word segment in the sequence is converted into a word embedding, the second word sequence t is obtained. qi The corresponding embedded sequence.
[0089] Furthermore, the aforementioned classification embedding is a word embedding representation of the classification marker. The feature vector corresponding to this classification marker, output by the feature extraction network, is used as the aggregate sequence representation for subsequent classification tasks. The separator embedding is a word embedding representation of the separator marker. The separator marker is used to separate the first word sequence and the second word sequence. For example, the classification marker [CLS] and the first word sequence t... q , delimiter [SEP] and second word sequence t qi By splicing, a spliced sequence is obtained. This is a splicing symbol.
[0090] In one example, we can first define the category identifier [CLS] and the first word sequence t. q , delimiter [SEP] and second word sequence tqi By concatenating the sequences, we obtain the concatenated sequence x. q,qi Then the spliced sequence x q,qi Perform word embedding transformation to obtain the concatenated embedding sequence.
[0091] In another example, we can first perform an embedding transformation to obtain the category embedding, the embedding sequence corresponding to the first word sequence, the separator embedding, and the embedding sequence corresponding to the second word sequence. Then, we can concatenate the above contents to obtain the concatenated embedding sequence.
[0092] 1-3. The concatenated embedded sequence is processed by a feature extraction network to obtain the output feature vector;
[0093] The concatenated embedded sequence is input into a feature extraction network, which performs feature extraction processing to obtain an output feature vector. The feature extraction network can be a neural network structure. For example, it can be a BERT (Bidirectional Encoder Representations from Transformers) model or a derivative model. For instance, for Chinese text, the feature extraction network can use the Chinese-BERT-WWM pre-trained language model. Of course, this application does not limit the feature extraction network to other model structures, such as ESIM (Enhanced Sequential Inference Model).
[0094] 1-4. Extract the feature vector corresponding to the classification embedding from the output feature vector, and use it as the matching representation vector.
[0095] After obtaining the output feature vector of the feature extraction network, the feature vector corresponding to the classification embedding is extracted from the output feature vector and used as the matching representation vector c. q,qi .
[0096] 2. Using a node scoring network, output the node score corresponding to the second node based on the matching representation vector;
[0097] A node scoring network is a neural network used to perform classification tasks. The input data to a node scoring network is a matching representation vector c. q,qi The output is the node score. The node score can range from [0,1], and the larger the node score, the higher the correctness of the node selection.
[0098] 3. The path scoring network outputs the path score corresponding to the second node based on the matching representation vector.
[0099] The path scoring network is also a neural network used to perform classification tasks. The input data for the path scoring network is the matching representation vector c. q,qi The output is the path score. The path score can range from [0,1], and the larger the path score, the higher the accuracy of the path selection.
[0100] Step 540: For the target second node whose path score does not meet the first condition, remove the target second node and its descendant nodes from the directory tree.
[0101] The first condition is set to remove some nodes and their descendant nodes that are not strongly related to the query information (or have a low matching degree), so as to achieve the purpose of pruning the directory tree. This eliminates the need to calculate the matching degree between the candidate information and the query information for each node in the directory tree, thus reducing the amount of computation.
[0102] The first condition may include, but is not limited to, at least one of the following: the path score is greater than a first threshold, and the path score is in the top X% of the score sequence; wherein, the first threshold may be a pre-set value, the score sequence is a sequence obtained by sorting the path scores of each second node in descending order of path score, and X may also be a pre-set value, such as X being 10 or 20.
[0103] In one example, step 540 includes: determining the target second node and the remaining second nodes to be retained from the second nodes; wherein the minimum path score among the remaining second nodes is greater than or equal to the maximum path score among the target second nodes, and the ratio of the number of remaining second nodes to the total number of second nodes is less than or equal to a set coefficient; removing the target second node and its descendant nodes from the directory tree. For example, if the total number of second nodes is 10, and the set coefficient is X%, such as 20%, then the two second nodes with the highest path scores among these 10 second nodes are the remaining second nodes to be retained, and the remaining 8 second nodes are the target second nodes to be removed.
[0104] In addition, since the directory tree is constructed based on the hierarchical relationship between candidate information, if the path score corresponding to the second node of the target does not meet the first condition, it means that the entire path below the second node of the target cannot match the query information. Therefore, the second node of the target and all its descendant nodes can be removed from the directory tree. These removed nodes no longer need to be matched with the query information (i.e., the node score and path score are calculated), which greatly reduces the amount of computation.
[0105] Step 550: Determine whether there is a remaining second node in the directory tree; if yes, proceed to step 560 below; if no, proceed to step 570 below.
[0106] Step 560: Take the remaining second node as the new first node, take the child nodes of the remaining second node as the new second node, and start executing again from step 530.
[0107] If there are remaining second nodes in the directory tree that have not been removed (that is, these remaining second nodes are second nodes that meet the first condition), then take the remaining second node as the new first node, take the child nodes of the remaining second node as the new second nodes, and start a loop from step 530 above.
[0108] Step 570: From the nodes that have not been removed in the directory tree, select the candidate information corresponding to the target node that meets the second condition, and use it as the matching result corresponding to the query information.
[0109] If there are no remaining second nodes in the directory tree that have not been removed, then from the remaining nodes in the directory tree, the candidate information corresponding to the target node that meets the second condition is selected as the matching result for the query information. The second condition is set to select the node with the highest matching degree with the query information from the remaining nodes in the directory tree, and the candidate information corresponding to that node is used as the matching result for the query information.
[0110] The second condition may include, but is not limited to, at least one of the following: the node score is the highest; the combined score calculated based on the node score and the path score is the highest; the node score is greater than the second threshold; and the combined score calculated based on the node score and the path score is greater than the third threshold. The second and third thresholds can both be pre-set values.
[0111] In one example, step 570 includes: for nodes that have not been removed from the directory tree, calculating the comprehensive score corresponding to the node based on the node score and path score; selecting the node with the largest comprehensive score as the target node; and determining the candidate information corresponding to the target node as the matching result corresponding to the query information.
[0112] In this embodiment, the calculation method for the comprehensive score is not limited. For example, the product of the node score and the path score can be used as the comprehensive score, or the sum of the node score and the path score can be used as the comprehensive score, or a weighted sum of the node score and the path score can be used to obtain the comprehensive score, and so on. After obtaining the comprehensive scores corresponding to each node that has not been removed from the directory tree, the node with the largest comprehensive score is selected as the target node with the highest matching degree, and then the candidate information corresponding to the target node is determined as the matching result corresponding to the query information.
[0113] Furthermore, considering that the candidate information in the directory tree may not be comprehensive, even if the target node with the highest comprehensive score is found, the matching degree between the candidate information corresponding to that target node and the query information may still be insufficient. An exemplary embodiment of this application provides a threshold judgment mechanism. After calculating the comprehensive score of each node in the directory tree that has not been eliminated, the maximum value of the comprehensive score is compared with a threshold value. If the maximum value of the comprehensive score is less than the threshold value, the default candidate information is determined as the matching result corresponding to the query information. If the maximum value of the comprehensive score is greater than the threshold value, the node with the highest comprehensive score is selected as the target node, and the candidate information corresponding to that target node is determined as the matching result corresponding to the query information. The aforementioned default candidate information is a general matching result when no suitable candidate information can be found. This default candidate information can be used as the candidate information corresponding to the root node in the directory tree. For example, Figure 2 The default standard answer in the answer library directory tree shown is "I don't understand what you're saying".
[0114] Furthermore, if the default candidate information is determined as the matching result corresponding to the query information, the query information can be recorded so that relevant technical personnel can create matching candidate information based on the query information, and then add the created candidate information to the directory tree to update and expand the content of the directory tree.
[0115] Optionally, even if the target node is not a leaf node in the directory tree, the query information and the target node can still be recorded. If the target node is not a leaf node in the directory tree, it means that the optimal candidate information may not have been matched for the query information, but only the suboptimal candidate information. By recording the query information and the target node, relevant technical personnel can create more suitable candidate information based on the recorded query information, so as to better update and improve the content of the directory tree.
[0116] In summary, the technical solution provided in this application constructs candidate information into a directory tree, and then calculates the matching degree between candidate information and query information corresponding to some nodes in batches based on the directory tree. The calculation results include node scores and path scores. Based on the path scores, the directory tree can be pruned, removing some branches with low matching degree with query information. Therefore, it is not necessary to calculate the matching degree between candidate information and query information corresponding to every node in the directory tree, reducing the computational complexity of the entire information matching process and helping to improve the efficiency of obtaining matching results.
[0117] Furthermore, when a target node with a comprehensive score greater than the threshold exists in the directory tree, the candidate information corresponding to that target node is determined as the matching result corresponding to the query information, enabling the optimal matching result to be found from the directory tree and fed back to the user. When no target node with a comprehensive score greater than the threshold exists in the directory tree, on the one hand, by returning default candidate information, a more general feedback result can be provided to the user, rather than an erroneous feedback result, so that the user can still get the best possible experience even when the directory tree coverage is incomplete. On the other hand, by recording the query information, relevant technical personnel can create matching candidate information based on the query information, and then add the created candidate information to the directory tree to update and expand the content of the directory tree.
[0118] In addition, if the final matched target node is not a leaf node in the directory tree, the query information and target node are also recorded so that relevant technical personnel can create more matching candidate information based on the query information in the record, so as to better update and improve the content of the directory tree.
[0119] Please refer to Figure 6 The diagram illustrates a flowchart of a training method for an information matching model provided in one embodiment of this application. The information matching model includes the feature extraction network, node scoring network, and path scoring network mentioned above. The execution entities for each step of this method can be the aforementioned entities. Figure 1 The model training device 10 in the implementation environment of the scheme shown. The method may include the following steps (610-660):
[0120] Step 610: Construct multiple training samples based on the directory tree. Each training sample includes information to be matched and candidate information corresponding to the sample nodes selected from the directory tree.
[0121] The directory tree is a directed acyclic graph composed of multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node.
[0122] In this application, the training process of the information matching model adopts a self-supervised learning approach, using candidate information existing in the existing directory tree as the data source to automatically construct the training sample set. Unlike existing self-supervised directory tree expansion algorithms, the focus of this application's scheme is on information matching rather than node addition, thus placing greater emphasis on the matching of information with itself.
[0123] Since the information matching model includes a node scoring network and a path scoring network, and both networks receive matching representation vectors as input, they can share the same feature extraction network. The node scoring network and the path scoring network are two classification networks; their structures can be the same or different, but their network parameters (including weights and biases) are independent and updated separately. The model training process can be viewed as a multi-task training process, requiring training both the node scoring network and the path scoring network. Therefore, the training sample set needs to include positive and negative samples from both the node scoring network and the path scoring network.
[0124] The aforementioned sample nodes refer to nodes selected from the directory tree. Each sample node is a node selected from the directory tree. Based on the candidate information corresponding to the sample node, matching information can be generated. Then, a training sample is constructed by combining the matching information and the candidate information corresponding to the sample node.
[0125] Optionally, step 610 may include the following sub-steps (1-4):
[0126] 1. Generate matching information based on the candidate information corresponding to the sample node or the candidate information corresponding to the child node of the sample node; construct the first training sample based on the matching information and the candidate information corresponding to the sample node, which is the positive sample of the node scoring network;
[0127] In one example, the information to be matched is generated based on the candidate information corresponding to the sample node as follows: the candidate information corresponding to the sample node is translated forward to obtain a first translation result; the first translation result is then translated backward to obtain the information to be matched, which is a different expression with the same semantics as the candidate information corresponding to the sample node. Taking text as an example, using any machine translation tool, the candidate information corresponding to the sample node is first translated from the first language to the second language (i.e., forward translation) to obtain the first translation result, and then the first translation result is translated from the second language back to the first language (i.e., backward translation) to obtain the information to be matched.
[0128] In another example, the information to be matched is generated based on the candidate information corresponding to the child nodes of the sample node as follows: Similar information to the candidate information corresponding to the child nodes of the sample node is generated; this similar information is forward-translated to obtain a second translation result; this second translation result is backward-translated to obtain the information to be matched, which is a different expression with the same semantics as the aforementioned similar information. Optionally, a child node is randomly sampled from all child nodes of the sample node, and then information similar to but not exactly the same as the candidate information corresponding to the sample node (referred to here as "similar information") is generated based on the candidate information corresponding to that child node. In one implementation, this similar information can be directly used as the information to be matched. In another implementation, the forward and backward translation processes described above are performed on this similar information to finally obtain the information to be matched.
[0129] Optionally, the forward and reverse translations described above can use the same translation tool or two different translation tools.
[0130] Optionally, similarity information for the candidate information corresponding to the sample node is generated based on the candidate information corresponding to the child nodes of the sample node in the following manner: For simplicity, the candidate information corresponding to the sample node is referred to as "first candidate information," and the candidate information corresponding to the child nodes of the sample node is referred to as "second candidate information." The first candidate information and the second candidate information are processed by word segmentation to obtain a first word set and a second word set, wherein the first word set includes each word obtained by word segmentation of the first candidate information, and the second word set includes each word obtained by word segmentation of the second candidate information. Then, at least one target word is obtained, which is a word that exists in the first word set but does not exist in the second word set. From the above at least one target word, one or more target words are randomly sampled and removed from the first candidate information. The modified first candidate information obtained is the similarity information described above.
[0131] 2. Select the first target node from the directory tree, excluding the sample node; generate matching information based on the candidate information corresponding to the first target node; construct the second training sample based on the matching information and the candidate information corresponding to the sample node, which is the negative sample of the node scoring network.
[0132] In one example, the information to be matched is generated based on the candidate information corresponding to the first target node in the following way: the candidate information corresponding to the first target node is directly used as the information to be matched.
[0133] In another example, matching information is generated based on the candidate information corresponding to the first target node as follows: the candidate information corresponding to the first target node is sequentially translated forward and backward as described above to obtain the matching information.
[0134] 3. Generate matching information based on the candidate information corresponding to the sample node or the candidate information corresponding to the ancestor node of the sample node; based on the matching information and the candidate information corresponding to the sample node, construct a third training sample, which is a positive sample of the path scoring network;
[0135] In one example, the matching information is generated based on the candidate information corresponding to the sample node in the following way: the candidate information corresponding to the sample node is sequentially translated forward and backward as described above to obtain the matching information.
[0136] In another example, matching information is generated based on the candidate information corresponding to the ancestor nodes of the sample node as follows: the candidate information corresponding to the ancestor nodes is sequentially translated forward and backward as described above to obtain the matching information.
[0137] 4. Select a second target node from the directory tree, excluding the sample node and its ancestor nodes; generate matching information based on the candidate information corresponding to the second target node; construct a fourth training sample based on the matching information and the candidate information corresponding to the sample node, which is a negative sample of the path scoring network.
[0138] In one example, the matching information is generated based on the candidate information corresponding to the second target node in the following way: the candidate information corresponding to the second target node is directly used as the matching information.
[0139] In another example, matching information is generated based on the candidate information corresponding to the second target node as follows: the candidate information corresponding to the second target node is sequentially translated forward and backward as described above to obtain the matching information.
[0140] Step 620: Obtain the matching representation vector of the information to be matched and the candidate information corresponding to the sample nodes through the feature extraction network.
[0141] Optionally, the information to be matched and the candidate information corresponding to the sample nodes are segmented into words to obtain the third word sequence and the fourth word sequence; the classification embedding, the embedding sequence corresponding to the third word sequence, the separator embedding, and the embedding sequence corresponding to the fourth word sequence are concatenated to obtain the concatenated embedding sequence; the concatenated embedding sequence is processed by a feature extraction network to obtain the output feature vector; the feature vector corresponding to the classification embedding is extracted from the output feature vector as the matching representation vector. This process is similar to... Figure 5The process of obtaining the matching representation vector of the query information and the candidate information corresponding to the second node as described in the embodiment is similar. For details, please refer to the above description and will not be repeated here.
[0142] Step 630: The node scoring network outputs the predicted value of the node score corresponding to the sample node based on the matching representation vector.
[0143] Node scores are used to indicate the correctness of node selection. A node scoring network is a neural network used to perform classification tasks. During training, the input data to the node scoring network is the matching representation vector of the information to be matched and the candidate information corresponding to the sample node, and the output is the predicted value of the node score corresponding to the sample node. The node score can range from [0,1], and the larger the node score, the higher the correctness of the node selection.
[0144] Step 640: The path scoring network outputs the predicted path score of the sample node based on the matching representation vector.
[0145] Path scores are used to indicate the correctness of path selection. A path scoring network is also a neural network used to perform classification tasks. During training, the input data to the path scoring network is the matching representation vector of the information to be matched and the candidate information corresponding to the sample node, and the output is the predicted path score for the sample node. The path score can range from [0,1], and a higher path score indicates a higher level of correctness in path selection.
[0146] Step 650: Calculate the model training loss based on the predicted values of node scores and path scores.
[0147] After obtaining the predicted values of node scores and path scores, the model training loss is calculated by combining the label data of the training samples.
[0148] Optionally, the node score training loss is calculated based on the predicted node score and the node score label; the path score training loss is calculated based on the predicted path score and the path score label; and the model training loss is calculated based on the node score training loss and the path score training loss. The label value for a node score is 0 or 1, where the label value for a positive sample in the node scoring network is 1, and the label value for a negative sample is 0. The label value for a path score is 0 or 1, where the label value for a positive sample in the path scoring network is 1, and the label value for a negative sample is 0. The model training loss can be obtained by weighted summing of the node score training loss and the path score training loss. The weights corresponding to the node score training loss and the path score training loss can be flexibly set, and this application does not impose any limitations on this.
[0149] Step 660: Adjust the network parameters of the information matching model according to the model training loss to obtain the trained information matching model; wherein, the trained information matching model is used to provide matching results corresponding to the query information based on the directory tree.
[0150] After obtaining the model training loss, the gradient descent algorithm is used to adjust the network parameters of the information matching model, including the parameters of the feature extraction network, node scoring network, and path scoring network, until a predetermined stopping condition is met, thus completing the training of the information matching model. The aforementioned stopping condition may be that the model accuracy meets the set requirements, or the number of training iterations reaches a set number, etc., which are not limited in this application.
[0151] In summary, the technical solution provided in this application, by training an information matching model that includes a feature extraction network, a node scoring network, and a path scoring network, enables the model to output node scores and path scores for two pieces of information. Thus, during model usage, the path scores can be used to prune the directory tree, removing branches with low matching degrees to the query information. This eliminates the need to calculate the matching degree between the candidate information corresponding to each node in the directory tree and the query information, reducing the computational complexity of the entire information matching process and improving the efficiency of obtaining matching results.
[0152] In addition, during model training, training samples are directly constructed based on the directory tree, using candidate information existing in the directory tree as a data source, making the acquisition of model training data simpler and more efficient.
[0153] The technical solution of this application will be described below using an application in an intelligent question-answering system as an example. The information matching model includes the feature extraction network, node scoring network, and path scoring network mentioned above.
[0154] like Figure 7 As shown, the process of using the model may include the following steps (710-790):
[0155] Step 710: Obtain the user question and answer database directory tree.
[0156] User-submitted questions refer to questions provided by users, and answers that match those questions are provided based on the answer database directory tree.
[0157] Answer library τ 0 =(N 0 E 0 In ), N 0 Let n be a set of nodes. Each node n in the answer set... i =(q i ,a i )∈N 0This represents a sample in the answer set, containing the sample question q. i And the standard answer a to this example question i , where q i and a i All data is text. Each edge e in the answer database... i = <n p ,n c >∈E 0 This represents a hierarchical relationship between answers in the answer database, where n p For n c The higher-order question and answer, i.e., n p The sample problem can contain n c The example problem. The answer set contains exactly one root node r = (q r ,a r )∈N 0 As the top-level node in the entire answer database, q r an empty string, a r This serves as the default answer for the question-and-answer system, and is the output when the entire answer database fails to match the user's question. An example of an answer database directory tree used in a COVID-19 question-and-answer system is shown below. Figure 2 As shown.
[0158] Step 720: Use the root node of the answer database directory tree as the first node for initialization, and use the child nodes of the root node as the second node for initialization.
[0159] Step 730: Obtain the matching representation vector of the user question and the sample question corresponding to the second node through the feature extraction network.
[0160] Optionally, the user question and the sample question corresponding to the second node are segmented into words to obtain the first word sequence and the second word sequence; the classification embedding, the embedding sequence corresponding to the first word sequence, the separator embedding, and the embedding sequence corresponding to the second word sequence are concatenated to obtain the concatenated embedding sequence; the concatenated embedding sequence is processed by a feature extraction network to obtain the output feature vector; the feature vector corresponding to the classification embedding is extracted from the output feature vector as the matching representation vector.
[0161] Step 740: The node scoring network outputs the node score corresponding to the second node based on the matching representation vector.
[0162] Step 750: The path scoring network outputs the path score corresponding to the second node based on the matching representation vector.
[0163] For example, such as Figure 8 As shown, for any node n in the answer database directory tree i =(q i ,a i)∈N 0 To investigate the degree of matching between it and the user's question q, the following operations were performed:
[0164] 1. Rearrange q and q i Using the jieba word segmentation tool, the corresponding word sequence t is obtained. q and t qi .
[0165] 2. t q and t qi The concatenation is used as the input format for the feature extraction network: [CLS] and [SEP] are special characters. This is a splicing operation. Let x be... q,qi The length is l.
[0166] 3. Place x q,qi Input is fed into a feature extraction network for text matching: Where h is the dimension of the hidden layer of the feature extraction network. The output of the corresponding bit [CLS] is taken as q and q'. i Matching representation vector
[0167] 4. Obtain the matching representation vector c q,qi Then, the matching representation vector c q,qi The node scores s are obtained by inputting them into the node scoring network and the path scoring network respectively. c Path score s p Among them, the node score s output by the node scoring network c Describe the correctness of the node selection; the node score is s. c Used to determine the optimal answer and perform matching confidence analysis. The path score s output by the path scoring network. p Description n i The correctness of the root path selection in the answer database directory tree, with a path score of s. p Used for dynamic pruning during the prediction process.
[0168] The computation process of the above node scoring network can be summarized as follows:
[0169] s c (q,q i )=σ(W c2 tanh(W c1 c q,qi +b1)+b2)∈(0,1);
[0170] The computation process of the path scoring network described above can be summarized as follows:
[0171] s p (q,q i )=σ(Wp2 tanh(W p1 c q,qi +b1)+b2)∈(0,1);
[0172] Where σ is the sigmoid function, W p1 , W p2 , b1, All of these are trainable parameters.
[0173] Step 760: For the target second node whose path score does not meet the first condition, remove the target second node and its descendant nodes from the answer database directory tree.
[0174] Optionally, the path scores of each second node are sorted in descending order to obtain a score sequence. The second nodes whose path scores rank in the top X% of the score sequence are identified as the remaining second nodes to be retained, while the remaining second nodes are the target second nodes to be removed. After identifying the target second nodes, the target second nodes and their descendant nodes are removed from the answer database directory tree. X can be a pre-set value, such as X = 10 or 20.
[0175] Step 770: Determine whether there is a remaining second node in the answer database directory tree; if yes, proceed to step 780 below; if no, proceed to step 790 below.
[0176] Step 780: Take the remaining second node as the new first node, take the child nodes of the remaining second node as the new second node, and start executing again from step 730.
[0177] If there are remaining second nodes in the answer database directory tree that have not been removed (that is, these remaining second nodes are second nodes that meet the first condition), then take the remaining second node as the new first node, take the child nodes of the remaining second node as the new second nodes, and start a loop from step 730 above.
[0178] Step 790: From the nodes that have not been removed from the answer database directory tree, select the standard answer corresponding to the target node that meets the second condition, and use it as the question and answer result corresponding to the user's question.
[0179] If there are no remaining second nodes in the answer database directory tree that have not been removed, then from the remaining nodes in the answer database directory tree, the standard answer corresponding to the target node that meets the second condition is selected as the question-and-answer result for the user's question. For example, for a node that has not been removed from the answer database directory tree, the comprehensive score corresponding to the node is calculated based on the node score and path score; the node with the largest comprehensive score is selected as the target node; and the standard answer corresponding to the target node is determined as the question-and-answer result for the user's question.
[0180] Optionally, after calculating the comprehensive score of each node in the answer database directory tree that has not been removed, the maximum comprehensive score is compared with a threshold value. If the maximum comprehensive score is less than the threshold value, the default standard answer is determined as the question-and-answer result corresponding to the user's question. If the maximum comprehensive score is greater than the threshold value, the node with the largest comprehensive score is selected as the target node, and the standard answer corresponding to that target node is determined as the question-and-answer result corresponding to the user's question. The above default standard answer is a general answer when no suitable answer can be found, such as... Figure 2 The default standard answer in the answer library directory tree shown is "I don't understand what you're saying".
[0181] For example, the implementation code of the process used in this model is as follows:
[0182] Input:Query question q,answer taxonomyτ 0 =(N 0 E 0 ), score threshold t, the pruning coefficient η (input: user question q, answer database directory tree τ) 0 =(N 0 E 0 The score threshold t (equivalent to the "threshold value" mentioned above, used to limit the overall score of the final selected node; the larger the score threshold t, the easier it is for the system to return the default standard answer), and the setting coefficient η (equivalent to the setting coefficient X% mentioned above, used to limit the aggressiveness of pruning during the search process; the larger the setting coefficient η, the fewer nodes need to be compared and the shorter the time, but it will affect the accuracy of the answer)).
[0183] Output:The best answer node in the taxonomy n * The best node's pathscore and node score (Output: The optimal node n in the answer database directory tree) *The path score of the optimal node and node scores )
[0184]
[0185]
[0186] As can be seen from the implementation code of the above model usage process, the usage process proceeds from top to bottom, level by level, starting from τ 0 Starting with the first-level nodes (line 6), each node is attempted to match with the user question q, and s is calculated. p and s c The score (line 10). Pruning is performed concurrently during the calculation; incorrect paths are not further compared. In the algorithm, after all child nodes of a given node have completed their score calculations (lines 12-15), only the score of the child node is retained. p The child node with the largest score and proportion η is used for subsequent calculations (line 15). After all calculations are completed, the node with the existing score and s is selected. c ×s p The node with the highest score n * =(q * ,a * This is the correct answer for model selection (line 16). Obtain the optimal node n. * After that, two follow-up judgments are required:
[0187] (1) Since the answer database directory tree cannot answer all questions raised by users (for example, the questions raised by users are unrelated to the fields covered by the question-and-answer system), for questions that cannot be answered, a default standard answer a needs to be returned to the user. r Here, we compare the path score and node score of a node with a score threshold t. When replying, use the default standard answer a. r Otherwise reply with a * .
[0188] (2) The system's answers should be as completely relevant to the user's questions as possible. Therefore, the model should be encouraged to respond with answers that are leaf nodes in the answer database directory tree. Such answers are more refined and thus more targeted. However, the answer database directory tree may not be able to provide the optimal answers at the leaf nodes for all of the user's questions, i.e., n. * For τ 0 The non-leaf nodes. At this point, the system returns an answer that also solves the user's problem but is not as specific. * At the same time, the user question q is compared with the selected node n. * Record this so that system maintainers can purposefully send data to n.* New nodes will be added to provide more targeted answers to similar questions asked by users in the future.
[0189] like Figure 9 As shown, the model training process may include the following steps (910-960):
[0190] Step 910: Construct multiple training samples based on the answer database directory tree. Each training sample includes the question to be matched and the example question corresponding to the sample node selected from the directory tree.
[0191] Step 920: Obtain the matching representation vectors of the problem to be matched and the sample problem corresponding to the sample node through the feature extraction network.
[0192] Step 930: The node scoring network outputs the predicted value of the node score corresponding to the sample node based on the matching representation vector.
[0193] Step 940: The path scoring network outputs the predicted path score of the sample node based on the matching representation vector.
[0194] Step 950: Calculate the model training loss based on the predicted values of node scores and path scores.
[0195] Step 960: Adjust the network parameters of the information matching model according to the model training loss to obtain the trained information matching model; wherein, the trained information matching model is used to provide question-and-answer results corresponding to user questions based on the answer database directory tree.
[0196] For example, the code for implementing the model training process is as follows:
[0197] Input: τ 0 =(N 0 E 0 ), negative size N, training epochs E, multitask learning weight λ, the model with parameters Θ 0 (Input: Answer library directory tree τ) 0 =(N 0 E 0 ), Number of negative samples N, Number of training iterations E, Multi-task learning weights λ, Initialized model parameters Θ 0 )
[0198] Output: Learned model parametersΘ
[0199]
[0200]
[0201] During model training, each training batch will specify τ 0 Each node in the code is traversed once as the matched node (i.e., the second parameter in the score calculation) (line 3). c The training (lines 4-11) and s p The training (lines 12-16) is performed separately, producing two losses L. c and L p Finally, multi-task learning is performed by weighted summation of these two losses using λ (line 17). For each training iteration, one positive sample and N negative samples are selected, and their InfoNCE (Noise Contrastive Estimation) losses are calculated (lines 11 and 16). This involves a series of functions, explained below:
[0202] `augment(q)`: A data augmentation function. It takes a question `q` as input and returns a question `q'` that is different from `q` but semantically similar. The implementation here uses back translation: taking `q` as Chinese as an example, it uses an arbitrary machine translation API (Application Programming Interface) to first translate `q` from Chinese to any other language, and then translates the translation back into Chinese to obtain `q'`. Furthermore, if the question-answering system has multiple different sample questions for the same node during data construction, this function can choose to return any replaceable sample question.
[0203] sample_child_q(n): Child node sampling function. It takes a node n as input and returns a randomly sampled child node of n.
[0204] sample_ancestor_q(n): Ancestor node sampling function. It takes a node n as input and returns a randomly sampled ancestor node of n or n itself.
[0205] remove_complement(n p ,n c ): A generalization function for the child node problem. Its input consists of two nodes, the second node being n. c =(q c ,a c ) represents the previous node n p =(q p ,ap Given a child node of q, output a problem similar to the parent node, modified from the child node's problem. The implementation here is: first, set q... c With q p Jieba segmentation yields two vocabulary sets W. c and W p Then calculate W c and W p The difference between the samples represents the refinement of the lower-order problem compared to the higher-order problem. The function output is q_c.remove(sample(W c -W p )), where remove is the removal function and sample is the random sampling function.
[0206] During the training process, s c With s p The labels are different: when n i When s is the matched node, c As the basis for selecting nodes, it measures whether the matched node is selected correctly, therefore, if and only if s c The label is 1 when the two calculated parameters belong to the same node; otherwise, it is 0. Its positive samples come from n. i The negative samples come from samples taken from all nodes except itself (lines 4-7 of the code). p As a basis for pruning during the prediction process, it measures whether the path of the matched node is selected correctly, therefore, s ≥ 0 if and only if s ≥ 0. c The first parameter in the calculation comes from n i and n i The ancestor node (denoted as A in the code above) ni The label is 1 when the condition is met, and 0 in all other cases. Its positive samples come from n. i The negative sample comes from the sample of all nodes except itself and its ancestors (line 12).
[0207] Furthermore, the above example only uses InfoNCE loss as the model training loss. In some other embodiments, cross-entropy loss or other loss functions can also be used as the model training loss.
[0208] This application not only returns the best answer to the user's current question when it exists in the answer database, but also proactively expands the answer database by returning a suboptimal answer when the optimal answer cannot be found, thus adapting to the continuous updating of user questions. Furthermore, this application is designed for a question-answering system with an answer database modeled by a directory tree structure. This not only reduces the number of answers required for matching and lowers the overall algorithm complexity by leveraging the directory tree structure, but also improves the user experience by returning a suboptimal answer (i.e., the answer in general cases) when no optimal answer exists.
[0209] The above embodiments provide the implementation process of the solution in an intelligent question-answering system. Of course, the solution can also be transferred to any other application scenario involving the calculation of the matching degree between two pieces of information, such as search systems and translation systems. This application does not limit this application.
[0210] It should be noted that the above descriptions of the usage and training processes of the information matching model have been presented with different embodiments. The content involved in the use of the model and the content involved in the training process are mutually corresponding and interconnected. If a part is not described in detail on one side, please refer to the description on the other side.
[0211] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0212] Please refer to Figure 10 The diagram illustrates a block diagram of an information matching apparatus according to an embodiment of this application. This apparatus is used to implement the aforementioned information matching method. The apparatus 1000 may include: an information acquisition module 1010, a score calculation module 1020, a node removal module 1030, and a result determination module 1040.
[0213] The information acquisition module 1010 is used to acquire query information and a directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node.
[0214] The score calculation module 1020 is used to take the root node of the directory tree as the first node of initialization, and the child nodes of the root node as the second nodes of initialization. Based on the query information and the candidate information corresponding to the second node, it calculates the node score and path score corresponding to each second node respectively. The node score is used to indicate the correctness of the node selection, and the path score is used to indicate the correctness of the path selection.
[0215] The node removal module 1030 is used to remove the target second node and its descendant nodes from the directory tree for target second nodes whose path scores do not meet the first condition.
[0216] The score calculation module 1020 is further configured to, when there are still remaining second nodes in the directory tree, take the remaining second nodes as new first nodes, take the child nodes of the remaining second nodes as new second nodes, and execute the step of calculating the node score and path score corresponding to each second node based on the query information and the candidate information corresponding to the second node.
[0217] The result determination module 1040 is used to select candidate information corresponding to the target node that meets the second condition from the nodes that have not been removed in the directory tree when there is no remaining second node in the directory tree, and use it as the matching result corresponding to the query information.
[0218] In an exemplary embodiment, the score calculation module 1020 is used for:
[0219] Obtain the matching representation vector of the query information and the candidate information corresponding to the second node;
[0220] The node scoring network outputs the node score corresponding to the second node based on the matching representation vector;
[0221] The path scoring network outputs the path score corresponding to the second node based on the matching representation vector.
[0222] Optionally, the score calculation module 1020 is used for:
[0223] The query information and the candidate information corresponding to the second node are respectively processed by word segmentation to obtain the first word sequence and the second word sequence;
[0224] The classification embedding, the embedding sequence corresponding to the first word sequence, the separator embedding, and the embedding sequence corresponding to the second word sequence are concatenated to obtain the concatenated embedding sequence.
[0225] The concatenated embedded sequence is processed by a feature extraction network to obtain an output feature vector;
[0226] The feature vector corresponding to the classification embedding is extracted from the output feature vector and used as the matching representation vector.
[0227] In an exemplary embodiment, the node removal module 1030 is used to:
[0228] The target second node and the remaining second nodes are determined from the second nodes; wherein the minimum path score of the remaining second nodes is greater than or equal to the maximum path score of the target second node, and the ratio of the number of remaining second nodes to the total number of second nodes is less than or equal to a set coefficient.
[0229] Remove the target second node and its descendant nodes from the directory tree.
[0230] In an exemplary embodiment, the result determination module 1040 is configured to:
[0231] For nodes in the directory tree that have not been removed, calculate the comprehensive score corresponding to the node based on the node score and path score.
[0232] Select the node with the highest comprehensive score as the target node;
[0233] The candidate information corresponding to the target node is determined as the matching result corresponding to the query information.
[0234] In an exemplary embodiment, the result determination module 1040 is further configured to:
[0235] If the maximum value of the comprehensive score is less than the threshold value, then the default candidate information will be determined as the matching result corresponding to the query information;
[0236] If the maximum value of the comprehensive score is greater than the threshold value, then the steps of selecting the node with the largest comprehensive score as the target node and determining the candidate information corresponding to the target node as the matching result corresponding to the query information are executed.
[0237] In an exemplary embodiment, the result determination module 1040 is further configured to:
[0238] If the target node is not a leaf node in the directory tree, record the query information and the target node.
[0239] Please refer to Figure 11 This diagram illustrates a block diagram of a training apparatus for an information matching model according to an embodiment of this application. The information matching model may include a feature extraction network, a node scoring network, and a path scoring network. The apparatus is used to implement the training method for the aforementioned information matching model. The apparatus 1100 may include: a sample construction module 1110, a feature extraction module 1120, a node scoring module 1130, a path scoring module 1140, a loss calculation module 1150, and a parameter adjustment module 1160.
[0240] The sample construction module 1110 is used to construct multiple training samples based on the directory tree. Each training sample includes information to be matched and candidate information corresponding to the sample nodes selected from the directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from the parent node to the child node represents that the candidate information corresponding to the parent node and the candidate information corresponding to the child node have a hierarchical relationship.
[0241] The feature extraction module 1120 is used to obtain the matching representation vector of the information to be matched and the candidate information corresponding to the sample node through the feature extraction network.
[0242] The node scoring module 1130 is used to output the predicted value of the node score corresponding to the sample node based on the matching representation vector through the node scoring network, and the node score is used to indicate the correctness of the node selection.
[0243] The path scoring module 1140 is used to output the predicted value of the path score corresponding to the sample node through the path scoring network based on the matching representation vector. The path score is used to indicate the correctness of path selection.
[0244] The loss calculation module 1150 is used to calculate the model training loss based on the predicted values of the node scores and the predicted values of the path scores.
[0245] The parameter adjustment module 1160 is used to adjust the network parameters of the information matching model according to the model training loss to obtain a trained information matching model; wherein, the trained information matching model is used to provide matching results corresponding to the query information based on the directory tree.
[0246] In an exemplary embodiment, the sample construction module 1110 is configured to:
[0247] The matching information is generated based on the candidate information corresponding to the sample node or the candidate information corresponding to the child node of the sample node; a first training sample is constructed based on the matching information and the candidate information corresponding to the sample node, wherein the first training sample is a positive sample of the node scoring network.
[0248] Select a first target node from the directory tree, excluding the sample node; generate the matching information based on the candidate information corresponding to the first target node; construct a second training sample based on the matching information and the candidate information corresponding to the sample node, wherein the second training sample is a negative sample of the node scoring network;
[0249] The matching information is generated based on the candidate information corresponding to the sample node or the candidate information corresponding to the ancestor node of the sample node; a third training sample is constructed based on the matching information and the candidate information corresponding to the sample node, and the third training sample is a positive sample of the path scoring network.
[0250] Select a second target node from the directory tree, excluding the sample node and its ancestor nodes; generate the matching information based on the candidate information corresponding to the second target node; construct a fourth training sample based on the matching information and the candidate information corresponding to the sample node, wherein the fourth training sample is a negative sample of the path scoring network.
[0251] Optionally, the sample construction module 1110 is used for:
[0252] The candidate information corresponding to the sample node is translated forward to obtain a first translation result; the first translation result is translated backward to obtain the information to be matched, wherein the information to be matched is a different expression with the same semantics as the candidate information corresponding to the sample node.
[0253] or,
[0254] Based on the candidate information corresponding to the child nodes of the sample node, similar information of the candidate information corresponding to the sample node is generated; the similar information is forward translated to obtain a second translation result; the second translation result is reverse translated to obtain the information to be matched, wherein the information to be matched is a different expression with the same semantics as the similar information.
[0255] In an exemplary embodiment, the loss calculation module 1150 is used for:
[0256] Calculate the node score training loss based on the predicted value of the node score and the label value of the node score;
[0257] Calculate the path score training loss based on the predicted value of the path score and the label value of the path score;
[0258] The model training loss is calculated based on the node score training loss and the path score training loss.
[0259] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0260] Please refer to Figure 12 This illustration shows a schematic diagram of a computer device according to an embodiment of this application. The computer device can be any electronic device with data computing, processing, and storage functions, and can be implemented as... Figure 1 The illustrated scheme implements a model training device 10 and / or a model usage device 20 in the implementation environment. This computer device is implemented as... Figure 1 When the model training device 10 is used in the implementation environment of the scheme shown, the computer device can be used to implement the training method of the information matching model provided in the above embodiments. The computer device is implemented as... Figure 1 When the model uses device 20 in the implementation environment of the scheme shown, the computer device can be used to implement the information matching method provided in the above embodiments. Specifically:
[0261] The computer device 1200 includes a central processing unit (such as a CPU, GPU, or FPGA) 1201, a system memory 1204 including RAM (Random-Access Memory) 1202 and ROM (Read-Only Memory) 1203, and a system bus 1205 connecting the system memory 1204 and the central processing unit 1201. The computer device 1200 also includes a basic input / output system (I / O system) 1206 to facilitate information transfer between various devices within the server, and a large-capacity storage device 1207 for storing the operating system 1213, application programs 1214, and other program modules 1215.
[0262] In some embodiments, the basic input / output system 1206 includes a display 1208 for displaying information and an input device 1209 for user input, such as a mouse or keyboard. Both the display 1208 and the input device 1209 are connected to the central processing unit 1201 via an input / output controller 1210 connected to the system bus 1205. The basic input / output system 1206 may also include the input / output controller 1210 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1210 also provides output to a display screen, printer, or other types of output devices.
[0263] The mass storage device 1207 is connected to the central processing unit 1201 via a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1207 and its associated computer-readable media provide non-volatile storage for the computer device 1200. That is, the mass storage device 1207 may include computer-readable media (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0264] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage medium is not limited to the above-mentioned types. The system memory 1204 and mass storage device 1207 described above can be collectively referred to as memory.
[0265] According to an embodiment of this application, the computer device 1200 can also be connected to a remote computer on a network, such as the Internet. That is, the computer device 1200 can be connected to the network 1212 via the network interface unit 1211 connected to the system bus 1205, or the network interface unit 1211 can be used to connect to other types of networks or remote computer systems (not shown).
[0266] The memory further includes at least one instruction, at least one program, code set, or instruction set, which is stored in the memory and configured to be executed by one or more processors to implement the above-described information matching method or the training method for the information matching model.
[0267] In an exemplary embodiment, a computer-readable storage medium is also provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, the at least one program, the code set, or the instruction set implements the above-described information matching method or the training method for the information matching model when executed by a processor of a computer device.
[0268] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0269] In an exemplary embodiment, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the aforementioned information matching method or the information matching model training method.
[0270] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0271] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An information matching method, characterized in that, The method includes: Obtain query information and directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node. The root node of the directory tree is used as the first node for initialization, and the child nodes of the root node are used as the second nodes for initialization. Based on the query information and the candidate information corresponding to the second node, the node score and path score corresponding to each second node are calculated respectively. The node score is used to indicate the correctness of node selection, and the path score is used to indicate the correctness of path selection. The correctness of path selection refers to the accuracy of selecting the matching result corresponding to the query information from the candidate information corresponding to the second node or the descendant nodes of the second node. For a target second node whose path score does not meet the first condition, remove the target second node and its descendant nodes from the directory tree, wherein the first condition includes the path score being greater than a first threshold. If there are still remaining second nodes in the directory tree, then the remaining second nodes are taken as new first nodes, and the child nodes of the remaining second nodes are taken as new second nodes. Then, the process starts again from the step of calculating the node score and path score of each second node based on the query information and the candidate information corresponding to the second node. If there are no remaining second nodes in the directory tree, then from the nodes that have not been removed from the directory tree, the candidate information corresponding to the target node that meets the second condition is selected as the matching result corresponding to the query information. If the target node is not a leaf node in the directory tree, the query information and the target node are recorded, wherein a new node is added under the target node, and the query information is used to create candidate information that matches the query information as candidate information corresponding to the new node.
2. The method according to claim 1, characterized in that, The step of calculating the node score and path score for each second node based on the query information and the candidate information corresponding to the second node includes: Obtain the matching representation vector of the query information and the candidate information corresponding to the second node; The node scoring network outputs the node score corresponding to the second node based on the matching representation vector; The path scoring network outputs the path score corresponding to the second node based on the matching representation vector.
3. The method according to claim 2, characterized in that, The step of obtaining the matching representation vector of the query information and the candidate information corresponding to the second node includes: The query information and the candidate information corresponding to the second node are respectively processed by word segmentation to obtain the first word sequence and the second word sequence; The classification embedding, the embedding sequence corresponding to the first word sequence, the separator embedding, and the embedding sequence corresponding to the second word sequence are concatenated to obtain the concatenated embedding sequence. The concatenated embedded sequence is processed by a feature extraction network to obtain an output feature vector; The feature vector corresponding to the classification embedding is extracted from the output feature vector and used as the matching representation vector.
4. The method according to claim 1, characterized in that, The step of selecting candidate information corresponding to the target node that meets the second condition from the nodes that have not been removed from the directory tree, as the matching result corresponding to the query information, includes: For nodes in the directory tree that have not been removed, calculate the comprehensive score corresponding to the node based on the node score and path score. Select the node with the highest comprehensive score as the target node; The candidate information corresponding to the target node is determined as the matching result corresponding to the query information.
5. The method according to claim 4, characterized in that, For nodes in the directory tree that have not been removed, after calculating the comprehensive score corresponding to the node based on the node score and path score, the process further includes: If the maximum value of the comprehensive score is less than the threshold value, then the default candidate information will be determined as the matching result corresponding to the query information; If the maximum value of the comprehensive score is greater than the threshold value, then the steps of selecting the node with the largest comprehensive score as the target node and determining the candidate information corresponding to the target node as the matching result corresponding to the query information are executed.
6. A training method for an information matching model, characterized in that, The information matching model includes a feature extraction network, a node scoring network, and a path scoring network; the method includes: Multiple training samples are constructed based on a directory tree. Each training sample includes information to be matched and candidate information corresponding to a sample node selected from the directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node. The feature extraction network is used to obtain the matching representation vector of the information to be matched and the candidate information corresponding to the sample node; The node scoring network outputs the predicted node score corresponding to the sample node based on the matching representation vector, and the node score is used to indicate the correctness of the node selection. The path scoring network outputs the predicted path score corresponding to the sample node based on the matching representation vector. The path score is used to indicate the correctness of path selection. The correctness of path selection refers to the accuracy of selecting the matching result corresponding to the query information from the candidate information corresponding to the sample node or the descendant nodes of the sample node. The model training loss is calculated based on the predicted values of the node scores and the predicted values of the path scores. The network parameters of the information matching model are adjusted according to the model training loss to obtain a fully trained information matching model. The fully trained information matching model provides matching results corresponding to query information based on the directory tree. In determining the matching results corresponding to the query information, the root node of the directory tree is used as the initial first node, and the child nodes of the root node are used as the initial second nodes. For a target second node whose path score does not meet the first condition, after the target second node and its descendant nodes are removed from the directory tree, if there are still remaining second nodes in the directory tree, these remaining second nodes are used as the new first nodes. The child nodes of a point are used as new second nodes. The first condition includes that the path score is greater than a first threshold. The path score of the new second node is used to remove the target second node and its descendant nodes again. If there are no remaining second nodes in the directory tree, the candidate information corresponding to the target node that meets the second condition among the nodes that have not been removed in the directory tree is used as the matching result corresponding to the query information. If the target node is not a leaf node in the directory tree, the query information and the target node are recorded. A new node is added under the target node. The query information is used to create candidate information that matches the query information as the candidate information corresponding to the new node.
7. The method according to claim 6, characterized in that, The construction of multiple training samples based on the directory tree includes: The matching information is generated based on the candidate information corresponding to the sample node or the candidate information corresponding to the child node of the sample node; a first training sample is constructed based on the matching information and the candidate information corresponding to the sample node, wherein the first training sample is a positive sample of the node scoring network. Select a first target node from the directory tree, excluding the sample node; generate the matching information based on the candidate information corresponding to the first target node; construct a second training sample based on the matching information and the candidate information corresponding to the sample node, wherein the second training sample is a negative sample of the node scoring network; The matching information is generated based on the candidate information corresponding to the sample node or the candidate information corresponding to the ancestor node of the sample node; a third training sample is constructed based on the matching information and the candidate information corresponding to the sample node, and the third training sample is a positive sample of the path scoring network. Select a second target node from the directory tree, excluding the sample node and its ancestor nodes; generate the matching information based on the candidate information corresponding to the second target node; construct a fourth training sample based on the matching information and the candidate information corresponding to the sample node, wherein the fourth training sample is a negative sample of the path scoring network.
8. The method according to claim 7, characterized in that, The step of generating the matching information based on the candidate information corresponding to the sample node or the candidate information corresponding to the child nodes of the sample node includes: The candidate information corresponding to the sample node is translated forward to obtain a first translation result; the first translation result is translated backward to obtain the information to be matched, wherein the information to be matched is a different expression with the same semantics as the candidate information corresponding to the sample node. or, Based on the candidate information corresponding to the child nodes of the sample node, similar information of the candidate information corresponding to the sample node is generated; the similar information is forward translated to obtain a second translation result; the second translation result is reverse translated to obtain the information to be matched, wherein the information to be matched is a different expression with the same semantics as the similar information.
9. The method according to any one of claims 6 to 8, characterized in that, The calculation of model training loss based on the predicted values of the node scores and the predicted values of the path scores includes: Calculate the node score training loss based on the predicted value of the node score and the label value of the node score; Calculate the path score training loss based on the predicted path score and the label value of the path score; The model training loss is calculated based on the node score training loss and the path score training loss.
10. An information matching device, characterized in that, The device includes: The information acquisition module is used to acquire query information and a directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents a hierarchical relationship between the candidate information corresponding to the parent node and the candidate information corresponding to the child node. The score calculation module is used to initialize the root node of the directory tree as the first node and the child nodes of the root node as the second nodes. Based on the query information and the candidate information corresponding to the second node, it calculates the node score and path score for each second node. The node score is used to indicate the correctness of node selection, and the path score is used to indicate the correctness of path selection. The correctness of path selection refers to the accuracy of selecting the matching result corresponding to the query information from the candidate information corresponding to the second node or the descendant nodes of the second node. The node removal module is used to remove the target second node and its descendant nodes from the directory tree for target second nodes whose path scores do not meet the first condition, wherein the first condition includes the path score being greater than a first threshold. The score calculation module is also used to, when there are still remaining second nodes in the directory tree, take the remaining second nodes as new first nodes, take the child nodes of the remaining second nodes as new second nodes, and execute the step of calculating the node score and path score corresponding to each second node based on the query information and the candidate information corresponding to the second node again. The result determination module is used to select candidate information corresponding to the target node that meets the second condition from the nodes that have not been removed in the directory tree when there is no remaining second node in the directory tree, and use it as the matching result corresponding to the query information. If the target node is not a leaf node in the directory tree, the query information and the target node are recorded, wherein a new node is added under the target node, and the query information is used to create candidate information that matches the query information as candidate information corresponding to the new node.
11. A training device for an information matching model, characterized in that, The information matching model includes a feature extraction network, a node scoring network, and a path scoring network; the device includes: The sample construction module is used to construct multiple training samples based on the directory tree. Each training sample includes information to be matched and candidate information corresponding to the sample nodes selected from the directory tree. The directory tree is a directed acyclic graph constructed from multiple nodes. Each node has corresponding candidate information. A directed edge from a parent node to a child node represents that the candidate information corresponding to the parent node and the candidate information corresponding to the child node have a hierarchical relationship. The feature extraction module is used to obtain a matching representation vector of the information to be matched and the candidate information corresponding to the sample node through the feature extraction network; The node scoring module is used to output the predicted value of the node score corresponding to the sample node based on the matching representation vector through the node scoring network. The node score is used to indicate the correctness of the node selection. The path scoring module is used to output the predicted value of the path score corresponding to the sample node based on the matching representation vector through the path scoring network. The path score is used to indicate the correctness of path selection. The correctness of path selection refers to the accuracy of selecting the matching result corresponding to the query information from the candidate information corresponding to the sample node or the descendant nodes of the sample node. The loss calculation module is used to calculate the model training loss based on the predicted values of the node scores and the predicted values of the path scores; A parameter adjustment module is used to adjust the network parameters of the information matching model according to the model training loss to obtain a trained information matching model. The trained information matching model provides matching results corresponding to query information based on the directory tree. In determining the matching results corresponding to the query information, the root node of the directory tree is used as the initial first node, and the child nodes of the root node are used as the initial second nodes. For a target second node whose path score does not meet the first condition, after the target second node and its descendant nodes are removed from the directory tree, if there are still remaining second nodes in the directory tree, these remaining second nodes are used as the new first nodes. The child nodes of the remaining second node are used as new second nodes. The first condition includes that the path score is greater than a first threshold. The path score of the new second node is used to remove the target second node and its descendant nodes again. If there are no remaining second nodes in the directory tree, the candidate information corresponding to the target node that meets the second condition among the nodes that have not been removed in the directory tree is used as the matching result corresponding to the query information. If the target node is not a leaf node in the directory tree, the query information and the target node are recorded. A new node is added under the target node. The query information is used to create candidate information that matches the query information as the candidate information corresponding to the new node.
12. A computer device, characterized in that, The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the information matching method as described in any one of claims 1 to 5, or to implement the training method for the information matching model as described in any one of claims 6 to 9.
13. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the information matching method as described in any one of claims 1 to 5, or to implement the training method for the information matching model as described in any one of claims 6 to 9.
14. A computer program product, characterized in that, The computer program product includes computer instructions executed by a processor to implement the information matching method as described in any one of claims 1 to 5, or to implement the training method for the information matching model as described in any one of claims 6 to 9.