Methods, devices, electronic devices and storage media for generating conversation topic tags

By using a topic segmenter and preference-semantic clustering method in dialogue topic labeling, combined with prompt words to guide the large model, the problems of insufficient information and lack of user preferences in unsupervised methods are solved, and high-precision and controllable dialogue topic label generation is achieved.

CN121071147BActive Publication Date: 2026-03-06SHENZHEN UNIVERSITY OF ADVANCED TECHNOLOGY +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511606653.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-03-06
Estimated Expiration
2045-11-05

Smart Images

  • Figure CN121071147B_ABST
    Figure CN121071147B_ABST
Patent Text Reader

Abstract

This application relates to the field of data processing technology, and in particular to a method, apparatus, electronic device, and storage medium for generating dialogue topic tags. The method includes: obtaining a context-enhanced topic representation of a target sentence using topic segmentation; clustering the topic representation by combining user preferences and inter-topic semantics to obtain topic clusters; inputting the topic clusters into a preset prompt-word guidance model; and obtaining topic tags corresponding to each topic cluster output by the prompt-word guidance model. This application can effectively improve the quality and accuracy of dialogue topic tag generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, electronic device, and storage medium for generating conversation topic tags. Background Technology

[0002] With the rapid development of artificial intelligence technology, intelligent customer service systems are playing an increasingly important role in improving service efficiency and quality. Accurately identifying user intent is key to generating targeted responses, and topic labeling is a crucial step in achieving this goal.

[0003] Currently, topic labeling in dialogues is mainly divided into two categories: supervised methods and unsupervised / self-supervised methods. Unsupervised / self-supervised methods do not rely on large amounts of manually labeled data, avoiding the drawbacks of supervised methods such as high labor costs, poor labeling consistency, and weak cross-domain portability, thus offering greater application flexibility. However, unsupervised / self-supervised methods are prone to introducing irrelevant information due to insufficient topic representation information, leading to uncontrollable and inaccurate topic tag generation. Summary of the Invention

[0004] To overcome the shortcomings of the prior art, this application provides a method, apparatus, electronic device and storage medium for generating dialogue topic tags, which integrates enhanced topic representation within the dialogue with cross-dialogue user preference alignment, so as to achieve fully automatic, high-precision and controllable generation of dialogue topic tags in scenarios with limited resources.

[0005] A first aspect of this application provides a method for generating conversation topic tags, the method comprising:

[0006] Utilize topic segmentation to obtain context-enhanced topic representations of the target sentence;

[0007] The topic representations are clustered by combining user preferences and semantics between topics to obtain topic clusters;

[0008] The topic clusters are input into a preset prompt word guidance model, and the topic tags corresponding to each topic cluster output by the prompt word guidance model are obtained.

[0009] In an optional implementation, the method further includes:

[0010] Construct a topic segmenter that includes a dual encoder, namely a topic similarity encoder and a coherence encoder;

[0011] Construct a training sample set, which includes dialogue data without topic tagging and dialogue data with user topic preference tagging;

[0012] Construct the first contrastive loss function of the topic similarity encoder and the second contrastive loss function of the dual encoder;

[0013] The overall loss function of the topic segmenter is determined based on the first contrastive loss function and the second contrastive loss function.

[0014] Based on the overall loss function, the topic segmenter is trained at the dataset level using the dialogue data without topic labels, and at the sentence level using the dialogue data with user topic preference labels, thus obtaining the topic segmenter.

[0015] In an optional implementation, obtaining the context-enhanced topic representation of the target sentence using topic segmentation includes:

[0016] The topic segmenter determines the relevance score of each pair of adjacent sentences in the entire dialogue to which the target sentence belongs;

[0017] The entire dialogue is divided into different topic blocks based on the relevance score, and the topic blocks are used as the topic representations corresponding to the target sentence.

[0018] In an optional implementation, determining the relevance score of each pair of adjacent sentences in the entire dialogue to which the target sentence belongs via the topic segmenter includes:

[0019] For each pair of adjacent sentences in the entire dialogue to which the target sentence belongs, the topic similarity score is obtained through the topic similarity encoder, and the coherence score is obtained through the coherence encoder.

[0020] The relevance score of each adjacent pair of sentences is determined based on the topic similarity score and the coherence score.

[0021] In an optional implementation, the clustering of the topic representations by combining user preferences and semantics between topics to obtain topic clusters includes:

[0022] The topic representations are clustered based on the original semantic distance to obtain anchor clusters;

[0023] Calculate the joint distance of each group of topic representations based on the preference scalar output by the preference reward model and the original semantic distance.

[0024] Based on the preference scalar, determine the topic pairs that conflict with the preference and cluster affiliation, and obtain the sub-clusters to be processed;

[0025] Calculate the joint spatial distance of topic preference semantics between all topic pairs between the sub-cluster to be processed and the anchor cluster, and reassign the sub-cluster to be processed to the anchor cluster with the smallest joint spatial distance of topic preference semantics to obtain the topic cluster.

[0026] In an optional implementation, determining the topic pairs that conflict with cluster affiliation based on the preference scalar to obtain the sub-clusters to be processed includes:

[0027] Determine a first threshold and a second threshold; the first threshold is used to represent a strong tendency to be classified into one category, and the second threshold is used to represent a strong tendency to be classified into a different category;

[0028] When it is determined that the preference scalar is greater than the first threshold and the target topic pair belongs to different clusters, or when the preference scalar is less than the second threshold and the target topic pair belongs to the same cluster, the target topic pair is determined to be a preference conflicting topic pair; the target topic pair is any one of all topic pairs.

[0029] The subcluster to be processed is reconstructed based on the preference connectivity of the conflicting preference topics.

[0030] In an optional implementation, the step of inputting the topic clusters into a preset prompt word guidance model and obtaining the topic tags corresponding to each topic cluster output by the prompt word guidance model includes:

[0031] The topic cluster is randomly divided into N subgroups, and each subgroup includes m topic fragments;

[0032] The m topic fragments of each subgroup are concatenated, and the large model is guided by the prompt words to generate a preliminary tag set, which contains N sub-tags;

[0033] The secondary tag that appears most frequently in the initial tag set is taken as the core tag;

[0034] Each of the other secondary tags is semantically compared with the core tag, and semantically irrelevant tags are eliminated to generate a clean set of secondary tags; the other secondary tags are the set of secondary tags in the initial tag set excluding the core tag;

[0035] The pure set of secondary tags is input into the prompt word guidance model to generate a generalized high-level topic tag.

[0036] A second aspect of this application provides a conversation topic tagging apparatus, the apparatus comprising:

