A knowledge graph construction method and system based on large model

By constructing a knowledge graph based on a large model, dynamically tracking the dialogue state and optimizing knowledge integration, the shortcomings of entity disambiguation and relation extraction in existing technologies are solved, and efficient knowledge extraction and system interaction are achieved.

CN120561316BActive Publication Date: 2025-10-28上海笑聘网络科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, entity disambiguation relies on a static rule base and lacks dynamic modeling capabilities. Relationship extraction ignores temporal dependency characteristics, and the knowledge integration process lacks adaptive adjustment, resulting in lagging knowledge updates and node redundancy in multi-turn dialogues, leading to low system collaboration efficiency.

Method used

We employ a knowledge graph construction method based on large models, using techniques such as BERT intent classification, LSTM sequence labeling, TransE entity disambiguation, and hierarchical clustering to dynamically track dialogue states, generate semantic structures, and optimize knowledge integration, thereby achieving end-to-end semantic coherence and accuracy.

Benefits of technology

It improved the accuracy of knowledge extraction and the smoothness of system interaction, reduced referential ambiguity in multi-turn dialogues, enhanced cross-modal semantic alignment capabilities, optimized knowledge integration efficiency, and maintained topic continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120561316B_ABST
    Figure CN120561316B_ABST
Patent Text Reader

Abstract

This invention relates to the field of knowledge extraction technology, specifically to a method and system for constructing a knowledge graph based on a large model. The method includes the following steps: acquiring the user's current input statement through a dialogue state tracker; inputting the statement into a BERT intent classification model for domain label parsing, behavior type recognition, and sentiment detection; outputting a three-dimensional classification vector; and extracting entity terms and relational predicates based on an LSTM sequence labeler to generate the original semantic structure. In this invention, intent classification, behavior recognition, and sentiment detection are integrated through three-dimensional semantic parsing to improve the granularity of semantic understanding; dynamic entity disambiguation combined with Manhattan distance thresholding and dialogue history tracking clarifies semantic boundaries and reduces referential ambiguity; hierarchical clustering of relational predicates and dynamic matching of the knowledge base enhance cross-modal alignment; generative responses and semantic coherence reordering work together to maintain topic continuity; and a closed loop of structured parsing and unstructured generation optimizes semantic output and interaction fluency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This 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 Technology

[0002] The field of knowledge extraction technology 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, relation extraction, event extraction, and ontology mapping, aiming to identify entities such as people, organizations, geographical locations, and events, and the semantic relationships between them, from natural language text or databases. Knowledge extraction typically relies on natural language processing methods and statistical learning models, using a combination of feature engineering and supervised learning to perform semantic parsing on large-scale data. It is a key supporting means for building semantic networks, knowledge graphs, and intelligent question-answering systems.

[0003] The knowledge graph construction method refers to the process of extracting information, semantically fusing, and matching ontology from multi-source heterogeneous data to form a semantically hierarchical and structured knowledge network. The technical aspects involved in this patent include extracting structured information from relational databases, achieving semantic modeling by constructing attribute and hierarchical mapping relationships between entities, and combining entity pairs and relation pairs extracted from text to perform unified semantic integration of multi-source data. This method generally completes knowledge extraction and graph generation through lexical analysis, contextual feature modeling, entity recognition model training, dependency parsing, and ontology mapping rule construction.

[0004] Traditional entity disambiguation relies on static rule bases, lacking the ability to dynamically model dialogue states. In multi-turn dialogues, entities with the same name become redundant due to missing context. Relation extraction employs independent semantic matching strategies, ignoring the temporal dependencies of predicates in the dialogue flow, leading to potential breaks in cross-turn relation reasoning. The knowledge integration process over-relies on predefined ontology mapping rules, lacking an adaptive adjustment mechanism for dynamically generated predicates, resulting in delayed knowledge updates. The generation module and parsing stage are designed in isolation, failing to establish a feedback path based on semantic coherence, making it easy for responses to deviate from the main dialogue line. Existing technologies operate independently at each stage, failing to form an end-to-end closed-loop optimization system, impacting the overall collaborative efficiency of knowledge extraction and the dialogue system. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing 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 knowledge graph construction method based on a large model, comprising the following steps:

[0007] S1: Obtain the user's current input statement through the dialogue state tracker, input the statement into the BERT intent classification model for domain label parsing, behavior type recognition, and sentiment detection, and output a three-dimensional classification vector. Extract entity terms and relational predicates based on a bidirectional LSTM sequence labeler with attention gating mechanism to generate the original semantic structure.

[0008] S2: Input the three-dimensional classification vector and the original semantic structure into the TransE dialogue entity disambiguation model, perform z-score normalization on the entity vector, calculate the Manhattan distance between the current entity vector and the entity with the same name in the dialogue history, establish independent nodes for entities whose distance values ​​exceed the set threshold optimized in 500 sets of dialogue samples by grid search method, and generate a dialogue entity state graph.

[0009] S3: Input the dialogue entity state graph into a hierarchical clustering algorithm to perform semantic aggregation of relation predicates, perform cosine similarity matching between the relation description vector and the predicates in the knowledge base, extract the predicates whose matching degree value reaches a set threshold, and generate a candidate set of dialogue strategies.

[0010] As a further embodiment of the present invention, the original semantic structure includes entity boundary markers, part-of-speech tagging sequences, and dependency relationship chains; the dialogue entity state graph includes a disambiguation marker bitmap, an entity vector matrix, and a cross-round association index; and the dialogue strategy candidate set includes a candidate predicate list, similarity weight values, and contextual constraints.

[0011] As a further aspect of the present invention, the hidden layer of the LSTM sequence labeler receives the attention weights output by BERT as a gating signal;

[0012] The formula for z-score normalization is: ,in For the original entity vector, The mean of the entity vectors in the dialogue history. Standard deviation;

[0013] The threshold for cosine similarity matching is set at 0.85, and the threshold is determined based on the inflection point of the F1-score curve of the test set.

[0014] As a further aspect of the present invention, the step of obtaining the original semantic structure specifically includes:

[0015] S101: Detect the user input text stream, call the BERT intent classification model to calculate the domain label weights, use a 12-head attention mechanism to perform sentence feature interaction, output the domain label distribution probability through a fully connected layer, use the softmax function to process the behavior type feature vector, and combine the positive and negative values ​​output by the sentiment polarity detection module to generate a three-dimensional classification vector.

[0016] S102: Construct the input feature matrix of the LSTM sequence labeler based on the three-dimensional classification vector, extract the term position encoding through a bidirectional gated recurrent unit, decode the entity boundary probability distribution using a conditional random field, calculate the co-occurrence frequency of predicate relations at time steps, and generate an entity relation encoding table.

[0017] S103: Call the entity relation encoding table to perform predicate-argument structure alignment, perform topological sorting according to syntactic dependency path, allocate semantic role weights through a 3-layer graph convolutional network, and use ReLU activation function and adjacency matrix normalization operation in each layer to construct a set of triples of head entity, relation type and tail entity to generate the original semantic structure;

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

[0019] As a further aspect of the present invention, the step of obtaining the dialogue entity state diagram specifically includes:

[0020] S201: The TransE model input matrix is ​​constructed by calling the three-dimensional classification vector and the original semantic structure. The absolute difference between the current entity and the historical entity in the Manhattan space is calculated by using entity vector translation operation. The distance value is binarized according to the preset disambiguation threshold parameter to generate an entity distance comparison table.

