Knowledge graph construction method and system based on large model

Through the knowledge graph construction method based on large models, combined with BERT, LSTM, TransE and GPT, the dynamic modeling problems of entity disambiguation and relationship extraction are solved, and the entity semantic boundary control and semantic coherence in multiple rounds of dialogue are realized, and the knowledge extraction and system interaction efficiency is improved.

CN120561316AActive Publication Date: 2025-08-29上海笑聘网络科技有限公司

Patent Information

Application Number
CN202511063597.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2025-08-29
Estimated Expiration
2045-07-31

AI Technical Summary

Technical Problem

In the prior art, entity disambiguation-dependent static rule base lacks dynamic modeling capabilities, relationship extraction ignores timing dependency characteristics, and knowledge integration process lacks adaptive adjustment, resulting in knowledge update lag and node redundancy in multiple rounds of dialogue, and low system coordination efficiency.

Method used

The knowledge graph construction method based on the big model is adopted, user input is obtained through the dialogue state tracker, and entity disambiguation is performed by combining BERT intent classification, LSTM sequence annotation and TransE model. Relational predicates are optimized using hierarchical clustering and cosine similarity matching to generate multiple rounds of dialogue strategy candidate sets, and semantic coherence is maintained through the GPT generation module.

Benefits of technology

It realizes multi-dimensional user requirements analysis, dynamic entity disambiguation and cross-modal semantic alignment, improves the accuracy of knowledge extraction and system interaction fluency, solves the logic fault problem in the traditional single-wheel processing mode, and realizes end-to-end optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120561316A_ABST
    Figure CN120561316A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of knowledge extraction, in particular to a knowledge graph construction method and system based on a large model, and the method comprises the following steps: obtaining a current input statement of a user through a dialogue state tracker, inputting the statement into a BERT intention classification model for domain label analysis, behavior type recognition and emotional tendency detection, and outputting a three-dimensional classification vector; and extracting entity lexical items and relation predicates based on an LSTM sequence tagging device, and generating an original semantic structural body. According to the method, intention classification, behavior recognition and emotion detection are fused through three-dimensional semantic analysis, semantic comprehension granularity is improved, dynamic entity disambiguation is combined with a Manhattan distance threshold value and dialogue history tracking, semantic boundaries are defined to reduce anaphora ambiguity, and cross-modal alignment is enhanced through relation predicate hierarchical clustering and knowledge base dynamic matching; generative reply and semantic coherence reordering collaboratively keep topic continuation, and structured analysis and unstructured generation closed loop optimize semantic output and interaction fluency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge extraction technology, and in particular to a method and system for constructing a knowledge graph based on a large model. Background Art

[0002] The field of knowledge extraction involves identifying semantically meaningful information elements from structured or unstructured data and converting them into standardized knowledge representations that can be used for further processing. The core content of this technology mainly includes tasks such as named entity recognition, relationship extraction, event extraction, and ontology mapping. The purpose is to identify entities such as people, organizations, geographic locations, events, and the semantic relationships between them from natural language text or databases. Knowledge extraction usually relies on natural language processing methods and statistical learning models. It performs semantic analysis on large-scale data through a combination of feature engineering and supervised learning. It is a key support means for building semantic networks, knowledge graphs, and intelligent question-answering systems.

[0003] Among them, the knowledge graph construction method refers to the process of forming a knowledge network with clear semantic hierarchy and structure by extracting information, semantic fusion and ontology matching from multi-source heterogeneous data. The technical matters involved in the subject of this patent include extracting structured information from relational databases, realizing semantic modeling by constructing attributes and hierarchical mapping relationships between entities, and combining entity pairs and relationship pairs extracted from text to perform unified semantic integration of multi-source data. This method generally completes knowledge extraction and graph generation through means such as lexical analysis, context feature modeling, entity recognition model training, dependency syntax analysis and ontology mapping rule construction.

[0004] Traditional entity disambiguation relies on a static rule base and lacks the ability to dynamically model conversational states. Entities with the same name in multiple rounds of conversations lack context, leading to node redundancy. Relationship extraction uses an independent semantic matching strategy, ignoring the temporal dependency of predicates in the conversation flow, making cross-round relationship reasoning prone to discontinuity. The knowledge integration process overly relies on predefined ontology mapping rules and lacks an adaptive adjustment mechanism for dynamically generated predicates, resulting in delayed knowledge updates. The generation module and parsing steps are separated in their design, and a feedback path based on semantic coherence is not established, making it easy for responses to deviate from the main thread of the conversation. Existing technologies operate independently in each link, failing to form an end-to-end closed-loop optimization system, impacting the overall collaborative efficiency of knowledge extraction and the conversation system. Summary of the Invention

[0005] The purpose of the present invention is to solve the shortcomings of the existing technology and propose a knowledge graph construction method and system based on a large model.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for constructing a knowledge graph based on a large model, comprising the following steps: S1: The user's current input sentence is obtained through the dialogue state tracker. The sentence is input into the BERT intent classification model for domain label analysis, behavior type recognition, and sentiment tendency detection. The model outputs a three-dimensional classification vector. The bidirectional LSTM sequence tagger with an attention gating mechanism extracts entity terms and relation predicates to generate the original semantic structure. S2: Input the three-dimensional classification vector and the original semantic structure into the TransE conversation entity disambiguation model, perform z-score normalization on the entity vector, calculate the Manhattan distance between the current entity vector and the entities with the same name in the conversation history, create independent nodes for entities whose distance values ​​exceed a set threshold optimized by grid search in 500 groups of conversation samples, and generate a conversation entity state diagram; S3: Input the dialogue entity state diagram into the hierarchical clustering algorithm to perform semantic aggregation of relationship predicates, perform cosine similarity matching between the relationship description vector and the knowledge base predicates, extract predicates whose matching values ​​reach a set threshold, and generate a dialogue strategy candidate set.

[0007] As a further solution of the present invention, the original semantic structure includes entity boundary markers, part-of-speech tag sequences, and dependency chains; the dialogue entity state diagram includes a disambiguation marker bitmap, an entity vector matrix, and a cross-turn association index; and the dialogue strategy candidate set includes a candidate predicate list, a similarity weight value, and context constraints.

[0008] As a further solution of the present invention, the hidden layer of the LSTM sequence tagger receives the attention weight output by BERT as a gating signal; The formula for the z-score normalization process is: ,in is the original entity vector, is the mean of the conversation history entity vector, is the standard deviation; The threshold for cosine similarity matching is set to 0.85, which is determined based on the inflection point of the F1-score curve of the test set.

[0009] As a further solution of the present invention, the step of obtaining the original semantic structure is specifically as follows: S101: Detects the user input sentence text stream, calls the BERT intent classification model to calculate domain label weights, uses a 12-head attention mechanism to perform sentence feature interaction, outputs domain label distribution probabilities through a fully connected layer, uses a softmax function to process the behavior type feature vector, and combines the positive and negative values ​​output by the sentiment polarity detection module to generate a three-dimensional classification vector. S102: constructing an input feature matrix of an LSTM sequence tagger based on the three-dimensional classification vector, extracting term position codes through a bidirectional gated recurrent unit, decoding entity boundary probability distribution using a conditional random field, calculating the co-occurrence frequency of predicate relations at time steps, and generating an entity relationship coding table; S103: calling the entity relationship encoding table to perform predicate-argument structure alignment, performing topological sorting according to syntactic dependency paths, assigning semantic role weights through a three-layer graph convolutional network, using a ReLU activation function and adjacency matrix normalization operation in each layer, constructing a triple set of head entity, relationship type, and tail entity, and generating an original semantic structure; The LSTM is a bidirectional 4-layer structure with a hidden layer dimension of 512 and a dropout mechanism with a probability of 0.2.