[0037] The acquisition module utilizes topic segmentation to obtain context-enhanced topic representations of the target sentence;

[0038] The clustering module is used to cluster the topic representations by combining user preferences and semantics between topics to obtain topic clusters;

[0039] The generation module is used to input the topic clusters into a preset prompt word guidance model and obtain the topic tags corresponding to each topic cluster output by the prompt word guidance model.

[0040] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the conversation topic tag generation method.

[0041] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described dialog topic tag generation method.

[0042] In summary, the dialogue topic tag generation method, apparatus, electronic device, and storage medium provided in this application have at least one of the following beneficial effects:

[0043] 1. By extracting contextual fragments related to the target sentence to generate a topic representation corresponding to the target sentence, the scope of topic information collection is expanded. It is no longer limited to single sentence information, but obtains richer information from the context to accurately reflect the topic, avoiding the problem of insufficient information from a single sentence.

[0044] 2. By clustering the topic representations by combining user preferences with the semantics between topics, topic clusters are obtained. By combining user preferences with the semantics between topics, the influence of users on topic granularity is fully considered, which can better fit the actual topic distribution.

[0045] 3. Input the acquired topic clusters into the preset prompt word guidance model, so that the prompt word guidance model outputs the topic tags corresponding to each topic cluster. Instead of simply counting high-frequency words, the model uses prompt words to abstract and summarize the semantics of the topics, which can generate concise, accurate topic tags that can cover the commonalities of diverse discourse under the topic. Attached Figure Description

[0046] Figure 1 This is a schematic diagram illustrating a dialogue topic annotation task according to an embodiment of this application;

[0047] Figure 2 This is a flowchart illustrating a method for generating dialogue topic tags according to an embodiment of this application;

[0048] Figure 3 This is a schematic diagram illustrating the training steps of a topic segmenter according to an embodiment of this application;

[0049] Figure 4 This is a schematic diagram illustrating the framework of a dialogue topic tag generation method according to an embodiment of this application;

[0050] Figure 5 This is a schematic diagram illustrating a preference-enhanced topic clustering method according to an embodiment of this application;

[0051] Figure 6 This is a functional block diagram of a dialogue topic tag generation device shown in an embodiment of this application;

[0052] Figure 7 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application. Detailed Implementation

[0053] The present application will be further described below with reference to the accompanying drawings and embodiments.

[0054] The following will clearly and completely describe the concept, specific structure, and resulting technical effects of this application in conjunction with embodiments and accompanying drawings, so as to fully understand the purpose, features, and effects of this application. Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. Other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are all within the scope of protection of this application. Furthermore, all connections / linkages involved in the patent do not simply refer to direct contact between components, but rather to the ability to form a better connection structure by adding or reducing connecting accessories according to specific implementation conditions. The various technical features in this application can be combined interactively without contradicting each other.

[0055] In the field of Natural Language Processing (NLP), dialogue topic annotation refers to the automatic identification and tagging of core topics of interest to users (such as product features, account information, after-sales support, etc.) during multi-turn dialogues. This technology is widely used in scenarios such as intelligent customer service, personalized recommendations, and user profiling. For example, in customer-customer interactions, dialogue topic annotation can quickly determine the customer's focus (such as product features, pricing, after-sales service, etc.). As the dialogue progresses, the topic may shift (e.g., from "obtaining credit card information" to "modifying personal information"). Dialogues in each domain have a specific topic distribution, which reflects the user's preferences in that scenario. Therefore, the dialogue topic annotation task aims to discover dialogue topics by jointly considering semantic and user preference factors. Figure 1As shown, for a set of dialogues within a specific domain, semantic summarization is first performed on each dialogue to obtain a subdivided topic space within the dialogue. Then, combined with user preferences, the subdivided topics in the subdivided topic space within the dialogue are further summarized into a unified topic space across dialogues. Finally, the optimal topic distribution that matches user preferences is autonomously explored and obtained. Currently, dialogue topic labeling is mainly divided into two categories: supervised methods and unsupervised / self-supervised methods. Among them, supervised methods use manually labeled dialogue data to train a classification model, enabling it to assign topic labels from a predefined set to sentences. By constructing a strong correspondence between utterances and topics within a specific domain, this type of method achieves high accuracy, but it relies on a large amount of domain-labeled data, resulting in high manual costs, poor consistency, and poor cross-domain portability.

[0056] Unsupervised / self-supervised methods do not rely on a pre-set set of topics but instead automatically identify topics across the entire dialogue dataset. Common methods include: 1) Neural network-based topic tag generation methods. These methods first divide the dialogue into topic blocks of uniform size using a fixed-length window, and then use a generative model to generate topic tags based on the given topic blocks. This can discover new topics to some extent, but the syntax and format of the generated results are difficult to control, and consistency in syntax and format cannot be guaranteed across dialogues. 2) Clustering methods based on inter-sentence semantic similarity. These methods aggregate semantically similar sentences into the same topic and develop multiple branches. Among these, multi-view clustering obtains semantic features under different perspectives and integrates various features in the clustering; density-based methods automatically distinguish different topic groups through the density distribution of semantic features in the semantic space; and structured prediction signal methods.

[0057] However, the aforementioned unsupervised / self-supervised methods lack a holistic consideration of the overall task process, typically optimizing only a single stage. This makes it difficult to simultaneously address key issues such as information sparsity, cross-dialogue consistency, and controllable label generation. Specifically, their shortcomings are mainly reflected in the following three aspects:

[0058] 1) In terms of topic representation, the information content is insufficient. When constructing topic representations using sentences as the basic unit, the information contained in a single sentence is limited, making it difficult to accurately map its topic category. Although some methods attempt to introduce semantically similar sentences to expand the representation dimensions, irrelevant information is easily mixed in, which leads to a decrease in the quality of topic representation.

[0059] 2) In terms of topic alignment, there is a lack of consideration for user preferences. The granularity of dialogue topics is significantly affected by user preferences, but existing methods mostly rely on semantic similarity between sentences for clustering, without incorporating user preference information. Taking the insurance field as an example, "I want to buy compulsory traffic accident liability insurance" and "I want to buy personal accident insurance" can be categorized into the unified topic of "I want to buy insurance" in the user's perception, but current methods that rely solely on semantic similarity are insufficient to achieve such precise alignment.

[0060] 3) In terms of topic tag generation, controllability and accuracy are insufficient. In unlabeled dialogue topic tag generation scenarios, generating concise and accurate topic tags is crucial for downstream tasks such as dialogue analysis and controllable dialogue generation. However, existing methods typically generate tags based on the most frequently used words, lacking the ability to abstract and summarize the semantics of the topic. This results in inaccurate tag expressions and difficulty in covering the common features of diverse discourse under the topic. For example, in the field of bank customer service, the three topics "querying account address and email," "changing account password," and "adding a new holder" should ideally be expressed in a high-level general sense as "managing account information," but existing methods struggle to achieve this kind of generalization.