[0021] S202: Perform distance value comparison based on the entity distance lookup table, perform orthogonal projection operation on entity vectors that exceed the disambiguation threshold, assign unique identifiers to unmatched entities using a hash encoding algorithm, establish a mapping between entity identifiers and timestamps of dialogue rounds, and generate an entity identifier mapping set;

[0022] S203: Call the entity identifier mapping set to perform graph structure construction, store the temporal association strength between entity nodes through the adjacency matrix, use the depth-first search algorithm to detect ambiguous branches of entities with the same name, integrate the entity state transition paths in the historical dialogue, and generate a dialogue entity state graph.

[0023] The TransE model uses Euclidean space mapping, and during training, the learning rate is set to 0.001 and the negative sampling ratio is 5:1.

[0024] The orthogonal projection operation uses the Gram-Schmidt orthogonalization method to eliminate linear dependence between vectors;

[0025] The edge weights of the adjacency matrix are determined by the product of the number of entity co-occurrences and the time decay factor. The formula for calculating the time decay factor is as follows: ,in , and This is a timestamp for the dialogue round.

[0026] As a further aspect of the present invention, the step of obtaining the dialogue strategy candidate set specifically includes:

[0027] S301: Detect the entity relationship feature vector in the dialogue entity state graph, calculate the semantic distance between entities using a hierarchical clustering algorithm, construct a clustering tree through single-chain aggregation, and prune the clustering tree according to a preset semantic difference threshold to generate entity semantic clusters.

[0028] S302: Call the relation description vectors in the entity semantic cluster to construct the knowledge base predicate vector space, calculate the cosine similarity between each relation description vector and the knowledge base predicate vector, store the similarity values ​​using matrix operations, and generate a predicate similarity matrix;

[0029] S303: Based on the predicate similarity matrix, set 0.85 as the similarity matching threshold, traverse all similarity values ​​in the matrix, filter predicate entries that exceed the threshold, sort them in descending order according to the semantic weight of the predicates, and combine the matching entries to generate a dialogue strategy candidate set;

[0030] The semantic distance is calculated using Mahalanobis distance, and the covariance matrix is ​​obtained by training based on historical dialogue data.

[0031] The predicate vectors of the knowledge base are generated through pre-training of a 300-dimensional Word2Vec model;

[0032] The predicate semantic weights are calculated using the TF-IDF algorithm, and the inverse document frequency factor is determined based on the frequency of predicate occurrences in the knowledge base.

[0033] As a further aspect of the present invention, the method further includes:

[0034] S4: Input the candidate dialogue strategy set into the GPT generation module for multi-round response generation, construct the association graph of noun phrases and verb phrases through the TextRank algorithm, calculate the semantic coherence between the generated text and the dialogue history, reorder the candidate responses, and output the response set.

[0035] As a further aspect of the present invention, the response set includes a generated text sequence, a coherence scoring table, and a priority sorting index;

[0036] The edge weights of the TextRank algorithm are calculated by weighting phrase co-occurrence frequency and part-of-speech association factor.

[0037] As a further aspect of the present invention, the step of obtaining the response set specifically includes:

[0038] 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, generate the response text item by item using the sequence generation strategy, and output the multi-round response set;

[0039] S402: Call the multi-turn response set, extract the noun phrases in the dialogue history and the verb phrases in the generated text using the TextRank algorithm, construct a weighted directed graph model, perform iterative calculation of edge weights until convergence, map the node weights to 128-dimensional semantic vectors, calculate the dot product of the dialogue history vector and the generated text vector, and obtain the semantic coherence value.

[0040] S403: Based on the semantic coherence value, establish a sorting index, use a quick sorting algorithm to perform a rearrangement operation on the candidate responses, set a coherence threshold of 0.65 to filter invalid text, merge the candidate responses that pass the threshold detection, and output the response set;

[0041] The template includes entity slots, relationship slots, and context constraints.

[0042] The semantic vector is compressed from a 768-dimensional BERT vector to a 128-dimensional vector using the PCA dimensionality reduction method;

[0043] The 0.65 coherence threshold was selected through ROC curve analysis to balance recall and precision.

[0044] A knowledge graph construction system based on a large model, the system being used to implement the aforementioned knowledge graph construction method based on a large model, the system comprising:

[0045] The semantic parsing module is used to obtain the three-dimensional classification vector of the user input statement through the BERT intent classification model, call the LSTM sequence labeler to perform entity term boundary recognition and relation predicate labeling operations on the statement, generate the original semantic structure, and pass the three-dimensional classification vector and the original semantic structure to the entity disambiguation module.

[0046] The entity disambiguation module is used to input the three-dimensional classification vector into the TransE dialogue 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 value between the entity vector and the entity with the same name in the dialogue history exceeds a set threshold, generate a dialogue entity state graph, and pass the dialogue entity state graph to the relationship aggregation module.

[0047] The relation aggregation module is used to perform semantic vector aggregation on the relation predicates in the state graph of the dialogue entity using a hierarchical clustering algorithm, match the aggregated relation description vectors with the predicates in the knowledge base using a cosine similarity algorithm, extract the set of predicates whose similarity values ​​reach a set threshold, generate a dialogue strategy candidate set, and pass the dialogue strategy candidate set to the response generation module.

[0048] The response generation module is used to input the dialogue strategy candidate set into the GPT generation module to perform multi-round dialogue response generation, call the TextRank algorithm to perform semantic coherence calculation on the generated text and dialogue history, perform descending order sorting operation on the candidate responses according to the coherence value, and output the sorted response set.

[0049] Compared with the prior art, the advantages and positive effects of the present invention are as follows:

[0050] This invention integrates intent classification, behavior recognition, and sentiment detection through a three-dimensional semantic parsing mechanism to achieve simultaneous parsing of multi-dimensional user needs and improve the granularity of semantic understanding. A dynamic entity disambiguation model, combined with Manhattan distance threshold control, establishes entity semantic boundaries by tracking dialogue history states, reducing referential ambiguity in multi-turn interactions. Hierarchical clustering of relational predicates and a dynamic knowledge base matching mechanism enhance cross-modal semantic alignment capabilities and optimize knowledge integration efficiency. A collaborative mechanism of generative responses and semantic coherence reordering maintains topic continuity through multi-turn dialogue state awareness, resolving the logical discontinuity problem in traditional single-turn processing modes. A closed-loop processing flow of structured parsing and unstructured generation achieves end-to-end optimization from raw semantics to knowledge networks and then to natural language output, improving knowledge extraction accuracy and system interaction fluency. Attached Figure Description

[0051] Figure 1 This is a schematic diagram of the workflow of the present invention;

[0052] Figure 2 This is a flowchart illustrating the steps for obtaining the original semantic structure of this invention.

[0053] Figure 3 This is a flowchart of the steps for obtaining the dialogue entity state diagram of the present invention;

[0054] Figure 4 This is a flowchart illustrating the steps for obtaining the candidate set of dialogue strategies in this invention.

[0055] Figure 5 This is a flowchart illustrating the steps for obtaining the response set in this invention. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of this invention clearer, the 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 merely illustrative and not intended to limit the invention.

[0057] 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.

[0058] Example 1