[0010] As a further solution of the present invention, the steps of obtaining the dialog entity state diagram are specifically as follows: S201: Calling the three-dimensional classification vector and the original semantic structure to construct a TransE model input matrix, using entity vector translation operation to calculate the absolute difference between the current entity and the historical entity in Manhattan space, binarizing the distance value according to a preset disambiguation threshold parameter, and generating an entity distance comparison table; S202: performing distance value comparison based on the entity distance comparison table, performing orthogonal projection operations on entity vectors that exceed the disambiguation threshold, assigning unique identifiers to unmatched entities using a hash coding algorithm, establishing a mapping between entity identifiers and conversation turn timestamps, and generating an entity identifier mapping set; S203: Calling the entity identification mapping set to execute graph structure construction, storing the temporal correlation strength between entity nodes through the adjacency matrix, using a depth-first search algorithm to detect ambiguous branches of entities with the same name, integrating entity state transition paths in historical conversations, and generating a conversation entity state graph; The TransE model uses Euclidean space mapping, and the learning rate is set to 0.001 and the negative sampling ratio is 5:1 during training; The orthogonal projection operation uses the Gram-Schmidt orthogonalization method to eliminate linear dependencies between vectors; The edge weight of the adjacency matrix is ​​determined by the product of the number of entity co-occurrences and the time decay factor. The time decay factor is calculated as follows: ,in , and Timestamp of the conversation turn.

[0011] As a further solution of the present invention, the step of obtaining the dialogue strategy candidate set is specifically as follows: S301: Detecting entity relationship feature vectors in the dialog entity state diagram, calculating semantic distances between entities using a hierarchical clustering algorithm, constructing a cluster tree using a single-link aggregation method, and pruning the cluster tree according to a preset semantic difference threshold to generate entity semantic clusters; S302: calling the relationship description vectors in the entity semantic cluster, constructing a knowledge base predicate vector space, calculating the cosine similarity between each relationship description vector and the knowledge base predicate vector, storing the similarity values ​​using a matrix operation method, and generating a predicate similarity matrix; S303: Based on the predicate similarity matrix, set 0.85 as the similarity matching threshold, traverse all similarity values ​​in the matrix, filter out predicate entries that exceed the threshold, sort them in descending order according to the predicate semantic weight, and combine the matching entries to generate a dialogue strategy candidate set; The semantic distance is calculated using Mahalanobis distance, and the covariance matrix is ​​obtained based on training of historical conversation data; The knowledge base predicate vector is generated by pre-training the 300-dimensional Word2Vec model; The predicate semantic weight is calculated using the TF-IDF algorithm, and the inverse document frequency factor is determined based on the frequency of occurrence of the predicate in the knowledge base.

[0012] As a further embodiment of the present invention, the method further comprises: S4: Input the dialogue strategy candidate set into the GPT generation module for multiple rounds of reply generation, construct an association graph between noun phrases and verb phrases through the TextRank algorithm, calculate the semantic coherence between the generated text and the dialogue history, reorder the candidate replies, and output a reply set.

[0013] As a further aspect of the present invention, the response set includes generating a text sequence, a coherence score table, and a priority ranking index; The edge weight of the TextRank algorithm is calculated by weighting the phrase co-occurrence frequency and the part-of-speech association factor.

[0014] As a further solution of the present invention, the steps of obtaining the reply set are specifically as follows: S401: Input the dialogue strategy candidate set into the GPT generation module, load the JSON template including the slot filling mechanism, traverse the candidate set elements, use the sequence generation strategy to generate reply text item by item, and output a multi-round reply set; S402: Calling the multi-round reply set, extracting noun phrases from the conversation history and verb phrases from the generated text using the TextRank algorithm, constructing a weighted directed graph model, performing iterative edge weight calculations until convergence, mapping node weights to 128-dimensional semantic vectors, and calculating the dot product between the conversation history vector and the generated text vector to obtain a semantic coherence value; S403: Establishing a sorting index based on the semantic coherence value, re-arranging the candidate replies using a quick sorting algorithm, setting a coherence threshold of 0.65 to filter out invalid text, merging candidate replies that pass the threshold test, and outputting a reply set; The template includes entity slots, relationship slots and context constraints; The semantic vector is compressed from the 768-dimensional BERT vector to 128 dimensions using the PCA dimensionality reduction method; The 0.65 coherence threshold was selected through ROC curve analysis to balance recall and precision.

[0015] A knowledge graph construction system based on a large model, the knowledge graph construction system based on a large model is used to implement the above-mentioned knowledge graph construction method based on a large model, and the system includes: A semantic parsing module is used to obtain a three-dimensional classification vector of the user input sentence through the BERT intent classification model, call the LSTM sequence tagger to perform entity term boundary recognition and relation predicate tagging operations on the sentence, generate an original semantic structure, and pass the three-dimensional classification vector and the original semantic structure to the entity disambiguation module; An entity disambiguation module is configured to input the three-dimensional classification vector into the TransE conversation entity disambiguation model, perform Manhattan distance calculation on the entity vector extracted from the original semantic structure, establish an independent node index when the distance between the entity vector and the entity with the same name in the conversation history exceeds a set threshold, generate a conversation entity state graph, and pass the conversation entity state graph to the relationship aggregation module; a relationship aggregation module for performing semantic vector aggregation on the relationship predicates in the dialogue entity state diagram using a hierarchical clustering algorithm, performing similarity matching between the aggregated relationship description vectors and the knowledge base predicates using a cosine similarity algorithm, extracting a set of predicates whose similarity values ​​meet a set threshold, generating a dialogue strategy candidate set, and passing the dialogue strategy candidate set to the response generation module; The reply generation module is used to input the dialogue strategy candidate set into the GPT generation module to perform multi-round dialogue reply generation, call the TextRank algorithm to perform semantic coherence calculation on the generated text and the dialogue history, perform a descending sort operation on the candidate replies based on the coherence value, and output the sorted reply set.

[0016] Compared with the prior art, the advantages and positive effects of the present invention are: In the present invention, intent classification, behavior recognition and emotion detection are integrated through a three-dimensional semantic parsing mechanism to achieve synchronous parsing of multi-dimensional user needs and improve the granularity of semantic understanding. The dynamic entity disambiguation model is combined with Manhattan distance threshold control to establish entity semantic boundaries through dialogue history state tracking, reducing reference ambiguity in multi-round interactions. The hierarchical clustering of relational predicates and the dynamic matching mechanism of the knowledge base enhance cross-modal semantic alignment capabilities and optimize knowledge integration efficiency. The collaborative mechanism of generative responses and semantic coherence reordering maintains topic continuity through multi-round dialogue state perception, solving the logical fault problem in the traditional single-round processing mode. The closed-loop processing flow of structured parsing and unstructured generation realizes end-to-end optimization from original semantics to knowledge network and then to natural language output, improving the accuracy of knowledge extraction and the fluency of system interaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a schematic diagram of the workflow of the present invention; Figure 2 Flowchart of the steps for obtaining the original semantic structure of the present invention; Figure 3 A flowchart of the steps for obtaining the dialogue entity state diagram of the present invention; Figure 4 Flowchart of the steps for obtaining a candidate set of dialogue strategies of the present invention; Figure 5 This is a flow chart of the steps for obtaining a reply set according to the present invention. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0019] In the description of the present invention, it should be understood that the terms "length," "width," "up," "down," "front," "back," "left," "right," "vertical," "horizontal," "top," "bottom," "inside," "outside," and the like, indicating positions or relationships, are based on the positions or relationships shown in the accompanying drawings and are intended only to facilitate the description of the present invention and simplify the description. They do not indicate or imply that the devices or elements referred to must have a specific orientation, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limiting the present invention. Furthermore, in the description of the present invention, "plurality" means two or more, unless otherwise expressly and specifically defined.