[0061] In summary, existing dialogue topic annotation technologies have significant shortcomings in several key dimensions and urgently need further improvement and refinement to meet the needs of practical application scenarios in intelligent customer service systems. This application primarily focuses on unsupervised / self-supervised processing methods for unannotated information in low-resource scenarios, aiming to address the aforementioned technical pain points.

[0062] Reference Figure 2 and Figure 4 The diagram illustrates a flowchart of a method for generating conversational topic tags according to an embodiment of this application. The method includes the following steps.

[0063] S21, use topic segmentation to obtain context-enhanced topic representations of the target sentence.

[0064] Using the target sentence alone as a topic representation provides too little topic information, while extending the topic representation to the entire dialogue introduces a large amount of irrelevant information. In order to obtain an accurate topic representation, in this embodiment of the application, the electronic device pre-trains a topic segmenter and uses the topic segmenter to perform topic segmentation in order to obtain an enhanced topic representation of the target sentence.

[0065] In some embodiments, the electronic device can pre-design a loss function using a contrastive learning mechanism to train a dual-encoder topic segmenter for topic boundary recognition, thereby performing topic segmentation. For the specific training process of the topic segmenter, please refer to [link to training documentation]. Figure 3 And its related descriptions.

[0066] The topic segmenter includes a topic similarity encoder. and coherence encoder The topic similarity encoder A coherence encoder used to measure topic similarity between utterances in a conversation. This is used to model discourse continuity between discourse pairs. It is achieved through a topic similarity encoder. and coherence encoder Collaborate to test topic boundaries in multi-round dialogues.

[0067] In an optional implementation, obtaining the context-enhanced topic representation of the target sentence using topic segmentation includes:

[0068] The topic segmenter determines the relevance score of each pair of adjacent sentences in the entire dialogue to which the target sentence belongs;

[0069] The entire dialogue is divided into different topic blocks based on the relevance score, and the topic blocks are used as the topic representations corresponding to the target sentence.

[0070] Topic segmentation is performed by triggering a dialog topic tag generation command. When the electronic device receives a dialog topic tag generation command for the target sentence, it first uses a topic segmenter to determine the relevance score of each pair of adjacent sentences in the entire dialog to which the target sentence belongs, and then obtains the topic representation of the target sentence based on the relevance score. In specific implementation, the context fragment of the target sentence is first obtained to obtain the entire dialog to which the target sentence belongs. The entire dialog is used as the input of the topic segmenter, and for each pair of adjacent sentences in the entire dialog... Topic similarity encoder Provide topic similarity score Continuity encoder Provide consistent scores The two scores are added together to obtain the relevance score for each adjacent pair of sentences. , that is .

[0071] After obtaining the relevance scores of each pair of adjacent sentences in the entire dialogue, a relevance score matrix can be obtained by organizing the sentences according to their order. Then, the TextTiling algorithm is used to obtain the boundary set for topic segmentation based on the relevance score matrix, thereby dividing the entire dialogue into different topic blocks. Each topic block is then used as the topic representation of the target sentence, alleviating the sparsity problem of topic representation caused by insufficient information in a single sentence. The relevance score threshold for boundary inference is set to 0.5. The contextual topic boundaries of the target sentence are obtained based on the relevance score threshold.

[0072] S22, perform clustering on the topic representation by combining user preferences and semantics between topics to obtain topic clusters.

[0073] Existing technologies rely solely on semantics for clustering without considering user preferences, leading to unclear classification of ambiguous points and misclassification of specific topics. This application addresses these issues by employing a preference-semantic complementary clustering logic. Specifically, upon obtaining the topic-enhanced vector representation, the electronic device can utilize a preference-enhanced topic clustering algorithm to align topic granularity, i.e., perform clustering that combines user preferences with semantic information between topics to obtain topic clusters.

[0074] In preference-enhanced topic clustering, all-mpnet-base-v2 is used to obtain sentence vectors, and UMAP is used for dimensionality reduction. Semantic clustering employs the Spectrum clustering method, with the default number of clusters K set to 30. For the Preference Reward Model (PRM), the default reward model is bert-base-uncased, with a learning rate of 2e-5 and 3 training epochs. A link preference threshold is used during preference inference. Set to 0.85, the splitting tendency threshold. Set it to 0.15.