[0059] Please see Figure 1 This invention provides a technical solution: a method for constructing a knowledge graph based on a large model, comprising the following steps:

[0060] S1: Obtain the user's current input statement through the dialogue state tracker, input the statement into the BERT intent classification model for domain label parsing, behavior type recognition, and sentiment detection, and output a three-dimensional classification vector. Extract entity terms and relational predicates based on a bidirectional LSTM sequence labeler with attention gating mechanism to generate the original semantic structure.

[0061] S2: Input the 3D classification vector and the original semantic structure into the TransE dialogue entity disambiguation model, perform z-score normalization on the entity vector, calculate the Manhattan distance between the current entity vector and the entity with the same name in the dialogue history, establish independent nodes for entities whose distance values ​​exceed the set threshold optimized in 500 sets of dialogue samples by grid search method, and generate a dialogue entity state graph.

[0062] S3: Input the dialogue entity state graph into the hierarchical clustering algorithm to perform semantic aggregation of relation predicates, perform cosine similarity matching between the relation description vector and the predicates in the knowledge base, extract the predicates whose matching degree value reaches the set threshold, and generate a candidate set of dialogue strategies.

[0063] S4: Input the dialogue strategy candidate set into the GPT generation module for multi-round response generation, construct the association graph of noun phrases and verb phrases through the TextRank algorithm, calculate the semantic coherence between the generated text and the dialogue history, reorder the candidate responses, and output the response set.

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

[0065] The hidden layer of the LSTM sequence labeler receives the attention weights output by BERT as a gating signal;

[0066] The formula for z-score normalization is: ,in For the original entity vector, The mean of the entity vectors in the dialogue history. Standard deviation;

[0067] The threshold for cosine similarity matching is set at 0.85, and the threshold is determined based on the inflection point of the F1-score curve of the test set.

[0068] The edge weights in the TextRank algorithm are calculated by weighting phrase co-occurrence frequency and part-of-speech association factor.

[0069] Please see Figure 2 The specific steps for obtaining the original semantic structure are as follows:

[0070] S101: Detect the user input text stream, call the BERT intent classification model to calculate the domain label weights, use a 12-head attention mechanism to perform sentence feature interaction, output the domain label distribution probability through a fully connected layer, use the softmax function to process the behavior type feature vector, and combine the positive and negative values ​​output by the sentiment polarity detection module to generate a three-dimensional classification vector.

[0071] The system detects the user's input text stream. When a user inputs "I want to listen to Zhang San's songs," the system first performs word segmentation on the text stream, obtaining the word sequence "I," "want," "listen," "Zhang San," "of," and "song." These word segments are then converted into corresponding word vectors, which are fed into the BERT intent classification model. Internally, the model encodes the input information through a multi-layered Transformer structure. A specially configured 12-head attention mechanism allows the model to capture the complex dependencies between word segments within the sentence in parallel across 12 different representation subspaces. Specifically, the semantic connections between "listen," "song," and "Zhang San," as well as the specific attribute of "Zhang San" as a singer, are effectively identified. One attention subspace focuses on the direct association between the action "listen" and the object "song," while another subspace emphasizes the indirect but crucial connection of "Zhang San" as the singer of the "song." Through feature interaction and information fusion via the 12-head attention mechanism, a precise understanding of the deep semantics of the entire input sentence is achieved.

[0072] Subsequently, the obtained sentence feature vectors are passed to a fully connected layer containing 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 vectors and adds bias terms to output 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 a softmax function to obtain the domain label probability distribution, specifically: "music playback" probability 0.95, "weather query" probability 0.03, and "news broadcast" probability 0.02. Simultaneously, a behavior type feature vector representing the user's intent (such as "play request") is also processed by the softmax function to obtain the behavior type probability distribution, resulting in "[play request: 0.90, favorite request: 0.05, other: 0.05]". In addition, a separate sentiment polarity detection module analyzes the original input statement "I want to listen to Zhang San's songs" to determine its sentiment tone; the sentiment of this statement is determined to be positive, and the sentiment polarity detection module outputs a positive value of +0.8. Finally, the system integrates the domain label distribution probability 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.

[0073] S102: Construct the input feature matrix of the LSTM sequence labeler based on the three-dimensional classification vector, extract the term position encoding through the bidirectional gated recurrent unit, decode the entity boundary probability distribution using the conditional random field, calculate the co-occurrence frequency of predicate relations at the time step, and generate the entity relation encoding table;

[0074] Based on the three-dimensional classification vector generated in step S101, this vector encapsulates information on domain classification (high probability of music playback), behavior type (high probability of playback request), and sentiment tendency (+0.8, positive), and is used to construct the input feature matrix of the Long Short-Term Memory (LSTM) sequence labeler. Specifically, for the user input "I want to listen to Zhang San's songs," each word in the segmented sequence "I," "want," "listen," "Zhang San," "of," and "song" has two parts in its input features: one part is the word embedding representation of that word (obtained through a pre-trained word vector model, set to 300 dimensions), and the other part is the additional feature obtained by directly concatenating or reducing the dimensionality of the aforementioned three-dimensional classification vector (set to 50 dimensions). Therefore, the total input feature dimension for each word is 350 dimensions. These word feature vectors are arranged sequentially to form the input feature matrix.

[0075] The matrix was fed into a bidirectional 4-layer LSTM network, where the hidden layer dimension of each LSTM layer was set to 512. During the network training phase, to enhance the model's generalization ability and reduce overfitting, a dropout probability of 0.2 was applied between network layers and in the recurrent connection parts. This dropout probability of 0.2 was determined through 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 model performance (measured by F1 score). It was found that when the dropout was 0.2, the model performed optimally in preventing overfitting and improving generalization ability; specifically, the F1 score was 0.88 when the dropout was 0.1, 0.89 when it was 0.15, 0.91 when it was 0.2, 0.90 when it was 0.25, and 0.88 when it was 0.3. Through bidirectional gated recurrent units, the LSTM network can capture contextual dependency information of word sequences in both forward and reverse directions, thereby extracting word position codes containing information from the preceding and following contexts for each word in the sequence ("I", "want", "listen", "Zhang San", "of", "song"). Taking "Zhang San" as an example, its encoding incorporates information from both the preceding word "listen" and the following word "of song". These deep codes are then fed into a Conditional Random Field (CRF) layer. The CRF layer optimizes the LSTM output by learning constraint rules between label sequences (e.g., the "B-singer" label tends to be followed by the "I-singer" label rather than the "B-song title" label). Through the CRF layer decoding process, the system outputs the optimal entity boundary label sequence for each lexical unit and its corresponding probability distribution. For example, the probability of "Zhang San" being labeled as "B-singer" is 0.9, as "I-singer" is 0.05, and as "O" (non-entity part) is 0.05. Meanwhile, the probability of "song" being labeled as "B-object" is 0.85. Next, the system analyzes these labeling results, statistically analyzing the co-occurrence frequency of core verbs (predicates, such as "listen") and identified entities (such as "Zhang San" and "song") within the same sentence. In the sentence "I want to listen to Zhang San's song," "listen" and "Zhang San" co-occur once, and "listen" and "song" co-occur once. The system structures and stores this co-occurrence information, the identified entities and their types (such as "Zhang San": singer, "song": object), and the relationships between them (such as the action "listen" connecting "Zhang San" and "song"), ultimately generating an entity relationship encoding table.

