A controllable review generation method and system based on multi-agent cooperation

Through a multi-agent collaboration method, multiple subjective agents are generated and the most relevant agents are screened using cosine similarity. Combined with review agents to select comments, the relevance and controllability issues of comment generation by large-scale language models are solved, and high-quality controllable comment generation is achieved.

CN119862962BActive Publication Date: 2025-10-10KUNMING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411953365.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-10-10
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

When generating controllable comments, large-scale language models find it difficult to simultaneously meet the requirements of story relevance and logical coherence, and the generated comments may not match the news content or meet the control conditions set for the task.

Method used

A multi-agent collaboration method is adopted to generate multiple subjective agents through a large-scale language model. Each agent expresses comments with different emotions from different perspectives. Sentence-BERT is used to calculate cosine similarity to select the most relevant agent, and the review agent is used to screen out comments that meet the news content and control conditions.

Benefits of technology

The controllability and text quality of generated comments have been significantly improved, ensuring that the comments are relevant to the news content and meet the set control conditions, thereby improving the quality and stability of the generated text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862962B_ABST
    Figure CN119862962B_ABST
Patent Text Reader

Abstract

The application relates to a controllable comment generation method and system based on multi-agent cooperation, and belongs to the technical field of natural language processing. The method comprises the following steps: downloading a comment data set, and preprocessing the data set; using a large-scale language model to simultaneously generate a plurality of subjective agents according to a news text; each subjective agent generates a comment with different emotions from different angles of the news content; selecting a subjective agent that is most suitable for a constraint condition from the generated subjective agents, and enabling the subjective agent to simulate a real news reader to generate a comment; and setting an examination agent to select a comment that is fluent and most suitable for the news content and the control condition from the generated comments. The method achieves ideal results on a Tencent fast report news data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a controllable comment generation method and system based on multi-agent collaboration, belonging to the technical field of natural language processing. Background Art

[0002] Controllable comment generation involves guiding a model's text generation through specific constraints, enabling precise control over the generated text's content, style, and sentiment, while maintaining high standards of text quality. Unlike traditional comment generation tasks, controllable comment generation requires not only that the model understand the news content and generate coherent and logically rigorous comments, but also that the comments strictly adhere to the set constraints. Controllable comment generation has a wide range of applications in fields such as news dissemination and public opinion guidance.

[0003] In recent years, the use of large-scale language models and prompt learning has become a new paradigm for generative tasks. Contextual learning based on a small number of examples can effectively help large models adapt to different tasks. However, even when the model is provided with a certain number of contextual examples, event-driven story generation tasks still face the problem of insufficient relevance and coherence in the generated stories. Therefore, the core task of this invention is to ensure that the stories generated by large models have a clear logical framework and improve the quality of the story text generated by large models. Prompt learning and contextual learning based on large-scale language models provide new ideas for solving the task of controllable comment generation. Prompt learning guides the model to generate text that meets the requirements by designing appropriate instructions or templates. Contextual learning provides examples in the input, allowing the model to learn task patterns from them. However, the ability of large-scale language models to understand complex news content and control task constraints remains limited. The generated comments may not match the news content or fail to meet the control requirements set by the task. Therefore, the core task of this invention is to ensure that the comments generated by large models strictly follow the specified control conditions while maintaining high standards of text quality. Summary of the Invention

[0004] The present invention provides a controllable comment generation method and system based on multi-agent collaboration, which are used to improve the controllability and text quality of comments generated by large-scale language models.

[0005] The technical solution of the present invention is: a controllable comment generation method based on multi-agent collaboration, the method comprising:

[0006] Step 1: Download the review dataset and preprocess it to form the experimental dataset of the present invention;

[0007] Step 2: Use a large-scale language model to generate multiple subjective agents based on the news text. Each subjective agent generates comments with different emotions from different perspectives of the news content.

[0008] Step 3: To meet the keyword and sentiment constraints set for the task, select the subjective agent that best meets the constraints from the generated agents and have them simulate real news readers to generate comments.

[0009] Step 4: To ensure the quality of generated comments and the stability of control, set the review agent to select the multiple generated comments and select the comments that are smooth and most consistent with the news content and control conditions.

[0010] Furthermore, the Step 1 includes:

[0011] Step 1.1, download the public review dataset from the Internet;