[0075] To better cluster topic representations, embodiments of this application provide the distance between topic preference-semantic joint spaces: The distance between the preference-semantic joint space of topics will be referred to as preference-semantic distance in the following text. That is, based on user preference weights ( Adjusting the original semantic distance between topics The method measures the distance between topics within the preference-semantic joint space. Here, semantic distance serves as a moderating basis, emphasizing the directionality of topics and providing a basic measure of topic separation. Preferences, designed as weights, simulate user preference tendencies for different topics in semantic clustering, further strengthening the separation between topics. The original semantic distance is obtained by directly calculating the Euclidean distance between topic representations, while user preference weights are generated by a preference reward model (PRM).

[0076] ;

[0077] in, x and y These represent different topic block vectors, i.e., topic representations.

[0078] The reward model was trained on user preference data. This preference data reflects users' requirements for topic granularity; that is, it indicates a pair of topic blocks. A binary variable indicating whether they belong to the same topic:

[0079] ;

[0080] Therefore, preference data can be viewed as two extreme opposing preference scenarios.

[0081] The preference-based reward model is trained on preference data using an existing reward model. Specifically, the electronic device uses preference data to construct reward question-answer pairs as training samples, and the loss function can be the mean squared error loss function, as follows:

[0082] .

[0083] During forward inference, a topic pair is input, and the preference reward model outputs preference weights. This represents the degree of user inclination towards whether a topic belongs to the same topic. It should be noted that the maximum preference weight (belonging to the same topic) and the minimum preference weight (not belonging to the same topic) respectively show clear preference tendencies, while the median value indicates the ambiguity of the user's preference tendency towards the topic.

[0084] To apply preference-semantic distance to topic clustering, this application provides a semantic space-based preference-enhanced topic clustering algorithm. The core of this algorithm lies in expressing the semantic-preference distance within a semantic space with known structure. Since the true joint space of semantic and preference information is implicit, a four-step algorithm is implemented based on the semantic space, gradually incorporating preference signals. (See Appendix) Figure 5 As shown.

[0085] In an optional implementation, the clustering of the topic representations by combining user preferences and semantics between topics to obtain topic clusters includes:

[0086] The topic representations are clustered based on the original semantic distance to obtain anchor clusters;

[0087] Calculate the joint distance of each group of topic representations based on the preference scalar output by the preference reward model and the original semantic distance.

[0088] Based on the preference scalar, determine the topic pairs that conflict with the preference and cluster affiliation, and obtain the sub-clusters to be processed;

[0089] Calculate the joint spatial distance of topic preference semantics between all topic pairs between the sub-cluster to be processed and the anchor cluster, and reassign the sub-cluster to be processed to the anchor cluster with the smallest joint spatial distance of topic preference semantics to obtain the topic cluster.

[0090] In some embodiments, the electronic device can calculate each topic. Original semantic distance , to the original semantic distance As a semantic similarity metric, topics are clustered based on semantic similarity to obtain anchor clusters, denoted as […]. Among them, the original semantic distance The Euclidean distance between topic representations is obtained by directly calculating the distance between them using electronic devices. The initial anchor clusters serve as anchor points embedded in the semantic space, providing a stable baseline structure for the subsequent optimized clustering process that introduces user preference constraints in the semantic-preference joint space. This ensures the progressive alignment and precise granular control of topic distribution.

[0091] Next, electronic devices can be weighted according to user preferences. Adjusting the original semantic distance between topics The method measures the distance within the topic preference-semantic joint space. (Original semantic distance) As a moderating base, it emphasizes the directionality of the topic and provides a basic measure of topic separation, while preference weights Semantic clustering simulates user preferences for different topics, further enhancing the separation between topics. For each group of topics... Using topics to Preference weights between Multiplied by topic Between To obtain the joint distance for each set of topic representations. ,in Among them, preference weights That is, a preference for scalars.

[0092] When the joint distance is calculated Subsequently, joint distance was utilized. This indicates the degree of differentiation between topics, serving as a metric for adjusting the initial anchor cluster.

[0093] Furthermore, electronic devices utilize preference scalars The system detects and extracts topic pairs where preferences conflict with cluster affiliation. Specifically, the electronic device first sets two thresholds, namely the first threshold... (Also known as the connection tendency threshold) and the second threshold (Also known as the splitting tendency threshold), through the first threshold Second threshold Identify two pairs of topics with strong preference tendencies (tendencies that strongly should be categorized together and tendencies that strongly should be categorized differently). The first threshold... The second threshold is used to indicate a strong tendency to classify something into one category. This signal is used to indicate a strong tendency to categorize topics into different groups. If a preference signal indicates that topics that should be grouped into one group are located in two different clusters, then this pair of topics is considered conflicting, and vice versa. That is... And the topics belong to different clusters, or If the topics belong to the same cluster, they are considered conflicting topics. The electronic device can then extract these conflicting topics and recombine and separate them according to their preferred connections to generate different subclusters to be processed. Specifically, for conflicting topic pairs that strongly tend to be grouped together, if they originally belonged to different clusters, they are merged into a single sub-cluster to be processed; for conflicting topic pairs that strongly tend to be grouped together, if they originally belonged to the same cluster, they are split into independent sub-clusters to be processed; all sub-clusters to be processed are generated based on the above operations. This completes the stripping of topics influenced by preferences and the editing of subclusters within the semantic-preference joint space.

[0094] By separating and recombining conflicting topics, topics heavily influenced by preferences are extracted from semantically-based anchor clusters and edited into different subclusters to be processed in the semantic-preference joint space for further clustering.

[0095] Finally, the electronic device can reassign each sub-cluster to the nearest anchor cluster by minimizing the joint semantic spatial distance of topic preferences for all topic pairs between the sub-cluster to be processed and the anchor cluster, thereby ultimately obtaining a topic cluster that conforms to user preferences and describes the topic distribution. Specifically, the distance between clusters is calculated as the sum of the mutual distances of all topics between the two clusters.

[0096] In aligning topic granularity, compared with existing topic clustering methods such as multi-angle clustering and density-related clustering, which only stay at the semantic level, this application successfully combines user preferences with semantics based on semantic interpretation through preference clustering algorithm, and jointly interprets the distribution of target topics. Through user preferences, it not only better reveals the user-centered topic distribution, but also ensures that topic blocks that are difficult to align semantically can achieve better alignment in the preference dimension.

[0097] To facilitate understanding of the inventive concept of the embodiments of this application, the following is the source code of a clustering algorithm for parameter configuration and execution logic:

[0098] {

[0099] enter:

[0100] Embedded representations of n topic fragments, with dimension m: T = {t1,…,tn} ∈ Rnxm

[0101] Preference-based reward model (PRM(topic, topic))

[0102] Clustering model CM (topic_embeddings | clustering_algorithm)

[0103] Initial number of clusters K

[0104] Connection propensity threshold

[0105] Split tendency threshold

[0106] Output:

[0107] The topic clusters for preference enhancement are C_SPK = {c1_SP,…,cK_SP}

[0108] CK ← CM(T | Spectrum) / / Get the anchored cluster

[0109] for i ← 1..n do

[0110] for j ← 1..n do

[0111] wij ← PRM(ti, tj)

[0112] d_SPij ← wij · d_sem(ti, tj)

[0113] if wij>θ1 then / / Should be connected but belong to different clusters

[0114] Mark (ti, tj) as a conflict pair. If ti and tj are not in the same anchor cluster, remove them from their respective clusters.

[0115] end if

[0116] if wij < θs then / / Should have split but are in the same cluster

[0117] Mark (ti, tj) as a conflict pair. If ti and tj are in the same anchored cluster, remove them from that cluster simultaneously.

[0118] end if

[0119] end for

[0120] end for

[0121] All conflicting topics are regrouped into a set of subclusters S = {s1, ..., s_p} to be processed, based on the "should be joined - should not be joined" constraint.

[0122] for s ∈S do

[0123] for ci ∈ CK do

[0124] dist_to[ci] ← Σ_{ti∈ci, tj∈s} d_SP(ti, tj) / / Calculate the cumulative SP distance between s and each anchored cluster

[0125] end for

[0126] c* ← argmin_{c∈CK} dist_to[c]

[0127] c*_SP ← c* ∪ s / / Merge the subcluster s to be processed into the most compatible anchored cluster.

[0128] end for

[0129] return C_SPK

[0130] }

[0131] S23, input the topic clusters into the preset prompt word guidance model, and obtain the topic tags corresponding to each topic cluster output by the prompt word guidance model.

[0132] The system uses prompts to guide the large model in assigning corresponding topic labels to each topic cluster. To reduce human intervention in topic space mining and ensure that topic labels accurately reflect the commonalities and granularity of topics within clusters, once each preference cluster (i.e., topic cluster) is obtained, the system uses prompts to guide the large model to achieve fully automated information autonomy within the topic clusters. This involves grouping topics within the clusters, summarizing their information, and then selecting the most appropriate topic labels through majority voting and filtering. Specifically, the electronic device first uses a divide-and-conquer strategy to divide a target topic cluster into many smaller clusters and generate high-precision, low-generalization secondary labels. Then, it merges and summarizes these secondary labels layer by layer from low to high generalization to generate a unified topic. Simultaneously, in terms of purification, the electronic device inserts a cleaning mechanism between the two merging levels to remove interfering information.

[0133] In this embodiment of the application, during the topic tag generation stage, LLaMA3-8B-Instruct is used by default as the large language model for prompt generation, that is, the prompt word guides the large model, and the number of topics in each subgroup is set to 25.

[0134] In an optional implementation, the step of inputting the topic clusters into a preset prompt word guidance model and obtaining the topic tags corresponding to each topic cluster output by the prompt word guidance model includes:

[0135] The topic cluster is randomly divided into N subgroups, and each subgroup includes m topic fragments;

[0136] The m topic fragments of each subgroup are concatenated, and the large model is guided by the prompt words to generate a preliminary tag set, which contains N sub-tags;

[0137] The secondary tag that appears most frequently in the initial tag set is taken as the core tag;

[0138] Each of the other secondary tags is semantically compared with the core tag, and semantically irrelevant tags are eliminated to generate a clean set of secondary tags; the other secondary tags are the set of secondary tags in the initial tag set excluding the core tag;

[0139] The pure set of secondary tags is input into the prompt word guidance model to generate a generalized high-level topic tag.

[0140] 1) Labeling of secondary clusters.