[0076] S103: Call the entity relation encoding table to perform predicate-argument structure alignment, perform topological sorting according to syntactic dependency path, allocate semantic role weights through a 3-layer graph convolutional network, and use ReLU activation function and adjacency matrix normalization operation in each layer to construct a set of triples of head entity, relation type and tail entity to generate the original semantic structure.

[0077] The system calls upon the entity relation encoding table generated in step S102, which stores structured entries such as (head entity: "user", relation: "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 statement "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), its patient is "song", and "Zhang San's" is a modifier of "song"), the system performs topological sorting of the relevant components according to this syntactic dependency path, thereby determining the priority order of semantic role assignment and the mutual dependencies.

[0078] Next, the system uses a 3-layer Graph Convolutional Network (GCN) to assign corresponding semantic role weights to the identified entities and relations. In this graph structure, entities and relations are treated as nodes, and the edges between them are constructed based on dependency relationships. Each layer of the GCN updates the node representation by aggregating information from its neighboring nodes, and after each aggregation, the ReLU activation function (whose mathematical expression is...) is applied. This introduces nonlinear transformation capabilities. Additionally, after each layer of GCN operations, a normalization operation is performed on the graph's adjacency matrix, specifically using a symmetric normalization method. Here, A represents the adjacency matrix, and D represents the degree matrix of the nodes. After iterative processing by a 3-layer graph convolutional network, each node in the graph (whether an entity or a relation) obtains a weight vector, which represents its role importance in the current semantic context. In the context of the predicate "listen," "song" is the direct action object and has a higher weight value; while "Zhang San," as an important attribute of "song" (the singer), also obtains a corresponding weight that reflects its importance. Based on these calculated weights and the previously aligned predicate-argument structure, the system constructs a set of triples for head entity, relation type, and tail entity. From the statement "I want to listen to Zhang San's song," the system can extract triples such as (user, want to listen, {song name: unknown, singer: Zhang San}), or more specifically, (Zhang San, is the singer, belongs to, song) and (user, performs action, listens to song). These extracted triple sets are further integrated and processed to generate the final original semantic structure.

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

[0080] Please see Figure 3 The specific steps for obtaining the dialogue entity state diagram are as follows:

[0081] S201: Construct the TransE model input matrix by calling the 3D classification vector and the original semantic structure, calculate the absolute difference between the current entity and the historical entity in the Manhattan space by using entity vector translation operation, and perform binarization judgment on the distance value according to the preset disambiguation threshold parameter to generate an entity distance comparison table.

[0082] The three-dimensional classification vector generated by S101 is called, specifically... This vector encodes domain information, behavior type, and sentiment polarity, and is combined with the original semantic structure generated by S103. This structure contains the entity "air conditioner," whose current state is "on" and whose set temperature is "26 degrees Celsius," together constructing the input data for the TransE model. The entity "air conditioner" is converted into its vector representation through a pre-trained embedding model, resulting in a 5-dimensional vector. There are two instances of the "air conditioner" entity in the dialogue history, with vectors respectively. and The system uses entity vector translation operations to calculate the sum of the absolute differences between the current entity and every historical entity in the Manhattan space. (Current air conditioner entity vector) Compared with historical air conditioning entity vectors The Manhattan distance calculation process is as follows: Current air conditioner entity vector Compared with historical air conditioning entity vectors The Manhattan distance calculation process is as follows: .

[0083] Next, based on a preset disambiguation threshold parameter... The calculated distance values ​​are then binarized for determination. This disambiguation threshold parameter... The threshold was set to 3.0. This value was determined based on in-depth analysis of large-scale historical dialogue data: statistically analyzing the Manhattan distance distribution characteristics between known entity pairs pointing to the same real-world object (identical entity pairs) and entity pairs pointing to different real-world objects (dissimilar entity pairs). A threshold was selected that maximizes the distinction between these two types of entity pairs. Specifically, in a calibration experiment containing 1000 identical entity pairs and 1000 dissimilar entity pairs, the average Manhattan distance and its distribution for identical entity pairs concentrated in a lower value range (mean 1.5, standard deviation 0.5), while the average Manhattan distance and its distribution for dissimilar entity pairs concentrated in a higher value range (mean 7.0, standard deviation 1.0). Experimental data showed that when... When the threshold is set to 3.0, the system achieves an accuracy of 92% in distinguishing between same-finite and different-finite entity pairs, which is an ideal balance. Therefore, this embodiment selects 3.0 as the disambiguation threshold. For the calculated distance value... ,because The determination is 1 (indicating the difference between the current entity and historical entities). (Pointing to the same object). For distance values... ,because The value is determined to be 0 (indicating the difference between the current entity and historical entities). (Pointing to different objects). The system summarizes the binarized judgment results of the current entity and all historical entities, and generates an entity distance lookup table.

[0084] S202: Perform distance value comparison based on entity distance lookup table, perform orthogonal projection operation on entity vectors that exceed the disambiguation threshold, assign unique identifiers to unmatched entities using hash encoding algorithm, establish a mapping between entity identifiers and timestamps of dialogue rounds, and generate entity identifier mapping sets;

[0085] Based on the entity distance lookup table generated in step S201, this table accurately records the matching status between each entity identified in the current dialogue round and entities recorded in the historical dialogue. The lookup table shows that the binary distance between the entity "Air Conditioner" and the historical entity "Air Conditioner_ID001" is 1, indicating a match; while the binary distance with "Air Conditioner_ID002" is 0, indicating a mismatch. The system compares these distance values. For entities whose distance in the lookup table is 0, meaning their calculated distances to all recorded historical entities exceed a preset disambiguation threshold... The entity vector (a new entity "remote controller", whose vector is...) (If its Manhattan distance to all entities in the historical database is greater than 3.0), the system determines that this is a newly emerging entity or an entity that is significantly different from historical entities.

[0086] For such entity vectors, the system performs orthogonal projection operations, specifically using the Gram-Schmidt orthogonalization method. This is done if a set of historical entity basis vectors considered important and linearly independent has already been established within the context of the current dialogue. Then the new entity vector By subtracting all its projected components onto these established basis vectors, we obtain a new vector that is orthogonal to all these historical basis vectors. For entities that fail to match any historical entity (i.e., entities whose calculated distances are all greater than the threshold), such as the aforementioned "remote controller," the system assigns a globally unique identifier (UID) using a hash encoding algorithm. Specifically, the entity name "remote controller" is concatenated with the precise timestamp of the current dialogue round (a high-precision timestamp "20250519103005.123"), and then a unique hash digest value is generated using the SHA256 hash algorithm, which serves as the entity's UID, denoted as "UID_A8F3". Subsequently, the system establishes a mapping relationship between the entity identifier and the dialogue round it appears in (currently the 5th round) and the corresponding specific timestamp (converted to a Unix timestamp, 1684463405 seconds). All such newly generated mappings (e.g., "UID_A8F3" -> round 5, timestamp 1684463405) are collected and stored, ultimately generating an entity identifier mapping set.

[0087] S203: Call the entity identifier mapping set to perform graph structure construction, store the temporal association strength between entity nodes through the adjacency matrix, use the depth-first search algorithm to detect ambiguous branches of entities with the same name, integrate the entity state transition paths in the historical dialogue, and generate the dialogue entity state graph.