[0020] Example 1 See also Figure 1 The present invention provides a technical solution: a method for constructing a knowledge graph based on a large model, comprising the following steps: S1: The user's current input sentence is obtained through the dialogue state tracker. The sentence is input into the BERT intent classification model for domain label analysis, behavior type recognition, and sentiment tendency detection. The model outputs a three-dimensional classification vector. The bidirectional LSTM sequence tagger with an attention gating mechanism extracts entity terms and relation predicates to generate the original semantic structure. S2: The three-dimensional classification vector and the original semantic structure are input into the TransE conversation entity disambiguation model. The entity vector is z-score normalized and the Manhattan distance between the current entity vector and entities with the same name in the conversation history is calculated. Entities whose distance exceeds a set threshold optimized by grid search across 500 conversation samples are then created as independent nodes to generate a conversation entity state diagram. S3: Input the dialogue entity state diagram into the hierarchical clustering algorithm to perform semantic aggregation of relationship predicates. Then, perform cosine similarity matching between the relationship description vector and the knowledge base predicates. Then, extract the predicates whose matching value reaches the set threshold and generate a candidate set of dialogue strategies. S4: The dialogue strategy candidate set is input into the GPT generation module for multiple rounds of response generation. The TextRank algorithm is used to construct a correlation graph between noun phrases and verb phrases. The semantic coherence between the generated text and the dialogue history is calculated. The candidate responses are re-ranked and the response set is output.

[0021] The original semantic structure includes entity boundary markers, part-of-speech tagging sequences, and dependency chains. The dialogue entity state diagram includes a disambiguation marker bitmap, an entity vector matrix, and a cross-turn association index. The dialogue strategy candidate set includes a candidate predicate list, similarity weight values, and context constraints. The response set includes a generated text sequence, a coherence score table, and a priority sorting index.

[0022] The hidden layer of the LSTM sequence tagger receives the attention weights output by BERT as gating signals; The formula for z-score standardization is: ,in is the original entity vector, is the mean of the conversation history entity vector, is the standard deviation; The threshold for cosine similarity matching is set to 0.85, which is determined based on the inflection point of the F1-score curve of the test set; The edge weight of the TextRank algorithm is calculated by weighting the phrase co-occurrence frequency and the part-of-speech association factor.

[0023] See also Figure 2 , the specific steps for obtaining the original semantic structure are: S101: Detects the user input sentence text stream, calls the BERT intent classification model to calculate domain label weights, uses a 12-head attention mechanism to perform sentence feature interaction, outputs domain label distribution probabilities through a fully connected layer, uses a softmax function to process the behavior type feature vector, and combines the positive and negative values ​​output by the sentiment polarity detection module to generate a three-dimensional classification vector. The system examines the user input sentence stream. When a user types "I want to listen to Zhang San's song," the system first performs token segmentation on the text stream, generating the token sequence "I," "want," "listen," "Zhang San," "of," and "song." These tokens are then converted into corresponding word vector representations, which are then fed into the BERT intent classification model. Within the model, the input information is encoded using a multi-layer Transformer architecture. A specially configured 12-head attention mechanism enables the model to capture the complex dependencies between tokens within the sentence in parallel across 12 different representation subspaces. Specifically, the semantic connections between "listen" and "song," "Zhang San," and the specific attributes of "Zhang San" as a singer are effectively recognized. One attention subspace focuses on the direct connection between the action "listening" and the object "song," while another subspace emphasizes the indirect but crucial connection between "Zhang San" as the singer of the "song." Through the interaction of features and information fusion within the 12-head attention mechanism, a precise understanding of the deep semantics of the entire input sentence is achieved.

[0024] The resulting sentence feature vector is then passed to a fully connected layer, which contains several neurons, each corresponding to a predefined domain label, such as "music playback," "weather query," and "news broadcast." The fully connected layer performs matrix multiplication on the input sentence feature vector and superimposes a bias term, outputting the raw scores for each domain label. For the input "I want to listen to Zhang San's songs," the fully connected layer outputs the raw scores for each domain label. These scores are normalized using the softmax function to obtain the domain label probability distribution: specifically, the probability for "music playback" is 0.95, the probability for "weather query" is 0.03, and the probability for "news broadcast" is 0.02. Simultaneously, a behavior type feature vector representing user intent (such as "play request") is also processed using the softmax function to obtain the behavior type probability distribution: "[play request: 0.90, favorite request: 0.05, other: 0.05]." In addition, a separate sentiment polarity detection module analyzes the original input sentence, "I want to listen to Zhang San's songs," and determines its emotional tone. If this sentence is positive, the sentiment polarity detection module outputs a positive value of +0.8. Finally, the system integrates the domain label probability distribution vector "[0.95, 0.03, 0.02]," the behavior type probability distribution vector "[0.90, 0.05, 0.05]," and the sentiment polarity value +0.8 to generate a three-dimensional classification vector.

[0025] S102: Construct an input feature matrix for the LSTM sequence tagger based on the three-dimensional classification vector, extract term position codes through a bidirectional gated recurrent unit, decode entity boundary probability distribution using a conditional random field, calculate the co-occurrence frequency of predicate relations at each time step, and generate an entity relationship encoding table; Based on the three-dimensional classification vector generated in step S101, this vector condenses information on domain classification (high probability of music playback), behavior type (high probability of playback request) and emotional tendency (+0.8, positive), and is used to construct the input feature matrix of the long short-term memory network (LSTM) sequence tagger. The specific operation is that for the user input "I want to listen to Zhang San's song", the input features of each word in the sequence "I", "want", "listen", "Zhang San", "of", and "song" obtained after word segmentation are composed of two parts: one part is the word embedding representation of the word itself (obtained through the pre-trained word vector model, set to 300 dimensions), and the other part is the direct splicing or dimensionality reduction of the aforementioned three-dimensional classification vector as an additional feature (set to 50 dimensions). Therefore, the total input feature dimension of each word is 350 dimensions. The feature vectors of these word units are arranged in sequence to form the input feature matrix.

[0026] This matrix is fed into a bidirectional 4-layer LSTM network, where the hidden layer dimension of each layer of LSTM is set to 512. During the training phase of the network, to enhance the generalization ability of the model and reduce the overfitting phenomenon, a dropout probability of 0.2 is adopted between network layers and in the recurrent connections. This 0.2 dropout probability is determined by hyperparameter search on the validation set, testing the impact of dropout values in the range [0.1, 0.15, 0.2, 0.25, 0.3] on the model performance (measured by the F1 score), and it is found that when the dropout is 0.2, the model performs optimally in preventing overfitting and enhancing the generalization ability; the specific experimental data are: F1 is 0.88 when dropout is 0.1, 0.89 when 0.15, 0.91 when 0.2, 0.90 when 0.25, and 0.88 when 0.3. Through the processing of bidirectional gated recurrent units, the LSTM network can capture the context-dependent information of the token sequence from both the forward and backward directions, thereby extracting the token position encoding containing its context information for each token in the sequence ("我", "想", "听", "张三", "的", "歌"). Taking "张三" as an example, its encoding not only incorporates the information of the previous token "听" but also integrates the information of the subsequent tokens "的歌". These deep encodings are then fed into the Conditional Random Field (CRF) layer. The CRF layer optimizes the output of LSTM by learning the constraint rules between label sequences (for example, the "B-歌手" label is more likely to be followed by the "I-歌手" label rather than the "B-歌曲名" label). Through the decoding process of the CRF layer, the system outputs the optimal entity boundary label sequence for each token and its corresponding probability distribution. For example, the probability that "张三" is labeled as "B-歌手" is 0.9, the probability of being labeled as "I-歌手" is 0.05, and the probability of being labeled as "O" (non-entity part) is 0.05. At the same time, the probability that "歌" is labeled as "B-对象" is 0.85. Immediately afterwards, the system analyzes these annotation results and counts the co-occurrence frequency of the core verb (predicate, such as "听") and the identified entities (such as "张三", "歌") within the same sentence. In the sentence "我想听张三的歌", "听" and "张三" co-occur 1 time, and "听" and "歌" co-occur 1 time. The system structures and stores these co-occurrence information, the identified entities and their types (such as "张三": singer, "歌": object), and the relationships between them (such as the action "听" connecting "张三" and "歌"), and finally generates an entity relationship encoding table.