[0141] The purpose of this step is to initially streamline the topic information within the preference cluster through grouping and summarizing, and to generate tags for each level group. To reduce the difficulty of summarizing diverse topic blocks, the electronic device reduces the number of topics contained in each group through grouping. Specifically, this module first groups the entire topic cluster... Randomly divided into N secondary groups Each It contains m topic fragments, and then... All topic fragments are spliced ​​together and input into the prompt-guided model along with the designed task prompts. The prompt-guided model then generates secondary tags for each secondary group based on the prompts. This yields a preliminary tag set. The preliminary tag set contains N secondary tags, meaning each topic cluster has N secondary tags.

[0142] 2) Secondary label cleaning and purification.

[0143] The purpose of this step is to remove noise and distractions from the secondary tag list through a majority voting mechanism, ensuring that the secondary tag list retains only those tags that reflect the topic. First, the electronic device guides the large model to select the secondary tags that appear most frequently (i.e., have the highest frequency) from the initially identified tag set as the core tags. Then, prompt words guide the large model to compare the core tags with other secondary tags one by one. (The initial tag set includes all tags other than the core tag), and semantically irrelevant secondary tags are removed to obtain a clean set of secondary tags. .

[0144] By cleaning and refining secondary labels, secondary groups can spontaneously form a preliminary consensus on a topic based on the principle of majority rule.

[0145] 3) Summary and annotation of the final topic tags.

[0146] Through the annotation and purification of secondary clustering tags, the clean set of secondary tags for a given topic already possesses the potential to reveal its higher-level topics. This step guides the larger model to comprehensively consider the entire clean set of secondary tags by using prompt words. To output a summary High-level topic tags .

[0147] In order to be directly applied to downstream tasks, topic annotations need to have a uniform format and sufficient information. Therefore, the prompt words require that the generated topic annotations be the same as the annotations of the secondary clustering labels in 1) above.

[0148] In topic tag generation, compared with existing technologies that only use the most frequently occurring keywords or even numerical tags as topic labels, this application guides the generation of tags for the large model through hierarchical prompts. By introducing a secondary tag generation method based on divide and conquer and a cleaning mechanism designed with the concept of simplification and purification, the model can accurately grasp the granularity of topic tags, greatly increasing the accuracy of topic tags. It can also controllably and directly provide topic tags with a unified format, conciseness and accuracy, and directly apply them to downstream tasks.

[0149] To facilitate understanding of the inventive concept of the embodiments of this application, the source code for the execution logic of the hierarchical topic tag generation algorithm is provided below:

[0150] {

[0151] enter:

[0152] There are K topic clusters C_K, and each cluster C_i contains several topic fragments P_j.

[0153] Large Language Model Based on Prompt (LLM) (prompt | input)

[0154] Output:

[0155] The set of topic tags {T_K} for each topic cluster

[0156] for each C_i ∈ C_K do

[0157] Randomly divide C_i into several groups S_N, where |S_n|=m for each group, and L_{n∈N} S_n = C_i

[0158] for each S_n do

[0159] l_n ← LLM(Label | S_n) / / Generate candidate labels for each group

[0160] end for

[0161] Initialize the cleaned tag set L_i ← θ

[0162] l^{core} ← LLM(VoteCore | {l_n}, n∈N) / / Voting to select the core tag

[0163] for each l_n do

[0164] if LLM(IsRelevant | (l_n, l^{core})) then

[0165] L_i.append(l_n) / / Preserve tags related to the core tags

[0166] end if

[0167] end for

[0168] T_i ← LLM(Conclude | L_i) / / Generate the final topic tags

[0169] end for

[0170] return {T_K}

[0171] }

[0172] Compared to existing technologies that mostly map target sentences to a pre-defined fixed set of topics and are limited to tasks with labeled data, even those that attempt to explore open topic spaces only rely on semantic information clustering, this application proposes and integrates two technologies: enhanced topic representation and granular alignment with user preferences. This enables the technology to autonomously explore and discover hidden optimal topic distributions without prior knowledge, ensuring that the generated topic labels accurately express topic information and conform to the real topic distribution that aligns with user preferences.

[0173] Figure 3 This is a schematic diagram illustrating the training steps of a topic segmenter according to an embodiment of this application.

[0174] S31, construct a topic segmenter containing dual encoders, which include a topic similarity encoder and a coherence encoder.

[0175] In this embodiment, sup-simcse-bert-base-uncased is selected as both the topic similarity encoder and the coherence encoder. The topic similarity encoder measures the topic similarity between utterances in a dialogue, while the coherence encoder models the discourse continuity between utterance pairs. Through the synergistic effect of the topic similarity encoder and the coherence encoder, topic boundaries are detected in multi-turn dialogues.

[0176] S32, Construct the training sample set.