[0088] The entity identifier mapping set generated in step S202 is invoked. This set contains the unique identifier (UID) of each entity, along with the dialogue round in which it first appears and the corresponding timestamp information. Specific entries are as follows: ("UID_AirConditioner01", Round 2, Timestamp) (seconds), ("UID_light01", round 3, timestamp) (seconds), ("UID_AirConditioner01", Round 5, timestamp) (The time interval is seconds, here indicating that the same entity appears in different rounds). The system constructs the graph structure based on this information. The nodes in the graph consist of entities represented by these UIDs.

[0089] An adjacency matrix is ​​used to store the temporal association strength between entity nodes. elements in Represents 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 times the two entities co-occur in the dialogue history and a time decay factor. The formula for calculating the time decay factor is as follows: In this formula, It is the timestamp of the entity that appears later among the two entities. It is a timestamp of the earliest physical entity. It is a preset time decay coefficient. The setting references the general principle that the influence of information in dialogue systems naturally diminishes over time. The immediate influence of information mentioned in a dialogue typically weakens as the number of dialogue rounds increases. In this embodiment, the setting... round Furthermore, it uses dialogue turns as the basic unit of measurement for time. When calculating the time decay factor, the decay coefficient... The unit is selected as "per round", and the timestamp difference is... The unit is also "rounds," which ensures that the index term... It is a pure numerical value without attributes, which meets the basic requirements of exponential function operations. As a unit of time measurement, "turn" directly reflects the natural process of dialogue interaction, avoiding the extra conversion steps of converting absolute time units (such as seconds or minutes) into dialogue turns, thus simplifying the calculation and making the decay effect directly related to the logical segmentation of the dialogue.

[0090] Table 1. Example Data Table of Entity Interaction

[0091]

