Theme generation method and device
By combining multiple rounds of iterative operations with a large language model, the topic generation process is optimized, which solves the shortcomings of traditional topic models in terms of stability and accuracy, and achieves efficient topic recognition and segmentation in multi-topic mixed text data.
Patent Information
- Application Number
- CN202510896923.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
AI Technical Summary
Traditional topic models have shortcomings in terms of generation stability and accuracy, especially when dealing with text data containing multiple topics, making it difficult to generate accurate topic information.
Through multiple rounds of iterative operations, combined with a large language model and topic retrieval, text segmentation and topic generation are performed, and the topic generation process is optimized by utilizing the positive feedback mechanism of retrieval and generation.
It improves the stability and accuracy of topic generation, especially in text data with multiple mixed topics, and can better identify and segment accurate topic information.
Smart Images

Figure CN120805900A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of natural language processing, and particularly relate to a topic generation method and device. BACKGROUND
[0002] A topic model is a class of statistical models used to automatically identify hidden topics in a collection of text. Topic models have wide and important applications in many fields, such as text classification, text summarization, document similarity calculation, and information retrieval. Topic models can help better understand and manage large amounts of text data by identifying and utilizing the implicit topic structure in the document. Traditional topic models can model text-topic distribution through latent semantic analysis, implicit Dirichlet distribution, non-negative matrix factorization, etc. In recent years, the rapid development of deep learning and large language models has made breakthroughs in many natural language processing tasks, including topic models. Many tasks, including topic models, are unified into a generative framework. Generative topic models can directly generate topics from input, which can result in low stability and accuracy of the output. SUMMARY
[0003] Embodiments of the present specification describe a topic generation method and device. The method can iteratively optimize through multiple rounds of topic library retrieval, text segment division, and topic generation. Through the mutual positive feedback mechanism of retrieval and generation, the retrieval effect and the effects of text segment division and topic generation are optimized at the same time, making the generated topic information more stable and accurate.
[0004] According to a first aspect, a topic generation method is provided, comprising: performing a plurality of rounds of iterative operations on a plurality of text segments, wherein any non-first round of iterative operation comprises: calling a first large language model based on the plurality of text segments and a reference topic list obtained in the last round, outputting a plurality of groups obtained by dividing the plurality of text segments in the current round by the first large language model, and a topic description corresponding to each group; matching a plurality of text segments contained in each group with a preset topic library to obtain a reference topic corresponding to each group, forming a reference topic list in the current round; and determining the topic information of the plurality of text segments according to the result generated in the last round of iterative operation in the plurality of iterative operations.
[0005] According to a second aspect, a topic generation apparatus is provided, comprising: an operation unit configured to perform a plurality of rounds of iteration operations on a plurality of text segments, wherein any non-first round of iteration operation comprises: calling a first large language model based on the plurality of text segments and a reference topic list obtained in a previous round, outputting, by the first large language model, a plurality of groups obtained by dividing the plurality of text segments in the current round and a topic description corresponding to each group; matching a plurality of text segments included in each group with a preset topic library to obtain a reference topic corresponding to each group, and forming a reference topic list in the current round; and a generation unit configured to determine topic information of the plurality of text segments according to a result generated in a last round of iteration operation in the plurality of rounds of iteration operations.
[0006] According to a third aspect, a computer readable storage medium is provided, which stores a computer program, and when the computer program is executed in a computer, the computer is caused to perform the method described in any implementation manner of the first aspect.
[0007] According to a fourth aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any implementation manner of the first aspect is implemented.
[0008] According to the topic generation method and apparatus provided in the embodiments of the present specification, first, a plurality of rounds of iteration operations are performed on a plurality of text segments, wherein any non-first round of iteration operation can comprise the following a) and b), specifically: a), calling a first large language model based on the plurality of text segments and a reference topic list obtained in a previous round, outputting, by the first large language model, a plurality of groups obtained by dividing the plurality of text segments in the current round and a topic description corresponding to each group; b), matching a plurality of text segments included in each group with a preset topic library to obtain a reference topic corresponding to each group, and forming a reference topic list in the current round. Then, topic information of the plurality of text segments is determined according to a result generated in a last round of iteration operation in the plurality of rounds of iteration operations. Thus, the topic library retrieval, text segment division and topic generation can be iteratively optimized through multiple rounds, and the retrieval effect and the effects of text segment division and topic generation can be simultaneously optimized through the mutual positive feedback mechanism of retrieval and generation, so that the generated topic information is more stable and accurate. BRIEF DESCRIPTION OF DRAWINGS
[0009] Figure 1 A schematic diagram showing an application scenario in which the embodiments of the present specification can be applied is shown;
[0010] Figure 2 A flowchart showing a topic generation method according to an embodiment is shown;
[0011] Figure 3A schematic diagram showing one example of application of the subject generation method of the embodiments of the present specification to an instant messaging application is shown.
[0012] Figure 4 A schematic block diagram of a subject generation apparatus according to one embodiment is shown. DETAILED DESCRIPTION
[0013] The technical solutions provided by the present specification are described in further detail below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are merely intended to explain the related application, and not to limit the application. In addition, it should be noted that only the parts related to the application are shown in the accompanying drawings. It should be noted that the embodiments of the present specification and the features in the embodiments can be combined with each other without conflict.
[0014] As mentioned earlier, topic models have a wide and important application in many fields, and there are currently a variety of topic models. These topic models may have some shortcomings. For example, traditional topic models often need to pre-set the number of topics, which is difficult to meet in many scenarios. For another example, LDA (Latent Dirichlet Allocation, Latent Dirichlet Allocation) and other topic models based on bag of words often ignore the order of words in the text, and important semantic information is often lost, and the topic itself is low in interpretability, and can only rely on the joint distribution between the topic and the word to interpret the topic. For another example, topic models based on generative framework have too high freedom, and the stability and controllability of generation are worse than traditional topic models, which greatly affects the accuracy of the topic.
[0015] Therefore, the embodiments of the present specification provide a subject generation method, which can be iteratively optimized through multiple rounds of topic library retrieval, text segment division, and topic generation, and through the mutual positive feedback mechanism of retrieval and generation, the retrieval effect and the effect of text segment division and topic generation are optimized at the same time, so that the generated topic information is more stable and accurate. Figure 1 A schematic diagram showing one application scenario in which the embodiments of the present specification can be applied is shown. In the application scenario shown, Figure 1 In the application scenario shown, topic information needs to be generated for multiple group chat messages M(1), M(2), …, M(n) generated by an instant messaging application, and for this purpose, multiple rounds of iterative operations can be performed to generate topic information for the multiple group chat messages. Figure 1The first iteration process is indicated by a dashed line “---”. In the first iteration, a plurality of group chat messages M(1), M(2), …, M(n) can be used to form a text block, and the text block can be converted into a vector by using the text vector model 101. The vector can be matched with the topic vectors of the topics stored in the topic library 102 to obtain a reference topic list of the first iteration. For any iteration operation after the first iteration, Figure 1 The iteration process is indicated by a solid line “—”. In a certain iteration, the first large language model 103 can be called based on the plurality of group chat messages M(1), M(2), …, M(n) and the reference topic list obtained in the last iteration. The first large language model 103 outputs N groups obtained by dividing the plurality of group chat messages M(1), M(2), …, M(n) in the current iteration, and a topic description corresponding to each group. In this example, the topic description can include keywords and explanations. Then, a plurality of group chat messages included in each group can be used to form a text block, and the text block can be converted into a vector by using the text vector model 101. The vector can be matched with the topic vectors of the topics stored in the topic library 102 to obtain a reference topic corresponding to each group. The reference topics generated by the N groups form a reference topic list of the current iteration. Finally, the topic information of the plurality of group chat messages M(1), M(2), …, M(n) can be determined according to the result generated in the last iteration in the plurality of iteration operations.
[0016] The above is a simple description of one application scenario of the topic generation method provided by the embodiments of the present disclosure. The topic generation method will be described in detail below. It can be understood that the method can be executed by any device, equipment, platform, or device cluster having computing and processing capabilities.
[0017] As can be seen from the above application scenario, to implement the topic generation method of the present embodiment, a topic library needs to be built in advance. The topic library can include topic descriptions of a plurality of topics. In practice, the topic library can be built in various ways, for example, a topic library can be generated by manually writing topic descriptions.
[0018] In some implementations, the topics in the topic library can be generated by the following steps (1), (2), and (3). Specifically:
[0019] Step (1), obtaining a plurality of historical text segments.
[0020] In the present implementation, the sources of the plurality of historical text segments can be the same as or different from the sources of the plurality of text segments processed by the topic generation method. Taking the plurality of text segments as a plurality of chat messages generated by an instant messaging application as an example, the plurality of historical text segments can include a plurality of historical chat messages generated by the instant messaging application, and can also include text segments generated in an email, etc.
[0021] Step (2), divide the plurality of historical text segments to obtain a plurality of historical groups.
[0022] In practice, the plurality of historical text segments can be divided in various ways. For example, the historical text segments can be first converted into high-dimensional semantic vectors, then the similarity between the vectors is calculated, and finally the historical text segments with a similarity higher than a threshold are divided into the same historical group.
[0023] In one example, the above step (2) can specifically include the following content: clustering the plurality of historical text segments to obtain a plurality of clusters as historical groups.
[0024] In this example, various clustering algorithms can be used to cluster the plurality of historical text segments, such as k-means clustering algorithm, DBSCAN (Density-Based Spatial Clustering of Applications with Noise) clustering algorithm, hierarchical clustering algorithm, etc., and the plurality of clusters obtained are used as historical groups.
[0025] Step (3), for each historical group, calling a second large language model to output a topic description corresponding to each historical group by the second large language model.
[0026] In this implementation, the second large language model can be the same as or different from the first large language model. For each historical group, the second large language model can be inputted with each historical group to generate a topic description corresponding to each historical group.
[0027] Based on the built topic library, a plurality of text segments can be subjected to a plurality of rounds of iteration to determine the topic information of the plurality of text segments. The first round of iteration in the above plurality of rounds of iteration can include the following steps: matching a text block composed of the plurality of text segments with the topic library to obtain a reference topic list of the first round.
[0028] In this way, the second round of iteration operation after the first round of iteration can be based on the plurality of text segments and the reference topic list of the first round to call the first large language model.
[0029] For any non-first round of iteration in the plurality of rounds of iteration, please refer to Figure 2 , Figure 2 A flowchart of a topic generation method according to one embodiment is shown. As Figure 2As shown, the topic generation method can include the following steps 201 and 202, in particular:
[0030] Step 201, performing a plurality of rounds of iteration operations on the plurality of text segments, wherein any non-first round of iteration operation includes the following steps 2011 and 2012, in particular:
[0031] Step 2011, based on the plurality of text segments and the reference topic list obtained in the last round, calling the first large language model, and outputting by the first large language model a plurality of groups obtained by dividing the plurality of text segments in this round, and a topic description corresponding to each group.
[0032] In this embodiment, the plurality of text segments can include various text segments, for example, can include text segments in documents or articles, can also include text segments in web pages, can also include text segments generated in daily communication and exchange (such as text segments generated in voice communication, text segments generated in emails, etc.), etc.
[0033] In some implementations, the plurality of text segments can include a plurality of chat messages generated by an instant messaging application, which can be chat messages generated by private chat between two people, and can also be group chat messages.
[0034] In practice, compared with other text segments, the topic in group chat messages generated by group chat has higher hybridity, such as the problem of coexistence of multiple topics and switching of multiple topics, and the topic generation method in this embodiment can divide text segments and generate topics through a plurality of rounds of iteration operations, so that the generated topic information is more accurate. Therefore, the topic generation method in this embodiment can well solve the topic hybridity problem in group chat messages.
[0035] In the plurality of rounds of iteration operations, each round of iteration operation can obtain a reference topic list, and the reference topic list can include a plurality of reference topics. For any non-first round of iteration operation, based on the plurality of text segments and the reference topic list obtained in the last round, the first large language model is called, and the first large language model outputs a plurality of groups obtained by dividing the plurality of text segments in this round, and a topic description corresponding to each group.
[0036] Here, a large language model (LLM) can also be referred to simply as a large model. A large language model is a natural language processing model based on deep learning technology, with a parameter order of magnitude usually reaching tens of billions to hundreds of billions or even higher, and with strong language understanding and generation capabilities. A large language model can use a Transformer architecture or its variants (such as GPT, BERT, etc.), which uses an attention mechanism to model global sequence data and can efficiently handle long-range dependencies, thus performing well in natural language tasks. A large language model is pre-trained on a large corpus of text to learn statistical features and semantic relationships of language, enabling it to have good generalization capabilities. The core capabilities of a large language model include, but are not limited to, understanding contextual semantics, generating coherent and grammatically correct text, performing logical reasoning, and handling multi-task scenarios. Its usage methods usually include direct inference and fine-tuning. In the direct inference mode, users guide the large language model to generate specific outputs by designing prompts. Prompts can be in the form of text describing tasks or instructions to stimulate the semantic understanding and generation capabilities of the large language model. In the fine-tuning mode, the large language model is further trained on a small dataset in a specific domain to optimize its performance on specific tasks. The strong generalization capabilities and flexibility of a large language model make it an important tool in the field of artificial intelligence technology, providing efficient and accurate solutions for automated text generation and understanding.
[0037] In some embodiments, a large language model can also have understanding and generation capabilities for data in other modalities (such as vision, audio, etc.), in which case the large language model can also be referred to as a multimodal large language model (MLLM). MLLMs provide a richer and more natural interactive experience by integrating text, images, sound, and other types of input and output. The core advantage of MLLMs is their ability to process and understand information from different modalities and integrate these information to complete complex tasks. For example, MLLMs can analyze a picture and generate descriptive text, or generate corresponding images based on text descriptions. This cross-modal understanding and generation capability makes MLLMs have wide application prospects in many fields.
[0038] In this embodiment, the topic description can be used to describe the topic. For example, the topic description can include topic keywords, that is, one or more topic keywords are used to specifically summarize the content of the topic.
[0039] In some implementations, the topic description can include topic keywords and an explanation, where the explanation can be used to introduce the topic. As an example, assume that the topic name of a certain topic is "bill AIGC content detection", where AIGC is the English full name of Artificial Intelligence Generated Content. The topic description corresponding to the topic name can include topic keywords and an explanation, for example:
[0040] Topic keywords: AIGC detection, bill review, AI-generated analysis, text authenticity verification, data security, etc.
[0041] Explanation: AI can be applied to bill generation, contract writing, financial reporting, etc. AI-generated bills may be at risk due to model training bias, data errors, or malicious tampering (such as fake bills, amount errors, and abnormal formats), and bill AIGC content detection can efficiently identify whether a bill is generated by AI and verify its authenticity.
[0042] Step 2012, match the text segments contained in each group with the preset topic library to obtain the reference topics corresponding to each group, and form a reference topic list of this round.
[0043] In this embodiment, the text segments contained in each group can be matched with the preset topic library to obtain the reference topics corresponding to each group, and form a reference topic list of this round. For example, the text segments contained in each group can be matched with the topic descriptions in the topic library for keyword matching, directly checking whether the two texts contain the same keywords or phrases, and the topic descriptions containing more than a preset number of the same keywords or phrases are taken as the reference topics corresponding to the group. For another example, the string similarity between the text segments contained in each group and the topic descriptions in the topic library can be calculated, i.e., the character overlap degree of the text is calculated, and the topic descriptions with a string similarity higher than a preset threshold are taken as the reference topics corresponding to the group.
[0044] In some implementations, the topic library can include topic descriptions of multiple topics, and topic vectors corresponding to the topic descriptions of the multiple topics. Based on this, the above step 2012 can include the following steps 1), step 2) and step 3), specifically:
[0045] Step 1), encode the text segments contained in any target group into a first vector.
[0046] In the implementation, the target group can be any one of the groups divided by the text segments, and the text segments included in the target group can be encoded into the first vector in various ways. For example, the text segments can be encoded into the first vector by using a Bag of Words (BoW) model. For another example, the text segments can be encoded into the first vector by using a Word2Vec model. For yet another example, the text segments can be encoded into the first vector by using a BGE (BAAI General Embedding) model. It can be understood that the first vector can be generated in the same way as the theme vector in the theme library.
[0047] Step 2), comparing the first vector with the plurality of theme vectors stored in the theme library to obtain a matched first theme vector.
[0048] In the implementation, the first vector can be compared with the plurality of theme vectors stored in the theme library, for example, the similarity can be calculated, and the theme vector with a similarity higher than a set threshold can be taken as the matched first theme vector.
[0049] Step 3), determining the first theme corresponding to the first theme vector in the theme library as the parameter theme corresponding to the target group.
[0050] By the implementation, the reference theme can be determined by vector similarity calculation, and the vector can capture the deep semantics of the text, so that the determined reference theme can be more accurate.
[0051] In some implementations, in addition to the step 2011 and the step 2012, the non-first iteration operation in the step 201 can further include the following steps S1 and S2, and details are as follows.
[0052] Step S1, determining the difference between the output of the first large language model in the current round and the output of the first large language model in the last round.
[0053] Step S2, determining whether the iteration operation in the current round is the last iteration operation based on the difference.
[0054] In the implementation, the difference between the output of the first large language model in the current round and the output of the first large language model in the last round can be determined, for example, whether the results of the two outputs are the same or the difference is less than a preset difference can be determined, and if the results of the two outputs are the same or the difference is less than the preset difference, it can be determined that the iteration operation in the current round is the last iteration operation.
[0055] In some implementations, the non-first-round iteration operation in step 201 may further include the following steps ① and ② in addition to steps 2011 and 2012. Specifically:
[0056] Step ①: Determine whether this round has reached the preset target number of iterations.
[0057] Step ②: When the target number of iterations is reached in this round, the iteration is stopped and the iteration operation of this round is regarded as the last round of iteration operation.
[0058] In this implementation, the target number of iterations can be determined in various ways, for example, manually or based on computational time. In practice, a greater number of iterations results in greater computational time and resource consumption. To control computational time and resource consumption, a target number of iterations can be pre-set so that iterations are stopped when the target number of iterations is reached.
[0059] Step 202: determining topic information of multiple text segments based on the result of the last round of iterative operations in the multiple rounds of iterative operations.
[0060] In this embodiment, the results of each iteration round other than the first iteration round may include: a plurality of groups derived from dividing the multiple text segments, a description of the topic corresponding to each group, and a list of reference topics for the current round. Based on this, the topic information of the multiple text segments can be determined based on the results of the last iteration round. For example, the entire content or a portion of the content of the results of the last iteration round can be used as the topic information of the multiple text segments.
[0061] In some implementations, the above step 202 may specifically include the following: determining the multiple groups output by the first largest language model in the last round of iteration and the topic descriptions corresponding to the groups as the topic information of the multiple text segments.
[0062] To more clearly describe the multiple rounds of iterative operations for multiple text segments, the topic generation method of this embodiment is explained below through formulas. Specifically, assuming that variable X represents multiple text segments, variable Y represents multiple groups obtained by dividing the multiple text segments, variable T represents the topic descriptions corresponding to the groups, and T′ represents the reference topic list, then the algorithm of the topic generation method of this embodiment involves the following formulas 1, 2, and 3. Specifically:
[0063] T0′~P(T′]X) Formula 1,
[0064] Y i+1 ,T i+1 ~P(Y,TX,T′ i ) Formula 2,
[0065] T' i+1 ~ P(T'|Y i ) Formula 3.
[0066] In Formula 1, in the first round of iteration, the initial value T'0 of the reference topic list T' is determined by the plurality of text segments X.
[0067] In Formula 2, in the non-first round of iteration, the reference topic list T' of the i+1th round is obtained based on the plurality of text segments X and the reference topic list T' of the ith round. i The plurality of text segments X is divided into a plurality of groups Y in the i+1th round. i+1 The plurality of groups Y i+1 The corresponding topic description T i+1 .
[0068] In Formula 3, in the non-first round of iteration, the reference topic list T' of the i+1th round is obtained based on the plurality of groups Y of the ith round. i+1 .
[0069] As can be seen from Formulas 2 and 3, the distribution of the groups Y and the topic description T is estimated based on the plurality of text segments X and the reference topic list T', and therefore, the more accurate the reference topic list T' is, the closer the distribution of the groups Y and the topic description T is to the real distribution. Similarly, the distribution of the reference topic list T' is estimated based on the groups Y, and therefore, the more accurate the groups Y are, the closer the distribution of the reference topic list T' is to the real distribution. This iteration process can be regarded as a variant of Gibbs sampling, because each sampling is based on the conditional probability of other variables to sample the current variable, that is, the Monte Carlo sampling process of the conditional probability of the multi-dimensional variables is used for the joint distribution estimation of the groups Y, the topic description T and the reference topic list T', and therefore, the final sampling probability is close to the real probability. Based on the above theoretical basis, the topic generation method of the embodiment can converge to the optimal division result and the optimal topic description.
[0070] In fact, the retrieval of the reference topic list strongly depends on the grouping of the plurality of text segments, and in turn, the grouping of the plurality of text segments and the generation of the topic description depend on the relevance of the reference topic list, and therefore, the two elements are a process of mutual promotion and positive feedback. The embodiment uses the positive feedback process to stimulate the optimization and update of the two variables, so that they converge to the optimal solution.
[0071] The topic information generated by the topic generation method provided in the embodiments of the present specification can be widely applied in many fields. For example, the topic generation method provided in the embodiments of the present specification can be embedded into an instant messaging application to facilitate the user to understand the topic of the chat message.
[0072] As Figure 3 shown, Figure 3A schematic diagram showing an example of application of the subject generation method of the embodiments of the present specification to an instant messaging application is shown. In Figure 3 In the example shown, multiple users can send group chat messages through the group chat interface 301 of the "casual chat group". The group chat interface 301 can be provided with a button 302, which can invoke the subject generation method to process the group chat messages in the group chat interface 301 to generate the subject information of the group chat messages. In use, the user can view the subject information of the group chat messages by clicking the button 302. It can be understood that, Figure 3 The position, style, display text, etc. of the button 302 in the above are merely illustrative and not limiting.
[0073] Referring back to the above process, in the embodiments of the present specification, a plurality of rounds of iteration operations are performed on the plurality of text segments, wherein any non-first round of iteration operation includes the following a) and b), specifically: a), based on the plurality of text segments and the reference subject list obtained in the last round, invoking a first large language model, and outputting, by the first large language model, a plurality of groups obtained by dividing the plurality of text segments in the current round, and a subject description corresponding to each group; b), matching the plurality of text segments contained in each group with a preset subject library to obtain a reference subject corresponding to each group, and forming a reference subject list in the current round. Then, the subject information of the plurality of text segments is determined according to the result generated in the last round of iteration operation in the plurality of rounds of iteration operations. Thus, the subject information generated can be iteratively optimized through multiple rounds of subject library retrieval, text segment division and subject generation, and the retrieval effect and the effects of text segment division and subject generation can be optimized through the mutual positive feedback mechanism of retrieval and generation, so that the generated subject information is more stable and accurate. According to another aspect of the embodiments, a subject generation apparatus is provided. The above subject generation apparatus can be deployed in any device, platform or device cluster with computing and processing capabilities.
[0074] Figure 4 A schematic block diagram of a subject generation apparatus according to an embodiment is shown. As Figure 4 As shown, the subject generation apparatus 400 includes: an operation unit 401 configured to perform a plurality of rounds of iteration operations on a plurality of text segments, wherein any non-first round of iteration operation includes: based on the plurality of text segments and a reference subject list obtained in the last round, invoking a first large language model, and outputting, by the first large language model, a plurality of groups obtained by dividing the plurality of text segments in the current round, and a subject description corresponding to each group; matching the plurality of text segments contained in each group with a preset subject library to obtain a reference subject corresponding to each group, and forming a reference subject list in the current round; and a generation unit 402 configured to determine the subject information of the plurality of text segments according to the result generated in the last round of iteration operation in the plurality of rounds of iteration operations.
[0075] In some optional implementations of the embodiment, the first round of iteration includes the following steps: matching the text block composed of the plurality of text segments with the topic library to obtain a first round of reference topic list.
[0076] In some optional implementations of the embodiment, matching the plurality of text segments contained in each group with the preset topic library to obtain the reference topic corresponding to each group includes: encoding the plurality of text segments contained in any target group into a first vector; comparing the first vector with a plurality of topic vectors stored in the topic library to obtain a matched first topic vector; and determining the first topic corresponding to the first topic vector in the topic library as the reference topic corresponding to the target group.
[0077] In some optional implementations of the embodiment, the non-first round of iteration operation further includes the following steps: determining the difference between the output of the first large language model in the current round and the output of the first large language model in the last round; and determining whether the current round of iteration operation is the last round of iteration operation based on the difference.
[0078] In some optional implementations of the embodiment, the non-first round of iteration operation further includes the following steps: determining whether the current round reaches a preset target iteration number; and stopping iteration and taking the iteration operation in the current round as the last round of iteration operation in the case that the current round reaches the target iteration number.
[0079] In some optional implementations of the embodiment, the topics in the topic library are generated by: obtaining a plurality of historical text segments; dividing the plurality of historical text segments to obtain a plurality of historical groups; and calling a second large language model to output a topic description corresponding to each historical group by the second large language model.
[0080] In some optional implementations of the embodiment, dividing the plurality of historical text segments to obtain a plurality of historical groups includes: clustering the plurality of historical text segments to obtain a plurality of clusters as historical groups.
[0081] In some optional implementations of the embodiment, the plurality of text segments include a plurality of chat messages generated by an instant messaging application.
[0082] In some optional implementations of the embodiment, the plurality of chat messages are group chat messages.
[0083] In some optional implementations of the embodiment, the topic description includes a topic keyword and an explanation.
[0084] In some optional implementations of the embodiment, the generation unit 402 is further configured to determine the topics of the plurality of text segments as the topics of the plurality of text segments corresponding to the plurality of groups of text segments output by the first large language model in the last iteration of the above-described operation.
[0085] According to another aspect, an embodiment also provides a computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method described above. Figure 2 According to another aspect, an embodiment also provides a computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method described above.
[0086] According to another aspect, an embodiment also provides a computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method described above. Figure 2 According to another aspect, an embodiment also provides a computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method described above.
[0087] Those skilled in the art should further understand that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms in the above description. Whether the functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0088] The steps of the method or algorithm described in combination with the embodiments disclosed herein can be implemented by hardware, software modules executed by a processor, or a combination of both. The software modules can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0089] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A topic generation method, comprising: Perform multiple rounds of iterations on multiple text segments, where any non-first round iterations include: Based on the multiple text segments and the reference topic list obtained in the previous round, calling a first large language model, and having the first large language model output a number of groups obtained by dividing the multiple text segments in this round, and a topic description corresponding to each group; Match the text segments in each group with the preset topic library to obtain the reference topics corresponding to each group, forming a reference topic list for this round; The topic information of the multiple text segments is determined according to the result of the last round of iterative operations in the multiple rounds of iterative operations.
2. The method according to claim 1, wherein The first iteration includes the following steps: The text block composed of the multiple text segments is matched with the topic library to obtain a first-round reference topic list.
3. The method according to claim 1, wherein The matching of the text segments contained in each group with the preset topic library to obtain the reference topics corresponding to each group specifically includes: Encode a plurality of text segments contained in any target group into a first vector; Comparing the first vector with a plurality of topic vectors stored in the topic library to obtain a matching first topic vector; The first topic corresponding to the first topic vector in the topic library is determined as the reference topic corresponding to the target group.
4. The method according to claim 1, wherein The non-first round iterative operation further includes the following steps: Determine a difference between an output of the first largest language model in the current round and an output of the first largest language model in the previous round; Based on the difference, it is determined whether the current round of iterative operation is the last round of iterative operation.
5. The method according to claim 1, wherein The non-first round iterative operation further includes the following steps: Determine whether the current round has reached the preset target number of iterations; When the target number of iterations is reached in this round, the iteration is stopped and the iteration operation of this round is regarded as the last iteration operation.
6. The method according to claim 1, wherein The themes in the theme library are generated in the following ways: Get multiple historical text segments; Dividing the multiple historical text segments into a plurality of historical groups; For each historical group, the second largest language model is called, and the second largest language model outputs the topic description corresponding to each historical group.
7. The method according to claim 6, wherein: The plurality of historical text segments are divided to obtain a number of historical groups, including: The multiple historical text segments are clustered to obtain multiple clusters as historical groups.
8. The method according to claim 1, wherein The multiple text segments include multiple chat messages generated by an instant messaging application.
9. The method according to claim 8, wherein The multiple chat messages are group chat messages.
10. The method according to claim 1, wherein The topic description includes topic keywords and explanations.
11. The method according to claim 1, wherein Determining the topic information of the multiple text segments according to the result of the last round of iterative operations in the multiple rounds of iterative operations includes: The plurality of groups output by the first language model in the last round of iterative operation and the topic descriptions corresponding to the respective groups are determined as the topic information of the plurality of text segments.
12. A theme generating device, comprising: The operation unit is configured to perform multiple rounds of iterative operations on the multiple text segments, wherein any non-first round iterative operations include: Based on the multiple text segments and the reference topic list obtained in the previous round, calling a first large language model, and having the first large language model output a number of groups obtained by dividing the multiple text segments in this round, and a topic description corresponding to each group; Match the text segments in each group with the preset topic library to obtain the reference topics corresponding to each group, forming a reference topic list for this round; The generating unit is configured to determine the topic information of the multiple text segments according to the result generated by the last round of iterative operations in the multiple rounds of iterative operations.
13. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 11.
14. A computing device comprising a memory and a processor, characterized in that: The memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Cited By
Abnormal event attribution method and system based on LLM deep semantic feature extraction
CN121117855A