[0177] The training sample set includes dialogue data without topic tags and dialogue data with user topic preference tags.

[0178] A positive and negative sample set for a topic similarity encoder is constructed from dialogue data without topic tagging, and a positive and negative sample set for a dual encoder is constructed from dialogue data with user topic preference tagging.

[0179] For each sentence The electronic device can construct positive and negative samples based on the distance between itself and other sentences in the same dialogue, thus obtaining the first set of positive and negative samples, which is the set of positive and negative samples of the similarity encoder.

[0180] ;

[0181] ;

[0182] Among them, positive samples It is the current sentence The set consisting of the first w sentences and the last w sentences, while the negative sample Then it is the same as the current sentence A set of sentences that are more than w apart. For each sentence pair... The electronic device can construct positive and negative samples based on adjacent sentence pairs of the same dialogue and sentence pairs of different dialogues, thus obtaining a second set of positive and negative samples, namely the positive and negative sample set of the dual encoder.

[0183] ;

[0184] ;

[0185] Among them, positive samples It is the current sentence The sentence pair consisting of the two sentences before and after, while the negative sample It is by A sentence pair consisting of two consecutive dialogues randomly sampled from other dialogues.

[0186] S33, construct the first contrastive loss function of the topic similarity encoder, and the second contrastive loss function of the dual encoder.

[0187] During both pre-training and fine-tuning, the learning rate was set to 5e-6, and the training epochs were 3. During the training phase of the topic segmenter, the electronic device first constructed two contrastive losses to enable the topic segmenter to better distinguish between topic-consistent and coherent utterances and irrelevant utterances. The contrastive loss of the topic similarity encoder (referred to as the first contrastive loss for ease of distinction) aims to supervise the topic similarity encoder to group two dialogues with higher topic similarity into the same topic, thereby improving the coherence of topic encoding. The contrastive loss of the dual encoder (referred to as the second contrastive loss for ease of distinction) aims to simultaneously supervise both encoders to capture topic continuity at the discourse level across dialogue levels.

[0188] Once the first set of positive and negative samples is constructed, the electronic device can... As a single training sample, by amplification Training is conducted by comparing the distance between positive and negative samples. The first contrastive loss function The calculation is as follows:

[0189] .

[0190] Once the second set of positive and negative samples is constructed, the electronic device can acquire... Dual encoders, calculating the second contrastive loss function The calculation is as follows:

[0191] ;

[0192] in, This represents the positive topic relevance calculated based on positive samples. This indicates negative topic relevance. Ignoring the symbol, then... The calculation formula is unified as follows:

[0193] .

[0194] S34, Calculate the overall loss function.

[0195] When the first contrastive loss function is determined Second contrast loss function Then, the electronic device considers the overall loss function L, which is calculated as follows:

[0196] ;

[0197] in, N The number of samples in the first positive and negative sample set. MThe number of samples in the second positive and negative sample set.

[0198] S35 uses a two-stage training strategy to train the topic segmenter.

[0199] This application embodiment utilizes a contrastive learning mechanism for loss design to comprehensively train the topic boundary recognition capability of the dual encoders.

[0200] The two-stage training strategy consists of: the first stage is dataset-level training, and the second stage is sentence-level training.

[0201] For dataset-level training, unsupervised topic segmentation training is performed on unlabeled dialogue data to obtain topic relevance between any two adjacent sentences. Specifically, this is done by constructing samples from each sentence in the target dataset. Construct training samples for each sentence Using the contrastive loss function and The topic segmenter is trained to adapt to the target dialogue domain. Initial training with unlabeled topic data enables the topic segmenter to acquire basic topic segmentation capabilities.

[0202] For sentence-level training, positive and negative samples are constructed using dialogue data annotated with user topic preferences to train the dual encoder. By training on more discriminative samples, the dual encoder gains the ability to accurately distinguish different topics at the sentence level. Specifically, to further align the model with real-world applications, electronic devices can acquire dialogue data annotated with user topic preferences from the training sample set for fine-grained adaptation training. Since dialogue data annotated with user topic preferences is more likely to indicate topic boundaries, it more closely resembles real-world usage. Further adjustments to the topic segmenter's model parameters make it more closely resemble real-world applications. Through fine-tuning with user topic preference-annotated data, the topic segmentation accuracy of the topic segmenter in real-world scenarios is improved.

[0203] In enhancing topic representation, compared with existing technologies that extract topic blocks according to a fixed window size or generate similar sentences outside the original dialogue to expand the topic representation, this application designs a topic segmenter with dual encoders to perform adaptive topic segmentation based on the context of the target sentence. It extracts coherent topic blocks from the original dialogue context as topic representations. By fully considering the phased and procedural characteristics of topic transition, it enables the complete extraction of several consecutive sentences contained in a topic, thereby having the ability to accurately extract complete topic information and ensuring the accuracy and stability of topic representation.

[0204] In summary, the dialogue topic tag generation method provided in this application achieves topic generation in unlabeled scenarios by integrating enhanced topic representation within the dialogue with cross-dialogue user preference alignment. This method is applied to real-world multi-turn dialogue scenarios, addressing technical challenges in existing technologies such as information sparsity, insufficient cross-dialogue topic consistency, and difficulty in controllable tag generation. Specifically, the method includes a three-stage dialogue topic tag generation framework:

[0205] 1) Topic representation enhancement stage based on topic segmentation.

[0206] By using topic segmentation technology, we extract contextual fragments that are highly relevant to the topic of the target sentence from the dialogue to which it belongs and construct a topic block. Then, we use this topic block as the topic representation of the target sentence to alleviate the problem of sparse topic representation caused by insufficient information in a single sentence.

[0207] 2) The topic granularity alignment stage with enhanced preferences.

[0208] Preliminary clustering is performed based on the semantic similarity between sentences, and user preferences are introduced as a constraint factor. A clustering algorithm with preference weights is used to ensure that the distribution of topics remains consistent across dialogue scenarios and that the granularity of topics is more in line with the actual perception of users.

[0209] 3) Hierarchical topic tag generation stage.

[0210] A three-layer topic summarization framework is constructed. Using a large language model prompt generation method, topic blocks under the same topic cluster are abstracted and filtered layer by layer to generate accurate topic tags with controllable semantics, format and syntax, so as to ensure that they can be directly called by downstream tasks.

[0211] Through the synergistic effect of the above three stages, this application can achieve fully automatic and high-precision generation of unlabeled dialogue topic tags in a low-resource annotation environment. The generated topic tags have the characteristics of high consistency, strong controllability and conformity to user preferences, and can be directly applied to various scenarios such as intelligent customer service, dialogue analysis and controllable dialogue generation.