[0012] Step 1.2: Label each news comment in the dataset with sentiment labels and keywords.

[0013] Furthermore, the Step 2 includes:

[0014] Step 2.1, in order to ensure that the generated comments meet the control conditions defined by the task (such as the emotional constraint C of the present invention), sen and keyword constraint C key ), and maintain the relevance of comments to news; according to the input news text T, the large-scale language model dynamically generates a group of intelligent agents R s ={R1, R2, R3, ..., R n}, where R i represents the generated i-th subjective agent. The format of each generated subjective agent is: <agent type, agent description>. Different subjective agents express different emotions and comments on different objects based on their own views.

[0015] Step 2.2: Prompt the large-scale language model to constrain C according to the input keywords. key , the subjective agents are divided into subjective agents R that are positive on keywords pos ={R1, R2, R3, ..., R n} and subjective agent R that is negative towards keywords neg ={R1, R2, R3, ..., R n}.

[0016] Furthermore, the Step 3 includes:

[0017] Step 3.1, from the generated subjective agent R pos and R neg Filter out the emotional constraints C that are consistent with the task input sen A consistent subjective agent to ensure that the generated reviews have the same sentiment polarity as the task requirements;

[0018] Step 3.2: To ensure that the generated comments meet the keyword constraint C key Constraints, using the multilingual pre-trained language model Sentence-BERT to constrain each subjective agent and keyword C that meets the emotional constraints key Encoded into a semantic vector; then, the cosine similarity between the keyword and each subjective agent that meets the sentiment constraint is calculated and used as the relevance score between the keyword and the subjective agent; the calculation formula of the relevance score is as follows:

[0019]

[0020] Where d represents the number of all subjective agents;

[0021] Step 3.3, from the calculated correlation score re Select the subjective agent R with the highest score best As the most relevant agent for generating reviews, its formula is as follows:

[0022] R best =argmaxscore re

[0023] Furthermore, the Step 4 includes:

[0024] Step 4.1. Since controllable generation tasks usually contain multiple objective dimensions, a review agent R is manually designed for each objective dimension. o To ensure that the generated reviews meet these objective dimensions; each review agent format is: <agent type, agent description>, where each review agent is responsible for one or more specific objective dimensions, and the agent description details the key points that the agent focuses on when evaluating the review;

[0025] Step 4.2: The review agent scores the comments generated by each subjective agent based on the set agent description;

[0026] Step 4.3. Calculate the total score of each comment and select the comment with the highest score as the final answer.

[0027] The present invention also provides a controllable comment generation system based on multi-agent collaboration, which includes: a module for executing the above-mentioned controllable comment generation method based on multi-agent collaboration.

[0028] The present invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned controllable comment generation method based on multi-agent collaboration when executing the program.

[0029] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned controllable comment generation method based on multi-agent collaboration.

[0030] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned controllable comment generation method based on multi-agent collaboration.

[0031] The beneficial effects of the present invention are:

[0032] The present invention proposes a controllable comment generation method based on multi-agent collaboration, which mainly includes three aspects: first, a group of emotional agents are generated according to the news text through prompt learning, and each subjective agent generates comments with different emotions from different angles of the news content; second, in order to meet the keywords and emotional constraints set by the task, the present invention selects the agent that best meets the constraints from the generated agents, and allows the agent to simulate real news readers to generate comments; finally, in order to ensure the quality of generated comments and the stability of control. The present invention manually sets review agents to select comments that are smooth and most consistent with the news content and control conditions from the multiple generated comments;

[0033] This invention improves the controllability and text quality of reviews generated by large-scale language models;

[0034] The controllable comment generation method based on multi-agent collaboration proposed in this invention is superior to previous methods, which verifies the effectiveness of the method of this invention for the controllable comment generation task. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Fig. 1 This is an overall framework diagram of a controllable review generation method based on multi-agent collaboration of the present invention;

[0036] Fig. 2 This is an example diagram of a prompt mechanism generated by a subjective agent of the present invention;

[0037] Fig. 3 This is an example diagram of the review agent scoring mechanism of the present invention. DETAILED DESCRIPTION

[0038] Example 1: Figs. 1-3 As shown, a controllable comment generation method based on multi-agent collaboration includes:

[0039] Step1, download the Tencent Express News comment dataset, which contains 207117 news texts and 666566 news comments, preprocess the dataset to construct the experimental dataset of the application;

[0040] Further, the Step1 comprises:

[0041] Step1.1, download the public Tencent Express News comment dataset from the Internet;

[0042] Step1.2, label each news comment in the dataset with a sentiment label and a keyword.

[0043] Step2, using a large-scale language model to generate multiple subjective agents according to the news text, each subjective agent generates a comment with different emotions from different angles of the news content;

[0044] Further, the Step2 comprises:

[0045] Step2.1, in order to ensure that the generated comments meet the control conditions defined by the task (such as the emotion constraint C sen and the keyword constraint C key ) of the application, and maintain the relevance of the comments to the news; prompt the large-scale language model to dynamically generate a set of agents R s ={R1, R2, R3, …, R n} according to the input news text T, where R i represents the i-th generated subjective agent, and the format of each generated subjective agent is: <agent type, agent description>, different subjective agents express different emotions and comments on different objects according to their own perspectives;

[0046] Step2.2, prompt the large-scale language model to divide the subjective agents into positive subjective agents R pos ={R1, R2, R3, …, R n} and negative subjective agents R neg ={R1, R2, R3, …, R n} according to the input keyword constraint C key .

[0047] Step3, in order to meet the keyword and emotion constraints set by the task, select the subjective agents that best fit the constraint conditions from the generated agents, and let the subjective agents simulate real news readers to generate comments;

[0048] Further, the Step3 comprises:

[0049] Step 3.1, from the generated subjective agent R pos and R neg Filter out the emotional constraints C that are consistent with the task input sen A consistent subjective agent to ensure that the generated reviews have the same sentiment polarity as the task requirements;

[0050] Step 3.2: To ensure that the generated comments meet the keyword constraint C key Constraints, using the multilingual pre-trained language model Sentence-BERT to constrain each subjective agent and keyword C that meets the emotional constraints key Encoded into a semantic vector; then, the cosine similarity between the keyword and each subjective agent that meets the sentiment constraint is calculated and used as the relevance score between the keyword and the subjective agent; the calculation formula of the relevance score is as follows:

[0051]

[0052] Where d represents the number of all subjective agents;

[0053] Step 3.3, from the calculated correlation score re Select the subjective agent R with the highest score best As the most relevant agent for generating reviews, its formula is as follows:

[0054] R best =argmaxscore re

[0055] Step 4: To ensure the quality of generated comments and the stability of control, set the review agent to select the multiple generated comments and select the comments that are smooth and most consistent with the news content and control conditions.

[0056] Furthermore, the Step 4 includes:

[0057] Step 4.1. Since controllable generation tasks usually contain multiple objective dimensions, a review agent R is manually designed for each objective dimension. o To ensure that the generated reviews meet these objective dimensions; each review agent format is: <agent type, agent description>, where each review agent is responsible for one or more specific objective dimensions, and the agent description details the key points that the agent focuses on when evaluating the review;

[0058] Step 4.2: The review agent scores the comments generated by each subjective agent based on the set agent description;

[0059] Step 4.3. Calculate the total score of each comment and select the comment with the highest score as the final answer.

[0060] The present invention also provides a controllable comment generation system based on multi-agent collaboration, the system comprising:

[0061] The preprocessing module is used to download the review dataset and preprocess the dataset;

[0062] The comment module uses a large-scale language model to generate multiple subjective agents based on news text. Each subjective agent generates comments with different emotions from different perspectives of the news content.

[0063] The simulated comment module selects the subjective agent that best meets the constraints from the generated agents and allows the subjective agent to simulate real news readers to generate comments;

[0064] The selection module is used to set the review agent to select multiple comments generated and select the comments that are fluent and most consistent with the news content and control conditions.

[0065] The present invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned controllable comment generation method based on multi-agent collaboration when executing the program.

[0066] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned controllable comment generation method based on multi-agent collaboration.

[0067] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned controllable comment generation method based on multi-agent collaboration.