[0092] Table 1 lists some example data on entity interactions. Taking the entity pair (Air Conditioner 01, Light 01) as an example, the co-occurrence count is 2, meaning entity Air Conditioner 01 appears in the second round of dialogue. ), Physical lamp 01 appears in the 3rd round of dialogue ( The time difference between them is Wheel. According to the formula, the time decay factor Therefore, in the adjacency matrix, the edge weight representing the association between "Air Conditioner 01" and "Lamp 01" is... For the entity pair (Air Conditioner 01, Sensor 01): the co-occurrence count is 1, and Air Conditioner 01 appears in the 2nd round ( Sensor 01 in the 5th round ( Time difference Wheel. Time decay factor. The corresponding edge weight is . formula By introducing a time decay factor and time difference This allows the model to dynamically assess the timeliness of historical information, assigning higher weights to recent interactions to more accurately reflect the focus of the current dialogue. The calculated edge weight value, such as 1.8096, indicates that the association between "Air Conditioner 01" and "Light 01" is stronger than the association between "Air Conditioner 01" and "Sensor 01" (0.7408). These weight values ​​constitute the core of the adjacency matrix. Next, the system uses a depth-first search (DFS) algorithm to traverse the constructed graph structure to detect whether there are nodes with the same original entity name but corresponding to different UIDs. When "Apple_UID001" (referring to a company) and "Apple_UID002" (referring to a fruit) exist in the system, the DFS algorithm helps trace the contextual paths of these two UIDs in the dialogue history. If significant differences are found in their connection patterns and shared entities, the system identifies this as an ambiguous branch. Finally, by integrating all entity nodes in the graph and the state transition paths represented by the weighted edges between them (a path can be from "air conditioner on" to "temperature adjustment" and then to "humidity sensor activated"), the final dialogue entity state graph is generated.

[0093] The TransE model uses Euclidean space mapping, and during training, the learning rate is set to 0.001 and the negative sampling ratio is 5:1.

[0094] Orthogonal projection operations use the Gram-Schmidt orthogonalization method to eliminate linear dependence between vectors;

[0095] The edge weights of the adjacency matrix are determined by the product of the number of entity co-occurrences and the time decay factor. The formula for calculating the time decay factor is as follows: ,in , and This is a timestamp for the dialogue round.

[0096] Please see Figure 4 The specific steps for obtaining the candidate set of dialogue strategies are as follows:

[0097] S301: Detect entity relationship feature vectors in the dialogue entity state graph, calculate semantic distance between entities using hierarchical clustering algorithm, construct clustering tree through single-chain aggregation, prune clustering tree according to preset semantic difference threshold, and generate entity semantic clusters.

[0098] The entity relation feature vectors in the dialogue entity state graph generated in step S203 are detected. These feature vectors are numerical representations of entities in the graph embedding space, learned from the dialogue entity state graph using the Node2Vec algorithm, with each vector set to 3 dimensions. The feature vector of entity "Air Conditioner A" is as follows: 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.

[0099] The semantic distance here is measured using Mahalanobis distance, and its calculation formula is as follows: ,in It is the covariance matrix. It is its inverse matrix. Covariance matrix The construction of this model is based on statistical learning of the feature vector differences between semantically similar entity pairs (air conditioners from different brands but with similar functions) and semantically dissimilar entity pairs in a large-scale historical dialogue dataset. Specifically, 10,000 entity pairs from historical dialogues are collected and manually labeled (to determine semantic similarity). For entity pairs labeled as semantically similar, the difference in their feature vectors is calculated. Then, a covariance matrix is ​​calculated based on this set of difference vectors and used as the basis for the model. The Mahalanobis distance between entity A and entity B was calculated. Mahalanobis distance between entity A and entity C Mahalanobis distance between entity B and entity C The system constructs a clustering tree using a single-linkage aggregation method. In this method, each entity initially forms an independent cluster; in each subsequent iteration, the algorithm merges the two closest clusters. The distance between clusters is defined as the minimum Mahalanobis distance between the entities contained in each cluster. Based on the calculated distances, A and B are first merged to form cluster (A,B), and then the distance between cluster (A,B) and entity C is calculated. .

[0100] Based on a preset semantic difference threshold Then, perform pruning operations on the constructed clustering tree. This semantic difference threshold... It was set to 1.8. This value was chosen based on a detailed evaluation of the clustering performance on the development dataset. This was achieved by systematically observing different thresholds (test range: ...). The internal consistency (i.e., the degree of semantic similarity between entities within a cluster) and inter-cluster differences (i.e., the degree of semantic distinction between entities in different clusters) of each cluster formed under the given conditions are measured in conjunction with the silhouette coefficient, an objective evaluation metric. Experimental results show that when When the threshold is set to 1.8, the resulting clusters achieve the highest contour coefficient score, indicating optimal cluster partitioning quality with good intra-cluster compactness and inter-cluster separation. Therefore, this embodiment selects 1.8 as the semantic difference threshold. Since the distance of 3.1 between clusters (A, B) and C is greater than the threshold of 1.8, no merging operation is performed. The final clusters, such as {Air Conditioner A, Air Conditioner B} and {Light Bulb C}, are entity semantic clusters.

[0101] S302: Call the relation description vectors in the entity semantic cluster to construct the knowledge base predicate vector space, calculate the cosine similarity between each relation description vector and the knowledge base predicate vector, store the similarity values ​​using matrix operations, and generate a predicate similarity matrix;

[0102] The system calls upon the entity semantic clusters generated in step S301. One cluster contains entities "Air Conditioner A" and "Air Conditioner B," while another independent cluster contains "PM2.5 Sensor X." Entities within these clusters semantically share certain core attributes or have close relationships with each other. The system extracts relevant relational description vectors from these clusters. These relational description vectors come from two sources: first, directly from the relational information directly related to these entities in the original semantic structure generated in step S103; and second, representative vectors generated by analyzing common connection patterns between entities within a specific cluster. For the "Air Conditioner" cluster, the possible extracted relational description vectors include... , For the entity "PM2.5 sensor X", the possible extracted relation description vector is: .

[0103] These relation description vectors extracted from the clusters, along with the predicate vectors stored in the knowledge base, were all generated by pre-training a 300-dimensional Word2Vec model. This Word2Vec model was trained on a large-scale general corpus and domain-specific text data, enabling the generated vectors to effectively capture deep semantic relationships between words. The knowledge base contains standard predicates such as "set device parameters," "query device status," and "get environmental readings," each with its own corresponding 300-dimensional vector representation, denoted as... , , Next, the system calculates the relation description vector extracted from each entity cluster (e.g., ...). ), and each predicate vector in the knowledge base (such as , The cosine similarity between (etc.). The method for calculating cosine similarity is as follows: .calculate and The cosine similarity was calculated, yielding a result of 0.88; and The cosine similarity was calculated, yielding a result of 0.45. The system stores all these calculated cosine similarity values ​​in a matrix format, forming a predicate similarity matrix. In this matrix, each row represents a relation description vector extracted from a cluster, and each column represents a predicate vector from a knowledge base. Each element in the matrix... That is, the first The i-th relation description vector and the i-th The cosine similarity values ​​between the predicate vectors of each knowledge base are used to generate the predicate similarity matrix.

[0104] S303: Based on the predicate similarity matrix, set 0.85 as the similarity matching threshold, traverse all similarity values ​​in the matrix, filter predicate entries that exceed the threshold, sort them in descending order according to the semantic weight of the predicates, and combine the matching entries to generate a candidate set of dialogue strategies.

[0105] Based on the predicate similarity matrix generated in step S302, this matrix stores in detail the semantic similarity between relevant relation description vectors in the current dialogue context and predefined standard predicates in the knowledge base. A row in the matrix represents the vector of the relation "adjust air conditioning temperature," which has a calculated similarity of 0.88 with the knowledge base predicate "set device parameters," and a calculated similarity of 0.45 with the knowledge base predicate "query device status." The system sets 0.85 as the similarity matching threshold. The threshold of 0.85 was determined based on the results of a controlled experiment: First, a standard test set containing 100 relation 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, and 0.90) were used to perform matching tests on the test set, and the precision and recall of the matching results were calculated under each threshold setting; finally, the F1 score (calculated using the formula...) was used to... The overall performance was evaluated using a threshold of 0.85. Experimental data showed that the F1 score reached a peak of 0.910 when the threshold was set to 0.85. Specific experimental data points were: threshold 0.80, P=0.88, R=0.92, F1=0.899; threshold 0.85, P=0.93, R=0.89, F1=0.910; threshold 0.90, P=0.96, R=0.83, F1=0.890. Therefore, considering both precision and recall, 0.85 was chosen as the final matching threshold.

[0106] Subsequently, the system iterates through all similarity values ​​in the predicate similarity matrix, filtering out predicate entries whose values ​​exceed a preset threshold of 0.85. The relation "adjust air conditioner temperature" has a similarity of 0.88 with the knowledge base predicate "set device parameters," which is greater than 0.85, so "set device parameters" is selected as a candidate predicate. However, its similarity with "query device status" is 0.45, which is less than 0.85, so "query device status" is not selected. For all filtered predicate entries, the system sorts them in descending order according to their corresponding predicate semantic weights. The predicate semantic weights are calculated using the TF-IDF algorithm. TF (Term Frequency) refers to the frequency of the predicate in the current dialogue context or related documents. IDF (Inverse Document Frequency) is determined based on the frequency of the predicate in the entire knowledge base, and its specific calculation formula is as follows: Suppose 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... Its TF-IDF weights are For another candidate predicate, "calibrate sensor accuracy," its TF value is 1, the number of knowledge base documents containing this predicate is 50, and its IDF value is [missing value]. Its TF-IDF weights are Based on the calculated TF-IDF weights, "Setting device parameters" (weight 5.988) will be ranked before "Calibrating sensor accuracy" (weight 5.278). Finally, the system will combine the matching predicate entries that have been filtered for similarity and sorted in descending order of semantic weight to form a candidate set of dialogue strategies with different priorities or policy directions.

[0107] Semantic distance is calculated using Mahalanobis distance, and the covariance matrix is ​​obtained by training based on historical dialogue data.

[0108] The predicate vectors of the knowledge base are generated through pre-training of a 300-dimensional Word2Vec model;

[0109] The semantic weights of predicates are calculated using the TF-IDF algorithm, and the inverse document frequency factor is determined based on the frequency of predicate occurrences in the knowledge base.

[0110] Please see Figure 5 The specific steps to obtain the response set are as follows:

[0111] 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, generate the response text item by item using the sequence generation strategy, and output the multi-round response set;

[0112] The dialogue strategy candidate set generated in step S303, containing strategy elements such as "Request: Query weather information, Location: Beijing, Time: Tomorrow" or "Command: Play song, Artist: Zhang San, Song type: Ballad," 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 specific slot filling mechanism. A weather query response template structure 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.

[0113] The GPT module iterates through each policy element in the dialogue policy candidate set. When processing the policy "Request: Query weather information, Location: Beijing, Time: Tomorrow", GPT uses this policy information (along with the relevant dialogue history context, if it exists and is beneficial to the current generation) as an input prompt. It strictly adheres to the structural requirements of the loaded JSON template, employing a specific sequence generation strategy (using nucleussampling with a temperature parameter of 0.7 and top-k sampling, where k is set to 40) to generate natural language response text item by item, while striving to accurately fill the preset slots in the template. These generation parameters (temperature 0.7, top-k=40) represent industry-standard settings that seek a balance between the diversity and quality of generated text. Through manual evaluation and systematic comparison of responses generated by different parameter combinations (e.g., temperature in the range of [0.5, 0.7, 0.9], top-k in the range of [20, 40, 60]) and objective metrics (e.g., BLEU, ROUGE scores), the current combination is ultimately selected to ensure that the generated response is both fluent and natural, without being overly divergent or random. Based on its complex language patterns and rich knowledge base 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 fills the template's {{weather conditions}} slot with the extracted or inferred key information "sunny," and the {{temperature range}} slot with "15 to 25 degrees Celsius." This text generation and slot-filling process is strictly executed for each policy element in the candidate set, resulting in a multi-round response set containing multiple potential response texts.

[0114] S402: Call the multi-turn response set, extract the noun phrases in the dialogue history and the verb phrases in the generated text through the TextRank algorithm, construct a weighted directed graph model, perform iterative calculation of edge weights until convergence, map the node weights to 128-dimensional semantic vectors, calculate the dot product of the dialogue history vector and the generated text vector, and obtain the semantic coherence value.

[0115] The system calls upon the multi-turn response set generated in step S401. This set contains multiple candidate responses generated for the current dialogue state. Candidate response 1 is: "Beijing will be sunny tomorrow, 15-25 degrees Celsius," candidate response 2 is: "We found that the weather in Beijing will be good tomorrow," and the related dialogue history: "User: What's the weather like in Beijing tomorrow?" The system uses the TextRank algorithm to extract core noun phrases from the dialogue history and core verb phrases from each generated candidate response text. For the dialogue history "User: What's the weather like in Beijing tomorrow?", the extracted noun phrases include "Beijing," "tomorrow," and "weather." For candidate response 1 "Beijing will be sunny tomorrow, 15-25 degrees Celsius," the extracted verb phrases include "(is) sunny" and "(is) 15-25 degrees Celsius."

[0116] Next, the system constructs a weighted directed graph model. The nodes in this graph consist of noun phrases and verb phrases extracted in the preceding steps. The edge weights between nodes are determined based on the semantic similarity between these phrases (calculated using cosine similarity from pre-trained word vectors) or their co-occurrence relationships in the original text. Then, the system performs an iterative edge weight calculation process similar to the PageRank algorithm on this graph until the weights of each node converge, thus obtaining the centrality score for each phrase. Subsequently, the system uses the weights (i.e., centrality scores) of these nodes (phrases) to construct a 128-dimensional semantic vector. One specific implementation is as follows: for each core noun phrase in the dialogue history, its corresponding 128-dimensional pre-trained embedding vector is obtained, and then a weighted average is performed based on its score calculated using the TextRank algorithm, ultimately resulting in a 128-dimensional vector representing the entire dialogue history. Similarly, for each core verb phrase in the generated response text, its 128-dimensional embedding vector is obtained, and a weighted average is calculated based on its TextRank score to obtain a 128-dimensional vector representing the generated text. The vector corresponding to response 1 is... The vector corresponding to reply 2 is Finally, the system calculates the dialogue history vector. With each generated text vector The dot product value between them. The semantic coherence value of response 1 is: The semantic coherence score for reply 2 is: These dot product values ​​represent the semantic coherence of each candidate response.

[0117] S403: Build a sorting index based on semantic coherence value, use the quick sorting algorithm to perform a rearrangement operation on candidate responses, set a coherence threshold of 0.65 to filter invalid text, merge candidate responses that pass the threshold detection, and output the response set;

[0118] Based on the semantic coherence values ​​of each candidate response calculated in step S402, response 1 has a coherence value of 0.687, response 2 has a coherence value of 0.453, and assuming there is also a response 3 with a coherence value of 0.550, the system establishes a sorting index accordingly. This index closely associates each candidate response with its corresponding semantic coherence value. The system uses the Quicksort algorithm to perform a descending order reordering operation on all candidate responses according to their semantic coherence values. The Quicksort algorithm first selects a pivot element, then divides the other elements in the list into two parts: all elements in one part are less than the pivot element, and all elements in the other part are greater than the pivot element; then this sorting process is recursively applied to these two sublists. After sorting, the order of the candidate responses is updated to: response 1 (0.687), response 3 (0.550), response 2 (0.453).

[0119] Next, the system sets 0.65 as the coherence threshold. This threshold of 0.65 is used to filter out invalid or low-quality text. The determination process for this threshold is as follows: First, a dataset containing 500 generated replies and their corresponding dialogue history is collected, and the coherence of each reply and its history is manually labeled (divided into three levels: coherent, partially coherent, and incoherent). Simultaneously, the semantic coherence value of these replies is calculated. By plotting ROC curves or analyzing the classification accuracy under different threshold settings (treating "coherent" and "partially coherent" as positive classes and "incoherent" as negative classes), it is found that the system performs best in distinguishing between coherent and incoherent replies when the threshold is 0.65. Specifically, at this threshold, the system can correctly identify 90% of coherent replies while successfully filtering out 85% of incoherent replies, thus achieving an acceptable balance between maintaining reply quality and avoiding over-filtering. Therefore, this embodiment selects 0.65 as the coherence threshold. The system iterates through the rearranged candidate response list, discarding responses with a semantic coherence score less than 0.65 (0.550 for response 3 and 0.453 for response 2) as invalid text. Response 1, with a coherence score of 0.687, is greater than 0.65 and passes the threshold test. The system merges all candidate responses that pass the threshold test (only response 1 in this case) to form the final response set and outputs this set.

[0120] The template includes entity slots, relationship slots, and context constraints;

[0121] The semantic vectors are compressed from 768-dimensional BERT vectors to 128-dimensional vectors using the PCA dimensionality reduction method;

[0122] The coherence threshold of 0.65 was selected through ROC curve analysis to balance recall and precision.

[0123] A knowledge graph construction system based on a large model, which is used to execute the aforementioned knowledge graph construction method based on a large model, includes:

[0124] The semantic parsing module is used to obtain the four-dimensional classification vector of the user input statement through the BERT intent classification model. The fourth dimension is the dialogue scene identifier. The LSTM sequence labeler is called to perform entity term boundary recognition and relation predicate labeling operations on the statement to generate the original semantic structure. The three-dimensional classification vector and the original semantic structure are passed to the entity disambiguation module.

[0125] The entity disambiguation module is used to input the 3D classification vector into the TransE dialogue entity disambiguation model, perform Manhattan distance calculation on the entity vectors extracted from the original semantic structure, and establish an independent node index when the distance value between the entity vector and the entity with the same name in the dialogue history exceeds a set threshold, generate a dialogue entity state graph, and pass the dialogue entity state graph to the relationship aggregation module.

[0126] The relation aggregation module is used to perform semantic vector aggregation on relation predicates in the dialogue entity state graph using a hierarchical clustering algorithm. It then uses a cosine similarity algorithm to match the aggregated relation description vectors with the predicates in the knowledge base, extracts the set of predicates whose similarity values ​​reach a set threshold, generates a dialogue strategy candidate set, and passes the dialogue strategy candidate set to the response generation module.

[0127] The response generation module is used to input the dialogue strategy candidate set into the GPT generation module to perform multi-round dialogue response generation, call the TextRank algorithm to perform semantic coherence calculation on the generated text and dialogue history, perform descending order sorting operation on the candidate responses based on the coherence value, and output the sorted response set.

[0128] The entity vector is stored in a B+ tree index structure, and the node branch factor is set to 50.

[0129] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for constructing a knowledge graph based on a large model, characterized in that, Includes the following steps: S1: Obtain the user's current input statement through the dialogue state tracker, input the statement into the BERT intent classification model for domain label parsing, behavior type recognition, and sentiment detection, and output a three-dimensional classification vector. Extract entity terms and relational predicates based on a bidirectional LSTM sequence labeler with attention gating mechanism to generate the original semantic structure. S2: Input the three-dimensional classification vector and the original semantic structure into the TransE dialogue entity disambiguation model, perform z-score normalization on the entity vector, calculate the Manhattan distance between the current entity vector and the entity with the same name in the dialogue history, establish independent nodes for entities whose distance values ​​exceed the set threshold optimized in 500 sets of dialogue samples by grid search method, and generate a dialogue entity state graph. S3: Input the dialogue entity state graph into a hierarchical clustering algorithm to perform semantic aggregation of relation predicates, perform cosine similarity matching between relation description vectors and knowledge base predicates, extract predicates whose matching degree values ​​reach a set threshold, and generate a dialogue strategy candidate set. The specific steps for obtaining the original semantic structure are as follows: S101: Detect the user input text stream, call the BERT intent classification model to calculate the domain label weights, use a 12-head attention mechanism to perform sentence feature interaction, output the domain label distribution probability through a fully connected layer, use the softmax function to process the behavior type feature vector, and combine the positive and negative values ​​output by the sentiment polarity detection module to generate a three-dimensional classification vector. S102: Construct the input feature matrix of the LSTM sequence labeler based on the three-dimensional classification vector, extract the term position encoding through a bidirectional gated recurrent unit, decode the entity boundary probability distribution using a conditional random field, calculate the co-occurrence frequency of predicate relations at time steps, and generate an entity relation encoding table. S103: Call the entity relation encoding table to perform predicate-argument structure alignment, perform topological sorting according to syntactic dependency path, allocate semantic role weights through a 3-layer graph convolutional network, and use ReLU activation function and adjacency matrix normalization operation in each layer to construct a set of triples of head entity, relation type and tail entity to generate the original semantic structure; The LSTM is a bidirectional 4-layer structure with a hidden layer dimension of 512 and uses a dropout mechanism with a probability of 0.

2. The specific steps for obtaining the dialogue entity state diagram are as follows: S201: The TransE model input matrix is ​​constructed by calling the three-dimensional classification vector and the original semantic structure. The absolute difference between the current entity and the historical entity in the Manhattan space is calculated by using entity vector translation operation. The distance value is binarized according to the preset disambiguation threshold parameter to generate an entity distance comparison table. S202: Perform distance value comparison based on the entity distance lookup table, perform orthogonal projection operation on entity vectors that exceed the disambiguation threshold, assign unique identifiers to unmatched entities using a hash encoding algorithm, establish a mapping between entity identifiers and timestamps of dialogue rounds, and generate an entity identifier mapping set; S203: Call the entity identifier mapping set to perform graph structure construction, store the temporal association strength between entity nodes through the adjacency matrix, use the depth-first search algorithm to detect ambiguous branches of entities with the same name, integrate the entity state transition paths in the historical dialogue, and generate a dialogue entity state graph. The TransE model uses Euclidean space mapping, and during training, the learning rate is set to 0.001 and the negative sampling ratio is 5:

1. The orthogonal projection operation uses the Gram-Schmidt orthogonalization method to eliminate linear dependence between vectors; The edge weights of the adjacency matrix are determined by the product of the number of entity co-occurrences and the time decay factor. The formula for calculating the time decay factor is as follows: ,in , and This is a timestamp for the dialogue round.

2. The knowledge graph construction method based on a large model according to claim 1, characterized in that, The original semantic structure includes entity boundary markers, part-of-speech tagging sequences, and dependency relationship chains; the dialogue entity state graph includes a disambiguation marker bitmap, an entity vector matrix, and a cross-round association index; and the dialogue strategy candidate set includes a candidate predicate list, similarity weight values, and contextual constraints.

3. The knowledge graph construction method based on a large model according to claim 2, characterized in that, The hidden layer of the LSTM sequence labeler receives the attention weights output by BERT as a gating signal; The formula for z-score normalization is: ,in For the original entity vector, The mean of the entity vectors in the dialogue history. Standard deviation; The threshold for cosine similarity matching is set at 0.85, and the threshold is determined based on the inflection point of the F1-score curve of the test set.

4. The knowledge graph construction method based on a large model according to claim 1, characterized in that, The specific steps for obtaining the dialogue strategy candidate set are as follows: S301: Detect the entity relationship feature vector in the dialogue entity state graph, calculate the semantic distance between entities using a hierarchical clustering algorithm, construct a clustering tree through single-chain aggregation, and prune the clustering tree according to a preset semantic difference threshold to generate entity semantic clusters. S302: Call the relation description vectors in the entity semantic cluster to construct the knowledge base predicate vector space, calculate the cosine similarity between each relation description vector and the knowledge base predicate vector, store the similarity values ​​using matrix operations, and generate 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 predicate entries that exceed the threshold, sort them in descending order according to the semantic weight of the predicates, 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 by training based on historical dialogue data. The predicate vectors of the knowledge base are generated through pre-training of a 300-dimensional Word2Vec model; The predicate semantic weights are calculated using the TF-IDF algorithm, and the inverse document frequency factor is determined based on the frequency of predicate occurrences in the knowledge base.

5. The knowledge graph construction method based on a large model according to claim 1, characterized in that, The method further includes: S4: Input the candidate dialogue strategy set into the GPT generation module for multi-round response generation, construct the association graph of noun phrases and verb phrases through the TextRank algorithm, calculate the semantic coherence between the generated text and the dialogue history, reorder the candidate responses, and output the response set.

6. The knowledge graph construction method based on a large model according to claim 5, characterized in that, The response set includes a generated text sequence, a coherence scoring table, and a priority sorting index; The edge weights of the TextRank algorithm are calculated by weighting phrase co-occurrence frequency and part-of-speech association factor.

7. The knowledge graph construction method based on a large model according to claim 6, characterized in that, The specific steps for obtaining the response set are 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, generate the response text item by item using the sequence generation strategy, and output the multi-round response set; S402: Call the multi-turn response set, extract the noun phrases in the dialogue history and the verb phrases in the generated text using the TextRank algorithm, construct a weighted directed graph model, perform iterative calculation of edge weights until convergence, map the node weights to 128-dimensional semantic vectors, calculate the dot product of the dialogue history vector and the generated text vector, and obtain the semantic coherence value. S403: Based on the semantic coherence value, establish a sorting index, use a quick sorting algorithm to perform a rearrangement operation on the candidate responses, set a coherence threshold of 0.65 to filter invalid text, merge the candidate responses that pass the threshold detection, and output the response set; The template includes entity slots, relationship slots, and context constraints. The semantic vector is compressed from a 768-dimensional BERT vector to a 128-dimensional vector using the PCA dimensionality reduction method; The 0.65 coherence threshold was selected through ROC curve analysis to balance recall and precision.

8. A knowledge graph construction system based on a large model, characterized in that, The system is used to implement the knowledge graph construction method based on a large model as described in any one of claims 1-7, and the system comprises: The semantic parsing module is used to obtain the three-dimensional classification vector of the user input statement through the BERT intent classification model, call the LSTM sequence labeler to perform entity term boundary recognition and relation predicate labeling operations on the statement, generate the original semantic structure, and pass 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 dialogue 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 value between the entity vector and the entity with the same name in the dialogue history exceeds a set threshold, generate a dialogue entity state graph, and pass the dialogue entity state graph to the relationship aggregation module. The relation aggregation module is used to perform semantic vector aggregation on the relation predicates in the state graph of the dialogue entity using a hierarchical clustering algorithm, match the aggregated relation description vectors with the predicates in the knowledge base using a cosine similarity algorithm, extract the set of predicates whose similarity values ​​reach a set threshold, generate a dialogue strategy candidate set, and pass the dialogue strategy candidate set to the response generation module. The response generation module is used to input the dialogue strategy candidate set into the GPT generation module to perform multi-round dialogue response generation, call the TextRank algorithm to perform semantic coherence calculation on the generated text and dialogue history, perform descending order sorting operation on the candidate responses according to the coherence value, and output the sorted response set.

Citation Information

Patent Citations

  • Plasticizing product recommendation method and system based on user demands

    CN119128177A

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

    CN120031684A