[0212] This application achieves controllable dialogue topic tag generation through the above embodiments, combining context-aware clustering and hierarchical generation. To verify the technical solution of this application, the following experiments were conducted.

[0213] In the topic segmentation stage, bert-base-uncased and sup-simcse-bert-base-uncased were used as the coherence encoder and topic encoder, respectively. During pre-training and fine-tuning, the learning rate was set to 5e-6, and the training epochs were 3. The relevance score threshold for boundary inference was set to 0.5. In preference-enhanced topic clustering, all-mpnet-base-v2 was used to obtain sentence vectors, and UMAP was used for dimensionality reduction. The semantic clustering part adopted the Spectrum clustering method, with the default number of clusters K set to 30. For PRM, the default reward model used bert-base-uncased, with a learning rate of 2e-5 and 3 training epochs. During preference inference, the link tendency threshold was set... Set to 0.85, the splitting tendency threshold. Set to 0.15. During the topic tag generation stage, LLaMA3-8B-Instruct is used as the large language model for prompt generation; the number of topics in each subgroup is set to 25.

[0214] During the validation process, the controllable dialogue topic label generator was experimentally tested on user-customer service dialogue datasets from four different domains: banking, finance, insurance, and tourism. Each dataset consists of different user-customer service dialogues. In addition to the original dialogues, these datasets are labeled with target sentences requiring topic labeling and provide real topic labels, as well as user preference data. User preference data is a binary variable indicating whether a pair of target sentences belongs to the same topic. It should be noted that the four domain datasets were used for training (banking), offline testing (finance and insurance), and online testing (tourism), respectively. Unlike other datasets, the online test dataset serves as a third-party evaluation of model performance and closely reflects real-world application scenarios, without providing real topic labels.

[0215] After training on a banking dataset, the model underwent both offline testing (where the electronic device evaluates the prediction results based on real labels) and online testing (where the real labels are unknown, and the prediction results are submitted to a third party for testing alongside other similar methods). Both tests evaluated the model's performance based on topic distribution (acc, nmi) and topic label quality (rouge, cosinesimilarity, llm_score). In the self-testing phase, the electronic device conducted comprehensive experiments on both in-domain (banking) and out-of-domain (finance, insurance) datasets, comparing the results with existing baseline models. In the blind testing phase, the controllable dialogue topic label generator's prediction data in the tourism domain was submitted to a third-party evaluation agency for evaluation alongside five other models, i.e., the DSTC12 competition. In both online and offline tests, this application demonstrated significant advantages in topic distribution quality and topic label quality. The experimental results are shown in Tables 1 and 2. Table 1 shows the model's in-domain performance on the banking dataset, and Table 2 shows the model's out-of-domain performance on the finance and insurance datasets.

[0216] Table 1

[0217]

[0218] Table 2

[0219]

[0220] Continued from Table 2

[0221]

[0222] Meanwhile, in the online testing of the DSTC12 competition (as shown in Tables 3 and 4), Table 3 shows the automatic evaluation results, and Table 4 shows the manual evaluation results. This application achieved second place overall with its lightweight design (using only models smaller than 8 bytes), and approached the first-place model using API interfaces in several metrics. While maintaining performance, it reduces dependence on external systems, resulting in not only superior performance but also high portability and flexibility, possessing significant advantages for independent commercialization and application in downstream scenarios.

[0223] Table 3

[0224]

[0225] In Table 3, API in LLM refers to a closed-source large model called through an interface; <30B refers to an open-source large model with fewer than 30 billion parameters.

[0226] Table 4

[0227]

[0228] In Table 4, the evaluation indicators are semantic relevance (SR), analytical usefulness (AU), granularity appropriateness (GR), actionability (ACT), domain relevance (DR), conciseness and wording (CWC), grammatical structure (GS), and topic differentiation (TD).

[0229] In addition, the above-described embodiments of this application have a high degree of compatibility, and their performance limit increases with the level of sophistication of the settings adopted in each module, as shown in Table 5, which presents the ablation test results of each module of this application.

[0230] Table 5

[0231]

[0232] Reference Figure 6 The diagram shown is a functional block diagram of a conversation topic tag generation device according to an embodiment of this application.

[0233] In some embodiments, the conversation topic tag generation device 60 may include multiple functional modules composed of computer program segments. The computer programs of each program segment of the conversation topic tag generation device 60 may be stored in the memory of an electronic device and executed by at least one processor to perform the function of generating conversation topic tags. Based on the functions they perform, they can be divided into multiple functional modules. The functional modules may include: an acquisition module 601, a clustering module 602, a generation module 603, a construction module 604, a calculation module 605, and a training module 606. The term "module" in this application refers to a series of computer program segments that can be executed by at least one processor and perform a fixed function, and which are stored in memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0234] The acquisition module 601 is used to acquire the context-enhanced topic representation of the target sentence by using topic segmentation.

[0235] The clustering module 602 is used to cluster the topic representation by combining user preferences and semantics between topics to obtain topic clusters.

[0236] The generation module 603 is used to input the topic clusters into a preset prompt word guidance model and obtain the topic tags corresponding to each topic cluster output by the prompt word guidance model.

[0237] The construction module 604 is used to construct a topic segmenter containing dual encoders, the dual encoders including a topic similarity encoder and a coherence encoder; construct a training sample set, the training sample set including dialogue data without topic labeling and dialogue data with user topic preference labeling; construct a first contrastive loss function for the topic similarity encoder and a second contrastive loss function for the dual encoders.

[0238] The calculation module 605 is used to determine the overall loss function of the topic segmenter based on the first contrast loss function and the second contrast loss function.

[0239] The training module 606 is used to train the topic segmenter at the dialogue level using the dialogue data without topic labels based on the overall loss function, and to train the topic segmenter at the discourse level using the dialogue data with user topic preference labels, so as to obtain the topic segmenter.

[0240] It should be understood that the various variations and specific embodiments of the dialogue topic tag generation method provided in the above embodiments are also applicable to the dialogue topic tag generation device of this embodiment. Through the foregoing detailed description of the dialogue topic tag generation method, those skilled in the art can clearly understand the implementation method of the dialogue topic tag generation device in this embodiment. For the sake of brevity, it will not be described in detail here.

[0241] See Figure 7 The diagram shown is a schematic representation of the structure of an electronic device according to an embodiment of this application. In a preferred embodiment of this application, the electronic device 7 includes a memory 71, at least one processor 72, and at least one communication bus 73.