[0068] The generation tasks of the present invention are usually dynamic and complex, and news content at different levels needs to be considered from multiple perspectives. Therefore, the present invention allows a large-scale language model to dynamically generate multiple subjective agents based on the input news content, and each subjective agent generates comments with different emotions from different perspectives of the news content; in order to meet the keywords and emotional constraints set by the task, the present invention selects the agent that best meets the constraints from the generated agents, and allows the agent to simulate real news readers to generate comments; ensuring the quality of generated comments and the stability of control. The present invention manually sets review agents to select comments that are smooth and most consistent with the news content and control conditions from the multiple generated comments. For complex controllable generation tasks, the quality of text generation can be evaluated from multiple dimensions, including content coherence, consistency with the news text, and controllability of specific constraints. Therefore, the present invention designs a review agent for each objective dimension to simulate real comment reviewers to ensure that the generated comments meet the task requirements.

[0069] To verify the effectiveness of this invention, we conducted the following experiments. To compare with existing methods, we used the publicly available Tencent Express dataset and annotated each sample with sentiment and keyword tags to ensure that the model evaluation in the experiment accurately reflects the constraints imposed by sentiment and keywords. Due to cost constraints, we randomly selected 200 sports-related samples from the test set to test the performance of our method. The existing comparison methods selected included GPT-3.5, Gemma, and Llama2. GPT-3.5 is a large-scale language model developed by OpenAI. It improves on GPT-3 and can understand and generate natural language or code. Gemma is a series of lightweight, open-source large-scale language models released by Google. Llama2 is a series of large-scale language models released by MetaAI, with parameter sizes ranging from 7 billion to 70 billion. This method uses ROUGE-n (Rn), BERTScore (BES), and GPT score (Key, Sen) as metrics to evaluate model generation results. For Rn, we use 1-gram, 2-gram, and l-gram. For BES, the bert-base-multilingual-cased model was used. For the GPT score, Key represents keyword constraints, and Sen represents sentiment constraints. The results of the compared methods and the proposed method on the sports-related Tencent Express dataset are shown in Table 1 below. The best performance for each metric is highlighted in bold:

[0070] Table 1 Experimental results

[0071]

[0072] As shown in Table 1, the method proposed in the present invention outperforms the zero-shot and contextual learning prompt methods in all indicators. In particular, for the GPT-3.5 model, the method proposed in the present invention improves by 3.09% and 4.79% respectively compared with the contextual prompt and prompt learning methods in the ROUGE-1 indicator; and improves by 5.5% and 6.17% respectively compared with prompt learning in the keyword constraint (Key) and sentiment constraint (Sen) indicators. In addition, in the ROUGE-2, ROUGE-1 and BERTScore indicators, the method proposed in the present invention also performs well, surpassing other comparison methods. These results show that the method proposed in the present invention can better understand complex tasks, and can still generate more coherent and contextual comments in the face of multiple constraints, significantly improving the quality of generated text.

[0073] To demonstrate the effectiveness of our proposed method, we conducted ablation experiments on the top-performing GPT-3.5 model. The experimental results are shown in Table 2. The "(-) Subjective Agent" model directly prompts the large language model to generate reviews, and then lets the review agent select the best review. The "(-) Review Agent" model allows the subjective agent to directly generate reviews. The "(-) Subjective Agent and Review Agent" model allows the large language model to generate reviews only through prompts.

[0074] Table 2 Ablation experiment results

[0075]

[0076] As shown in Table 2, each module of the method of the present invention has produced positive effects. Taking the "method of the present invention" as a benchmark, when there is only a review agent, the Key index decreased by 9.5% and the Sen index decreased by 9.34%; when there is only a subjective agent, R-1 decreased by 3.86% and BES decreased by 4.14%; when comments are generated only by prompts, the performance of the model decreases most significantly. In general, the subjective agent plays a key role in the constraint control of the prompt model. By acting as a subjective agent, the model can generate comments that are more in line with the constraints from the reader's point of view. The review agent selects the comments that are most fluent and most consistent with the news text based on the description. These results show that the combination of subjective agents and review agents can effectively improve the controllability, accuracy and quality of generated comments.

[0077] To further verify the effectiveness of the proposed method, we conducted experiments on entertainment-themed data from the Tencent Express dataset, as commentary styles vary significantly across news topics.

[0078] Table 3 Experimental results on other news topics

[0079]

[0080] As shown in Table 3, the multi-agent collaboration proposed in this paper also performs well in generating entertainment news reviews, significantly outperforming the prompt learning and context learning methods. This further demonstrates the wide applicability of this method across a variety of news topics.