[0027] S103: Call the entity relationship encoding table to perform predicate-argument structure alignment, perform topological sorting according to the syntactic dependency path, assign semantic role weights through a three-layer graph convolutional network, use the ReLU activation function and adjacency matrix normalization operation in each layer, construct a set of triplets of head entity, relationship type, and tail entity, and generate the original semantic structure; The entity relationship encoding table generated in step S102 is called. This table stores structured entries such as (head entity: "user", relationship: "want to listen", tail entity: "song") and (head entity: "song", attribute: "singer", tail entity: "Zhang San"). Based on the syntactic dependency analysis results of the sentence "I want to listen to Zhang San's song" (the analysis results show that "listen" is the core predicate, its agent is "I" (representing the user), the patient is "song", and "Zhang San's" is the attributive of "song"), the system topologically sorts the relevant components according to this syntactic dependency path, thereby determining the priority of semantic role assignment and the mutual dependencies.

[0028] Next, the system uses a three-layer graph convolutional network (GCN) to assign corresponding semantic role weights to the identified entities and relationships. In this graph structure, entities and relationships are nodes, and the edges between them are constructed based on dependency relationships. Each layer of GCN updates the representation of the node by aggregating information from its neighboring nodes and applies the ReLU activation function (the mathematical expression of which is ) introduces nonlinear transformation capabilities. At the same time, after each layer of GCN operation, the adjacency matrix of the graph is normalized, specifically using the symmetric normalization method , where A represents the adjacency matrix and D represents the node degree matrix. After iterative processing through a three-layer graph convolutional network, each node in the graph (whether an entity or a relationship) receives a weight vector representing its role importance in the current semantic context. In the context of the predicate "listen," "song," as the direct action object, receives a higher weight; while "Zhang San," as a key attribute of "song" (the singer), also receives a corresponding weight reflecting its importance. Based on these calculated weights and the previously aligned predicate-argument structure, the system constructs a set of triples consisting of a head entity, a relationship type, and a tail entity. From the sentence "I want to listen to Zhang San's song," the system can extract triples such as (user, want to listen, {song title: unknown, singer: Zhang San}), or more specifically, (Zhang San, singer belongs to, song) and (user, perform action, listen to song). These extracted triples are further integrated and processed to generate the final original semantic structure.

[0029] LSTM is a bidirectional 4-layer structure with a hidden layer dimension of 512 and a dropout mechanism with a probability of 0.2.

[0030] See also Figure 3 , the specific steps for obtaining the dialogue entity state diagram are: S201: Call the three-dimensional classification vector and the original semantic structure to construct the TransE model input matrix, use the entity vector translation operation to calculate the absolute difference between the current entity and the historical entity in Manhattan space, perform binary determination on the distance value according to the preset disambiguation threshold parameter, and generate an entity distance comparison table; Call the three-dimensional classification vector generated by S101, specifically This vector encodes domain information, behavior type, and sentiment polarity, and is combined with the original semantic structure generated by S103, which contains the entity "air conditioner", its current state "on", and the set temperature "26 degrees Celsius", to construct the input data of the TransE model. The entity "air conditioner" is converted into its vector representation through the pre-trained embedding model, a 5-dimensional vector There are two “air conditioner” entity instances in the conversation history, and their vectors are and The system uses entity vector translation operation to calculate the absolute difference between the current entity and each historical entity in Manhattan space. and historical air conditioning entity vector The Manhattan distance calculation process is: Current air conditioner entity vector and historical air conditioning entity vector The Manhattan distance calculation process is: .

[0031] Next, according to a preset disambiguation threshold parameter , perform binary judgment on the calculated distance values. The disambiguation threshold parameter is set to 3.0. The determination of this value is based on an in-depth analysis of large-scale historical conversation data: statistically analyzing the Manhattan distance distribution characteristics between entity pairs that are known to point to the same real-world object (co-referential entity pairs) and entity pairs that point to different real-world objects (heterogeneous entity pairs). By selecting a distance value that can maximize the distinction between these two types of entity pairs as the threshold. Specifically, in a calibration experiment involving 1,000 pairs of co-referential entity pairs and 1,000 pairs of heterogeneous entity pairs, the average Manhattan distance of co-referential entity pairs and their distribution are concentrated in the lower numerical area (average 1.5, standard deviation 0.5), while the average Manhattan distance of heterogeneous entity pairs and their distribution are concentrated in the higher numerical area (average 7.0, standard deviation 1.0). Experimental data show that when When set to 3.0, the system achieves an accuracy of 92% in distinguishing homonymous and heteronymous entity pairs, which is an ideal balance point. Therefore, this embodiment selects 3.0 as the disambiguation threshold. ,because , judged as 1 (indicating that the current entity and the historical entity points to the same object). For distance values ,because , judged as 0 (indicating that the current entity and the historical entity The system aggregates the binary determination results of the current entity and all historical entities to generate an entity distance comparison table.

[0032] S202: Perform distance value comparison based on the entity distance comparison table, perform orthogonal projection operation on entity vectors that exceed the disambiguation threshold, use a hash coding algorithm to assign unique identifiers to unmatched entities, establish a mapping between entity identifiers and conversation turn timestamps, and generate an entity identifier mapping set; Based on the entity distance comparison table generated in step S201, the table accurately records the matching status between each entity identified in the current conversation round and the entities recorded in the historical conversation. The comparison table shows that the binary distance between the entity "air conditioner" and the historical entity "air conditioner_ID001" is 1, indicating that they match; and the binary distance with "air conditioner_ID002" is 0, indicating that they do not match. The system performs a comparison on these distance values. For those entities judged as 0 in the comparison table, that is, their calculated distances from all recorded historical entities exceed the preset disambiguation threshold. Entity vector of a new entity "remote controller" whose vector is , its Manhattan distance with all entities in the historical database is greater than 3.0), the system determines that this is a newly appeared entity or an entity that is significantly different from historical entities.

[0033] For such entity vectors, the system performs an orthogonal projection operation, specifically using the Gram-Schmidt orthogonalization method. If a set of historical entity basis vectors that are considered important and linearly independent has been established in the context of the current conversation , then the new entity vector By subtracting all its projection components on these established basis vectors, a new vector is obtained that is orthogonal to these historical basis vectors. For entities that fail to successfully match any historical entities (i.e., entities for which all calculated distances are greater than a threshold), such as the aforementioned "remote control," the system uses a hashing algorithm to assign them a globally unique identifier (UID). Specifically, the entity name "remote control" is concatenated with the precise timestamp of the current conversation turn (a high-precision timestamp, "20250519103005.123") and then hashed using the SHA256 algorithm to generate a unique hash digest value, which serves as the entity's UID, denoted as "UID_A8F3." The system then establishes a mapping between the entity identifier and the conversation turn in which it appeared (currently the fifth conversation turn) and the corresponding specific timestamp (converted to a Unix timestamp, 1684463405 seconds). All such newly generated mappings (e.g., "UID_A8F3" -> turn 5, timestamp 1684463405) are collected and stored, ultimately forming a set of entity identifier mappings.

[0034] S203: Calling the entity identification mapping set to execute graph structure construction, storing the temporal correlation strength between entity nodes through the adjacency matrix, using the depth-first search algorithm to detect ambiguous branches of entities with the same name, integrating the entity state transition paths in the historical conversation, and generating a conversation entity state graph; Call the entity identification mapping set generated in step S202. This set contains the unique identifier (UID) of each entity and its first conversation turn and corresponding timestamp information. The specific entries are as follows ("UID_Air Conditioner 01", turn 2, timestamp seconds), ("UID_Light01", round 3, timestamp seconds), ("UID_Air Conditioner 01", round 5, timestamp seconds, where the same entity appears in different rounds). The system constructs the graph structure based on this information. The nodes in the graph are composed of the entities represented by these UIDs.