[0242] Those skilled in the art should understand that Figure 7 The structure of the electronic device shown does not constitute a limitation of the embodiments of this application. It can be a bus structure or a star structure. The electronic device 7 may also include more or fewer other hardware or software than shown, or different component arrangements.

[0243] In some embodiments, the electronic device 7 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), digital processors, and embedded devices. The electronic device 7 may also include user equipment, which includes, but is not limited to, any electronic product capable of human-computer interaction with a user via a keyboard, mouse, remote control, touchpad, or voice control device, such as a personal computer, tablet computer, smartphone, or digital camera.

[0244] In the embodiments provided in this application, it should be understood that the disclosed methods, apparatuses, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple components or modules may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices, components, or modules may be electrical, mechanical, or other forms.

[0245] The components described as separate parts may or may not be physically separate. The components shown as components may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the components can be selected to achieve the purpose of this embodiment according to actual needs.

[0246] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each component can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0247] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0248] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0249] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0250] The above is a detailed description of the preferred embodiments of this application. However, the invention of this application is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.

Claims

1. A method for generating a dialogue topic label, characterized by, The dialogue topic label generation method comprises: obtaining a context-enhanced topic representation of a target sentence by topic segmentation; performing clustering on the topic representation in combination with user preference and inter-topic semantics to obtain a topic cluster; inputting the topic cluster into a preset prompt word guided large model, and obtaining a topic label corresponding to each topic cluster output by the prompt word guided large model; wherein the inputting of the topic cluster into the preset prompt word guided large model and the obtaining of the topic label corresponding to each topic cluster output by the prompt word guided large model comprise: randomly dividing the topic cluster into N secondary groups, each secondary group comprising m topic segments; splicing the m topic segments of each secondary group to generate a preliminary label set based on the prompt word guided large model, the preliminary label set comprising N secondary labels; taking the secondary label with the highest frequency of occurrence in the preliminary label set as a core label; performing semantic relevance comparison between each of the other secondary labels and the core label one by one, eliminating irrelevant labels to generate a pure secondary label set; the other secondary labels are the secondary label set excluding the core label in the preliminary label set; inputting the pure secondary label set into the prompt word guided large model to generate a general high-level topic label. 2.The dialogue topic label generation method of claim 1, wherein, The dialogue topic label generation method further comprises: constructing a topic segmenter comprising a double encoder, the double encoder comprising a topic similarity encoder and a coherence encoder; constructing a training sample set, the training sample set comprising dialogue data without topic label annotation and dialogue data with user topic preference annotation; constructing a first contrast loss function of the topic similarity encoder and a second contrast loss function of the double encoder; determining an overall loss function of the topic segmenter according to the first contrast loss function and the second contrast loss function; based on the overall loss function, training the topic segmenter at a data set level using the dialogue data without topic label annotation, and training the topic segmenter at a sentence level using the dialogue data with user topic preference annotation to obtain the topic segmenter. 3.The dialogue topic label generation method of claim 2, wherein, The obtaining of the context-enhanced topic representation of the target sentence by topic segmentation comprises: determining, by the topic segmenter, a relevance score of each pair of adjacent sentences in the entire dialogue to which the target sentence belongs; dividing the entire dialogue into different topic blocks according to the relevance score, and taking the topic blocks as the topic representation corresponding to the target sentence. 4.The method of claim 3, wherein, The determining of the relevance score of each pair of adjacent sentences in the entire dialogue to which the target sentence belongs by the topic segmenter comprises: for each pair of adjacent sentences in the entire dialogue to which the target sentence belongs, obtaining a corresponding topic similarity score by the topic similarity encoder and a corresponding coherence score by the coherence encoder; determining the relevance score of each pair of adjacent sentences according to the topic similarity score and the coherence score. 5.The method of Claim 1, wherein, The performing of clustering on the topic representation in combination with user preference and inter-topic semantics to obtain a topic cluster comprises: According to the original semantic distance, the topic representations are clustered to obtain anchor clusters; According to the preference scalar output by the preference reward model and the original semantic distance, a joint distance of each group of topic representations is calculated; According to the preference scalar, a topic pair with a preference and clustering attribution conflict is determined to obtain a to-be-processed sub-cluster; A topic preference semantic joint space distance of all topic pairs between the to-be-processed sub-cluster and the anchor clusters is calculated, and the to-be-processed sub-cluster is re-assigned to an anchor cluster with a minimum topic preference semantic joint space distance to obtain the topic cluster. 6.The method of Claim 5, wherein, The step of determining, according to the preference scalar, a topic pair with a preference and clustering attribution conflict to obtain a to-be-processed sub-cluster includes: A first threshold value and a second threshold value are determined, the first threshold value is used to represent a strong tendency to be classified into one category, and the second threshold value is used to represent a strong tendency to be classified into different categories; When it is determined that the preference scalar is greater than the first threshold value and a target topic pair belongs to different clustering clusters, or the preference scalar is less than the second threshold value and the target topic pair belongs to the same clustering cluster, the target topic pair is determined to be a preference conflict topic pair; the target topic pair is any one of all topic pairs; According to the preference connection relationship of the preference conflict topic pair, the to-be-processed sub-cluster is reconstructed.

7. A dialogue topic label generating apparatus characterized by comprising: The dialogue topic label generation device includes: An acquisition module is configured to acquire a context-enhanced topic representation of a target sentence by topic segmentation; A clustering module is configured to perform clustering on the topic representation by combining user preference and inter-topic semantics to obtain a topic cluster; A generation module is configured to input the topic cluster into a preset prompt word guided large model and acquire a topic label corresponding to each topic cluster output by the prompt word guided large model; The step of inputting the topic cluster into the preset prompt word guided large model and acquiring a topic label corresponding to each topic cluster output by the prompt word guided large model includes: The topic cluster is randomly divided into N secondary groups, and each secondary group includes m topic segments; The m topic segments in each secondary group are spliced to generate a preliminary label set based on the prompt word guided large model, and the preliminary label set includes N secondary labels; The secondary label with the highest frequency in the preliminary label set is taken as a core label; Other secondary labels are compared with the core label for semantic relevance one by one, and irrelevant labels are removed to generate a pure secondary label set; the other secondary labels are the secondary label set excluding the core label in the preliminary label set; The pure secondary label set is input into the prompt word guided large model to generate a general high-level topic label.

8. An electronic device, comprising: A computer program is stored on a memory and executable on a processor, and the processor implements the steps of the dialogue topic label generation method according to any one of claims 1 to 6 when executing the computer program.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the dialogue topic label generation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Label extraction method and device, electronic equipment and storage medium

    CN115062621A

  • Image paragraph meaning releasing method based on topic clustering and transfer prediction

    CN116737976A