[0081] In order to better illustrate the effect of the method of the present invention on the controllable comment generation task, volunteers were recruited to conduct manual evaluation on the method and the three methods of the best performing GPT-3.5 model in Table 1. The present invention randomly selected 50 comments from the experimental results and invited 3 college students to evaluate the comments from three aspects: (1) Fluency: measures the quality of the sentence, whether it is fluent and whether it follows grammar. (2) Relevance: measures the degree of relevance between the comment and the news text. (3) Controllability: measures whether the comment meets the control conditions of the task, which is the sum and average of the accuracy of the sentiment constraint and the keyword constraint. The score range of each indicator of fluency and relevance is from 1 (worst) to 5 points (best). The indicator of controllability is the accuracy from 0% to 100%. The results of the manual evaluation are shown in Table 4. Overall, the method of the present invention surpasses other methods in fluency, relevance and controllability.

[0082] Table 4. Manual evaluation results

[0083] Method Fluency Relevance Controllability Hint learning 3.27 3.38 85.5% Context learning 3.48 3.54 83% Method of the invention 4.13 4.25 92%

[0084] The specific embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge of ordinary technicians in this field without departing from the scope of the present invention.

Claims

1. A controllable review generation method based on multi-agent collaboration, characterized by: The method comprises: Step 1: Download the review dataset and preprocess it. Step 2: Use a large-scale language model to generate multiple subjective agents based on the news text. Each subjective agent generates comments with different emotions from different perspectives of the news content. Step 3: Select the subjective agent that best meets the constraints from the generated agents and let the subjective agent simulate real news readers to generate comments; Step 4: Set up a review agent to select the multiple comments generated and select the comments that are smooth and most consistent with the news content and control conditions; Step 3 includes: Step 3.

1. From the generated subjective agent and Filter out the emotional constraints related to the task input consistent subjective agents; Step 3.2, use the multilingual pre-trained language model Sentence-BERT to constrain each subjective agent and keyword that meets the emotional constraints Encoded into a semantic vector; then, the cosine similarity between the keyword and each subjective agent that meets the sentiment constraint is calculated and used as the relevance score between the keyword and the subjective agent; the calculation formula of the relevance score is as follows: ; Where d represents the number of all subjective agents; Step 3.3, from the calculated correlation score Select the subjective agent with the highest score As the most relevant agent for generating reviews, its formula is as follows: 。 2. The method for generating controllable comments based on multi-agent collaboration according to claim 1, characterized in that: Step 1 includes: Step 1.1, download the public review dataset from the Internet; Step 1.2: Label each news comment in the dataset with sentiment labels and keywords.

3. The controllable comment generation method based on multi-agent collaboration according to claim 1 is characterized by: Step 2 includes: Step 2.1, according to the input news text Prompt large-scale language models to dynamically generate a set of agents ,in It represents the nth generated subjective agent. The format of each generated subjective agent is: <agent type, agent description>. Different subjective agents express different emotions and comments on different objects based on their own views. Step 2.2: Prompt the large-scale language model to follow the input keyword constraints , the subjective agents are divided into subjective agents that are positive about keywords and subjective agents that are negative about keywords .

4. The method for generating controllable comments based on multi-agent collaboration according to claim 1, characterized in that: Step 4 includes: Step 4.

1. Manually design a review agent for each objective dimension ,The format of each review agent is: <agent type, agent description>, where each review agent is responsible for one or more specific objective dimensions, and the agent description details the key content that the agent focuses on when evaluating the review; Step 4.2: The review agent scores the comments generated by each subjective agent based on the set agent description; Step 4.

3. Calculate the total score of each comment and select the comment with the highest score as the final answer.

5. A controllable review generation system based on multi-agent collaboration, characterized by: The system includes: a module for executing a controllable comment generation method based on multi-agent collaboration as described in any one of claims 1 to 4.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements a controllable comment generation method based on multi-agent collaboration as described in any one of claims 1 to 4.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements a controllable comment generation method based on multi-agent collaboration as described in any one of claims 1 to 4.

8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, it implements a controllable comment generation method based on multi-agent collaboration as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Emotion analysis and generation method for news comments

    CN114444481A

  • Chinese media comment text automatic generation method, system, device and client

    CN116431803A