[0035] An adjacency matrix is ​​used to store the temporal correlation strength between entity nodes. Elements in Represents the entity UID and entity UID The strength of the association between the two entities. This strength value is determined by the product of the number of co-occurrences of the two entities in the conversation history and a time decay factor. The calculation formula of the time decay factor is In this formula, is the timestamp of the later of the two entities, is the timestamp of the earlier occurrence of the entity, Is a preset time decay coefficient. The setting of refers to the general rule that the influence of information in a dialogue system naturally decays over time. The immediate influence of information mentioned in a dialogue usually gradually decreases as the number of dialogue turns increases. In this embodiment, the setting Round , and uses the conversation turn as the basic unit of time. When calculating the time decay factor, the decay coefficient The unit is selected as "per round", and the timestamp difference The unit of is also "round", which ensures that the exponential term It is a pure numeric value without attributes, meeting the basic requirements of exponential functions. As a unit of time measurement, "turns" directly reflect the natural progression of conversational interactions, avoiding the extra conversion step of converting absolute time units (such as seconds or minutes) to conversation turns. This simplifies calculations and allows the decay effect to be directly linked to the logical segmentation of the conversation.

[0036] Table 1 Entity interaction example data table

[0037] As shown in Table 1, some sample data of entity interactions are listed. Take the entity pair (air conditioner 01, light 01) as an example for calculation: the co-occurrence count is 2 times, and the entity air conditioner 01 appears in the second round of dialogue ( ), Entity Light 01 appears in the third round of dialogue ( The time difference between them is According to the formula, the time decay factor Therefore, in the adjacency matrix, the edge weight representing the association between "air conditioner 01" and "light 01" is For the entity pair (air conditioner 01, sensor 01): the co-occurrence count is 1, and air conditioner 01 is in the second round ( ), sensor 01 in the 5th round ( ). Time difference Time decay factor The corresponding edge weight is . formula By introducing the time decay factor and time difference This enables the model to dynamically assess the timeliness of historical information, assigning higher weight to recent interactions, thereby more accurately reflecting the focus of the current conversation. A calculated edge weight, such as 1.8096, indicates that the association between "air conditioner 01" and "lamp 01" is stronger than the 0.7408 association between "air conditioner 01" and "sensor 01." These weights form the core component of the adjacency matrix. The system then uses a depth-first search (DFS) algorithm to traverse the constructed graph structure, detecting whether nodes have the same original entity name but correspond to different UIDs. If the system contains "apple_UID001" (referring to a company) and "apple_UID002" (referring to a type of fruit), the DFS algorithm can help trace the contextual paths of these two UIDs in the conversation history. If their connection patterns and co-existing entities differ significantly, the system identifies this as an ambiguous branch. Finally, by integrating the state transition paths represented by all entity nodes in the graph and the weighted edges between them (a path can be "air conditioner on" to "temperature adjustment" to "humidity sensor activation"), the final dialogue entity state graph is generated.

[0038] The TransE model uses Euclidean space mapping, and the learning rate is set to 0.001 and the negative sampling ratio is 5:1 during training; The orthogonal projection operation uses the Gram-Schmidt orthogonalization method to eliminate the linear correlation between vectors; The edge weight of the adjacency matrix is ​​determined by the product of the number of entity co-occurrences and the time decay factor. The time decay factor is calculated as follows: ,in , and Timestamp of the conversation turn.

[0039] See also Figure 4 , the specific steps for obtaining the dialogue strategy candidate set are: S301: Detecting entity relationship feature vectors in the dialogue entity state diagram, calculating semantic distances between entities using a hierarchical clustering algorithm, constructing a cluster tree using single-link aggregation, and pruning the cluster tree based on a preset semantic difference threshold to generate entity semantic clusters; Detect the entity relationship feature vectors in the dialogue entity state graph generated in step S203. These feature vectors are numerical representations of entities in the graph embedding space. They are learned from the dialogue entity state graph using the Node2Vec algorithm. Each vector is set to 3 dimensions. The feature vector of the entity "Air Conditioner A" is , the feature vector of entity “air conditioner B” is , the feature vector of entity “light bulb C” is The system uses a hierarchical clustering algorithm to calculate the semantic distance between these entity vectors.

[0040] The semantic distance here is measured using Mahalanobis distance, and its calculation formula is: ,in is the covariance matrix, is its inverse matrix. Covariance matrix The construction of is based on statistical learning of the feature vector differences between semantically similar entity pairs (air conditioners of different brands but similar functions) and semantically dissimilar entity pairs in large-scale historical conversation data. The specific process is to collect 10,000 pairs of entity pairs from historical conversations and manually annotate them (to determine whether they are semantically similar). For entity pairs marked as semantically similar, the difference between their feature vectors is calculated, and then the covariance matrix is ​​calculated based on the set of these difference vectors and used as the After calculation, the Mahalanobis distance between entity A and entity B is , the Mahalanobis distance between entity A and entity C , the Mahalanobis distance between entity B and entity C The system constructs a cluster tree by single-linkage aggregation. In this method, each entity initially constitutes an independent cluster; in each subsequent iteration, the algorithm merges the two closest clusters among all current clusters. The distance between clusters is defined as the minimum Mahalanobis distance between the entities contained in each cluster. According to the calculated distance, A and B are first merged to form cluster (A, B), and then the distance between cluster (A, B) and entity C is calculated as .

[0041] According to a preset semantic difference threshold , perform pruning operations on the constructed clustering tree. The semantic difference threshold was set to 1.8. This value was chosen based on a careful evaluation of the clustering performance on the development dataset. The internal consistency (i.e., the semantic similarity between entities within a cluster) and inter-cluster differences (i.e., the semantic distinction between entities in different clusters) of each cluster formed under the setting of , are measured by combining the objective evaluation index of Silhouette Coefficient. The experimental results show that when When set to 1.8, the clusters formed achieve the highest score on the silhouette coefficient, indicating that the cluster division quality is optimal at this time, with both intra-cluster compactness and inter-cluster separation reaching good levels. Therefore, this embodiment selects 1.8 as the semantic difference threshold. Since the distance 3.1 between clusters (A, B) and C is greater than the threshold of 1.8, the merge operation is not performed. The clusters finally formed, such as {air conditioner A, air conditioner B} and {light bulb C}, are entity semantic clusters.

[0042] S302: calling the relationship description vectors in the entity semantic cluster, constructing the knowledge base predicate vector space, calculating the cosine similarity between each relationship description vector and the knowledge base predicate vector, storing the similarity values ​​using a matrix operation method, and generating a predicate similarity matrix; Call the entity semantic clusters generated in step S301. One cluster contains the entities "air conditioner A" and "air conditioner B", while another independent cluster contains "PM2.5 sensor X". The entities in these clusters semantically share certain core attributes or are closely related to each other. The system extracts relevant relationship description vectors from these clusters. There are two sources of these relationship description vectors: one is directly derived from the relationship information directly related to these entities in the original semantic structure generated in step S103; the other is a representative vector generated by analyzing the common connection relationship patterns between entities within a specific cluster. For the cluster "air conditioner", the relationship description vectors that may be extracted include 、 ; For the entity “PM2.5 sensor X”, the possible extracted relationship description vector is .

[0043] These relationship description vectors extracted from the clusters and the predicate vectors stored in the knowledge base are obtained by pre-training a 300-dimensional Word2Vec model. The Word2Vec model is trained on a large-scale general corpus and text data related to specific fields, so that the generated vectors can effectively capture the deep semantic relationships between words. The knowledge base contains standard predicates such as "set device parameters", "query device status", "get environmental readings", etc., which also have corresponding 300-dimensional vector representations, denoted as 、 、 Then, the system calculates each relationship description vector extracted from the entity cluster (such as ), and each predicate vector in the knowledge base (such as 、 The cosine similarity between , etc. is calculated as follows: .calculate and The cosine similarity of , the result is 0.88; calculate and The cosine similarity of the cluster is 0.45. The system stores all the calculated cosine similarity values ​​in a matrix format to form a predicate similarity matrix. In this matrix, each row represents a relationship description vector extracted from the cluster, and each column represents a predicate vector in the knowledge base. Each element in the matrix That is the The relationship description vector and the The cosine similarity value between the knowledge base predicate vectors is the generated predicate similarity matrix.

[0044] S303: Based on the predicate similarity matrix, set 0.85 as the similarity matching threshold, traverse all similarity values ​​in the matrix, filter out predicate entries that exceed the threshold, sort them in descending order according to the predicate semantic weight, and combine the matching entries to generate a dialogue strategy candidate set; Based on the predicate similarity matrix generated in step S302, the matrix stores in detail the semantic similarity between the relevant relationship description vectors in the current dialogue context and the predefined standard predicates in the knowledge base. A row of data in the matrix represents the vector of the relationship "adjust the air conditioning temperature", and its calculated similarity with the knowledge base predicate "set device parameters" is 0.88, while its calculated similarity with the knowledge base predicate "query device status" is 0.45. The system sets 0.85 as the similarity matching threshold The determination of this threshold of 0.85 is based on the results of a controlled experiment: First, a standard test set containing 100 relationship description vectors and their corresponding correct knowledge base predicates was prepared; then, a series of different similarity thresholds (including 0.70, 0.75, 0.80, 0.85, 0.90) were used to perform matching tests on the test set, and the precision and recall of the matching results under each threshold setting were calculated; finally, the F1 score (the calculation formula is ) to evaluate overall performance. Experimental data shows that when the threshold is set to 0.85, the F1 score reaches a peak of 0.910. Specific experimental data points are: at a threshold of 0.80, P=0.88, R=0.92, F1=0.899; at a threshold of 0.85, P=0.93, R=0.89, F1=0.910; and at a threshold of 0.90, P=0.96, R=0.83, F1=0.890. Therefore, considering both precision and recall, 0.85 was selected as the final matching threshold.

[0045] Subsequently, the system traverses all similarity values ​​in the predicate similarity matrix and filters out those predicate entries whose values ​​exceed the preset threshold of 0.85. The similarity between the relationship "adjust the air conditioning temperature" and the knowledge base predicate "set device parameters" is 0.88. Since it is greater than 0.85, "set device parameters" is selected as the candidate predicate. However, its similarity with "query device status" is 0.45. Since it is less than 0.85, "query device status" is not selected. For all predicate entries that pass the screening, the system arranges them in descending order according to their corresponding predicate semantic weights. The TF-IDF algorithm is used to calculate the predicate semantic weight. Among them, TF (TermFrequency) refers to the frequency of the predicate appearing in the current conversation context or related documents. The IDF (InverseDocumentFrequency) factor is determined based on the frequency of the predicate appearing in the entire knowledge base. Its specific calculation formula is: Assume that the total number of predicates in the knowledge base is 10,000. For the predicate "set device parameters", its TF value in the current context is 2, and the number of knowledge base documents containing this predicate is 500, then its IDF value is , whose TF-IDF weight is For another candidate predicate "calibration sensor accuracy", its TF value is 1, the number of knowledge base documents containing this predicate is 50, and its IDF value is , whose TF-IDF weight is Based on the calculated TF-IDF weight, "Set device parameters" (weight 5.988) will be ranked before "Calibrate sensor accuracy" (weight 5.278). Finally, the system combines the matching predicate entries, which have been screened for similarity and sorted in descending order of semantic weight, to form a candidate set of dialogue strategies with different priorities or strategic directions.

[0046] The semantic distance is calculated using Mahalanobis distance, and the covariance matrix is ​​obtained based on training of historical conversation data; The knowledge base predicate vectors are generated by pre-training the 300-dimensional Word2Vec model; The semantic weight of the predicate is calculated using the TF-IDF algorithm, and the inverse document frequency factor is determined based on the frequency of occurrence of the predicate in the knowledge base.

[0047] See also Figure 5 , the specific steps for obtaining the reply collection are: S401: Input the dialogue strategy candidate set into the GPT generation module, load the JSON template including the slot filling mechanism, traverse the candidate set elements, use the sequence generation strategy to generate response text item by item, and output a multi-round response set; The dialogue policy candidate set generated in step S303, which includes policy elements such as "Request: Query weather information, Location: Beijing, Time: Tomorrow" or "Command: Play a song, Singer: Zhang San, Song type: Lyrical," is input into the GPT (Generative Pre-trained Transformer) generation module. Before performing the text generation task, the system first loads a series of predefined JSON templates. These templates have a built-in slot-filling mechanism. For example, the response template structure for a weather query is {"type":"weather_report","city":"{{Location}}","date":"{{Time}}","forecast":"{{Weather conditions}}","temperature_range":"{{Temperature range}}"}, where {{Location}}, {{Time}}, {{Weather conditions}}, and {{Temperature range}} are slots waiting to be filled with specific information.

[0048] The GPT module iterates through each policy element in the candidate dialogue policy set. When processing the policy "Request: Query weather information, Location: Beijing, Time: Tomorrow," GPT uses this policy information (and any relevant conversation history context, if available and useful) as an input prompt. Following the structure of the loaded JSON template, GPT employs a specific sequence generation strategy (nucleus sampling with a temperature parameter of 0.7 and top-k sampling with k set to 40) to generate natural language responses one by one, while ensuring that each slot in the template is accurately filled. These generation parameters (temperature of 0.7 and top-k of 40) are industry-standard settings that strike a balance between diversity and quality. The current combination was selected through manual evaluation of responses generated using different parameter combinations (e.g., temperature in the range [0.5, 0.7, 0.9] and top-k in the range [20, 40, 60]) and systematic comparison using objective metrics such as BLEU and ROUGE scores). This ensures that the generated responses are both fluent and natural, while not overly random. Based on the complex language patterns and rich knowledge learned from massive amounts of text data, the GPT model generates text content such as "Tomorrow's weather forecast for Beijing is sunny, with temperatures between 15 and 25 degrees Celsius." It then extracts or infers the key information, "sunny," into the {{weather conditions}} slot of the template, and "15 to 25 degrees Celsius" into the {{temperature range}} slot. This text generation and slot filling process is rigorously repeated for each policy element in the candidate set, resulting in a multi-round response set containing multiple potential response texts.

[0049] S402: Calling multiple rounds of reply sets, extracting noun phrases from the conversation history and verb phrases from the generated text using the TextRank algorithm, constructing a weighted directed graph model, performing iterative edge weight calculations until convergence, mapping node weights to 128-dimensional semantic vectors, and calculating the dot product between the conversation history vector and the generated text vector to obtain a semantic coherence value. The multi-round reply set generated by step S401 is called. This set contains multiple candidate replies generated for the current dialogue state. Candidate reply 1 is: "Beijing will be sunny tomorrow, 15-25 degrees", candidate reply 2 is: "I have found that the weather in Beijing will be good tomorrow", and the related dialogue history: "User: How will the weather in Beijing be tomorrow?" The system uses the TextRank algorithm to extract core noun phrases from the dialogue history and core verb phrases from each generated candidate reply text. For the dialogue history "User: How will the weather in Beijing be tomorrow?", the extracted noun phrases include "Beijing", "tomorrow", and "weather". For candidate reply 1 "Beijing will be sunny tomorrow, 15-25 degrees", the extracted verb phrases include "(is) sunny" and "(at) 15-25 degrees."

[0050] Next, the system constructs a weighted directed graph model. The nodes in the graph are composed of the noun phrases and verb phrases extracted in the previous steps. The edge weights between nodes are determined based on the semantic similarity between these phrases (the cosine similarity between them is calculated by pre-trained word vectors) or their co-occurrence relationship in the original text. The system then performs an iterative edge weight calculation process similar to the PageRank algorithm on the graph until the weight values ​​of each node in the graph converge, thereby obtaining the centrality score of each phrase. Subsequently, the system uses the weights (i.e., centrality scores) of these nodes (phrases) to construct a 128-dimensional semantic vector. A specific implementation method is to obtain the corresponding 128-dimensional pre-trained embedding vector for each core noun phrase in the conversation history, and then perform a weighted average based on the score calculated by the TextRank algorithm, and finally obtain a 128-dimensional vector representing the entire conversation history. Similarly, we obtain the 128-dimensional embedding vector for each core verb phrase in the generated reply text and perform weighted average based on its TextRank score to obtain a 128-dimensional vector representing the generated text. The vector corresponding to reply 1 is , the vector corresponding to reply 2 is Finally, the system calculates the conversation history vector Generate a text vector with each The dot product value between them is: The semantic coherence value of reply 2 is: These dot product values ​​are the semantic coherence values ​​of each candidate response.

[0051] S403: Establish a sorting index based on the semantic coherence value, use a quick sort algorithm to reorder the candidate replies, set a coherence threshold of 0.65 to filter out invalid text, merge the candidate replies that pass the threshold test, and output a reply set; Based on the semantic coherence values ​​calculated for each candidate reply in step S402, Reply 1 has a coherence value of 0.687, Reply 2 has a coherence value of 0.453, and assuming there is a Reply 3 with a coherence value of 0.550, the system establishes a sorting index. This index closely associates each candidate reply with its corresponding semantic coherence value. The system uses the Quicksort algorithm to sort all candidate replies in descending order according to their semantic coherence values. The Quicksort algorithm first selects a pivot element and then divides the remaining elements in the list into two parts: one part with all elements smaller than the pivot element and the other part with all elements larger than the pivot element. This sorting process is then recursively applied to these two sublists. After sorting, the order of the candidate replies is updated to: Reply 1 (0.687), Reply 3 (0.550), Reply 2 (0.453).

[0052] Next, the system sets 0.65 as the coherence threshold , used to filter out invalid or low-quality text. The threshold of 0.65 was determined as follows: First, a dataset containing 500 generated replies and their corresponding conversation histories was collected. Each reply was manually annotated for coherence with its history (categorized as coherent, partially coherent, and incoherent). Simultaneously, the semantic coherence values ​​of these replies were calculated. By plotting receiver operating characteristic (ROC) curves or analyzing the classification accuracy at different threshold settings (considering "coherent" and "partially coherent" as positive classes, and "incoherent" as negative), it was found that a threshold of 0.65 achieved the best overall performance in distinguishing coherent from incoherent replies. Specifically, at this threshold, the system correctly identified 90% of coherent replies while successfully filtering out 85% of incoherent replies, achieving an acceptable balance between maintaining reply quality and avoiding over-screening. Therefore, this embodiment selected 0.65 as the coherence threshold. The system traverses the re-arranged candidate response list and considers those with semantic coherence values ​​less than 0.65 (0.550 for response 3 and 0.453 for response 2) invalid and discards them. However, response 1, with a coherence value of 0.687, exceeds 0.65 and passes the threshold test. The system merges all candidate responses that pass the threshold test (here, only response 1) to form the final response set, which is then output.

[0053] The template contains entity slots, relationship slots, and context constraints; The semantic vector is compressed from the 768-dimensional BERT vector to 128 dimensions using the PCA dimensionality reduction method; The coherence threshold of 0.65 was selected through ROC curve analysis to balance recall and precision.

[0054] A knowledge graph construction system based on a large model, which is used to execute the above-mentioned knowledge graph construction method based on a large model, and the system includes: The semantic parsing module uses the BERT intent classification model to obtain a four-dimensional classification vector for the user input sentence. The fourth dimension is the dialog scene identifier. The module then calls the LSTM sequence tagger to perform entity term boundary recognition and relation predicate tagging operations on the sentence to generate the original semantic structure. The module then passes the three-dimensional classification vector and the original semantic structure to the entity disambiguation module. The entity disambiguation module is used to input the three-dimensional classification vector into the TransE conversation entity disambiguation model, perform Manhattan distance calculation on the entity vector extracted from the original semantic structure, establish an independent node index when the distance between the entity vector and the entity with the same name in the conversation history exceeds a set threshold, generate a conversation entity state diagram, and pass the conversation entity state diagram to the relationship aggregation module; The relationship aggregation module is used to perform semantic vector aggregation on the relationship predicates in the dialogue entity state diagram using a hierarchical clustering algorithm. The aggregated relationship description vectors are then matched with the knowledge base predicates using the cosine similarity algorithm. The set of predicates whose similarity values ​​meet the set threshold is extracted to generate a dialogue strategy candidate set. The dialogue strategy candidate set is then passed to the response generation module. The response generation module is used to input the dialogue policy candidate set into the GPT generation module to perform multi-round dialogue response generation. It uses the TextRank algorithm to calculate the semantic coherence between the generated text and the dialogue history, sorts the candidate responses in descending order based on the coherence value, and outputs the sorted response set. The entity vectors are stored in a B+ tree index structure, and the node branching factor is set to 50.

[0055] The above are merely preferred embodiments of the present invention and do not limit the present invention in any other form. Any technician familiar with the profession may use the technical content disclosed above to change or modify it into an equivalent embodiment with equivalent changes and apply it to other fields. However, any simple modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall still fall within the scope of protection of the technical solution of the present invention.

Claims

1. A method for constructing a knowledge graph based on a large model, characterized in that: The following steps are involved: S1: The user's current input sentence is obtained through the dialogue state tracker. The sentence is input into the BERT intent classification model for domain label analysis, behavior type recognition, and sentiment tendency detection. The model outputs a three-dimensional classification vector. The bidirectional LSTM sequence tagger with an attention gating mechanism extracts entity terms and relation predicates to generate the original semantic structure. S2: Input the three-dimensional classification vector and the original semantic structure into the TransE conversation entity disambiguation model, perform z-score normalization on the entity vector, calculate the Manhattan distance between the current entity vector and the entities with the same name in the conversation history, create independent nodes for entities whose distance values ​​exceed a set threshold optimized by grid search in 500 groups of conversation samples, and generate a conversation entity state diagram; S3: Input the dialogue entity state diagram into the hierarchical clustering algorithm to perform semantic aggregation of relationship predicates, perform cosine similarity matching between the relationship description vector and the knowledge base predicates, extract predicates whose matching values ​​reach a set threshold, and generate a dialogue strategy candidate set.

2. The method for constructing a knowledge graph based on a large model according to claim 1, characterized in that: The original semantic structure includes entity boundary markers, part-of-speech tag sequences, and dependency chains; the dialogue entity state diagram includes a disambiguation marker bitmap, an entity vector matrix, and a cross-turn association index; and the dialogue strategy candidate set includes a candidate predicate list, a similarity weight value, and context constraints.

3. The method for constructing a knowledge graph based on a large model according to claim 2, characterized in that: The hidden layer of the LSTM sequence tagger receives the attention weight output by BERT as a gating signal; The formula for the z-score normalization process is: ,in is the original entity vector, is the mean of the conversation history entity vector, is the standard deviation; The threshold for cosine similarity matching is set to 0.85, which is determined based on the inflection point of the F1-score curve of the test set.

4. The method for constructing a knowledge graph based on a large model according to claim 3, characterized in that: The steps for obtaining the original semantic structure are specifically as follows: S101: Detects the user input sentence text stream, calls the BERT intent classification model to calculate domain label weights, uses a 12-head attention mechanism to perform sentence feature interaction, outputs domain label distribution probabilities through a fully connected layer, uses a softmax function to process the behavior type feature vector, and combines the positive and negative values ​​output by the sentiment polarity detection module to generate a three-dimensional classification vector. S102: constructing an input feature matrix of an LSTM sequence tagger based on the three-dimensional classification vector, extracting term position codes through a bidirectional gated recurrent unit, decoding entity boundary probability distribution using a conditional random field, calculating the co-occurrence frequency of predicate relations at time steps, and generating an entity relationship coding table; S103: calling the entity relationship encoding table to perform predicate-argument structure alignment, performing topological sorting according to syntactic dependency paths, assigning semantic role weights through a three-layer graph convolutional network, using a ReLU activation function and adjacency matrix normalization operation in each layer, constructing a triple set of head entity, relationship type, and tail entity, and generating an original semantic structure; The LSTM is a bidirectional 4-layer structure with a hidden layer dimension of 512 and a dropout mechanism with a probability of 0.

2.

5. The method for constructing a knowledge graph based on a large model according to claim 4, characterized in that: The steps for obtaining the dialogue entity state diagram are specifically as follows: S201: Calling the three-dimensional classification vector and the original semantic structure to construct a TransE model input matrix, using entity vector translation operation to calculate the absolute difference between the current entity and the historical entity in Manhattan space, binarizing the distance value according to a preset disambiguation threshold parameter, and generating an entity distance comparison table; S202: performing distance value comparison based on the entity distance comparison table, performing orthogonal projection operations on entity vectors that exceed the disambiguation threshold, assigning unique identifiers to unmatched entities using a hash coding algorithm, establishing a mapping between entity identifiers and conversation turn timestamps, and generating an entity identifier mapping set; S203: Calling the entity identification mapping set to execute graph structure construction, storing the temporal correlation strength between entity nodes through the adjacency matrix, using a depth-first search algorithm to detect ambiguous branches of entities with the same name, integrating entity state transition paths in historical conversations, and generating a conversation entity state graph; The TransE model uses Euclidean space mapping, and the learning rate is set to 0.001 and the negative sampling ratio is 5:1 during training; The orthogonal projection operation uses the Gram-Schmidt orthogonalization method to eliminate linear dependencies between vectors; The edge weight of the adjacency matrix is ​​determined by the product of the number of entity co-occurrences and the time decay factor. The time decay factor is calculated as follows: ,in , and Timestamp of the conversation turn.

6. The method for constructing a knowledge graph based on a large model according to claim 5, characterized in that: The steps for obtaining the dialogue strategy candidate set are specifically as follows: S301: Detecting entity relationship feature vectors in the dialog entity state diagram, calculating semantic distances between entities using a hierarchical clustering algorithm, constructing a cluster tree using a single-link aggregation method, and pruning the cluster tree according to a preset semantic difference threshold to generate entity semantic clusters; S302: calling the relationship description vectors in the entity semantic cluster, constructing a knowledge base predicate vector space, calculating the cosine similarity between each relationship description vector and the knowledge base predicate vector, storing the similarity values ​​using a matrix operation method, and generating a predicate similarity matrix; S303: Based on the predicate similarity matrix, set 0.85 as the similarity matching threshold, traverse all similarity values ​​in the matrix, filter out predicate entries that exceed the threshold, sort them in descending order according to the predicate semantic weight, and combine the matching entries to generate a dialogue strategy candidate set; The semantic distance is calculated using Mahalanobis distance, and the covariance matrix is ​​obtained based on training of historical conversation data; The knowledge base predicate vector is generated by pre-training the 300-dimensional Word2Vec model; The predicate semantic weight is calculated using the TF-IDF algorithm, and the inverse document frequency factor is determined based on the frequency of occurrence of the predicate in the knowledge base.

7. The method for constructing a knowledge graph based on a large model according to claim 6, characterized in that: The method further comprises: S4: Input the dialogue strategy candidate set into the GPT generation module for multiple rounds of reply generation, construct an association graph between noun phrases and verb phrases through the TextRank algorithm, calculate the semantic coherence between the generated text and the dialogue history, reorder the candidate replies, and output a reply set.

8. The method for constructing a knowledge graph based on a large model according to claim 7, characterized in that: The response set includes generating a text sequence, a coherence score table, and a priority ranking index; The edge weight of the TextRank algorithm is calculated by weighting the phrase co-occurrence frequency and the part-of-speech association factor.

9. The method for constructing a knowledge graph based on a large model according to claim 8, characterized in that: The steps for obtaining the reply set are specifically as follows: S401: Input the dialogue strategy candidate set into the GPT generation module, load the JSON template including the slot filling mechanism, traverse the candidate set elements, use the sequence generation strategy to generate reply text item by item, and output a multi-round reply set; S402: Calling the multi-round reply set, extracting noun phrases from the conversation history and verb phrases from the generated text using the TextRank algorithm, constructing a weighted directed graph model, performing iterative edge weight calculations until convergence, mapping node weights to 128-dimensional semantic vectors, and calculating the dot product between the conversation history vector and the generated text vector to obtain a semantic coherence value; S403: Establishing a sorting index based on the semantic coherence value, re-arranging the candidate replies using a quick sorting algorithm, setting a coherence threshold of 0.65 to filter out invalid text, merging candidate replies that pass the threshold test, and outputting a reply set; The template includes entity slots, relationship slots and context constraints; The semantic vector is compressed from the 768-dimensional BERT vector to 128 dimensions using the PCA dimensionality reduction method; The 0.65 coherence threshold was selected through ROC curve analysis to balance recall and precision.

10. A knowledge graph construction system based on a large model, characterized in that: The system is used to implement the method for constructing a knowledge graph based on a large model according to any one of claims 1 to 9, and the system includes: A semantic parsing module is used to obtain a three-dimensional classification vector of the user input sentence through the BERT intent classification model, call the LSTM sequence tagger to perform entity term boundary recognition and relation predicate tagging operations on the sentence, generate an original semantic structure, and pass the three-dimensional classification vector and the original semantic structure to the entity disambiguation module; An entity disambiguation module is configured to input the three-dimensional classification vector into the TransE conversation entity disambiguation model, perform Manhattan distance calculation on the entity vector extracted from the original semantic structure, establish an independent node index when the distance between the entity vector and the entity with the same name in the conversation history exceeds a set threshold, generate a conversation entity state graph, and pass the conversation entity state graph to the relationship aggregation module; a relationship aggregation module for performing semantic vector aggregation on the relationship predicates in the dialogue entity state diagram using a hierarchical clustering algorithm, performing similarity matching between the aggregated relationship description vectors and the knowledge base predicates using a cosine similarity algorithm, extracting a set of predicates whose similarity values ​​meet a set threshold, generating a dialogue strategy candidate set, and passing the dialogue strategy candidate set to the response generation module; The reply generation module is used to input the dialogue strategy candidate set into the GPT generation module to perform multi-round dialogue reply generation, call the TextRank algorithm to perform semantic coherence calculation on the generated text and the dialogue history, perform a descending sort operation on the candidate replies based on the coherence value, and output the sorted reply set.

Citation Information

Patent Citations

  • Plasticizing product recommendation method and system based on user demands

    CN119128177A

  • Method for constructing knowledge graph based on large language model and vector library

    CN119129722A

  • Middle and primary school multi-person foreign language situational teaching method and system based on VR

    CN120031684A

Cited By

  • Dynamic knowledge base collaborative improvement method based on multiple rounds of dialogues

    CN121168609A

  • Multi-round dialogue robot intention hit optimization method

    CN121301521A

  • Power transmission line engineering defect identification management system fused with artificial intelligence

    CN121392512A

  • User intention recognition method based on context semantic analysis

    CN121435979A

  • A user intention recognition method based on context semantic parsing

    CN121435979B